Feature request: Allow selective enforcement for EnforceCodeStyleInBuild
- Dominant language
- C#
- Stars
- 3.2k
- Forks
- 1.3k
- PR merge metrics
- PR metrics pending
Description
Problem
`true `currently enables all IDE/code-style diagnostics during build.
In medium and large solutions this causes several issues:
Hundreds of low-value style warnings appear during CI
Hard to incrementally adopt code-style enforcement
"All or nothing" approach
Forces teams to:
either disable EnforceCodeStyleInBuild completely
or manually configure each diagnostic severity in .editorconfig
This makes gradual adoption painful and noisy.
Proposed behavior
Allow specifying specific diagnostics to enforce during build.
Option A — list of diagnostics
`IDE0005;IDE0055;IDE0044`
Meaning:
only these diagnostics run during build
others remain IDE-only
Option B — glob support
`IDE00*;IDE10*`
Option C — separate property
Alternative (more explicit):
`IDE0005;IDE0055`
Why this is useful
I needed to enforce IDE0060 Remove unused parameter 'd' if it is not part of a shipped public API rule
so behavior would be like in GO (Enforcing IDE0060 ensures that unused parameters are not left in method signatures. Like in Go, this prevents hidden or unnecessary dependencies and reduces coupling introduced during refactoring, which improves long-term maintainability.).
I tried to configure like that
in Directory.Build.props
```
true
true
```
in .editorconfig
```
dotnet_analyzer_diagnostic.category-Style.severity = suggestion
dotnet_diagnostic.IDE0060.severity = error
```
But this setting disables all other IDE errros exept IDE0060 during `dotnet format` so I had to revert the changes.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the current EnforceCodeStyleInBuild behavior using Directory.Build.props, .editorconfig, and dotnet format. Compare the proposed list, glob, or separate-property approaches; done means selected diagnostics are enforced during build while other IDE-only diagnostics are not.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- build-system, cli
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100