From 0675a9b0ac5652875b883850363f96b45ac57c12 Mon Sep 17 00:00:00 2001 From: elachlan <2433737+elachlan@users.noreply.github.com> Date: Wed, 12 Jan 2022 17:25:33 +1000 Subject: [PATCH] SA1024 Colon should be followed by a space --- eng/Common.globalconfig | 2 +- src/Build.OM.UnitTests/Definition/ProjectItem_Tests.cs | 2 +- src/Build.UnitTests/BuildEnvironmentHelper_Tests.cs | 2 +- src/Build.UnitTests/ConsoleOutputAlignerTests.cs | 2 +- src/Build.UnitTests/Graph/IsolateProjects_Tests.cs | 2 +- src/Build.UnitTests/ProjectCache/ProjectCacheTests.cs | 4 ++-- src/Build/BackEnd/Components/ProjectCache/ProxyTargets.cs | 2 +- .../Components/SdkResolution/CachingSdkResolverService.cs | 2 +- src/Build/Construction/ProjectElementContainer.cs | 2 +- src/Build/Definition/ProjectCollection.cs | 4 ++-- src/Build/Instance/ProjectItemGroupTaskItemInstance.cs | 2 +- src/Build/Utilities/NuGetFrameworkWrapper.cs | 2 +- src/Framework/BuildEventContext.cs | 2 +- src/Framework/ReuseableStringBuilder.cs | 2 +- src/Shared/UnitTests/TestEnvironment.cs | 2 +- .../ResourceHandling/GenerateResource_Tests.cs | 2 +- src/Tasks/Exec.cs | 2 +- src/Tasks/RedistList.cs | 2 +- src/Tasks/ResolveComReference.cs | 2 +- src/Utilities.UnitTests/ToolLocationHelper_Tests.cs | 2 +- 20 files changed, 22 insertions(+), 22 deletions(-) diff --git a/eng/Common.globalconfig b/eng/Common.globalconfig index ba417e063f2..dda3ffde61a 100644 --- a/eng/Common.globalconfig +++ b/eng/Common.globalconfig @@ -755,7 +755,7 @@ dotnet_diagnostic.SA1021.severity = suggestion dotnet_diagnostic.SA1023.severity = warning # Colon should be followed by a space -dotnet_diagnostic.SA1024.severity = suggestion +dotnet_diagnostic.SA1024.severity = warning # Code should not contain multiple whitespace characters in a row dotnet_diagnostic.SA1025.severity = suggestion diff --git a/src/Build.OM.UnitTests/Definition/ProjectItem_Tests.cs b/src/Build.OM.UnitTests/Definition/ProjectItem_Tests.cs index 1bd2d2e55de..c32b0e8e748 100644 --- a/src/Build.OM.UnitTests/Definition/ProjectItem_Tests.cs +++ b/src/Build.OM.UnitTests/Definition/ProjectItem_Tests.cs @@ -759,7 +759,7 @@ private static void TestIncludeExcludeWithDifferentSlashes(string projectContent { Action runTest = (include, exclude) => { - TestIncludeExclude(projectContents, inputFiles, expectedInclude, include, exclude, normalizeSlashes: true, makeExpectedIncludeAbsolute:makeExpectedIncludeAbsolute); + TestIncludeExclude(projectContents, inputFiles, expectedInclude, include, exclude, normalizeSlashes: true, makeExpectedIncludeAbsolute: makeExpectedIncludeAbsolute); }; var includeWithForwardSlash = Helpers.ToForwardSlash(includeString); diff --git a/src/Build.UnitTests/BuildEnvironmentHelper_Tests.cs b/src/Build.UnitTests/BuildEnvironmentHelper_Tests.cs index 47bf0c2c6c3..f1e11354289 100644 --- a/src/Build.UnitTests/BuildEnvironmentHelper_Tests.cs +++ b/src/Build.UnitTests/BuildEnvironmentHelper_Tests.cs @@ -372,7 +372,7 @@ public void BuildEnvironmentFindsAmd64() [PlatformSpecific(TestPlatforms.Windows)] public void BuildEnvironmentFindsAmd64RunningInAmd64NoVS() { - using (var env = new EmptyStandaloneEnviroment(MSBuildExeName, writeFakeFiles:true, includeAmd64Folder:true)) + using (var env = new EmptyStandaloneEnviroment(MSBuildExeName, writeFakeFiles: true, includeAmd64Folder: true)) { var msBuild64Exe = Path.Combine(env.BuildDirectory, "amd64", MSBuildExeName); BuildEnvironmentHelper.ResetInstance_ForUnitTestsOnly(() => msBuild64Exe, ReturnNull, ReturnNull, diff --git a/src/Build.UnitTests/ConsoleOutputAlignerTests.cs b/src/Build.UnitTests/ConsoleOutputAlignerTests.cs index 36d24c027e3..9657a96c825 100644 --- a/src/Build.UnitTests/ConsoleOutputAlignerTests.cs +++ b/src/Build.UnitTests/ConsoleOutputAlignerTests.cs @@ -20,7 +20,7 @@ public void IndentBiggerThanBuffer_IndentedAndNotAligned(string input, bool alig string indent = " "; var aligner = new ConsoleOutputAligner(bufferWidth: 4, alignMessages: aligned); - string output = aligner.AlignConsoleOutput(message:input, prefixAlreadyWritten: false, prefixWidth: indent.Length); + string output = aligner.AlignConsoleOutput(message: input, prefixAlreadyWritten: false, prefixWidth: indent.Length); output.ShouldBe(indent + input + Environment.NewLine); } diff --git a/src/Build.UnitTests/Graph/IsolateProjects_Tests.cs b/src/Build.UnitTests/Graph/IsolateProjects_Tests.cs index b610f6e496f..69f44708e46 100644 --- a/src/Build.UnitTests/Graph/IsolateProjects_Tests.cs +++ b/src/Build.UnitTests/Graph/IsolateProjects_Tests.cs @@ -137,7 +137,7 @@ public IsolateProjectsTests(ITestOutputHelper testOutput) { // OSX links /var into /private, which makes Path.GetTempPath() to return "/var..." but Directory.GetCurrentDirectory to return "/private/var..." // this discrepancy fails the msbuild undeclared reference enforcements due to failed path equality checks - _env.SetTempPath(Path.Combine(Directory.GetCurrentDirectory(), Guid.NewGuid().ToString("N")), deleteTempDirectory:true); + _env.SetTempPath(Path.Combine(Directory.GetCurrentDirectory(), Guid.NewGuid().ToString("N")), deleteTempDirectory: true); } // todo investigate why out of proc builds fail on macos https://github.com/dotnet/msbuild/issues/3915 diff --git a/src/Build.UnitTests/ProjectCache/ProjectCacheTests.cs b/src/Build.UnitTests/ProjectCache/ProjectCacheTests.cs index 07d7ce076ac..9cca8eafd44 100644 --- a/src/Build.UnitTests/ProjectCache/ProjectCacheTests.cs +++ b/src/Build.UnitTests/ProjectCache/ProjectCacheTests.cs @@ -1295,8 +1295,8 @@ public void EngineShouldHandleExceptionsFromCachePluginViaGraphBuild(ErrorLocati { {1, new []{2}} }, - extraContentPerProjectNumber:null, - extraContentForAllNodes:@$" + extraContentPerProjectNumber: null, + extraContentForAllNodes: @$" <{ItemTypeNames.ProjectCachePlugin} Include=`{SamplePluginAssemblyPath.Value}` /> <{ItemTypeNames.ProjectReferenceTargets} Include=`Build` Targets=`Build` /> diff --git a/src/Build/BackEnd/Components/ProjectCache/ProxyTargets.cs b/src/Build/BackEnd/Components/ProjectCache/ProxyTargets.cs index 47b9e36867c..2379042fe5f 100644 --- a/src/Build/BackEnd/Components/ProjectCache/ProxyTargets.cs +++ b/src/Build/BackEnd/Components/ProjectCache/ProxyTargets.cs @@ -18,7 +18,7 @@ namespace Microsoft.Build.Experimental.ProjectCache /// The proxy targets are left in the build result (i.e., both GetTargetPath and Build will appear in the build result). /// Real targets can be committed in which case msbuild only keeps the proxy target in the build result. /// - public class ProxyTargets: ITranslatable + public class ProxyTargets : ITranslatable { private Dictionary _proxyTargetToRealTargetMap = null!; diff --git a/src/Build/BackEnd/Components/SdkResolution/CachingSdkResolverService.cs b/src/Build/BackEnd/Components/SdkResolution/CachingSdkResolverService.cs index 97e1c8f55bf..4ec872e6718 100644 --- a/src/Build/BackEnd/Components/SdkResolution/CachingSdkResolverService.cs +++ b/src/Build/BackEnd/Components/SdkResolution/CachingSdkResolverService.cs @@ -15,7 +15,7 @@ namespace Microsoft.Build.BackEnd.SdkResolution { - internal sealed class CachingSdkResolverService: SdkResolverService + internal sealed class CachingSdkResolverService : SdkResolverService { /// /// Stores the cache in a set of concurrent dictionaries. The main dictionary is by build submission ID and the inner dictionary contains a case-insensitive SDK name and the cached . diff --git a/src/Build/Construction/ProjectElementContainer.cs b/src/Build/Construction/ProjectElementContainer.cs index db480ae4e79..ffd099e1def 100644 --- a/src/Build/Construction/ProjectElementContainer.cs +++ b/src/Build/Construction/ProjectElementContainer.cs @@ -31,7 +31,7 @@ public abstract class ProjectElementContainer : ProjectElement /// External projects support /// internal ProjectElementContainer(ProjectElementContainerLink link) - :base(link) + : base(link) { } diff --git a/src/Build/Definition/ProjectCollection.cs b/src/Build/Definition/ProjectCollection.cs index fe629102479..35614af5aac 100644 --- a/src/Build/Definition/ProjectCollection.cs +++ b/src/Build/Definition/ProjectCollection.cs @@ -1735,7 +1735,7 @@ private void CreateLoggingService(int maxCPUCount, bool onlyLogCriticalEvents) /// internal void ResetToolsetsForTests(ToolsetConfigurationReader configurationReaderForTestsOnly) { - InitializeToolsetCollection(configReader:configurationReaderForTestsOnly); + InitializeToolsetCollection(configReader: configurationReaderForTestsOnly); } #if FEATURE_WIN32_REGISTRY @@ -1744,7 +1744,7 @@ internal void ResetToolsetsForTests(ToolsetConfigurationReader configurationRead /// internal void ResetToolsetsForTests(ToolsetRegistryReader registryReaderForTestsOnly) { - InitializeToolsetCollection(registryReader:registryReaderForTestsOnly); + InitializeToolsetCollection(registryReader: registryReaderForTestsOnly); } #endif diff --git a/src/Build/Instance/ProjectItemGroupTaskItemInstance.cs b/src/Build/Instance/ProjectItemGroupTaskItemInstance.cs index 9eeda046676..f3506fe20c2 100644 --- a/src/Build/Instance/ProjectItemGroupTaskItemInstance.cs +++ b/src/Build/Instance/ProjectItemGroupTaskItemInstance.cs @@ -18,7 +18,7 @@ namespace Microsoft.Build.Execution /// Immutable. /// [DebuggerDisplay("{_itemType} Include={_include} Exclude={_exclude} Remove={_remove} Condition={_condition}")] - public class ProjectItemGroupTaskItemInstance: ITranslatable + public class ProjectItemGroupTaskItemInstance : ITranslatable { /// /// Item type, for example "Compile" diff --git a/src/Build/Utilities/NuGetFrameworkWrapper.cs b/src/Build/Utilities/NuGetFrameworkWrapper.cs index 251433163b0..9d3546fcf37 100644 --- a/src/Build/Utilities/NuGetFrameworkWrapper.cs +++ b/src/Build/Utilities/NuGetFrameworkWrapper.cs @@ -88,7 +88,7 @@ public bool IsCompatible(string target, string candidate) private string GetNonZeroVersionParts(Version version, int minVersionPartCount) { - var nonZeroVersionParts = version.Revision == 0 ? version.Build == 0 ? version.Minor == 0 ? 1 : 2 : 3: 4; + var nonZeroVersionParts = version.Revision == 0 ? version.Build == 0 ? version.Minor == 0 ? 1 : 2 : 3 : 4; return version.ToString(Math.Max(nonZeroVersionParts, minVersionPartCount)); } } diff --git a/src/Framework/BuildEventContext.cs b/src/Framework/BuildEventContext.cs index 15b70dfb56e..70e4746bc85 100644 --- a/src/Framework/BuildEventContext.cs +++ b/src/Framework/BuildEventContext.cs @@ -97,7 +97,7 @@ public BuildEventContext int targetId, int taskId ) - :this(submissionId, nodeId, InvalidEvaluationId, projectInstanceId, projectContextId, targetId, taskId) + : this(submissionId, nodeId, InvalidEvaluationId, projectInstanceId, projectContextId, targetId, taskId) { } diff --git a/src/Framework/ReuseableStringBuilder.cs b/src/Framework/ReuseableStringBuilder.cs index 18457bee6f6..982f818bae3 100644 --- a/src/Framework/ReuseableStringBuilder.cs +++ b/src/Framework/ReuseableStringBuilder.cs @@ -236,7 +236,7 @@ internal static StringBuilder Get(int capacity) // If user wants bigger capacity than maximum capacity, respect it. returned = new StringBuilder(SelectBracketedCapacity(capacity)); #if DEBUG - MSBuildEventSource.Log.ReusableStringBuilderFactoryStart(hash: returned.GetHashCode(), newCapacity:capacity, oldCapacity:0, type:"miss"); + MSBuildEventSource.Log.ReusableStringBuilderFactoryStart(hash: returned.GetHashCode(), newCapacity: capacity, oldCapacity: 0, type: "miss"); #endif } else if (returned.Capacity < capacity) diff --git a/src/Shared/UnitTests/TestEnvironment.cs b/src/Shared/UnitTests/TestEnvironment.cs index bbc969855dd..22d8b098595 100644 --- a/src/Shared/UnitTests/TestEnvironment.cs +++ b/src/Shared/UnitTests/TestEnvironment.cs @@ -203,7 +203,7 @@ public TransientTempPath SetTempPath(string tempPath, bool deleteTempDirectory = /// Extensions of the file (defaults to '.tmp') public TransientTestFile CreateFile(string extension = ".tmp") { - return WithTransientTestState(new TransientTestFile(extension, createFile:true, expectedAsOutput:false)); + return WithTransientTestState(new TransientTestFile(extension, createFile: true, expectedAsOutput: false)); } public TransientTestFile CreateFile(string fileName, string contents = "") diff --git a/src/Tasks.UnitTests/ResourceHandling/GenerateResource_Tests.cs b/src/Tasks.UnitTests/ResourceHandling/GenerateResource_Tests.cs index 1e89908e045..038639c72ed 100644 --- a/src/Tasks.UnitTests/ResourceHandling/GenerateResource_Tests.cs +++ b/src/Tasks.UnitTests/ResourceHandling/GenerateResource_Tests.cs @@ -3738,7 +3738,7 @@ public static string GetTestResXContent(bool useType, string linkedBitmap, strin /// The name of the resx file public static string WriteTestResX(bool useType, string linkedBitmap, string extraToken, string resxFileToWrite = null, TestEnvironment env = null) { - return WriteTestResX(useType, linkedBitmap, extraToken, useInvalidType: false, resxFileToWrite:resxFileToWrite); + return WriteTestResX(useType, linkedBitmap, extraToken, useInvalidType: false, resxFileToWrite: resxFileToWrite); } /// diff --git a/src/Tasks/Exec.cs b/src/Tasks/Exec.cs index 90ef4257092..636dd5536b5 100644 --- a/src/Tasks/Exec.cs +++ b/src/Tasks/Exec.cs @@ -183,7 +183,7 @@ public ITaskItem[] Outputs /// if they aren't used. ConsoleOutput is a combination of stdout and stderr. /// [Output] - public ITaskItem[] ConsoleOutput => !ConsoleToMSBuild ? Array.Empty(): _nonEmptyOutput.ToArray(); + public ITaskItem[] ConsoleOutput => !ConsoleToMSBuild ? Array.Empty() : _nonEmptyOutput.ToArray(); #endregion diff --git a/src/Tasks/RedistList.cs b/src/Tasks/RedistList.cs index a096bf62c37..6d2862fac49 100644 --- a/src/Tasks/RedistList.cs +++ b/src/Tasks/RedistList.cs @@ -251,7 +251,7 @@ public static RedistList GetFrameworkList35() /// public static RedistList GetRedistListFromPath(string path) { - string[] redistListPaths = (path == null) ? Array.Empty(): GetRedistListPathsFromDisk(path); + string[] redistListPaths = (path == null) ? Array.Empty() : GetRedistListPathsFromDisk(path); var assemblyTableInfos = new AssemblyTableInfo[redistListPaths.Length]; for (int i = 0; i < redistListPaths.Length; ++i) diff --git a/src/Tasks/ResolveComReference.cs b/src/Tasks/ResolveComReference.cs index f624c4c3dd0..afa2a75cb88 100644 --- a/src/Tasks/ResolveComReference.cs +++ b/src/Tasks/ResolveComReference.cs @@ -1299,7 +1299,7 @@ internal bool ResolveComReferencePia(ComReferenceInfo referenceInfo, string refN /// internal IEnumerable GetResolvedAssemblyReferenceItemSpecs() { - return (ResolvedAssemblyReferences == null) ? Array.Empty(): ResolvedAssemblyReferences.Select(rar => rar.ItemSpec); + return (ResolvedAssemblyReferences == null) ? Array.Empty() : ResolvedAssemblyReferences.Select(rar => rar.ItemSpec); } /// diff --git a/src/Utilities.UnitTests/ToolLocationHelper_Tests.cs b/src/Utilities.UnitTests/ToolLocationHelper_Tests.cs index 77c45aba26a..9067d780c92 100644 --- a/src/Utilities.UnitTests/ToolLocationHelper_Tests.cs +++ b/src/Utilities.UnitTests/ToolLocationHelper_Tests.cs @@ -2679,7 +2679,7 @@ public void GetPathToReferenceAssembliesWithCustomTargetFrameworkInFallbackPathA (string frameworkName, string frameworkVersion, string frameworkProfile, string customFrameworkDir, string fallbackSearchPaths) => ToolLocationHelper.GetPathToReferenceAssemblies( frameworkName, "v" + frameworkVersion, frameworkProfile, - targetFrameworkRootPath:null, targetFrameworkFallbackSearchPaths:fallbackSearchPaths)); + targetFrameworkRootPath: null, targetFrameworkFallbackSearchPaths: fallbackSearchPaths)); } }