dotnet / dotnet/roslyn

Skip analyzers on command line when their diagnostics would not be visible in the build

Open
#81,031 0 comments 1 reaction 2 assignees Claimed by @RikkiGibson View on GitHub
Area-Analyzers
Dominant language
C#
Stars
20.7k
Forks
4.3k
PR merge metrics
PR metrics pending

Description

> We do have the ability to skip analyzers when all their diagnostic IDs are disabled.
>
> When an analyzer throws an exception, we even write out a message like `Suppress the following diagnostics to disable this analyzer: ID1, ID2, ID3, ...`
>
> If there isn't some known reason for running analyzers whose diagnostics have silent/suggestion severity on the command line, it feels reasonable to skip them. Just take the logic which is skipping the analyzers with disabled diagnostics today, and adjust it so that when running on command line, it demands that some diagnostic for it is configured to have warning or greater severity.
>
> Do we not know until they raise diagnostics what their level is?
>
> I believe we know the severity for any diagnostic by ID before any analyzer runs.

_Originally posted by @RikkiGibson in [#81026](https://github.com/dotnet/roslyn/issues/81026#issuecomment-3487806199)_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.