dotnet / dotnet/sdk

.NET 11 Preview 2 breaking change: AnalysisLevel now affects CodeStyle (IDExxxx) analyzers

Open
#53,409 1 comment 2 reactions 0 assignees View on GitHub
Area-Microsoft.CodeAnalysis.NetAnalyzers Priority:0
Dominant language
C#
Stars
3.2k
Forks
1.3k
PR merge metrics
PR metrics pending

Description

In Preview 1, AnalysisLevel didn't seem to have an effect on IDExxxx analyzers. In Preview 2, it does.

The reason is in `AddGlobalAnalyzerConfigForPackage_MicrosoftCodeAnalysisCSharpCodeStyle`, there is this condition to add the globalconfig:

```



```

The relevant part of the condition is `EffectiveAnalysisLevelStyle >= 11`. This is now the case in .NET 11.

Note that the documentation of AnalysisLevel is only mentioned under NetAnalyzers (Code Quality analyzers) (CAxxxx), and it doesn't mention that it has any effect on CodeStyle (IDExxxx) analyzers.

Also, is it documented somewhere what IDExxxx analyzers are enabled in `default`, `minimum`, and `recommended` analysis modes? For example, IDE0004 is not enabled in `recommended`, but IDE0005 is. Is that documented somewhere without digging into the globalconfigs inside the SDK installation?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.