Skip to content

fix(csharp): align S2178 runtime operand messages - #947

Open
wakemeup0 wants to merge 5 commits into
fix/smoke-csharp-s6610-unicode-literals-20261015from
fix/smoke-csharp-s2178-operand-message-20261015
Open

wakemeup0 wants to merge 5 commits into
fix/smoke-csharp-s6610-unicode-literals-20261015from
fix/smoke-csharp-s2178-operand-message-20261015

Conversation

@wakemeup0

@wakemeup0 wakemeup0 commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fix C# S2178 primary-message wording for the existing Humanizer finding at DateTimeHumanizeAlgorithms.cs:75. Proven runtime Boolean right operands now include the reference extraction advice. Known constants and unsupported expressions retain the existing short message.

Change type and scope

Bug fix limited to C# S2178 message selection and two owned source/test files. The existing detector admission, issue counts, ranges, ordered duplicates, exports, descriptors, profiles, cache keys and quickfix behavior are preserved. Primitive int/bool facts, explicit normal-method declaration witnesses and bounded direct zero-argument bool method calls are private to this rule.

Related issues

Direct user request to fix and publish the real-project smoke findings. This is the independently qualified S2178 message package; no issue closure is requested.

Verification

Independent source and frozen-evidence review approved this exact signed head without actionable findings. The review verified signed source inventories, unchanged committed regression bytes, executed behavioral red/green evidence, complete ordered report comparisons and fresh CLI witnesses. Independent review receipt SHA256: 7c0d8c55d48d844377878c07161ea3380e1d34c9c4927f2f5bc2887564fe36c8. All 21 exact-head hosted checks and dependency-base restoration remain publication gates.

  • Signed tests-only v3 2ab2c26ef911458bcfd890a2efddfb8a26102200 preserves the original production prefix. Genuine unchanged-production unit red: 6 passed/2 failed. Real CLI red: 2 passed/5 failed. Every output format ran before aggregated assertions. The original v1 signed red and lint failure are retained. Final test bytes equal the v3 red checkpoint.
  • Original defect: short_circuit_logic::tests::s2178_humanizer_fourth_declarator_runtime_message and CLI csharp_s2178_cli_complete_controls_lf / csharp_s2178_cli_complete_controls_unicode_crlf. Original Humanizer replay changes exactly one message in each format.
  • Full typed real-reference documents: csharp_s2178_cli_complete_typed_lf and _typed_unicode_crlf pin all target objects and entire all-rule documents. Actual installed SonarAnalyzer.CSharp 10.33 evidence precedes implementation; no new reference/server run was made for this repair.
  • 94 additional native controls x LF/Unicode CRLF cover all six comparisons, both operators, multi-declarator/literal/call/member-initialized locals, writes, optional/@ parameters, negation/calls, constants and unknown/scope/callee refusals. Three extra parser child/owner controls retain incomplete diagnostics. s2178_flattened_params_preserve_unknown_inventory and csharp_s2178_cli_flattened_params_complete_documents preserve three flattened-params contexts. The first implementation failed this review regression before the owner refusal guard; signed v3 genuine base-production red and final green preserve identical tests. csharp_s2178_cli_cache_runtime_unknown_restored_documents verifies same-path/cache runtime-long to const-short to exact restored runtime documents/source. csharp_s2178_cli_preserves_malformed_and_invalid_utf8_documents pins complete error documents and exit2.
  • Executed cargo test --locked --jobs 1 -p hoonarqube-csharp --all-targets --all-features -- --test-threads=2: 1898 passed. Dedicated S2178 CLI target: 7 passed; inherited affected CLI targets: 98 passed. Strict affected all-target/all-feature Clippy, fmt, diff and locked compiler-artifact CLI build passed.
  • All 22 prior complete reports and 4 independently frozen supplemental documents match. Humanizer changes exactly one message per format; the other 20 prior streams are byte-identical. Each typed variant retains 141 total issues/34 S2178/5 descriptors with 18 long/16 short target messages. All 1,113 original source pins are preserved. Twenty-four additional complete control/error/cache/params documents match. Six separately captured same-path/cache documents also match, with source bytes checked before and after every format and phase, and exact runtime document restoration.
  • Pinned released 0.3.1 implicit-default Docker dogfood passed with zero rust:S3776. Final clean signed head c544670f99cceb193dcda152d903ac1881fa87f9 / tree e60b8d56c5ceff5a8f81548bb9f241e3f5e12476; compiler executable and immutable binary bound to that exact source.
  • Local evidence: /Users/wakemeup/.codex/artifacts/hoonarqube-repairs-20261013/csharp-s2178-operand-message (report.md, receipt.json, final-gates-qualified.json, complete-report-replay-qualification.json, acceptance-to-tests.json). Hosted PR checks remain the publication coordinator's gate.

The PR initially targeted main to obtain all 21 successful checks from the repository’s GitHub default CodeQL setup. The intended dependency base is now restored to fix/smoke-csharp-s6610-unicode-literals-20261015. Publication verifies the unchanged signed head, full body and exact-head hosted check rollup against that base.

Compatibility and risks

This changes only qualified existing S2178 message strings. Unknown never implies runtime: const/var/fields/member/alternate-type literals, arithmetic/casts, unsupported binding constructs, ambiguous/sibling/future declarations, nearest lambda/local-function/accessor boundaries, flattened params syntax, malformed syntax and unsupported calls preserve short messages. No new lint allowances or catalog/dependency/schema changes. No quickfix behavior changes. Reference and native preservation controls are identified separately.

Limitations

This is a conservative source-visible witness. Runtime expressions outside the explicit int/bool declaration/call shapes may retain short wording. Parenthesized-operand detector gaps remain: 20 reference-positive/native-absent instances across both typed variants. Historical undeclared controls retain their original two short findings; the installed analyzer's compiler-error/zero-diagnostic context difference remains unqualified. Standalone C# semantic context stays missing and parity incomplete. No complete S2178 or full SonarQube parity claim, merge, tag or release is made.

@wakemeup0
wakemeup0 changed the base branch from main to fix/smoke-csharp-s6610-unicode-literals-20261015 October 15, 2026 18:14
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