Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Roslyn.Diagnostics.Analyzers and remove RS0005 suppressions #60556

Merged
merged 1 commit into from
Apr 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -245,10 +245,6 @@ csharp_preserve_single_line_statements = true
# https://github.com/dotnet/roslyn/pull/54259 has been published.
dotnet_style_allow_statement_immediately_after_block_experimental = false

[src/CodeStyle/**.{cs,vb}]
# warning RS0005: Do not use generic CodeAction.Create to create CodeAction
dotnet_diagnostic.RS0005.severity = none

[src/{Analyzers,CodeStyle,Features,Workspaces,EditorFeatures,VisualStudio}/**/*.{cs,vb}]

# IDE0011: Add braces
Expand Down
2 changes: 1 addition & 1 deletion eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
</PropertyGroup>
<PropertyGroup>
<!-- Versions used by several individual references below -->
<RoslynDiagnosticsNugetPackageVersion>3.3.4-beta1.22160.2</RoslynDiagnosticsNugetPackageVersion>
<RoslynDiagnosticsNugetPackageVersion>3.3.4-beta1.22204.1</RoslynDiagnosticsNugetPackageVersion>
<MicrosoftCodeAnalysisNetAnalyzersVersion>6.0.0-rc1.21366.2</MicrosoftCodeAnalysisNetAnalyzersVersion>
<MicrosoftCodeAnalysisTestingVersion>1.1.2-beta1.22122.4</MicrosoftCodeAnalysisTestingVersion>
<MicrosoftVisualStudioExtensibilityTestingVersion>0.1.132-beta</MicrosoftVisualStudioExtensibilityTestingVersion>
Expand Down
2 changes: 0 additions & 2 deletions eng/config/globalconfigs/NonShipping.globalconfig
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ dotnet_diagnostic.RS1026.severity = none
dotnet_diagnostic.RS1032.severity = none
# Define diagnostic description correctly
dotnet_diagnostic.RS1033.severity = none
# Do not use generic CodeAction.Create to create CodeAction - not useful for tests
dotnet_diagnostic.RS0005.severity = none
# Do not call 'GetTestAccessor()' from production code: does not apply to tests
dotnet_diagnostic.RS0043.severity = none

Expand Down
2 changes: 0 additions & 2 deletions eng/config/globalconfigs/Shipping.globalconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,5 @@ is_global = true
dotnet_diagnostic.CA1802.severity = warning
dotnet_diagnostic.CA2007.severity = warning

dotnet_diagnostic.RS0005.severity = warning

# CA2016: Forward the 'CancellationToken' parameter to methods
dotnet_diagnostic.CA2016.severity = warning
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,11 @@ public static CodeAction CreateBatchPragmaFix(
FixAllState fixAllState,
CancellationToken cancellationToken)
{
// This is a temporary generated code action, which doesn't need telemetry, hence suppressing RS0005.
#pragma warning disable RS0005 // Do not use generic CodeAction.Create to create CodeAction
return CodeAction.Create(
((CodeAction)pragmaActions[0]).Title,
createChangedDocument: ct =>
BatchPragmaFixesAsync(suppressionFixProvider, document, pragmaActions, pragmaDiagnostics, cancellationToken),
equivalenceKey: fixAllState.CodeActionEquivalenceKey);
#pragma warning restore RS0005 // Do not use generic CodeAction.Create to create CodeAction
}

private static async Task<Document> BatchPragmaFixesAsync(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,10 @@ public override async Task<CodeAction> TryGetMergedFixAsync(
currentSolution = currentSolution.WithDocumentSyntaxRoot(document.Id, newRoot);
}

// This is a temporary generated code action, which doesn't need telemetry, hence suppressing RS0005.
#pragma warning disable RS0005 // Do not use generic CodeAction.Create to create CodeAction
var batchAttributeRemoveFix = CodeAction.Create(
attributeRemoveFixes.First().Title,
createChangedSolution: ct => Task.FromResult(currentSolution),
equivalenceKey: fixAllState.CodeActionEquivalenceKey);
#pragma warning restore RS0005 // Do not use generic CodeAction.Create to create CodeAction

newBatchOfFixes.Insert(0, (diagnostic: null, batchAttributeRemoveFix));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,8 @@ internal static class DefaultFixAllProviderHelpers
if (solution == null)
return null;

#pragma warning disable RS0005 // Do not use generic 'CodeAction.Create' to create 'CodeAction'

return CodeAction.Create(
title, c => Task.FromResult(solution));

#pragma warning disable RS0005 // Do not use generic 'CodeAction.Create' to create 'CodeAction'
}

private static Task<Solution?> GetDocumentFixesAsync(FixAllContext fixAllContext, FixAllContexts fixAllContextsAsync)
Expand Down