Skip to content

Commit af31377

Browse files
authored
fix and enable warning on SA1015 (#7236)
1 parent 6543df7 commit af31377

File tree

8 files changed

+20
-20
lines changed

8 files changed

+20
-20
lines changed

eng/Common.globalconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -741,7 +741,7 @@ dotnet_diagnostic.SA1013.severity = suggestion
741741
dotnet_diagnostic.SA1014.severity = suggestion
742742

743743
# Closing generic bracket should not be followed by a space
744-
dotnet_diagnostic.SA1015.severity = suggestion
744+
dotnet_diagnostic.SA1015.severity = warning
745745

746746
dotnet_diagnostic.SA1019.severity = none
747747

src/Build.OM.UnitTests/ObjectModelRemoting/RemoteProjectsProviderMock/ConstructionLinkMocks/ProjectElemetExportHelper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ private static MockProjectElementLinkRemoter Export<RMock>(ProjectCollectionLink
7979
return exporter.Export<ProjectElement, RMock>(xml);
8080
}
8181

82-
private static bool IsOfType<T> (ProjectElement xml) { return xml is T; }
82+
private static bool IsOfType<T>(ProjectElement xml) { return xml is T; }
8383

8484
private static Dictionary<Type, ExporterFactory> knownTypes = new Dictionary<Type, ExporterFactory>();
8585

src/Build.OM.UnitTests/ObjectModelRemoting/RemoteProjectsProviderMock/ExporterMock.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ internal interface IRemoterSource
101101
/// Base remoter object implementation.
102102
/// </summary>
103103
/// <typeparam name="T"></typeparam>
104-
internal abstract class MockLinkRemoter<T> : ExportedLinksMap.LinkedObject<T> , IRemoterSource
104+
internal abstract class MockLinkRemoter<T> : ExportedLinksMap.LinkedObject<T>, IRemoterSource
105105
where T : class
106106
{
107107
object IRemoterSource.RealObject => this.Source;

src/Build.UnitTests/BackEnd/ConfigCache_Tests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ public static IEnumerable<object[]> CacheSerializationTestData
4545
new BuildRequestData("path3", new Dictionary<string, string> { ["a3"] = "b3" }, Constants.defaultToolsVersion, new[] { "target3" }, null),
4646
Constants.defaultToolsVersion);
4747

48-
brq3.ProjectDefaultTargets = new List<string>{"target3"};
49-
brq3.ProjectInitialTargets = new List<string>{"targetInitial"};
48+
brq3.ProjectDefaultTargets = new List<string> {"target3"};
49+
brq3.ProjectInitialTargets = new List<string> {"targetInitial"};
5050

5151
var configCache3 = new ConfigCache();
5252
configCache3.AddConfiguration(brq3.ShallowCloneWithNewId(3));

src/Build.UnitTests/Evaluation/Expander_Tests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3727,7 +3727,7 @@ public void Medley()
37273727
new string[] {"$(Reg:AAA)", ""}
37283728
};
37293729

3730-
var errorTests = new List<string>{
3730+
var errorTests = new List<string> {
37313731
"$(input[)",
37323732
"$(input.ToString()])",
37333733
"$(input.ToString()[)",

src/Build.UnitTests/Graph/ProjectGraph_Tests.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -891,7 +891,7 @@ public void GetTargetListsUsesAllTargetsForNonMultitargetingNodes()
891891

892892
projectGraph.ProjectNodes.Count.ShouldBe(2);
893893

894-
IReadOnlyDictionary<ProjectGraphNode, ImmutableList<string>> targetLists = projectGraph.GetTargetLists(new List<string>{"A"});
894+
IReadOnlyDictionary<ProjectGraphNode, ImmutableList<string>> targetLists = projectGraph.GetTargetLists(new List<string> {"A"});
895895
targetLists.Count.ShouldBe(projectGraph.ProjectNodes.Count);
896896

897897
targetLists[GetFirstNodeWithProjectNumber(projectGraph, 1)].ShouldBe(new[] { "A" });
@@ -932,7 +932,7 @@ public void GetTargetsListInnerBuildToInnerBuild()
932932

933933
projectGraph.ProjectNodes.Count.ShouldBe(2);
934934

935-
IReadOnlyDictionary<ProjectGraphNode, ImmutableList<string>> targetLists = projectGraph.GetTargetLists(new List<string>{"A"});
935+
IReadOnlyDictionary<ProjectGraphNode, ImmutableList<string>> targetLists = projectGraph.GetTargetLists(new List<string> {"A"});
936936
targetLists.Count.ShouldBe(projectGraph.ProjectNodes.Count);
937937

938938
targetLists[GetFirstNodeWithProjectNumber(projectGraph, 1)].ShouldBe(new[] { "A" });
@@ -966,7 +966,7 @@ public void GetTargetListsFiltersTargetsForOuterAndInnerBuilds()
966966

967967
projectGraph.ProjectNodes.Count.ShouldBe(4);
968968

969-
IReadOnlyDictionary<ProjectGraphNode, ImmutableList<string>> targetLists = projectGraph.GetTargetLists(new List<string>{"A"});
969+
IReadOnlyDictionary<ProjectGraphNode, ImmutableList<string>> targetLists = projectGraph.GetTargetLists(new List<string> {"A"});
970970

971971
targetLists.Count.ShouldBe(projectGraph.ProjectNodes.Count);
972972
var root = GetFirstNodeWithProjectNumber(projectGraph, 1);
@@ -1138,7 +1138,7 @@ public void GetTargetListsForComplexMultitargetingGraph()
11381138

11391139
projectGraph.ProjectNodes.Count.ShouldBe(12);
11401140

1141-
IReadOnlyDictionary<ProjectGraphNode, ImmutableList<string>> targetLists = projectGraph.GetTargetLists(new List<string>{"A"});
1141+
IReadOnlyDictionary<ProjectGraphNode, ImmutableList<string>> targetLists = projectGraph.GetTargetLists(new List<string> {"A"});
11421142

11431143
targetLists.Count.ShouldBe(projectGraph.ProjectNodes.Count);
11441144

@@ -1724,7 +1724,7 @@ public void InnerBuildAsRootViaGlobalPropertyShouldNotPropagateInnerBuildPropert
17241724
var root = CreateProjectFile(env: _env, projectNumber: 1, projectReferences: new[] {2}, projectReferenceTargets: null, defaultTargets: null, extraContent: MultitargetingSpecificationPropertyGroup).Path;
17251725
CreateProjectFile(env: _env, projectNumber: 2);
17261726

1727-
var graph = new ProjectGraph(root, new Dictionary<string, string>{{InnerBuildPropertyName, "foo"}});
1727+
var graph = new ProjectGraph(root, new Dictionary<string, string> {{InnerBuildPropertyName, "foo"}});
17281728

17291729
var dot = graph.ToDot();
17301730

@@ -1789,13 +1789,13 @@ public void InnerBuildsCanHaveSeparateReferences()
17891789

17901790
innerBuildWithCommonReferences.ProjectReferences.Count.ShouldBe(4);
17911791
var referenceNumbersSet = innerBuildWithCommonReferences.ProjectReferences.Select(r => Path.GetFileNameWithoutExtension(r.ProjectInstance.FullPath)).ToHashSet();
1792-
referenceNumbersSet.ShouldBeSameIgnoringOrder(new HashSet<string>{"2", "3"});
1792+
referenceNumbersSet.ShouldBeSameIgnoringOrder(new HashSet<string> {"2", "3"});
17931793

17941794
var innerBuildWithAdditionalReferences = GetNodesWithProjectNumber(graph, 1).First(n => n.ProjectInstance.GlobalProperties.TryGetValue(InnerBuildPropertyName, out string p) && p == "b");
17951795

17961796
innerBuildWithAdditionalReferences.ProjectReferences.Count.ShouldBe(8);
17971797
referenceNumbersSet = innerBuildWithAdditionalReferences.ProjectReferences.Select(r => Path.GetFileNameWithoutExtension(r.ProjectInstance.FullPath)).ToHashSet();
1798-
referenceNumbersSet.ShouldBeSameIgnoringOrder(new HashSet<string>{"2", "3", "4", "5"});
1798+
referenceNumbersSet.ShouldBeSameIgnoringOrder(new HashSet<string> {"2", "3", "4", "5"});
17991799
}
18001800

18011801
[Fact]
@@ -1805,7 +1805,7 @@ public void InnerBuildProducedByOuterBuildCanBeReferencedByAnotherNode()
18051805
<ProjectReference Include='1.proj' Properties='{InnerBuildPropertyName}=a'/>
18061806
</ItemGroup>";
18071807

1808-
var additionalGlobalProperties = new Dictionary<string, string>{{"x", "y"}};
1808+
var additionalGlobalProperties = new Dictionary<string, string> {{"x", "y"}};
18091809

18101810
var graph = new ProjectGraph(new []
18111811
{
@@ -1844,7 +1844,7 @@ public void StandaloneInnerBuildsCanBeReferencedWithoutOuterBuilds()
18441844
CreateProjectFile(env: _env, projectNumber: 2, projectReferences: new []{3}, projectReferenceTargets: null, defaultTargets: null, extraContent: MultitargetingSpecificationPropertyGroup + $"<PropertyGroup><{InnerBuildPropertyName}>a</{InnerBuildPropertyName}></PropertyGroup>");
18451845
CreateProjectFile(env: _env, projectNumber: 3);
18461846

1847-
var additionalGlobalProperties = new Dictionary<string, string>{{"x", "y"}};
1847+
var additionalGlobalProperties = new Dictionary<string, string> {{"x", "y"}};
18481848

18491849
var graph = new ProjectGraph(root, additionalGlobalProperties);
18501850

@@ -1871,7 +1871,7 @@ public void InnerBuildsProducedByOuterBuildsCanBeReferencedByOtherInnerBuilds()
18711871
<ProjectReference Include='2.proj' Condition=`'$({InnerBuildPropertyName})' == 'a'` Properties='{InnerBuildPropertyName}=a'/>
18721872
</ItemGroup>".Cleanup();
18731873

1874-
var additionalGlobalProperties = new Dictionary<string, string>{{"x", "y"}};
1874+
var additionalGlobalProperties = new Dictionary<string, string> {{"x", "y"}};
18751875

18761876
var root = CreateProjectFile(
18771877
env: _env,

src/MSBuild.UnitTests/CommandLineSwitches_Tests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ public void GraphBuildSwitchCanHaveParameters()
548548
{
549549
CommandLineSwitches switches = new CommandLineSwitches();
550550

551-
MSBuildApp.GatherCommandLineSwitches(new List<string>{ "/graph", "/graph:true; NoBuild ;; ;", "/graph:foo"}, switches);
551+
MSBuildApp.GatherCommandLineSwitches(new List<string> { "/graph", "/graph:true; NoBuild ;; ;", "/graph:foo"}, switches);
552552

553553
switches[CommandLineSwitches.ParameterizedSwitch.GraphBuild].ShouldBe(new[] {"true", " NoBuild ", " ", "foo"});
554554

@@ -560,7 +560,7 @@ public void GraphBuildSwitchCanBeParameterless()
560560
{
561561
CommandLineSwitches switches = new CommandLineSwitches();
562562

563-
MSBuildApp.GatherCommandLineSwitches(new List<string>{ "/graph" }, switches);
563+
MSBuildApp.GatherCommandLineSwitches(new List<string> { "/graph" }, switches);
564564

565565
switches[CommandLineSwitches.ParameterizedSwitch.GraphBuild].ShouldBe(new string[0]);
566566

src/Shared/UnitTests/FileMatcher_Tests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1360,11 +1360,11 @@ public void FileEnumerationCacheTakesExcludesIntoAccount()
13601360
Array.Sort(files);
13611361
Assert.Equal(new []{"a.cs", "b.cs", "c.cs"}, files);
13621362

1363-
files = FileMatcher.Default.GetFiles(testProject.TestRoot, "**/*.cs", new List<string>{"a.cs"});
1363+
files = FileMatcher.Default.GetFiles(testProject.TestRoot, "**/*.cs", new List<string> {"a.cs"});
13641364
Array.Sort(files);
13651365
Assert.Equal(new[] {"b.cs", "c.cs" }, files);
13661366

1367-
files = FileMatcher.Default.GetFiles(testProject.TestRoot, "**/*.cs", new List<string>{"a.cs", "c.cs"});
1367+
files = FileMatcher.Default.GetFiles(testProject.TestRoot, "**/*.cs", new List<string> {"a.cs", "c.cs"});
13681368
Array.Sort(files);
13691369
Assert.Equal(new[] {"b.cs" }, files);
13701370
}

0 commit comments

Comments
 (0)