From 0cd69c1d49127db15991386a2e1a4501f7a5bdfc Mon Sep 17 00:00:00 2001 From: Ivan Naranjo Date: Mon, 2 Oct 2017 11:57:51 +0100 Subject: [PATCH] Automatic code cleanup. (#812) * Sorting/organizing usings. * Adding missing license notices. * Adding reformated code. * Fixing spacing inconsistency. --- .../GoogleAnalyticsUtils/HitSender.cs | 2 +- .../DataSourceUnitTestsBase.cs | 1 - .../Properties/AssemblyInfo.cs | 18 ++++++++++++++++-- .../CsrDataSource.cs | 2 +- .../ResourceManagerDataSource.cs | 3 ++- .../CloudBuilderUtils.cs | 3 --- .../NetCoreAppUtils.cs | 6 +++--- .../CsrGitUtils.cs | 10 +++++----- .../GitRepository.cs | 4 ++-- .../Properties/AssemblyInfo.cs | 2 +- .../PowerShellFailedToConnectException.cs | 4 ++-- .../Properties/AssemblyInfo.cs | 1 - .../RemoteToolInstaller.cs | 2 +- .../Section.cs | 4 ++-- .../TeamExplorerUtils.cs | 8 ++++---- .../ISectionViewModel.cs | 1 - .../GoogleProjectTemplateSelectorWizard.cs | 1 + .../GoogleProjectTemplateWizard.cs | 3 ++- .../Properties/AssemblyInfo.cs | 2 +- .../ProcessUtilsTests.cs | 16 +++++++++++++++- .../Async/AsyncPropertyUtils.cs | 2 +- .../WindowsCredentialManager.cs | 1 - .../Accounts/CurrentAccountProjectSettings.cs | 2 +- .../Events/GcsFileBrowserNewFolderEvent.cs | 2 +- .../Events/PubSubSubscriptionCreatedEvent.cs | 1 - .../AttachDebuggerFirewallPort.cs | 6 +++--- .../AttachDebuggerSettings.cs | 4 ++-- .../AttachDebuggerSettingsStore.cs | 10 +++++----- .../AttachDebuggerStepBase.cs | 2 +- .../AttachDebuggerWindow.cs | 6 +++--- .../EnablePowerShellPortStepViewModel.cs | 2 +- .../ListProcessStepViewModel.cs | 2 +- .../CloudExplorer/CloudExplorerViewModel.cs | 2 +- .../Gce/GceInstanceViewModel.cs | 2 +- .../PubSub/SubscriptionViewModel.cs | 1 - .../AsyncRepositories.cs | 1 - .../CloudSourceRepositories/CsAddRepoWindow.cs | 2 +- .../CsrAddRepoWindowViewModel.cs | 2 +- .../CloudSourceRepositories/CsrCloneWindow.cs | 4 ++-- .../CsrCloneWindowViewModel.cs | 4 ++-- .../CsrGitSetupWarningViewModel.cs | 2 +- .../CsrReposViewModel.cs | 6 +++--- .../CsrSectionControlViewModel.cs | 2 +- .../GoogleCloudExtensionPackage.cs | 4 ++-- .../GceStep/GceStepViewModel.cs | 2 +- .../GoogleCloudExtension/Resources.Designer.cs | 8 ++++---- .../LogsViewerToolWindowCommand.cs | 2 +- .../ProjectIdDialog/PickProjectIdViewModel.cs | 3 ++- .../PickProjectIdWindowContent.xaml.cs | 1 + .../TemplateChooserDialog/AspNetVersion.cs | 1 - .../TemplateChooserViewModel.cs | 1 - .../TemplateWizards/ReplacementsKeys.cs | 1 + .../GoogleCloudExtension/Utils/StringUtils.cs | 1 - .../AssemblyInitialize.cs | 15 ++++++++++++++- .../PubSub/TopicViewModelBaseTests.cs | 4 ++-- .../CsrAddRepoWindowViewModelTests.cs | 5 ++--- .../SolutionUserOptionsTests.cs | 2 +- ...GoogleProjectSelectorTemplateWizardTests.cs | 1 - .../GitExtentionWrapper.cs | 2 -- .../VisualStudioWrapper.cs | 2 +- .../EchoApp/Properties/AssemblyInfo.cs | 1 - 61 files changed, 123 insertions(+), 94 deletions(-) diff --git a/GoogleCloudExtension/GoogleAnalyticsUtils/HitSender.cs b/GoogleCloudExtension/GoogleAnalyticsUtils/HitSender.cs index 32b4b7333..053545355 100644 --- a/GoogleCloudExtension/GoogleAnalyticsUtils/HitSender.cs +++ b/GoogleCloudExtension/GoogleAnalyticsUtils/HitSender.cs @@ -59,7 +59,7 @@ public async void SendHitData(Dictionary hitData) } catch (Exception ex) when ( ex is HttpRequestException || - ex is TaskCanceledException ) // timeout + ex is TaskCanceledException) // timeout { } } diff --git a/GoogleCloudExtension/GoogleCloudExtension.DataSources.UnitTests/DataSourceUnitTestsBase.cs b/GoogleCloudExtension/GoogleCloudExtension.DataSources.UnitTests/DataSourceUnitTestsBase.cs index 054c818c2..61a4c936f 100644 --- a/GoogleCloudExtension/GoogleCloudExtension.DataSources.UnitTests/DataSourceUnitTestsBase.cs +++ b/GoogleCloudExtension/GoogleCloudExtension.DataSources.UnitTests/DataSourceUnitTestsBase.cs @@ -102,7 +102,6 @@ protected static TService GetMockedService { - IClientService clientService = GetMockedClientService(responses); TRequest request = GetMockedRequest(requestExpression, clientService); diff --git a/GoogleCloudExtension/GoogleCloudExtension.DataSources.UnitTests/Properties/AssemblyInfo.cs b/GoogleCloudExtension/GoogleCloudExtension.DataSources.UnitTests/Properties/AssemblyInfo.cs index 422defe8d..74984d2c5 100644 --- a/GoogleCloudExtension/GoogleCloudExtension.DataSources.UnitTests/Properties/AssemblyInfo.cs +++ b/GoogleCloudExtension/GoogleCloudExtension.DataSources.UnitTests/Properties/AssemblyInfo.cs @@ -1,4 +1,18 @@ -using System.Reflection; +// Copyright 2017 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following @@ -9,7 +23,7 @@ [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("GoogleCloudExtension.DataSources.UnitTests")] -[assembly: AssemblyCopyright("Copyright © 2017")] +[assembly: AssemblyCopyright("Copyright \u00A9 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] diff --git a/GoogleCloudExtension/GoogleCloudExtension.DataSources/CsrDataSource.cs b/GoogleCloudExtension/GoogleCloudExtension.DataSources/CsrDataSource.cs index 4663e63ac..f10334149 100644 --- a/GoogleCloudExtension/GoogleCloudExtension.DataSources/CsrDataSource.cs +++ b/GoogleCloudExtension/GoogleCloudExtension.DataSources/CsrDataSource.cs @@ -52,7 +52,7 @@ public async Task> ListReposAsync() }, x => x.Repos, x => x.NextPageToken); - } + } /// /// Creates a cloud source repository. diff --git a/GoogleCloudExtension/GoogleCloudExtension.DataSources/ResourceManagerDataSource.cs b/GoogleCloudExtension/GoogleCloudExtension.DataSources/ResourceManagerDataSource.cs index 62f5c992c..2232e5002 100644 --- a/GoogleCloudExtension/GoogleCloudExtension.DataSources/ResourceManagerDataSource.cs +++ b/GoogleCloudExtension/GoogleCloudExtension.DataSources/ResourceManagerDataSource.cs @@ -56,7 +56,8 @@ public ResourceManagerDataSource(GoogleCredential credential, string appName) internal ResourceManagerDataSource( GoogleCredential credential, Func factory, - string appName) : base(credential, factory, appName) { } + string appName) : base(credential, factory, appName) + { } /// /// Returns the complete list of projects for the current credentials. diff --git a/GoogleCloudExtension/GoogleCloudExtension.Deployment/CloudBuilderUtils.cs b/GoogleCloudExtension/GoogleCloudExtension.Deployment/CloudBuilderUtils.cs index bce9491fc..ae42aead3 100644 --- a/GoogleCloudExtension/GoogleCloudExtension.Deployment/CloudBuilderUtils.cs +++ b/GoogleCloudExtension/GoogleCloudExtension.Deployment/CloudBuilderUtils.cs @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -using System; -using System.Diagnostics; -using System.IO; namespace GoogleCloudExtension.Deployment { diff --git a/GoogleCloudExtension/GoogleCloudExtension.Deployment/NetCoreAppUtils.cs b/GoogleCloudExtension/GoogleCloudExtension.Deployment/NetCoreAppUtils.cs index f74683d74..84b02f00e 100644 --- a/GoogleCloudExtension/GoogleCloudExtension.Deployment/NetCoreAppUtils.cs +++ b/GoogleCloudExtension/GoogleCloudExtension.Deployment/NetCoreAppUtils.cs @@ -32,9 +32,9 @@ internal static class NetCoreAppUtils // The mapping of supported .NET Core versions to the base images to use for the Docker image. private static readonly Dictionary s_knownRuntimeImages = new Dictionary { - [ KnownProjectTypes.NetCoreWebApplication1_0 ] = "gcr.io/google-appengine/aspnetcore:1.0", - [ KnownProjectTypes.NetCoreWebApplication1_1 ] = "gcr.io/google-appengine/aspnetcore:1.1", - [ KnownProjectTypes.NetCoreWebApplication2_0 ] = "gcr.io/google-appengine/aspnetcore:2.0" + [KnownProjectTypes.NetCoreWebApplication1_0] = "gcr.io/google-appengine/aspnetcore:1.0", + [KnownProjectTypes.NetCoreWebApplication1_1] = "gcr.io/google-appengine/aspnetcore:1.1", + [KnownProjectTypes.NetCoreWebApplication2_0] = "gcr.io/google-appengine/aspnetcore:2.0" }; /// diff --git a/GoogleCloudExtension/GoogleCloudExtension.GitUtils/CsrGitUtils.cs b/GoogleCloudExtension/GoogleCloudExtension.GitUtils/CsrGitUtils.cs index d7cf00940..d99ea9c0e 100644 --- a/GoogleCloudExtension/GoogleCloudExtension.GitUtils/CsrGitUtils.cs +++ b/GoogleCloudExtension/GoogleCloudExtension.GitUtils/CsrGitUtils.cs @@ -15,8 +15,8 @@ using GoogleCloudExtension.Utils; using System; using System.Diagnostics; -using System.Linq; using System.IO; +using System.Linq; using System.Threading.Tasks; namespace GoogleCloudExtension.GitUtils @@ -72,8 +72,8 @@ public static async Task CloneAsync(string url, string localPath) /// Otherwise false. /// public static bool StoreCredential( - string url, - string refreshToken, + string url, + string refreshToken, StoreCredentialPathOption pathOption) { url.ThrowIfNullOrEmpty(nameof(url)); @@ -81,7 +81,7 @@ public static bool StoreCredential( Uri uri = new Uri(url); UriPartial uriPartial; - switch(pathOption) + switch (pathOption) { case StoreCredentialPathOption.UrlPath: uriPartial = UriPartial.Path; @@ -90,7 +90,7 @@ public static bool StoreCredential( uriPartial = UriPartial.Authority; break; default: - throw new ArgumentException(nameof(pathOption)); + throw new ArgumentException(nameof(pathOption)); } return WindowsCredentialManager.Write( $"git:{uri.GetLeftPart(uriPartial)}", diff --git a/GoogleCloudExtension/GoogleCloudExtension.GitUtils/GitRepository.cs b/GoogleCloudExtension/GoogleCloudExtension.GitUtils/GitRepository.cs index 74b5365a8..769e99733 100644 --- a/GoogleCloudExtension/GoogleCloudExtension.GitUtils/GitRepository.cs +++ b/GoogleCloudExtension/GoogleCloudExtension.GitUtils/GitRepository.cs @@ -99,7 +99,7 @@ public async Task> GetRemotesUrls() /// Returns true if the git repository contains the git SHA revision. /// /// The Git SHA. - public async Task ContainsCommitAsync(string sha) => + public async Task ContainsCommitAsync(string sha) => (await ExecCommandAsync($"cat-file -t {sha}"))?.FirstOrDefault() == "commit"; /// @@ -128,7 +128,7 @@ public Task> ExecCommandAsync(string command) => /// public static async Task IsGitCredentialManagerInstalledAsync() => (await GitRepository.RunGitCommandAsync( - "credential-manager version", + "credential-manager version", Directory.GetCurrentDirectory(), throwOnError: false)) != null; diff --git a/GoogleCloudExtension/GoogleCloudExtension.Interop/Properties/AssemblyInfo.cs b/GoogleCloudExtension/GoogleCloudExtension.Interop/Properties/AssemblyInfo.cs index 760ccdf92..234ca5f84 100644 --- a/GoogleCloudExtension/GoogleCloudExtension.Interop/Properties/AssemblyInfo.cs +++ b/GoogleCloudExtension/GoogleCloudExtension.Interop/Properties/AssemblyInfo.cs @@ -23,7 +23,7 @@ [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("GoogleCloudExtension.Interop")] -[assembly: AssemblyCopyright("Copyright © 2017")] +[assembly: AssemblyCopyright("Copyright \u00A9 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] diff --git a/GoogleCloudExtension/GoogleCloudExtension.PowerShellUtils/PowerShellFailedToConnectException.cs b/GoogleCloudExtension/GoogleCloudExtension.PowerShellUtils/PowerShellFailedToConnectException.cs index e312abfca..d519615cd 100644 --- a/GoogleCloudExtension/GoogleCloudExtension.PowerShellUtils/PowerShellFailedToConnectException.cs +++ b/GoogleCloudExtension/GoogleCloudExtension.PowerShellUtils/PowerShellFailedToConnectException.cs @@ -21,10 +21,10 @@ public class PowerShellFailedToConnectException : Exception /// /// This error message indicates it fails to establish connection. /// - public const string SessionEmptyErrorMessage = + public const string SessionEmptyErrorMessage = @"Cannot validate argument on parameter 'Session'. The argument is null or empty."; - public PowerShellFailedToConnectException(Exception innerException) : + public PowerShellFailedToConnectException(Exception innerException) : base(innerException.Message, innerException) { } } diff --git a/GoogleCloudExtension/GoogleCloudExtension.PowerShellUtils/Properties/AssemblyInfo.cs b/GoogleCloudExtension/GoogleCloudExtension.PowerShellUtils/Properties/AssemblyInfo.cs index e592573b5..e04084809 100644 --- a/GoogleCloudExtension/GoogleCloudExtension.PowerShellUtils/Properties/AssemblyInfo.cs +++ b/GoogleCloudExtension/GoogleCloudExtension.PowerShellUtils/Properties/AssemblyInfo.cs @@ -13,7 +13,6 @@ // limitations under the License. using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following diff --git a/GoogleCloudExtension/GoogleCloudExtension.PowerShellUtils/RemoteToolInstaller.cs b/GoogleCloudExtension/GoogleCloudExtension.PowerShellUtils/RemoteToolInstaller.cs index 7bc7f84dc..411f1a54b 100644 --- a/GoogleCloudExtension/GoogleCloudExtension.PowerShellUtils/RemoteToolInstaller.cs +++ b/GoogleCloudExtension/GoogleCloudExtension.PowerShellUtils/RemoteToolInstaller.cs @@ -81,7 +81,7 @@ public async Task Install(CancellationToken cancelToken) return await target.ExecuteAsync(AddInstallCommands, cancelToken); } catch (Exception ex) when ( - ex is ParameterBindingException && + ex is ParameterBindingException && ex.Message.Contains(PowerShellFailedToConnectException.SessionEmptyErrorMessage)) { throw new PowerShellFailedToConnectException(ex); diff --git a/GoogleCloudExtension/GoogleCloudExtension.TeamExplorerExtension.v14/Section.cs b/GoogleCloudExtension/GoogleCloudExtension.TeamExplorerExtension.v14/Section.cs index aa64b5ac1..b777f51e1 100644 --- a/GoogleCloudExtension/GoogleCloudExtension.TeamExplorerExtension.v14/Section.cs +++ b/GoogleCloudExtension/GoogleCloudExtension.TeamExplorerExtension.v14/Section.cs @@ -15,8 +15,8 @@ using GoogleCloudExtension.Utils; using Microsoft.TeamFoundation.Controls; using System; -using System.Diagnostics; using System.ComponentModel.Composition; +using System.Diagnostics; namespace GoogleCloudExtension.TeamExplorerExtension { @@ -30,7 +30,7 @@ public class Section : Model, ITeamExplorerSection { private const string Guid = "2625FA1D-22DD-440E-87C0-1EB42DB7C5A4"; - private ISectionViewModel _viewModel; + private readonly ISectionViewModel _viewModel; private IServiceProvider _serviceProvider; private TeamExplorerUtils _teamExploerServices; private bool _isBusy; diff --git a/GoogleCloudExtension/GoogleCloudExtension.TeamExplorerExtension.v14/TeamExplorerUtils.cs b/GoogleCloudExtension/GoogleCloudExtension.TeamExplorerExtension.v14/TeamExplorerUtils.cs index 94f28f214..5417e7521 100644 --- a/GoogleCloudExtension/GoogleCloudExtension.TeamExplorerExtension.v14/TeamExplorerUtils.cs +++ b/GoogleCloudExtension/GoogleCloudExtension.TeamExplorerExtension.v14/TeamExplorerUtils.cs @@ -71,10 +71,10 @@ public void ShowMessage(string message, ICommand command) => public void ShowError(string message) => NotificationManager?.ShowNotification( - message, - NotificationType.Error, - NotificationFlags.RequiresConfirmation, - null, + message, + NotificationType.Error, + NotificationFlags.RequiresConfirmation, + null, default(Guid)); #endregion diff --git a/GoogleCloudExtension/GoogleCloudExtension.TeamExplorerExtension/ISectionViewModel.cs b/GoogleCloudExtension/GoogleCloudExtension.TeamExplorerExtension/ISectionViewModel.cs index 3a8f64655..10d5d62a5 100644 --- a/GoogleCloudExtension/GoogleCloudExtension.TeamExplorerExtension/ISectionViewModel.cs +++ b/GoogleCloudExtension/GoogleCloudExtension.TeamExplorerExtension/ISectionViewModel.cs @@ -12,7 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -using System; namespace GoogleCloudExtension.TeamExplorerExtension { diff --git a/GoogleCloudExtension/GoogleCloudExtension.TemplateWizards/GoogleProjectTemplateSelectorWizard.cs b/GoogleCloudExtension/GoogleCloudExtension.TemplateWizards/GoogleProjectTemplateSelectorWizard.cs index 7e7f7aa72..1c639944a 100644 --- a/GoogleCloudExtension/GoogleCloudExtension.TemplateWizards/GoogleProjectTemplateSelectorWizard.cs +++ b/GoogleCloudExtension/GoogleCloudExtension.TemplateWizards/GoogleProjectTemplateSelectorWizard.cs @@ -11,6 +11,7 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + namespace GoogleCloudExtension.TemplateWizards { /// diff --git a/GoogleCloudExtension/GoogleCloudExtension.TemplateWizards/GoogleProjectTemplateWizard.cs b/GoogleCloudExtension/GoogleCloudExtension.TemplateWizards/GoogleProjectTemplateWizard.cs index a153ec0b9..da30929d2 100644 --- a/GoogleCloudExtension/GoogleCloudExtension.TemplateWizards/GoogleProjectTemplateWizard.cs +++ b/GoogleCloudExtension/GoogleCloudExtension.TemplateWizards/GoogleProjectTemplateWizard.cs @@ -11,6 +11,7 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + namespace GoogleCloudExtension.TemplateWizards { /// @@ -19,5 +20,5 @@ namespace GoogleCloudExtension.TemplateWizards /// of problems loading wizards from MEF component assemblies. /// public class GoogleProjectTemplateWizard : DelegatingTemplateWizard - {} + { } } diff --git a/GoogleCloudExtension/GoogleCloudExtension.TemplateWizards/Properties/AssemblyInfo.cs b/GoogleCloudExtension/GoogleCloudExtension.TemplateWizards/Properties/AssemblyInfo.cs index 9d9066b31..672dc0ae5 100644 --- a/GoogleCloudExtension/GoogleCloudExtension.TemplateWizards/Properties/AssemblyInfo.cs +++ b/GoogleCloudExtension/GoogleCloudExtension.TemplateWizards/Properties/AssemblyInfo.cs @@ -23,7 +23,7 @@ [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Google Inc.")] [assembly: AssemblyProduct("TemplateWizards")] -[assembly: AssemblyCopyright("Copyright © 2017")] +[assembly: AssemblyCopyright("Copyright \u00A9 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] diff --git a/GoogleCloudExtension/GoogleCloudExtension.Utils.UnitTests/ProcessUtilsTests.cs b/GoogleCloudExtension/GoogleCloudExtension.Utils.UnitTests/ProcessUtilsTests.cs index b6f892c77..a3b0727a9 100644 --- a/GoogleCloudExtension/GoogleCloudExtension.Utils.UnitTests/ProcessUtilsTests.cs +++ b/GoogleCloudExtension/GoogleCloudExtension.Utils.UnitTests/ProcessUtilsTests.cs @@ -1,4 +1,18 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; +// Copyright 2017 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using Microsoft.VisualStudio.TestTools.UnitTesting; using System.ComponentModel; using System.Diagnostics.CodeAnalysis; using System.Threading.Tasks; diff --git a/GoogleCloudExtension/GoogleCloudExtension.Utils/Async/AsyncPropertyUtils.cs b/GoogleCloudExtension/GoogleCloudExtension.Utils/Async/AsyncPropertyUtils.cs index 2626e14d1..dcf6c8c9b 100644 --- a/GoogleCloudExtension/GoogleCloudExtension.Utils/Async/AsyncPropertyUtils.cs +++ b/GoogleCloudExtension/GoogleCloudExtension.Utils/Async/AsyncPropertyUtils.cs @@ -33,7 +33,7 @@ public static AsyncProperty CreateAsyncProperty( Task valueSource, Func func, T defaultValue = default(T)) { return new AsyncProperty( - valueSource.ContinueWith(t => func(GetTaskResultSafe(t))), + valueSource.ContinueWith(t => func(GetTaskResultSafe(t))), defaultValue); } diff --git a/GoogleCloudExtension/GoogleCloudExtension.Utils/WindowsCredentialManager.cs b/GoogleCloudExtension/GoogleCloudExtension.Utils/WindowsCredentialManager.cs index 3a02730b2..2cebca755 100644 --- a/GoogleCloudExtension/GoogleCloudExtension.Utils/WindowsCredentialManager.cs +++ b/GoogleCloudExtension/GoogleCloudExtension.Utils/WindowsCredentialManager.cs @@ -72,7 +72,6 @@ public static bool Write( Marshal.FreeCoTaskMem(credential.CredentialBlob); Marshal.FreeCoTaskMem(credential.UserName); } - } [DllImport("Advapi32.dll", EntryPoint = "CredWriteW", CharSet = CharSet.Unicode, SetLastError = true)] diff --git a/GoogleCloudExtension/GoogleCloudExtension/Accounts/CurrentAccountProjectSettings.cs b/GoogleCloudExtension/GoogleCloudExtension/Accounts/CurrentAccountProjectSettings.cs index 650b0d5cf..ea95b4f4b 100644 --- a/GoogleCloudExtension/GoogleCloudExtension/Accounts/CurrentAccountProjectSettings.cs +++ b/GoogleCloudExtension/GoogleCloudExtension/Accounts/CurrentAccountProjectSettings.cs @@ -12,9 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +using GoogleCloudExtension.SolutionUtils; using System; using System.Diagnostics; -using GoogleCloudExtension.SolutionUtils; namespace GoogleCloudExtension.Accounts { diff --git a/GoogleCloudExtension/GoogleCloudExtension/Analytics/Events/GcsFileBrowserNewFolderEvent.cs b/GoogleCloudExtension/GoogleCloudExtension/Analytics/Events/GcsFileBrowserNewFolderEvent.cs index cce9a9624..4c499045b 100644 --- a/GoogleCloudExtension/GoogleCloudExtension/Analytics/Events/GcsFileBrowserNewFolderEvent.cs +++ b/GoogleCloudExtension/GoogleCloudExtension/Analytics/Events/GcsFileBrowserNewFolderEvent.cs @@ -16,7 +16,7 @@ namespace GoogleCloudExtension.Analytics.Events { - class GcsFileBrowserNewFolderEvent + internal class GcsFileBrowserNewFolderEvent { private const string GcsFileGcsFileBrowserNewFolderEventName = "gcsFileBrowserNewFolder"; private const string DeploymentDurationProperty = "duration"; diff --git a/GoogleCloudExtension/GoogleCloudExtension/Analytics/Events/PubSubSubscriptionCreatedEvent.cs b/GoogleCloudExtension/GoogleCloudExtension/Analytics/Events/PubSubSubscriptionCreatedEvent.cs index e32ea638b..aa5f3b114 100644 --- a/GoogleCloudExtension/GoogleCloudExtension/Analytics/Events/PubSubSubscriptionCreatedEvent.cs +++ b/GoogleCloudExtension/GoogleCloudExtension/Analytics/Events/PubSubSubscriptionCreatedEvent.cs @@ -24,6 +24,5 @@ public static AnalyticsEvent Create(CommandStatus status) PubSubSubscriptionCreatedEventName, CommandStatusUtils.StatusProperty, CommandStatusUtils.GetStatusString(status)); } - } } diff --git a/GoogleCloudExtension/GoogleCloudExtension/AttachDebuggerDialog/AttachDebuggerFirewallPort.cs b/GoogleCloudExtension/GoogleCloudExtension/AttachDebuggerDialog/AttachDebuggerFirewallPort.cs index a940b2644..1df255cab 100644 --- a/GoogleCloudExtension/GoogleCloudExtension/AttachDebuggerDialog/AttachDebuggerFirewallPort.cs +++ b/GoogleCloudExtension/GoogleCloudExtension/AttachDebuggerDialog/AttachDebuggerFirewallPort.cs @@ -31,7 +31,7 @@ namespace GoogleCloudExtension.AttachDebuggerDialog /// public class AttachDebuggerFirewallPort { - private static readonly TimeSpan ConnectivityTestTimeout = TimeSpan.FromSeconds(5); + private static readonly TimeSpan s_connectivityTestTimeout = TimeSpan.FromSeconds(5); private static readonly TimeSpan s_firewallRuleWaitMaxTime = TimeSpan.FromMinutes(5); private readonly Lazy _lazyDataSource; private Instance _gceInstance; @@ -122,7 +122,7 @@ public async Task IsPortEnabled() .SelectMany(x => x.Allowed) // x is now FireWall.AllowedData // Check if the allowed protocol is tcp - .Where(x => x?.IPProtocol == "tcp" && x.Ports != null) + .Where(x => x?.IPProtocol == "tcp" && x.Ports != null) .SelectMany(x => x.Ports) // x is now port number in string type // Check if the allowed port number matches @@ -148,7 +148,7 @@ public async Task ConnectivityTest(CancellationToken cancelToken) try { var connectTask = client.ConnectAsync(_gceInstance.GetPublicIpAddress(), PortInfo.Port); - if (connectTask == await Task.WhenAny(connectTask, Task.Delay(ConnectivityTestTimeout, cancelToken))) + if (connectTask == await Task.WhenAny(connectTask, Task.Delay(s_connectivityTestTimeout, cancelToken))) { await connectTask; Debug.WriteLine("ConnectivityTest, Succeeded"); diff --git a/GoogleCloudExtension/GoogleCloudExtension/AttachDebuggerDialog/AttachDebuggerSettings.cs b/GoogleCloudExtension/GoogleCloudExtension/AttachDebuggerDialog/AttachDebuggerSettings.cs index af7ba8d81..a44df9c9f 100644 --- a/GoogleCloudExtension/GoogleCloudExtension/AttachDebuggerDialog/AttachDebuggerSettings.cs +++ b/GoogleCloudExtension/GoogleCloudExtension/AttachDebuggerDialog/AttachDebuggerSettings.cs @@ -60,9 +60,9 @@ public class AttachDebuggerSettings { private const int InstancesDefaultUserMaxLength = 10; private static readonly Lazy s_instance = new Lazy(); - private static readonly Lazy> _lazyDefaultUsersList = + private static readonly Lazy> s_lazyDefaultUsersList = new Lazy>(AttachDebuggerSettingsStore.ReadGceInstanceDefaultUsers); - private static List _defaultUsersList => _lazyDefaultUsersList.Value; + private static List _defaultUsersList => s_lazyDefaultUsersList.Value; /// /// Singleton instance. diff --git a/GoogleCloudExtension/GoogleCloudExtension/AttachDebuggerDialog/AttachDebuggerSettingsStore.cs b/GoogleCloudExtension/GoogleCloudExtension/AttachDebuggerDialog/AttachDebuggerSettingsStore.cs index 5b695e910..9d674b181 100644 --- a/GoogleCloudExtension/GoogleCloudExtension/AttachDebuggerDialog/AttachDebuggerSettingsStore.cs +++ b/GoogleCloudExtension/GoogleCloudExtension/AttachDebuggerDialog/AttachDebuggerSettingsStore.cs @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -using Newtonsoft.Json; using GoogleCloudExtension.Utils; +using Newtonsoft.Json; using System; using System.Collections.Generic; using System.IO; @@ -27,7 +27,7 @@ internal static class AttachDebuggerSettingsStore { private const string SettingsPath = @"googlecloudvsextension\attach_debugger_dialog"; private const string DefaultUsersSettingFile = @"gceinstace_default_user.cfg"; - private static readonly string DefaultUsersSettingsFullPath + private static readonly string s_defaultUsersSettingsFullPath = Path.Combine(GetStoragePath(), DefaultUsersSettingFile); /// @@ -36,9 +36,9 @@ private static readonly string DefaultUsersSettingsFullPath public static List ReadGceInstanceDefaultUsers() { List results = null; - if (File.Exists(DefaultUsersSettingsFullPath)) + if (File.Exists(s_defaultUsersSettingsFullPath)) { - string jsonText = File.ReadAllText(DefaultUsersSettingsFullPath); + string jsonText = File.ReadAllText(s_defaultUsersSettingsFullPath); if (!string.IsNullOrWhiteSpace(jsonText)) { try @@ -62,7 +62,7 @@ public static void PersistGceInstanceDefaultUsers(List defa { Directory.CreateDirectory(GetStoragePath()); } - File.WriteAllText(DefaultUsersSettingsFullPath, JsonConvert.SerializeObject(defaultUsers)); + File.WriteAllText(s_defaultUsersSettingsFullPath, JsonConvert.SerializeObject(defaultUsers)); } private static string GetStoragePath() diff --git a/GoogleCloudExtension/GoogleCloudExtension/AttachDebuggerDialog/AttachDebuggerStepBase.cs b/GoogleCloudExtension/GoogleCloudExtension/AttachDebuggerDialog/AttachDebuggerStepBase.cs index 72a6759ac..133490142 100644 --- a/GoogleCloudExtension/GoogleCloudExtension/AttachDebuggerDialog/AttachDebuggerStepBase.cs +++ b/GoogleCloudExtension/GoogleCloudExtension/AttachDebuggerDialog/AttachDebuggerStepBase.cs @@ -24,7 +24,7 @@ namespace GoogleCloudExtension.AttachDebuggerDialog /// public abstract class AttachDebuggerStepBase : ViewModelBase, IAttachDebuggerStep { - private CancellationTokenSource _cancellationTokenSource; + private readonly CancellationTokenSource _cancellationTokenSource; private bool _isCancelButtonEnabled; private bool _isOKButtonEnabled; private bool _isCancelButtonVisible = true; diff --git a/GoogleCloudExtension/GoogleCloudExtension/AttachDebuggerDialog/AttachDebuggerWindow.cs b/GoogleCloudExtension/GoogleCloudExtension/AttachDebuggerDialog/AttachDebuggerWindow.cs index 47563db8d..a2da470cb 100644 --- a/GoogleCloudExtension/GoogleCloudExtension/AttachDebuggerDialog/AttachDebuggerWindow.cs +++ b/GoogleCloudExtension/GoogleCloudExtension/AttachDebuggerDialog/AttachDebuggerWindow.cs @@ -12,14 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. +using Google.Apis.Compute.v1.Data; using GoogleCloudExtension.Analytics; using GoogleCloudExtension.Analytics.Events; using GoogleCloudExtension.DataSources; -using GoogleCloudExtension.Utils; -using StringResources = GoogleCloudExtension.Resources; -using Google.Apis.Compute.v1.Data; using GoogleCloudExtension.Theming; +using GoogleCloudExtension.Utils; using System; +using StringResources = GoogleCloudExtension.Resources; namespace GoogleCloudExtension.AttachDebuggerDialog { diff --git a/GoogleCloudExtension/GoogleCloudExtension/AttachDebuggerDialog/EnablePowerShellPortStepViewModel.cs b/GoogleCloudExtension/GoogleCloudExtension/AttachDebuggerDialog/EnablePowerShellPortStepViewModel.cs index 38672a983..ba188f55e 100644 --- a/GoogleCloudExtension/GoogleCloudExtension/AttachDebuggerDialog/EnablePowerShellPortStepViewModel.cs +++ b/GoogleCloudExtension/GoogleCloudExtension/AttachDebuggerDialog/EnablePowerShellPortStepViewModel.cs @@ -65,7 +65,7 @@ protected override async Task GetNextStep() // This is the second time, check connectivity with a longer wait time. await ConnectivityTestUntillTimeout(waitTime) : // This is the first time, we don't check "waitTime", test connectivity anyhow. - await port.ConnectivityTest(CancelToken); + await port.ConnectivityTest(CancelToken); if (connected) { return InstallStartRemoteToolStepViewModel.CreateStep(Context); diff --git a/GoogleCloudExtension/GoogleCloudExtension/AttachDebuggerDialog/ListProcessStepViewModel.cs b/GoogleCloudExtension/GoogleCloudExtension/AttachDebuggerDialog/ListProcessStepViewModel.cs index 7814a799c..74dc85852 100644 --- a/GoogleCloudExtension/GoogleCloudExtension/AttachDebuggerDialog/ListProcessStepViewModel.cs +++ b/GoogleCloudExtension/GoogleCloudExtension/AttachDebuggerDialog/ListProcessStepViewModel.cs @@ -17,7 +17,6 @@ using GoogleCloudExtension.Analytics; using GoogleCloudExtension.Analytics.Events; using GoogleCloudExtension.Utils; -using Shell = Microsoft.VisualStudio.Shell; using System; using System.Collections.Generic; using System.Diagnostics; @@ -25,6 +24,7 @@ using System.Runtime.InteropServices; using System.Threading.Tasks; using System.Windows.Controls; +using Shell = Microsoft.VisualStudio.Shell; namespace GoogleCloudExtension.AttachDebuggerDialog { diff --git a/GoogleCloudExtension/GoogleCloudExtension/CloudExplorer/CloudExplorerViewModel.cs b/GoogleCloudExtension/GoogleCloudExtension/CloudExplorer/CloudExplorerViewModel.cs index aa1cde465..9263c2b05 100644 --- a/GoogleCloudExtension/GoogleCloudExtension/CloudExplorer/CloudExplorerViewModel.cs +++ b/GoogleCloudExtension/GoogleCloudExtension/CloudExplorer/CloudExplorerViewModel.cs @@ -22,6 +22,7 @@ using GoogleCloudExtension.DataSources; using GoogleCloudExtension.ManageAccounts; using GoogleCloudExtension.Utils; +using GoogleCloudExtension.Utils.Async; using System; using System.Collections; using System.Collections.Generic; @@ -30,7 +31,6 @@ using System.Threading.Tasks; using System.Windows.Input; using System.Windows.Media; -using GoogleCloudExtension.Utils.Async; namespace GoogleCloudExtension.CloudExplorer { diff --git a/GoogleCloudExtension/GoogleCloudExtension/CloudExplorerSources/Gce/GceInstanceViewModel.cs b/GoogleCloudExtension/GoogleCloudExtension/CloudExplorerSources/Gce/GceInstanceViewModel.cs index ffe2dd7bb..62d7676f2 100644 --- a/GoogleCloudExtension/GoogleCloudExtension/CloudExplorerSources/Gce/GceInstanceViewModel.cs +++ b/GoogleCloudExtension/GoogleCloudExtension/CloudExplorerSources/Gce/GceInstanceViewModel.cs @@ -99,7 +99,7 @@ public override void OnMenuItemOpen() // To be safe and in case the constructor/initiailzation code could be modified in the future. if (_attachDebuggerCommand != null) { - _attachDebuggerCommand.CanExecuteCommand = + _attachDebuggerCommand.CanExecuteCommand = Instance.IsWindowsInstance() && Instance.IsRunning() && !ShellUtils.IsBusy(); } base.OnMenuItemOpen(); diff --git a/GoogleCloudExtension/GoogleCloudExtension/CloudExplorerSources/PubSub/SubscriptionViewModel.cs b/GoogleCloudExtension/GoogleCloudExtension/CloudExplorerSources/PubSub/SubscriptionViewModel.cs index 5b4f0a811..274aa9a02 100644 --- a/GoogleCloudExtension/GoogleCloudExtension/CloudExplorerSources/PubSub/SubscriptionViewModel.cs +++ b/GoogleCloudExtension/GoogleCloudExtension/CloudExplorerSources/PubSub/SubscriptionViewModel.cs @@ -116,7 +116,6 @@ internal async void OnDeleteSubscriptionCommand() Resources.PubSubDeleteSubscriptionErrorMessage, Resources.PubSubDeleteSubscriptionErrorHeader, e.Message); - } await _owner.Refresh(); } diff --git a/GoogleCloudExtension/GoogleCloudExtension/CloudSourceRepositories/AsyncRepositories.cs b/GoogleCloudExtension/GoogleCloudExtension/CloudSourceRepositories/AsyncRepositories.cs index 11d01abc5..11f255be2 100644 --- a/GoogleCloudExtension/GoogleCloudExtension/CloudSourceRepositories/AsyncRepositories.cs +++ b/GoogleCloudExtension/GoogleCloudExtension/CloudSourceRepositories/AsyncRepositories.cs @@ -14,7 +14,6 @@ using Google.Apis.CloudSourceRepositories.v1.Data; using GoogleCloudExtension.Utils; -using GoogleCloudExtension.Utils.Async; using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/GoogleCloudExtension/GoogleCloudExtension/CloudSourceRepositories/CsAddRepoWindow.cs b/GoogleCloudExtension/GoogleCloudExtension/CloudSourceRepositories/CsAddRepoWindow.cs index 9777fcaa4..9ff426b11 100644 --- a/GoogleCloudExtension/GoogleCloudExtension/CloudSourceRepositories/CsAddRepoWindow.cs +++ b/GoogleCloudExtension/GoogleCloudExtension/CloudSourceRepositories/CsAddRepoWindow.cs @@ -14,9 +14,9 @@ using Google.Apis.CloudResourceManager.v1.Data; using Google.Apis.CloudSourceRepositories.v1.Data; -using StringResources = GoogleCloudExtension.Resources; using GoogleCloudExtension.Theming; using System.Collections.Generic; +using StringResources = GoogleCloudExtension.Resources; namespace GoogleCloudExtension.CloudSourceRepositories { diff --git a/GoogleCloudExtension/GoogleCloudExtension/CloudSourceRepositories/CsrAddRepoWindowViewModel.cs b/GoogleCloudExtension/GoogleCloudExtension/CloudSourceRepositories/CsrAddRepoWindowViewModel.cs index be5230382..ce254dc68 100644 --- a/GoogleCloudExtension/GoogleCloudExtension/CloudSourceRepositories/CsrAddRepoWindowViewModel.cs +++ b/GoogleCloudExtension/GoogleCloudExtension/CloudSourceRepositories/CsrAddRepoWindowViewModel.cs @@ -65,7 +65,7 @@ public string RepositoryName /// /// Add repo for the project message /// - public string AddRepoForProjectMessage => + public string AddRepoForProjectMessage => String.Format(Resources.CsrAddRepoForProjectMessageFormat, _project.Name); /// diff --git a/GoogleCloudExtension/GoogleCloudExtension/CloudSourceRepositories/CsrCloneWindow.cs b/GoogleCloudExtension/GoogleCloudExtension/CloudSourceRepositories/CsrCloneWindow.cs index c732fcd57..b86eda2ad 100644 --- a/GoogleCloudExtension/GoogleCloudExtension/CloudSourceRepositories/CsrCloneWindow.cs +++ b/GoogleCloudExtension/GoogleCloudExtension/CloudSourceRepositories/CsrCloneWindow.cs @@ -13,9 +13,9 @@ // limitations under the License. using Google.Apis.CloudResourceManager.v1.Data; -using StringResources = GoogleCloudExtension.Resources; using GoogleCloudExtension.Theming; using System.Collections.Generic; +using StringResources = GoogleCloudExtension.Resources; namespace GoogleCloudExtension.CloudSourceRepositories { @@ -40,7 +40,7 @@ public class CloneDialogResult /// public class CsrCloneWindow : CommonDialogWindowBase { - private CsrCloneWindowViewModel ViewModel { get; } + private CsrCloneWindowViewModel ViewModel { get; } private CsrCloneWindow(IList projects) : base(StringResources.CsrCloneWindowTitle) { diff --git a/GoogleCloudExtension/GoogleCloudExtension/CloudSourceRepositories/CsrCloneWindowViewModel.cs b/GoogleCloudExtension/GoogleCloudExtension/CloudSourceRepositories/CsrCloneWindowViewModel.cs index e818513c4..9ee581431 100644 --- a/GoogleCloudExtension/GoogleCloudExtension/CloudSourceRepositories/CsrCloneWindowViewModel.cs +++ b/GoogleCloudExtension/GoogleCloudExtension/CloudSourceRepositories/CsrCloneWindowViewModel.cs @@ -127,7 +127,7 @@ public bool IsReady /// Responds to create repo button click event /// public ProtectedCommand CreateRepoCommand { get; } - + /// /// Gets a result of type . /// null inidcates no result is created, user cancelled the operation. @@ -169,7 +169,7 @@ private void RepositoriesAsyncPropertyChanged(object sender, PropertyChangedEven .FirstOrDefault(x => x.Name == _latestCreatedRepo.Name); if (SelectedRepository != null) { - break; + break; } // else if it is null, user may have changed project, continue to select first repo. } diff --git a/GoogleCloudExtension/GoogleCloudExtension/CloudSourceRepositories/CsrGitSetupWarningViewModel.cs b/GoogleCloudExtension/GoogleCloudExtension/CloudSourceRepositories/CsrGitSetupWarningViewModel.cs index cd095fe9a..88757951a 100644 --- a/GoogleCloudExtension/GoogleCloudExtension/CloudSourceRepositories/CsrGitSetupWarningViewModel.cs +++ b/GoogleCloudExtension/GoogleCloudExtension/CloudSourceRepositories/CsrGitSetupWarningViewModel.cs @@ -41,7 +41,7 @@ public class CsrGitSetupWarningViewModel : ViewModelBase public bool IsEnabled { get { return _isEnabled; } - private set { SetValueAndRaise(ref _isEnabled, value); } + private set { SetValueAndRaise(ref _isEnabled, value); } } /// diff --git a/GoogleCloudExtension/GoogleCloudExtension/CloudSourceRepositories/CsrReposViewModel.cs b/GoogleCloudExtension/GoogleCloudExtension/CloudSourceRepositories/CsrReposViewModel.cs index 319ddee57..304e1331b 100644 --- a/GoogleCloudExtension/GoogleCloudExtension/CloudSourceRepositories/CsrReposViewModel.cs +++ b/GoogleCloudExtension/GoogleCloudExtension/CloudSourceRepositories/CsrReposViewModel.cs @@ -41,7 +41,7 @@ public class CsrReposViewModel : ViewModelBase /// This is to preserve the list when a new user control is created. /// Without doing so, user constantly sees the list of repos are loading without reasons. /// - private readonly static ObservableCollection s_repoList + private readonly static ObservableCollection s_repoList = new ObservableCollection(); private static RepoItemViewModel s_activeRepo; @@ -270,8 +270,8 @@ Dictionary> projectRepos } private async Task TryGetCloudRepoAsync( - string url, - string projectId, + string url, + string projectId, Dictionary> projectReposMap) { IList cloudRepos; diff --git a/GoogleCloudExtension/GoogleCloudExtension/CloudSourceRepositories/CsrSectionControlViewModel.cs b/GoogleCloudExtension/GoogleCloudExtension/CloudSourceRepositories/CsrSectionControlViewModel.cs index e7077838f..1f86f0743 100644 --- a/GoogleCloudExtension/GoogleCloudExtension/CloudSourceRepositories/CsrSectionControlViewModel.cs +++ b/GoogleCloudExtension/GoogleCloudExtension/CloudSourceRepositories/CsrSectionControlViewModel.cs @@ -184,7 +184,7 @@ void ISectionViewModel.Cleanup() #endregion private async Task CheckGitInstallationAsync() - { + { if (await _gitSetupViewModel.CheckInstallationAsync()) { OnGitInstallationCheckSuccess(); diff --git a/GoogleCloudExtension/GoogleCloudExtension/GoogleCloudExtensionPackage.cs b/GoogleCloudExtension/GoogleCloudExtension/GoogleCloudExtensionPackage.cs index 474398653..00cf9d385 100644 --- a/GoogleCloudExtension/GoogleCloudExtension/GoogleCloudExtensionPackage.cs +++ b/GoogleCloudExtension/GoogleCloudExtension/GoogleCloudExtensionPackage.cs @@ -150,11 +150,11 @@ protected override int QueryClose(out bool canClose) if (_closingEvent != null) { var tasks = new List(); - foreach(var handler in _closingEvent.GetInvocationList().OfType()) + foreach (var handler in _closingEvent.GetInvocationList().OfType()) { tasks.Add(SystemTasks.Task.Run(() => handler(this, EventArgs.Empty))); }; - + SystemTasks.Task.WaitAll(tasks.ToArray(), TimeSpan.FromMilliseconds(1000)); } return base.QueryClose(out canClose); diff --git a/GoogleCloudExtension/GoogleCloudExtension/PublishDialogSteps/GceStep/GceStepViewModel.cs b/GoogleCloudExtension/GoogleCloudExtension/PublishDialogSteps/GceStep/GceStepViewModel.cs index 61b1d9e07..879579d40 100644 --- a/GoogleCloudExtension/GoogleCloudExtension/PublishDialogSteps/GceStep/GceStepViewModel.cs +++ b/GoogleCloudExtension/GoogleCloudExtension/PublishDialogSteps/GceStep/GceStepViewModel.cs @@ -22,6 +22,7 @@ using GoogleCloudExtension.ManageWindowsCredentials; using GoogleCloudExtension.PublishDialog; using GoogleCloudExtension.Utils; +using GoogleCloudExtension.Utils.Async; using GoogleCloudExtension.VsVersion; using System; using System.Collections.Generic; @@ -29,7 +30,6 @@ using System.Linq; using System.Threading.Tasks; using System.Windows; -using GoogleCloudExtension.Utils.Async; namespace GoogleCloudExtension.PublishDialogSteps.GceStep { diff --git a/GoogleCloudExtension/GoogleCloudExtension/Resources.Designer.cs b/GoogleCloudExtension/GoogleCloudExtension/Resources.Designer.cs index 73455ecf1..f26684945 100644 --- a/GoogleCloudExtension/GoogleCloudExtension/Resources.Designer.cs +++ b/GoogleCloudExtension/GoogleCloudExtension/Resources.Designer.cs @@ -8,10 +8,10 @@ // //------------------------------------------------------------------------------ -namespace GoogleCloudExtension { - using System; - - +namespace GoogleCloudExtension +{ + + /// /// A strongly-typed resource class, for looking up localized strings, etc. /// diff --git a/GoogleCloudExtension/GoogleCloudExtension/StackdriverLogsViewer/LogsViewerToolWindowCommand.cs b/GoogleCloudExtension/GoogleCloudExtension/StackdriverLogsViewer/LogsViewerToolWindowCommand.cs index 73bf3768e..22c092c42 100644 --- a/GoogleCloudExtension/GoogleCloudExtension/StackdriverLogsViewer/LogsViewerToolWindowCommand.cs +++ b/GoogleCloudExtension/GoogleCloudExtension/StackdriverLogsViewer/LogsViewerToolWindowCommand.cs @@ -58,7 +58,7 @@ private LogsViewerToolWindowCommand(Package package) { var menuCommandID = new CommandID(CommandSet, CommandId); var menuItem = new OleMenuCommand( - (sender, e) => ToolWindowCommandUtils.ShowToolWindow(), menuCommandID); + (sender, e) => ToolWindowCommandUtils.ShowToolWindow(), menuCommandID); menuItem.BeforeQueryStatus += ToolWindowCommandUtils.EnableMenuItemOnValidProjectId; commandService.AddCommand(menuItem); } diff --git a/GoogleCloudExtension/GoogleCloudExtension/TemplateWizards/Dialogs/ProjectIdDialog/PickProjectIdViewModel.cs b/GoogleCloudExtension/GoogleCloudExtension/TemplateWizards/Dialogs/ProjectIdDialog/PickProjectIdViewModel.cs index 600f27ed7..5c87ffa7b 100644 --- a/GoogleCloudExtension/GoogleCloudExtension/TemplateWizards/Dialogs/ProjectIdDialog/PickProjectIdViewModel.cs +++ b/GoogleCloudExtension/GoogleCloudExtension/TemplateWizards/Dialogs/ProjectIdDialog/PickProjectIdViewModel.cs @@ -108,7 +108,8 @@ public AsyncProperty LoadTask } public PickProjectIdViewModel(IPickProjectIdWindow owner) - : this(owner, DataSourceFactories.CreateResourceManagerDataSource, ManageAccountsWindow.PromptUser) { } + : this(owner, DataSourceFactories.CreateResourceManagerDataSource, ManageAccountsWindow.PromptUser) + { } /// /// For Testing. diff --git a/GoogleCloudExtension/GoogleCloudExtension/TemplateWizards/Dialogs/ProjectIdDialog/PickProjectIdWindowContent.xaml.cs b/GoogleCloudExtension/GoogleCloudExtension/TemplateWizards/Dialogs/ProjectIdDialog/PickProjectIdWindowContent.xaml.cs index 27fd1ba17..d93632465 100644 --- a/GoogleCloudExtension/GoogleCloudExtension/TemplateWizards/Dialogs/ProjectIdDialog/PickProjectIdWindowContent.xaml.cs +++ b/GoogleCloudExtension/GoogleCloudExtension/TemplateWizards/Dialogs/ProjectIdDialog/PickProjectIdWindowContent.xaml.cs @@ -11,6 +11,7 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + namespace GoogleCloudExtension.TemplateWizards.Dialogs.ProjectIdDialog { /// diff --git a/GoogleCloudExtension/GoogleCloudExtension/TemplateWizards/Dialogs/TemplateChooserDialog/AspNetVersion.cs b/GoogleCloudExtension/GoogleCloudExtension/TemplateWizards/Dialogs/TemplateChooserDialog/AspNetVersion.cs index 5b5e2e4ba..372329ab9 100644 --- a/GoogleCloudExtension/GoogleCloudExtension/TemplateWizards/Dialogs/TemplateChooserDialog/AspNetVersion.cs +++ b/GoogleCloudExtension/GoogleCloudExtension/TemplateWizards/Dialogs/TemplateChooserDialog/AspNetVersion.cs @@ -161,6 +161,5 @@ public static IList GetAvailableVersions(FrameworkType framework) throw new InvalidOperationException($"Unknown Famework type: {framework}"); } } - } } diff --git a/GoogleCloudExtension/GoogleCloudExtension/TemplateWizards/Dialogs/TemplateChooserDialog/TemplateChooserViewModel.cs b/GoogleCloudExtension/GoogleCloudExtension/TemplateWizards/Dialogs/TemplateChooserDialog/TemplateChooserViewModel.cs index 123738918..d0dce421b 100644 --- a/GoogleCloudExtension/GoogleCloudExtension/TemplateWizards/Dialogs/TemplateChooserDialog/TemplateChooserViewModel.cs +++ b/GoogleCloudExtension/GoogleCloudExtension/TemplateWizards/Dialogs/TemplateChooserDialog/TemplateChooserViewModel.cs @@ -25,7 +25,6 @@ namespace GoogleCloudExtension.TemplateWizards.Dialogs.TemplateChooserDialog /// public class TemplateChooserViewModel : ViewModelBase { - private string _gcpProjectId; private FrameworkType _selectedFramework; private AspNetVersion _selectedVersion; diff --git a/GoogleCloudExtension/GoogleCloudExtension/TemplateWizards/ReplacementsKeys.cs b/GoogleCloudExtension/GoogleCloudExtension/TemplateWizards/ReplacementsKeys.cs index cd17ee554..c6ce5c44a 100644 --- a/GoogleCloudExtension/GoogleCloudExtension/TemplateWizards/ReplacementsKeys.cs +++ b/GoogleCloudExtension/GoogleCloudExtension/TemplateWizards/ReplacementsKeys.cs @@ -11,6 +11,7 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + namespace GoogleCloudExtension.TemplateWizards { /// diff --git a/GoogleCloudExtension/GoogleCloudExtension/Utils/StringUtils.cs b/GoogleCloudExtension/GoogleCloudExtension/Utils/StringUtils.cs index 8959937a9..748a9af1b 100644 --- a/GoogleCloudExtension/GoogleCloudExtension/Utils/StringUtils.cs +++ b/GoogleCloudExtension/GoogleCloudExtension/Utils/StringUtils.cs @@ -14,7 +14,6 @@ using System; using System.Collections.Generic; -using System.IO; using System.Linq; using System.Text; diff --git a/GoogleCloudExtension/GoogleCloudExtensionUnitTests/AssemblyInitialize.cs b/GoogleCloudExtension/GoogleCloudExtensionUnitTests/AssemblyInitialize.cs index 27c85e3be..d0bd022e6 100644 --- a/GoogleCloudExtension/GoogleCloudExtensionUnitTests/AssemblyInitialize.cs +++ b/GoogleCloudExtension/GoogleCloudExtensionUnitTests/AssemblyInitialize.cs @@ -1,4 +1,17 @@ - +// Copyright 2017 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + using GoogleCloudExtension.Analytics; using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Windows; diff --git a/GoogleCloudExtension/GoogleCloudExtensionUnitTests/CloudExplorerSources/PubSub/TopicViewModelBaseTests.cs b/GoogleCloudExtension/GoogleCloudExtensionUnitTests/CloudExplorerSources/PubSub/TopicViewModelBaseTests.cs index 41537eee2..c1e335fc0 100644 --- a/GoogleCloudExtension/GoogleCloudExtensionUnitTests/CloudExplorerSources/PubSub/TopicViewModelBaseTests.cs +++ b/GoogleCloudExtension/GoogleCloudExtensionUnitTests/CloudExplorerSources/PubSub/TopicViewModelBaseTests.cs @@ -186,7 +186,8 @@ private class TestTopicViewModelBase : TopicViewModelBase public TestTopicViewModelBase( IPubsubSourceRootViewModel owner, ITopicItem item, - IEnumerable subscriptions) : base(owner, item, subscriptions) { } + IEnumerable subscriptions) : base(owner, item, subscriptions) + { } public void AssetOwnerEquals(IPubsubSourceRootViewModel ownerMockObject) { @@ -194,5 +195,4 @@ public void AssetOwnerEquals(IPubsubSourceRootViewModel ownerMockObject) } } } - } diff --git a/GoogleCloudExtension/GoogleCloudExtensionUnitTests/CloudSourceRepository/CsrAddRepoWindowViewModelTests.cs b/GoogleCloudExtension/GoogleCloudExtensionUnitTests/CloudSourceRepository/CsrAddRepoWindowViewModelTests.cs index a883b2291..bcd037822 100644 --- a/GoogleCloudExtension/GoogleCloudExtensionUnitTests/CloudSourceRepository/CsrAddRepoWindowViewModelTests.cs +++ b/GoogleCloudExtension/GoogleCloudExtensionUnitTests/CloudSourceRepository/CsrAddRepoWindowViewModelTests.cs @@ -19,8 +19,8 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; using System; -using System.Linq; using System.Collections.Generic; +using System.Linq; namespace GoogleCloudExtensionUnitTests.CloudSourceRepository { @@ -85,11 +85,10 @@ public void ValidRepoNameValidationTest() TestRepoNameValidRange('A', 'Z'); TestRepoNameValidRange('0', '9'); TestValidRepoName("_This-is_valid"); // _ and - character - } public void InvalidRepoNameTest() - { + { TestRepoNameInvalidRange(Convert.ToChar(0), Convert.ToChar(44)); // 45 is - TestRepoNameInvalidRange(Convert.ToChar(46), Convert.ToChar(47)); // 48 is 0 TestRepoNameInvalidRange(Convert.ToChar(58), Convert.ToChar(64)); // 57 is 9, 66 is A diff --git a/GoogleCloudExtension/GoogleCloudExtensionUnitTests/SolutionUserOptionsTests.cs b/GoogleCloudExtension/GoogleCloudExtensionUnitTests/SolutionUserOptionsTests.cs index 7fbca8157..eaf2178d8 100644 --- a/GoogleCloudExtension/GoogleCloudExtensionUnitTests/SolutionUserOptionsTests.cs +++ b/GoogleCloudExtension/GoogleCloudExtensionUnitTests/SolutionUserOptionsTests.cs @@ -28,7 +28,7 @@ public class TestOptions [SolutionSettingKey("google_string_1")] public string StringOption { get; set; } = "string option 1"; - [SolutionSettingKey("google_string_2")] + [SolutionSettingKey("google_string_2")] public string StringOption2 { get; set; } = "string option 2"; public string NonOption { get; set; } diff --git a/GoogleCloudExtension/GoogleCloudExtensionUnitTests/TemplateWizards/GoogleProjectSelectorTemplateWizardTests.cs b/GoogleCloudExtension/GoogleCloudExtensionUnitTests/TemplateWizards/GoogleProjectSelectorTemplateWizardTests.cs index 3b1710bd9..529654f4b 100644 --- a/GoogleCloudExtension/GoogleCloudExtensionUnitTests/TemplateWizards/GoogleProjectSelectorTemplateWizardTests.cs +++ b/GoogleCloudExtension/GoogleCloudExtensionUnitTests/TemplateWizards/GoogleProjectSelectorTemplateWizardTests.cs @@ -74,7 +74,6 @@ public class GoogleProjectTemplateSelectorWizardTests [TestInitialize] public void BeforeEach() { - _replacements = new Dictionary { {ReplacementsKeys.ProjectNameKey, DefaultProjectName}, diff --git a/GoogleCloudExtension/GoogleCloudExtensions.TeamExplorerExtension.v15/GitExtentionWrapper.cs b/GoogleCloudExtension/GoogleCloudExtensions.TeamExplorerExtension.v15/GitExtentionWrapper.cs index 44c992873..85606d053 100644 --- a/GoogleCloudExtension/GoogleCloudExtensions.TeamExplorerExtension.v15/GitExtentionWrapper.cs +++ b/GoogleCloudExtension/GoogleCloudExtensions.TeamExplorerExtension.v15/GitExtentionWrapper.cs @@ -13,8 +13,6 @@ // limitations under the License. using System; -using System.Linq; -using static System.Diagnostics.Debug; namespace GoogleCloudExtension.TeamExplorerExtension { diff --git a/GoogleCloudExtension/ProjectTemplates/ProjectTemplate.Tests/VisualStudioWrapper.cs b/GoogleCloudExtension/ProjectTemplates/ProjectTemplate.Tests/VisualStudioWrapper.cs index 36ff20819..5c80b7e19 100644 --- a/GoogleCloudExtension/ProjectTemplates/ProjectTemplate.Tests/VisualStudioWrapper.cs +++ b/GoogleCloudExtension/ProjectTemplates/ProjectTemplate.Tests/VisualStudioWrapper.cs @@ -14,12 +14,12 @@ using EnvDTE; using EnvDTE80; +using Microsoft.Win32; using System; using System.Diagnostics; using System.IO; using System.Runtime.InteropServices; using System.Runtime.InteropServices.ComTypes; -using Microsoft.Win32; using Process = System.Diagnostics.Process; using Thread = System.Threading.Thread; diff --git a/GoogleCloudExtension/TestProjects/EchoApp/Properties/AssemblyInfo.cs b/GoogleCloudExtension/TestProjects/EchoApp/Properties/AssemblyInfo.cs index 698cb00ae..1bcb5ae5a 100644 --- a/GoogleCloudExtension/TestProjects/EchoApp/Properties/AssemblyInfo.cs +++ b/GoogleCloudExtension/TestProjects/EchoApp/Properties/AssemblyInfo.cs @@ -1,5 +1,4 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following