Skip to content

chore: enforce code style at build, fix Sonar Java and caching, narrow .gitignore - #205

Merged
HandyS11 merged 1 commit into
developfrom
chore/build-hygiene
Nov 11, 2026
Merged

HandyS11 merged 1 commit into
developfrom
chore/build-hygiene

Conversation

@HandyS11

Copy link
Copy Markdown
Owner

Summary

Four build-hygiene fixes.

Code style now fails the build (.editorconfig)

  • 48 code-style options and 21 naming rules raised from suggestion to warning. A suggestion is info-level, so even with EnforceCodeStyleInBuild + TreatWarningsAsErrors it never failed the build.
  • Added dotnet_diagnostic.IDE1006.severity = warning. Without it, the build ignores naming-rule severities: a probe with private int counter was not flagged even at warning. This also starts enforcing the existing async-suffix naming rule.
  • There are no existing violations, so no code changes were needed.

Sonar workflow

What run 43043567906 shows:

  • Java 17 was dead weight. setup-java downloaded Zulu 17, then the scanner ignored it and provisioned its own JRE 21. Java 17 is no longer a supported scanner runtime: SonarQube Cloud dropped it on 2026-07-20, and SonarQube Server requires 21 from 2026.4. The setup-java step is removed.
  • The packages cache never saved anything. Its path was ${{ runner.temp }}\cache, which nothing writes to, so every run logged Path Validation Error … no cache is being saved. It now caches ~\.sonar\cache, where the scanner keeps its JRE, engine and plugins.
  • The scanner cache key never changed. It hit on every run, so the install step never ran again and the scanner was stuck on 12.0 (12.1.0 is out). The scanner is now pinned in .config/dotnet-tools.json and restored each run. Dependabot's NuGet updater discovers only that path, not the root dotnet-tools.json the .NET 10 SDK creates by default. The JRE/plugin cache key hashes the manifest, so each scanner bump starts a fresh cache. There are no restore-keys, so stale plugins aren't carried forward.

.gitignore

  • Removed the UTF-8 BOM.
  • The DocFX block ignored *.html, *.pdf, *.zip, *.manifest (and more) anywhere in the repo, plus any api/ folder. It is now scoped to /docfx/_site/ and /docfx/api/. *.log, *.tmp and *.cache are still covered by the template entries.
  • The list of ignored files in a built working tree is identical before and after.

samples/ no longer marked as generated code

  • [**/samples/*/**.cs] never matched the repo-root samples/ folder, because Roslyn needs at least one directory before **/samples. The section had no effect.
  • With a glob that does match, it would have silently turned off nullable analysis (CS8600/CS8602 disappear).
  • Analyzers are already disabled for samples by samples/Directory.Build.props.

Test plan

  • Solution builds clean in Debug and Release (no-incremental)
  • Format verification (--verify-no-changes) passes
  • Tests: 1181 passed, 31 skipped (AOT smoke tests, env-gated)
  • Samples solution builds with 0 warnings
  • A probe file confirms IDE0161, IDE0007 and IDE1006 now fail the build
  • Dispatch the SonarQube workflow on this branch. Check that scanner 12.1 is restored, the path-validation warning is gone and a cache is saved. A second run should reuse the cached JRE.

🤖 Generated with Claude Code

…w .gitignore

- Raise code-style and naming rule severities from suggestion to warning, and
  configure IDE1006 so naming rules are enforced at build at all.
- Sonar: drop the unused JDK 17 step (the scanner provisions JRE 21 itself),
  cache the scanner's real user cache, pin the scanner in
  .config/dotnet-tools.json and key the cache on that manifest.
- .gitignore: remove the UTF-8 BOM and scope the DocFX patterns to docfx/.
- Remove the samples generated_code section, which never matched samples/.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@HandyS11
HandyS11 merged commit d5371e9 into develop Nov 11, 2026
7 checks passed
@HandyS11
HandyS11 deleted the chore/build-hygiene branch November 11, 2026 18:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant