Skip to content

fix(LC0086): one predictable deny-list for every PageStyle value - #697

Open
Arthurvdv wants to merge 5 commits into
mainfrom
fix/lc0086-predictable-denials
Open

Arthurvdv wants to merge 5 commits into
mainfrom
fix/lc0086-predictable-denials

Conversation

@Arthurvdv

Copy link
Copy Markdown
Member

Summary

LC0086 now applies one fixed deny-list to every PageStyle value, so whether a literal is reported depends only on where it appears. This removes the false positives on common words such as 'None', 'Standard', 'Strong' and 'Ambiguous' that appear in the Business Central corpus.

Not reported:

  • Method arguments and attribute arguments (SetText('…', 'None'), Assert.AreEqual('Strong', …), [EventSubscriber(…, 'Strong', …)]).
  • Comparison operands (=, <>, <, <=, >, >=) and in [...] elements, including parenthesized operands and the ? : branches inside an operand.
  • case labels and ranges. A literal in the statement after the label is still reported.
  • Every property value. This replaces the earlier Caption/OptionCaption and StyleExpr checks.
  • Multilanguage text: TextConst ENU = '…' and the legacy label(Name; ENU = '…') report label.
  • Literals under a label other than its text, such as the Comment value.

Still reported:

  • Assignments to non-field variables, including array elements and ternary branches.
  • exit('…').
  • The text of locked labels and locked report labels.

Simplification. The data-access argument check (DataAccessNavTypeKinds plus the pre-14.2 GetOperation fallback) is gone, because the syntax-only argument denial covers it. EnumProvider gains the SyntaxKinds used here; all of them exist at 12.0, and ConditionalExpression is guarded for SDKs that lack it.

Accepted limitation. A style passed through a helper parameter, such as SetStyle('Unfavorable'), is no longer reported.

Roadmap verdicts (#522)

  • StyleExpr flow analysis: declined. One syntax-based policy keeps the rule predictable.
  • CodeFix to Format(PageStyle::X): declined, because it adds complexity for little value.
  • Cross-object tracing: declined, because the consumer of a public helper's return value cannot be known.

Closes #522

Tests

  • 35 PageStyleStringLiteral cases pass on net10.0 and net8.0. Every new NoDiagnostic fixture failed before its fix.
  • dotnet test ALCops.sln is green.
  • dotnet format --verify-no-changes is clean.
  • The CI Release builds of LinterCop and Common pass for netstandard2.1, net8.0 and net10.0.
  • Validate-Rules.ps1 passes.
  • Three rounds of /code-review high ran; all findings were fixed or answered.

Docs: ALCops/alcops.dev#249

🤖 Generated with Claude Code

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.

LC0086: roadmap - StyleExpr flow analysis, CodeFix, cross-object tracing

1 participant