Skip to content

Commit 460a0e5

Browse files
authored
Merge pull request #6380 from mavasani/UpgradeNetAnalyzers
Move to latest .NET8 pre-release version of NetAnalyzers package for dogfooding
2 parents 4437e7b + cd01f06 commit 460a0e5

File tree

73 files changed

+208
-118
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+208
-118
lines changed

.editorconfig

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ dotnet_style_allow_statement_immediately_after_block_experimental = false
257257
# IDE2004: Blank line not allowed after constructor initializer colon
258258
csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = false
259259

260-
### Configuration for FxCop analyzers executed on this repo ###
260+
### Configuration for .Net analyzers executed on this repo ###
261261
[*.{cs,vb}]
262262

263263
# Default analyzed API surface = 'all' (public APIs + non-public APIs)
@@ -293,6 +293,12 @@ dotnet_diagnostic.CA1711.severity = suggestion
293293
# CA1309: Use ordinal string comparison
294294
dotnet_diagnostic.CA1309.severity = suggestion
295295

296+
# CA1305: Pass IFormatProvider - https://github.com/dotnet/roslyn-analyzers/issues/6379
297+
dotnet_diagnostic.CA1305.severity = suggestion
298+
299+
# CA1851: Possible multiple enumerations of 'IEnumerable' collection - https://github.com/dotnet/roslyn-analyzers/issues/6379
300+
dotnet_diagnostic.CA1851.severity = suggestion
301+
296302
### Configuration for PublicAPI analyzers executed on this repo ###
297303
[*.{cs,vb}]
298304

NuGet.config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<clear />
66
<add key="dotnet5" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json" />
77
<add key="dotnet7" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet7/nuget/v3/index.json" />
8+
<add key="dotnet8" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet8/nuget/v3/index.json" />
89
<add key="dotnet-eng" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json" />
910
<add key="dotnet-tools" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json" />
1011
<add key="dotnet-public" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public/nuget/v3/index.json" />

eng/Versions.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
<MicrosoftCodeAnalysisForRoslynDiagnosticsAnalyzersVersion>3.7.0</MicrosoftCodeAnalysisForRoslynDiagnosticsAnalyzersVersion>
4848
<MicrosoftCodeAnalysisVersionForTests>4.4.0-2.22416.9</MicrosoftCodeAnalysisVersionForTests>
4949
<DogfoodAnalyzersVersion>3.3.4-beta1.22418.3</DogfoodAnalyzersVersion>
50-
<DogfoodNetAnalyzersVersion>7.0.0</DogfoodNetAnalyzersVersion>
50+
<DogfoodNetAnalyzersVersion>8.0.0-preview1.22621.6</DogfoodNetAnalyzersVersion>
5151
<MicrosoftCodeAnalysisBannedApiAnalyzersVersion>$(DogfoodAnalyzersVersion)</MicrosoftCodeAnalysisBannedApiAnalyzersVersion>
5252
<MicrosoftCodeAnalysisAnalyzersVersion>$(DogfoodAnalyzersVersion)</MicrosoftCodeAnalysisAnalyzersVersion>
5353
<MicrosoftCodeAnalysisPerformanceSensitiveAnalyzersVersion>3.3.3-beta1.21126.3</MicrosoftCodeAnalysisPerformanceSensitiveAnalyzersVersion>

src/Microsoft.CodeAnalysis.Analyzers/UnitTests/UpgradeMSBuildWorkspaceAnalyzerTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ private static DiagnosticResult GetBasicExpectedDiagnostic(int line, int column)
120120
#pragma warning restore RS0030 // Do not use banned APIs
121121

122122
[SuppressMessage("Performance", "CA1812:Avoid uninstantiated internal classes", Justification = "Used via new() constraint: https://github.com/dotnet/roslyn-analyzers/issues/3199")]
123-
internal class TestCSharpUpgradeMSBuildWorkspaceAnalyzer : CSharpUpgradeMSBuildWorkspaceAnalyzer
123+
internal sealed class TestCSharpUpgradeMSBuildWorkspaceAnalyzer : CSharpUpgradeMSBuildWorkspaceAnalyzer
124124
{
125125
public TestCSharpUpgradeMSBuildWorkspaceAnalyzer()
126126
: base(performAssemblyChecks: false)
@@ -129,7 +129,7 @@ public TestCSharpUpgradeMSBuildWorkspaceAnalyzer()
129129
}
130130

131131
[SuppressMessage("Performance", "CA1812:Avoid uninstantiated internal classes", Justification = "Used via new() constraint: https://github.com/dotnet/roslyn-analyzers/issues/3199")]
132-
internal class TestVisualBasicUpgradeMSBuildWorkspaceAnalyzer : VisualBasicUpgradeMSBuildWorkspaceAnalyzer
132+
internal sealed class TestVisualBasicUpgradeMSBuildWorkspaceAnalyzer : VisualBasicUpgradeMSBuildWorkspaceAnalyzer
133133
{
134134
public TestVisualBasicUpgradeMSBuildWorkspaceAnalyzer()
135135
: base(performAssemblyChecks: false)

src/NetAnalyzers/CSharp/Microsoft.CodeQuality.Analyzers/QualityGuidelines/CSharpAvoidMultipleEnumerationsAnalyzer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis.CSharp.NetAnalyzers.Microsoft.CodeQuality.Analy
99
[DiagnosticAnalyzer(LanguageNames.CSharp)]
1010
internal sealed partial class CSharpAvoidMultipleEnumerationsAnalyzer : AvoidMultipleEnumerations
1111
{
12-
protected override bool IsExpressionOfForEachStatement(SyntaxNode node)
13-
=> node.Parent is ForEachStatementSyntax forEachStatementSyntax && forEachStatementSyntax.Expression.Equals(node);
12+
protected override bool IsExpressionOfForEachStatement(SyntaxNode syntax)
13+
=> syntax.Parent is ForEachStatementSyntax forEachStatementSyntax && forEachStatementSyntax.Expression.Equals(syntax);
1414
}
1515
}

src/NetAnalyzers/CSharp/Microsoft.NetCore.Analyzers/InteropServices/CSharpDisableRuntimeMarshalling.FixAllProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ protected override async Task<SyntaxNode> FixAllInDocumentAsync(FixAllContext fi
2626
if (document.Project.CompilationOptions is CSharpCompilationOptions { AllowUnsafe: false })
2727
{
2828
// We can't code fix if unsafe code isn't allowed.
29-
return await document.GetSyntaxRootAsync(fixAllContext.CancellationToken);
29+
return await document.GetSyntaxRootAsync(fixAllContext.CancellationToken).ConfigureAwait(false);
3030
}
3131

3232
var editor = await DocumentEditor.CreateAsync(document, fixAllContext.CancellationToken).ConfigureAwait(false);

src/NetAnalyzers/CSharp/Microsoft.NetCore.Analyzers/Performance/CSharpConstantExpectedAnalyzer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ private sealed class CSharpDiagnosticHelper : DiagnosticHelper
4444
private readonly IdentifierNameSyntax _constantExpectedMinIdentifier = (IdentifierNameSyntax)SyntaxFactory.ParseName(ConstantExpectedMin);
4545
private readonly IdentifierNameSyntax _constantExpectedMaxIdentifier = (IdentifierNameSyntax)SyntaxFactory.ParseName(ConstantExpectedMax);
4646

47-
public override Location? GetMaxLocation(SyntaxNode attributeNode) => GetArgumentLocation(attributeNode, _constantExpectedMaxIdentifier);
47+
public override Location? GetMaxLocation(SyntaxNode attributeSyntax) => GetArgumentLocation(attributeSyntax, _constantExpectedMaxIdentifier);
4848

49-
public override Location? GetMinLocation(SyntaxNode attributeNode) => GetArgumentLocation(attributeNode, _constantExpectedMinIdentifier);
49+
public override Location? GetMinLocation(SyntaxNode attributeSyntax) => GetArgumentLocation(attributeSyntax, _constantExpectedMinIdentifier);
5050

5151
private static Location? GetArgumentLocation(SyntaxNode attributeNode, IdentifierNameSyntax targetNameSyntax)
5252
{

src/NetAnalyzers/CSharp/Microsoft.NetCore.Analyzers/Runtime/CSharpDetectPreviewFeatureAnalyzer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ private static bool TryGetPreviewInterfaceNodeForTypeImplementingPreviewInterfac
286286
private static bool IsIdentifierNameSyntax(TypeSyntax identifier, ISymbol previewInterfaceSymbol) => identifier is IdentifierNameSyntax identifierName && IsSyntaxToken(identifierName.Identifier, previewInterfaceSymbol) ||
287287
identifier is NullableTypeSyntax nullable && IsIdentifierNameSyntax(nullable.ElementType, previewInterfaceSymbol);
288288

289-
protected override SyntaxNode? GetPreviewImplementsClauseSyntaxNodeForMethodOrProperty(ISymbol methodSymbol, ISymbol previewSymbol)
289+
protected override SyntaxNode? GetPreviewImplementsClauseSyntaxNodeForMethodOrProperty(ISymbol methodOrPropertySymbol, ISymbol previewSymbol)
290290
{
291291
throw new System.NotImplementedException();
292292
}

src/NetAnalyzers/CSharp/Microsoft.NetCore.Analyzers/Runtime/CSharpSpecifyCultureForToLowerAndToUpper.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ namespace Microsoft.NetCore.CSharp.Analyzers.Runtime
1212
[DiagnosticAnalyzer(LanguageNames.CSharp)]
1313
public class CSharpSpecifyCultureForToLowerAndToUpperAnalyzer : SpecifyCultureForToLowerAndToUpperAnalyzer
1414
{
15-
protected override Location GetMethodNameLocation(SyntaxNode invocationNode)
15+
protected override Location GetMethodNameLocation(SyntaxNode node)
1616
{
17-
Debug.Assert(invocationNode.IsKind(SyntaxKind.InvocationExpression));
17+
Debug.Assert(node.IsKind(SyntaxKind.InvocationExpression));
1818

19-
var invocation = (InvocationExpressionSyntax)invocationNode;
19+
var invocation = (InvocationExpressionSyntax)node;
2020
if (invocation.Expression is MemberAccessExpressionSyntax memberAccess)
2121
{
2222
return memberAccess.Name.GetLocation();

src/NetAnalyzers/CSharp/Microsoft.NetCore.Analyzers/Usage/CSharpImplementGenericMathInterfacesCorrectly.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ namespace Microsoft.NetCore.CSharp.Analyzers.Usage
1010
[DiagnosticAnalyzer(LanguageNames.CSharp)]
1111
public sealed class CSharpImplementGenericMathInterfacesCorrectly : ImplementGenericMathInterfacesCorrectly
1212
{
13-
protected override SyntaxNode? FindTheTypeArgumentOfTheInterfaceFromTypeDeclaration(ISymbol typeSymbol, ISymbol anInterfaceSymbol)
13+
protected override SyntaxNode? FindTheTypeArgumentOfTheInterfaceFromTypeDeclaration(ISymbol typeSymbol, ISymbol theInterfaceSymbol)
1414
{
1515
foreach (SyntaxReference syntaxReference in typeSymbol.DeclaringSyntaxReferences)
1616
{
1717
SyntaxNode typeDefinition = syntaxReference.GetSyntax();
1818
if (typeDefinition is BaseTypeDeclarationSyntax baseType &&
19-
FindTypeArgumentFromBaseInterfaceList(baseType.BaseList.Types, anInterfaceSymbol) is { } node)
19+
FindTypeArgumentFromBaseInterfaceList(baseType.BaseList.Types, theInterfaceSymbol) is { } node)
2020
{
2121
return node;
2222
}

0 commit comments

Comments
 (0)