Skip to content

Template .editorconfig contradicts CODESTYLE by relaxing all analyzers repo-wide #353

Description

@ptr727

The template's root .editorconfig carries a repo-wide analyzer relaxation that CODESTYLE.md explicitly names as forbidden. Because it ships in the template, every derived repo inherits it.

The contradiction

.editorconfig line 86:

dotnet_analyzer_diagnostic.severity = suggestion

CODESTYLE.md line 243:

Repo-wide: a dotnet_diagnostic.<RULE>.severity entry in the root .editorconfig, only when the rule is genuinely not applicable to any project. Relaxing a batch of CA* rules (or dotnet_analyzer_diagnostic.severity) to push a brownfield port through the build is exactly what this forbids.

The rule names the exact setting sitting three lines below the comment block that cites the rule. The setting also defeats much of AnalysisLevel=latest-all + AnalysisMode=All, which the template sets in Directory.Build.props -- rules are enabled, then demoted to suggestion, so they never fail a build.

Blast radius

Every C# repo checked carries the identical line, inherited from here:

ProjectTemplate, LanguageTags, PlexCleaner, PhotoCleaner, MediaTools, NxWitness, AudioCleaner

Evidence from Utilities

Utilities removed it and probed what it had been hiding (ptr727/Utilities#418). Result:

Rule Sites Project
xUnit1051 29 test project only

Zero findings in the library or the AOT sample project. Re-run with -p:EnforceCodeStyleInBuild=true to confirm IDE analyzers were not silently skipped -- same result. The relaxation was hiding nothing in shipping code, and the one rule it did hide was a true positive worth fixing (async test calls not passing TestContext.Current.CancellationToken, so xUnit v3 could not cancel a stalled network-bound test).

Utilities now builds clean with the line removed and TreatWarningsAsErrors intact: 0 warnings, 183/183 tests passing.

Every other suppression in Utilities was independently probed by removing it and rebuilding, and all proved load-bearing (CA1711, CA1707, CA1515, NoWarn IL3058). The blanket relaxation was the only unjustified one. IDE0055 was inert but is worth keeping as a guard since CSharpier owns formatting -- it just needed a rationale comment.

Caveat

One repo being clean is one data point, not proof the baseline is wrong everywhere. The other six may have real findings behind the line, and a template change would surface them all at once. Suggested sequence:

  1. Run the probe in each derived repo -- delete the line, build with TreatWarningsAsErrors=false, tabulate by rule. Cheap and non-destructive.
  2. If findings are small and genuine (as in Utilities), drop the line from the template and let each repo fix its own.
  3. If some repo has a large brownfield backlog, that repo takes a scoped, commented, project-level suppression -- which is what CODESTYLE prescribes -- rather than the template keeping a blanket one for everyone.

Alternative

If the relaxation is a deliberate fleet decision rather than an oversight, then CODESTYLE.md line 243 should say so and carve out the exception, so the two stop contradicting each other. Either way the current state is inconsistent -- the template violates its own committed standard.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions