Skip to content

Commit c24f141

Browse files
authored
Merge pull request #3191 from sharwell/update-test-library
Update to Microsoft.CodeAnalysis.Testing 1.0.1-beta1.20453.7
2 parents 22df09d + 0d96701 commit c24f141

7 files changed

Lines changed: 22 additions & 15 deletions

File tree

NuGet.config

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
<packageSources>
44
<clear />
55
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
6-
<add key="roslyn" value="https://dotnet.myget.org/F/roslyn/api/v3/index.json" />
7-
<add key="roslyn-analyzers" value="https://dotnet.myget.org/F/roslyn-analyzers/api/v3/index.json" />
6+
<add key="dotnet-tools" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json" />
87

98
<!-- Uncomment this to test unpublished builds from the AppVeyor feed. -->
109
<!--<add key="appveyor-stylecop" value="https://ci.appveyor.com/nuget/stylecopanalyzers" />-->

StyleCop.Analyzers/Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
<PackageReference Include="DotNetAnalyzers.DocumentationAnalyzers" Version="1.0.0-beta.46" PrivateAssets="all" />
4848
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.66" PrivateAssets="all" />
4949
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.0" PrivateAssets="all" />
50-
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.CodeStyle" Version="3.6.0-4.20251.5" PrivateAssets="all" />
50+
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.CodeStyle" Version="3.7.0-6.20427.1" PrivateAssets="all" />
5151
</ItemGroup>
5252

5353
<!-- Public API -->

StyleCop.Analyzers/StyleCop.Analyzers.Test/OrderingRules/SA1206CodeFixProviderUnitTests.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ public async Task VerifyKeywordReorderingInMethodDeclarationAsync()
116116
DiagnosticResult[] expected =
117117
{
118118
Diagnostic().WithLocation(1, 38).WithArguments("static", "new"),
119-
Diagnostic().WithLocation(1, 45).WithArguments("public", "static"),
120119
Diagnostic().WithLocation(1, 45).WithArguments("public", "new"),
121120
};
122121
await VerifyCSharpFixAsync(testCode, expected, fixedTestCode, CancellationToken.None).ConfigureAwait(false);

StyleCop.Analyzers/StyleCop.Analyzers.Test/OrderingRules/SA1206UnitTests.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ public async Task TestKeywordsWithExpressionBodiedMemberAndAsyncKeywordAsync()
4040
DiagnosticResult[] expected = new[]
4141
{
4242
Diagnostic().WithLocation(3, 11).WithArguments("static", "async"),
43-
Diagnostic().WithLocation(3, 18).WithArguments("public", "static"),
4443
Diagnostic().WithLocation(3, 18).WithArguments("public", "async"),
4544
};
4645

@@ -75,7 +74,6 @@ static public void ThirdMethod() {}
7574
Diagnostic().WithLocation(7, 32).WithArguments("protected", "async"),
7675
Diagnostic().WithLocation(8, 16).WithArguments("static", "new"),
7776
Diagnostic().WithLocation(9, 9).WithArguments("static", "new"),
78-
Diagnostic().WithLocation(9, 16).WithArguments("public", "static"),
7977
Diagnostic().WithLocation(9, 16).WithArguments("public", "new"),
8078
Diagnostic().WithLocation(10, 13).WithArguments("public", "virtual"),
8179
Diagnostic().WithLocation(11, 12).WithArguments("public", "extern"),
@@ -160,7 +158,6 @@ public async Task TestKeywordsWithOperatorDeclarationsAsync()
160158
Diagnostic().WithLocation(3, 12).WithArguments("public", "extern"),
161159
Diagnostic().WithLocation(3, 19).WithArguments("static", "extern"),
162160
Diagnostic().WithLocation(4, 12).WithArguments("static", "extern"),
163-
Diagnostic().WithLocation(4, 19).WithArguments("public", "static"),
164161
Diagnostic().WithLocation(4, 19).WithArguments("public", "extern"),
165162
Diagnostic().WithLocation(5, 19).WithArguments("static", "extern"),
166163
};

StyleCop.Analyzers/StyleCop.Analyzers.Test/StyleCop.Analyzers.Test.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818

1919
<ItemGroup>
2020
<PackageReference Include="Microsoft.CodeAnalysis" Version="1.3.2" />
21-
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.CodeFix.Testing.XUnit" Version="1.0.1-beta1.20214.2" />
22-
<PackageReference Include="Microsoft.VisualStudio.Composition" Version="15.6.36" />
21+
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.CodeFix.Testing.XUnit" Version="1.0.1-beta1.20453.7" />
22+
<PackageReference Include="Microsoft.VisualStudio.Composition" Version="16.1.8" />
2323
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
2424
<PackageReference Include="xunit" Version="2.4.1" />
2525
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" PrivateAssets="all" />

StyleCop.Analyzers/StyleCop.Analyzers/OrderingRules/SA1206DeclarationKeywordsMustFollowOrder.cs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,26 @@ private static void CheckModifiersOrderAndReportDiagnostics(SyntaxNodeAnalysisCo
9595
{
9696
var currentModifierType = GetModifierType(modifier);
9797

98+
bool reportPreviousModifier = false;
99+
bool reportPreviousOtherModifier = false;
98100
if (CompareModifiersType(currentModifierType, previousModifierType) < 0)
99101
{
100-
context.ReportDiagnostic(Diagnostic.Create(Descriptor, modifier.GetLocation(), modifier.ValueText, previousModifier.ValueText));
102+
reportPreviousModifier = true;
101103
}
102104

103105
if (AccessOrStaticModifierNotFollowingOtherModifier(currentModifierType, previousModifierType) && otherModifiersAppearEarlier)
104106
{
105-
context.ReportDiagnostic(Diagnostic.Create(Descriptor, modifier.GetLocation(), modifier.ValueText, previousOtherModifier.ValueText));
107+
reportPreviousOtherModifier = true;
108+
}
109+
110+
if (reportPreviousModifier || reportPreviousOtherModifier)
111+
{
112+
// Note: Only report one diagnostic per modifier. If both diagnostics apply, report the diagnostic
113+
// relative to the earlier modifier.
114+
var reportedModifier = reportPreviousModifier && (!reportPreviousOtherModifier || previousModifier.SpanStart < previousOtherModifier.SpanStart)
115+
? previousModifier.ValueText
116+
: previousOtherModifier.ValueText;
117+
context.ReportDiagnostic(Diagnostic.Create(Descriptor, modifier.GetLocation(), modifier.ValueText, reportedModifier));
106118
}
107119

108120
if (!otherModifiersAppearEarlier && currentModifierType == ModifierType.Other)

StyleCop.Analyzers/StyleCopTester/StyleCopTester.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@
2424

2525
<ItemGroup>
2626
<PackageReference Include="Microsoft.Build.Locator" Version="1.2.2" />
27-
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version=" 2.9.0-beta4-62830-01" />
28-
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version=" 2.9.0-beta4-62830-01" />
29-
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version=" 2.9.0-beta4-62830-01" />
30-
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version=" 2.9.0-beta4-62830-01" />
27+
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="2.9.0" />
28+
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="2.9.0" />
29+
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="2.9.0" />
30+
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="2.9.0" />
3131
</ItemGroup>
3232

3333
<ItemGroup>

0 commit comments

Comments
 (0)