Skip to content

chore: enable EnforceCodeStyleInBuild and bring code to style-green (Standards §1.2.1) - #29

Merged
StuartMeeks merged 3 commits into
mainfrom
chore/enable-enforcecodestyle
Aug 21, 2026
Merged

chore: enable EnforceCodeStyleInBuild and bring code to style-green (Standards §1.2.1)#29
StuartMeeks merged 3 commits into
mainfrom
chore/enable-enforcecodestyle

Conversation

@StuartMeeks

Copy link
Copy Markdown
Owner

NextIteration.Standards §1.2.1 flipped from "blocked" to MUST (standards #16): EnforceCodeStyleInBuild must be true, set in Directory.Build.props (now in the canonical template). It runs the IDE analyzers in-build so the canonical .editorconfig (adopted in #27) actually gates the house style instead of merely documenting it.

What's here

  • EnforceCodeStyleInBuild=true in Directory.Build.props (matches template; §1.2/§1.2.1).
  • Mechanical, behavior-preserving reformat to go green under the flag, via dotnet format:
    • IDE0011 — braces on all single-statement ifs (estate house style is braces-always; this code used brace-less guards)
    • IDE0160 — file-scoped → block-scoped namespaces (the interop layer and every test file were file-scoped, so those files re-indent wholesale — that's the bulk of the diff)
    • minor: expression-body / accessibility / collection-expression / using-placement fixes
  • IDE0005 suppressed in the test project only — see below.

Note on the diff size: almost all of it is the IDE0160 namespace re-indent (whole-file indentation shift) plus added braces. No logic changed.

⚠️ Standards decision baked in (needs a follow-up in the standards repo)

Enabling the flag makes the editorconfig's IDE0005=warning gate at build, but IDE0005 requires GenerateDocumentationFile, which §2.7 mandates false for test projects → Roslyn hard-errors demanding the doc file. The test project has zero actual unused usings; it's a pure config conflict. Resolved by adding IDE0005 to the test project's NoWarn (agreed approach: amend §2.7 estate-wide). STANDARD.md §2.7 needs the matching amendment so this is conformance, not a per-repo deviation.

Tooling note

dotnet format writes literal merge-conflict markers into multi-targeted projects (it can't reconcile the net8 and net10 passes). Worked around by formatting against a single TFM (there are no #if regions, so the fixes are identical across TFMs).

Verification

Clean Release build with the flag on (0 warnings); 334/334 tests pass on net8.0 + net10.0.

🤖 Generated with Claude Code

…Standards §1.2.1)

NextIteration.Standards §1.2.1 flipped from "blocked" to MUST: EnforceCodeStyleInBuild
must be true, set in Directory.Build.props (matches the revised template). It runs the
IDE analyzers in-build so the canonical .editorconfig actually gates the house style.

Bringing the code green under the flag is mechanical, behavior-preserving reformat work,
applied with `dotnet format` (run against a single TFM to avoid dotnet format's
multi-target conflict-marker bug):
- IDE0011: braces on all single-statement ifs (estate house style is braces-always)
- IDE0160: file-scoped -> block-scoped namespaces (interop layer + all test files)
- minor: expression-body/accessibility/collection-expression/using-placement fixes

IDE0005 is suppressed in the TEST project only: it requires GenerateDocumentationFile,
which §2.7 mandates false for test projects, so gating it there hard-errors ("set
GenerateDocumentationFile=true to enable IDE0005"). It still gates the shipping project.
This is a newly-surfaced consequence of the §1.2.1 flag flip; STANDARD.md §2.7 needs the
matching amendment estate-wide (the test project has zero actual unused usings).

Clean Release build (0 warnings, flag on); 334/334 tests pass on net8.0 + net10.0.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

@github-advanced-security github-advanced-security AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CodeQL found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

StuartMeeks and others added 2 commits August 21, 2026 06:20
A comment placed between => and the expression body trips IDE0055 (Fix
formatting) on the Windows Roslyn analyzer, though not on the Linux/macOS legs
or the local build. Move the comments above the member and make the bodies
single-line in AtomicFile.BuildTempPath and one test, eliminating the only two
such constructs in the tree.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ity race

SelectAndGetSelected_RoundTripsDecryptedPayload flaked on macOS:
Assert.True(await SelectCredentialAsync(id)) returned false because the
just-added item wasn't yet visible to SelectCredentialAsync's lookup under
concurrent multi-targeted keychain access — the same add-visibility race
already hardened for the delete and export read-backs. Wrap the four
select-after-add assertions (Keychain + libsecret) with RetryHelper.

Note: AddCredentialCommand does add-then-select in production too, so this is a
latent race in the experimental Keychain/libsecret backends, tracked separately.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Comment thread src/NextIteration.SpectreConsole.Auth/Persistence/Keychain/KeychainInterop.cs Dismissed
Comment thread tests/NextIteration.SpectreConsole.Auth.Tests/Infrastructure/TempDir.cs Dismissed
@StuartMeeks
StuartMeeks merged commit 08e4d18 into main Aug 21, 2026
9 checks passed
@StuartMeeks
StuartMeeks deleted the chore/enable-enforcecodestyle branch August 21, 2026 10:48
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.

2 participants