diff --git a/eng/Common.globalconfig b/eng/Common.globalconfig index fd878420d57..1869473b0f1 100644 --- a/eng/Common.globalconfig +++ b/eng/Common.globalconfig @@ -741,7 +741,7 @@ dotnet_diagnostic.SA1013.severity = suggestion dotnet_diagnostic.SA1014.severity = suggestion # Closing generic bracket should not be followed by a space -dotnet_diagnostic.SA1015.severity = suggestion +dotnet_diagnostic.SA1015.severity = warning dotnet_diagnostic.SA1019.severity = none diff --git a/src/Build.OM.UnitTests/ObjectModelRemoting/RemoteProjectsProviderMock/ConstructionLinkMocks/ProjectElemetExportHelper.cs b/src/Build.OM.UnitTests/ObjectModelRemoting/RemoteProjectsProviderMock/ConstructionLinkMocks/ProjectElemetExportHelper.cs index 641e4b1b66b..6fba5806135 100644 --- a/src/Build.OM.UnitTests/ObjectModelRemoting/RemoteProjectsProviderMock/ConstructionLinkMocks/ProjectElemetExportHelper.cs +++ b/src/Build.OM.UnitTests/ObjectModelRemoting/RemoteProjectsProviderMock/ConstructionLinkMocks/ProjectElemetExportHelper.cs @@ -79,7 +79,7 @@ private static MockProjectElementLinkRemoter Export(ProjectCollectionLink return exporter.Export(xml); } - private static bool IsOfType (ProjectElement xml) { return xml is T; } + private static bool IsOfType(ProjectElement xml) { return xml is T; } private static Dictionary knownTypes = new Dictionary(); diff --git a/src/Build.OM.UnitTests/ObjectModelRemoting/RemoteProjectsProviderMock/ExporterMock.cs b/src/Build.OM.UnitTests/ObjectModelRemoting/RemoteProjectsProviderMock/ExporterMock.cs index 004bbf7dfa9..1b7e3b67aee 100644 --- a/src/Build.OM.UnitTests/ObjectModelRemoting/RemoteProjectsProviderMock/ExporterMock.cs +++ b/src/Build.OM.UnitTests/ObjectModelRemoting/RemoteProjectsProviderMock/ExporterMock.cs @@ -101,7 +101,7 @@ internal interface IRemoterSource /// Base remoter object implementation. /// /// - internal abstract class MockLinkRemoter : ExportedLinksMap.LinkedObject , IRemoterSource + internal abstract class MockLinkRemoter : ExportedLinksMap.LinkedObject, IRemoterSource where T : class { object IRemoterSource.RealObject => this.Source; diff --git a/src/Build.UnitTests/BackEnd/ConfigCache_Tests.cs b/src/Build.UnitTests/BackEnd/ConfigCache_Tests.cs index 77441aa3a97..7cfadc9a5e4 100644 --- a/src/Build.UnitTests/BackEnd/ConfigCache_Tests.cs +++ b/src/Build.UnitTests/BackEnd/ConfigCache_Tests.cs @@ -45,8 +45,8 @@ public static IEnumerable CacheSerializationTestData new BuildRequestData("path3", new Dictionary { ["a3"] = "b3" }, Constants.defaultToolsVersion, new[] { "target3" }, null), Constants.defaultToolsVersion); - brq3.ProjectDefaultTargets = new List{"target3"}; - brq3.ProjectInitialTargets = new List{"targetInitial"}; + brq3.ProjectDefaultTargets = new List {"target3"}; + brq3.ProjectInitialTargets = new List {"targetInitial"}; var configCache3 = new ConfigCache(); configCache3.AddConfiguration(brq3.ShallowCloneWithNewId(3)); diff --git a/src/Build.UnitTests/Evaluation/Expander_Tests.cs b/src/Build.UnitTests/Evaluation/Expander_Tests.cs index 1ffc80a6c98..06c13eae9c6 100644 --- a/src/Build.UnitTests/Evaluation/Expander_Tests.cs +++ b/src/Build.UnitTests/Evaluation/Expander_Tests.cs @@ -3727,7 +3727,7 @@ public void Medley() new string[] {"$(Reg:AAA)", ""} }; - var errorTests = new List{ + var errorTests = new List { "$(input[)", "$(input.ToString()])", "$(input.ToString()[)", diff --git a/src/Build.UnitTests/Graph/ProjectGraph_Tests.cs b/src/Build.UnitTests/Graph/ProjectGraph_Tests.cs index 80609e1b593..71dfb675845 100644 --- a/src/Build.UnitTests/Graph/ProjectGraph_Tests.cs +++ b/src/Build.UnitTests/Graph/ProjectGraph_Tests.cs @@ -891,7 +891,7 @@ public void GetTargetListsUsesAllTargetsForNonMultitargetingNodes() projectGraph.ProjectNodes.Count.ShouldBe(2); - IReadOnlyDictionary> targetLists = projectGraph.GetTargetLists(new List{"A"}); + IReadOnlyDictionary> targetLists = projectGraph.GetTargetLists(new List {"A"}); targetLists.Count.ShouldBe(projectGraph.ProjectNodes.Count); targetLists[GetFirstNodeWithProjectNumber(projectGraph, 1)].ShouldBe(new[] { "A" }); @@ -932,7 +932,7 @@ public void GetTargetsListInnerBuildToInnerBuild() projectGraph.ProjectNodes.Count.ShouldBe(2); - IReadOnlyDictionary> targetLists = projectGraph.GetTargetLists(new List{"A"}); + IReadOnlyDictionary> targetLists = projectGraph.GetTargetLists(new List {"A"}); targetLists.Count.ShouldBe(projectGraph.ProjectNodes.Count); targetLists[GetFirstNodeWithProjectNumber(projectGraph, 1)].ShouldBe(new[] { "A" }); @@ -966,7 +966,7 @@ public void GetTargetListsFiltersTargetsForOuterAndInnerBuilds() projectGraph.ProjectNodes.Count.ShouldBe(4); - IReadOnlyDictionary> targetLists = projectGraph.GetTargetLists(new List{"A"}); + IReadOnlyDictionary> targetLists = projectGraph.GetTargetLists(new List {"A"}); targetLists.Count.ShouldBe(projectGraph.ProjectNodes.Count); var root = GetFirstNodeWithProjectNumber(projectGraph, 1); @@ -1138,7 +1138,7 @@ public void GetTargetListsForComplexMultitargetingGraph() projectGraph.ProjectNodes.Count.ShouldBe(12); - IReadOnlyDictionary> targetLists = projectGraph.GetTargetLists(new List{"A"}); + IReadOnlyDictionary> targetLists = projectGraph.GetTargetLists(new List {"A"}); targetLists.Count.ShouldBe(projectGraph.ProjectNodes.Count); @@ -1724,7 +1724,7 @@ public void InnerBuildAsRootViaGlobalPropertyShouldNotPropagateInnerBuildPropert var root = CreateProjectFile(env: _env, projectNumber: 1, projectReferences: new[] {2}, projectReferenceTargets: null, defaultTargets: null, extraContent: MultitargetingSpecificationPropertyGroup).Path; CreateProjectFile(env: _env, projectNumber: 2); - var graph = new ProjectGraph(root, new Dictionary{{InnerBuildPropertyName, "foo"}}); + var graph = new ProjectGraph(root, new Dictionary {{InnerBuildPropertyName, "foo"}}); var dot = graph.ToDot(); @@ -1789,13 +1789,13 @@ public void InnerBuildsCanHaveSeparateReferences() innerBuildWithCommonReferences.ProjectReferences.Count.ShouldBe(4); var referenceNumbersSet = innerBuildWithCommonReferences.ProjectReferences.Select(r => Path.GetFileNameWithoutExtension(r.ProjectInstance.FullPath)).ToHashSet(); - referenceNumbersSet.ShouldBeSameIgnoringOrder(new HashSet{"2", "3"}); + referenceNumbersSet.ShouldBeSameIgnoringOrder(new HashSet {"2", "3"}); var innerBuildWithAdditionalReferences = GetNodesWithProjectNumber(graph, 1).First(n => n.ProjectInstance.GlobalProperties.TryGetValue(InnerBuildPropertyName, out string p) && p == "b"); innerBuildWithAdditionalReferences.ProjectReferences.Count.ShouldBe(8); referenceNumbersSet = innerBuildWithAdditionalReferences.ProjectReferences.Select(r => Path.GetFileNameWithoutExtension(r.ProjectInstance.FullPath)).ToHashSet(); - referenceNumbersSet.ShouldBeSameIgnoringOrder(new HashSet{"2", "3", "4", "5"}); + referenceNumbersSet.ShouldBeSameIgnoringOrder(new HashSet {"2", "3", "4", "5"}); } [Fact] @@ -1805,7 +1805,7 @@ public void InnerBuildProducedByOuterBuildCanBeReferencedByAnotherNode() "; - var additionalGlobalProperties = new Dictionary{{"x", "y"}}; + var additionalGlobalProperties = new Dictionary {{"x", "y"}}; var graph = new ProjectGraph(new [] { @@ -1844,7 +1844,7 @@ public void StandaloneInnerBuildsCanBeReferencedWithoutOuterBuilds() CreateProjectFile(env: _env, projectNumber: 2, projectReferences: new []{3}, projectReferenceTargets: null, defaultTargets: null, extraContent: MultitargetingSpecificationPropertyGroup + $"<{InnerBuildPropertyName}>a"); CreateProjectFile(env: _env, projectNumber: 3); - var additionalGlobalProperties = new Dictionary{{"x", "y"}}; + var additionalGlobalProperties = new Dictionary {{"x", "y"}}; var graph = new ProjectGraph(root, additionalGlobalProperties); @@ -1871,7 +1871,7 @@ public void InnerBuildsProducedByOuterBuildsCanBeReferencedByOtherInnerBuilds() ".Cleanup(); - var additionalGlobalProperties = new Dictionary{{"x", "y"}}; + var additionalGlobalProperties = new Dictionary {{"x", "y"}}; var root = CreateProjectFile( env: _env, diff --git a/src/MSBuild.UnitTests/CommandLineSwitches_Tests.cs b/src/MSBuild.UnitTests/CommandLineSwitches_Tests.cs index 56740ebea60..25fd47c6db9 100644 --- a/src/MSBuild.UnitTests/CommandLineSwitches_Tests.cs +++ b/src/MSBuild.UnitTests/CommandLineSwitches_Tests.cs @@ -548,7 +548,7 @@ public void GraphBuildSwitchCanHaveParameters() { CommandLineSwitches switches = new CommandLineSwitches(); - MSBuildApp.GatherCommandLineSwitches(new List{ "/graph", "/graph:true; NoBuild ;; ;", "/graph:foo"}, switches); + MSBuildApp.GatherCommandLineSwitches(new List { "/graph", "/graph:true; NoBuild ;; ;", "/graph:foo"}, switches); switches[CommandLineSwitches.ParameterizedSwitch.GraphBuild].ShouldBe(new[] {"true", " NoBuild ", " ", "foo"}); @@ -560,7 +560,7 @@ public void GraphBuildSwitchCanBeParameterless() { CommandLineSwitches switches = new CommandLineSwitches(); - MSBuildApp.GatherCommandLineSwitches(new List{ "/graph" }, switches); + MSBuildApp.GatherCommandLineSwitches(new List { "/graph" }, switches); switches[CommandLineSwitches.ParameterizedSwitch.GraphBuild].ShouldBe(new string[0]); diff --git a/src/Shared/UnitTests/FileMatcher_Tests.cs b/src/Shared/UnitTests/FileMatcher_Tests.cs index e1f0567d8e2..db63dd11fa3 100644 --- a/src/Shared/UnitTests/FileMatcher_Tests.cs +++ b/src/Shared/UnitTests/FileMatcher_Tests.cs @@ -1360,11 +1360,11 @@ public void FileEnumerationCacheTakesExcludesIntoAccount() Array.Sort(files); Assert.Equal(new []{"a.cs", "b.cs", "c.cs"}, files); - files = FileMatcher.Default.GetFiles(testProject.TestRoot, "**/*.cs", new List{"a.cs"}); + files = FileMatcher.Default.GetFiles(testProject.TestRoot, "**/*.cs", new List {"a.cs"}); Array.Sort(files); Assert.Equal(new[] {"b.cs", "c.cs" }, files); - files = FileMatcher.Default.GetFiles(testProject.TestRoot, "**/*.cs", new List{"a.cs", "c.cs"}); + files = FileMatcher.Default.GetFiles(testProject.TestRoot, "**/*.cs", new List {"a.cs", "c.cs"}); Array.Sort(files); Assert.Equal(new[] {"b.cs" }, files); }