chore(stylecop): add StyleCop.Analyzers with curated ruleset - #159
Merged
Conversation
DeepDiver1975
force-pushed
the
chore/stylecop-analyzers
branch
from
August 31, 2026 07:20
9cb8cfe to
0c8fe7f
Compare
Adds StyleCop.Analyzers 1.2.0-beta.556 as a solution-wide analyzer via Directory.Build.props, with a stylecop.json and .editorconfig severity overrides curated to fit this codebase: - SA1101/SA1309: disabled — the codebase already uses _camelCase private fields without a `this.` prefix. - SA1600-SA1648 (documentation-required family): disabled — XML docs are optional here (CS1591 is already suppressed). - SA1201/SA1202/SA1204 (member ordering by kind/access/static): disabled — no code-fix support exists, and the codebase organizes members by domain/lifecycle grouping rather than kind or access level. - SA1402 (one type per file): disabled — several files deliberately group a closed set of small related record types (SyncCommand.cs, IncidentSnapshot.cs, MasterDataSet.cs, ...). - SA1312: disabled — its walker doesn't recognize `using var _ = ...` as the discard idiom it is; the test suite uses this pattern throughout. orderingRules.usingDirectivesPlacement is set to outsideNamespace to match the file-scoped namespaces already enforced in this repo. Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com>
DeepDiver1975
force-pushed
the
chore/stylecop-analyzers
branch
from
August 31, 2026 08:20
0c8fe7f to
0cc0cbf
Compare
Mechanical fixes across the whole solution to satisfy the newly-enabled curated ruleset: - Parameter/argument lists reformatted to either one line or one parameter per line (SA1117), and multi-line non-lambda arguments extracted to local variables (SA1118). - Files with a mismatched first type reordered so the type matching the filename comes first (SA1649); a few genuine grab-bags of small, unrelated test doubles instead get a scoped `#pragma warning disable SA1649` with a comment, matching the SA1402 rationale. - Incident.cs's AuditEvent record split into its own file. - A tuple-element casing fix (SA1316) and a couple of raw-SQL literals extracted to local consts to satisfy SA1118. No behavior changes — the full test suite (802 tests) still passes. Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com>
DeepDiver1975
force-pushed
the
chore/stylecop-analyzers
branch
from
August 31, 2026 10:12
0cc0cbf to
dedb3c5
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
StyleCop.Analyzers(1.2.0-beta.556) solution-wide viaDirectory.Build.props, enforced through the existingTreatWarningsAsErrors.chore(stylecop): ...for the full list of disabled rules and why (underscore-prefixed private fields, optional XML docs, member-kind/access ordering with no code-fix support, deliberately-grouped multi-type files, and theusing var _ = ...discard idiom).src/andtests/) into compliance: mostly mechanical parameter-list reformatting (SA1117/SA1118), a handful of file reorders/renames so the first type matches the filename (SA1649), one type extraction (AuditEventinto its own file), and a tuple-casing fix.Independent of
chore/code-qualityper earlier discussion — starts fresh frommainrather than building on that branch's in-progress work.Test plan
dotnet build LageBuch.sln --configuration Release— clean, zero StyleCop diagnostics (the only remaining failure is a pre-existing, unrelated local environment gap: the Android SDK/JDK aren't installed in this sandbox, soLageBuch.App.Android's APK packaging step fails — C# compilation for that project succeeds cleanly)dotnet test LageBuch.sln --configuration Release— all 802 tests pass, 1 pre-existing skipubuntu-latestandwindows-latestlegs (please checkgh pr checksonce CI runs — a clean local Linux build isn't proof of the Windows leg)🤖 Generated with Claude Code
https://claude.ai/code/session_01UwN31QccH98YV9eEc2bue2