Repository navigation
fix(AC0002): skip setup tables whose primary key is always blank - #579
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.
Fixes #575
Summary
AC0002 (
NotBlankRequiredOnPrimaryKeyField) no longer reports setup tables. A setup table holds one record, and its primary key is always blank by design. Setup tables are assumed to be singletons that no other table relates to, so the cascading rename/delete the rule guards against does not apply.NotBlankOnPrimaryKeyField: one early return in the AC0002 branch, which reuses the sharedTableHelper.IsSetupTable(also used by AC0013). It matches a sole Code primary key field namedPrimary Key/PrimaryKey, or a parameterless, return-lessGetRecordOncemethod on the table. The helper already compiles on netstandard2.1, so no TFM guards are needed.NoDiagnosticfixtures (SetupTablePrimaryKey,SetupTablePrimaryKeyNoSpace,SetupTableGetRecordOnce), observed failing before the fix. AHasDiagnostic/PrimaryKeyTextFieldregression guard pins the Code-only scope..claude/rules/diagnostics/ac0002-not-blank-required-on-primary-key-field.md. The AC0013 doc notes that it shares the heuristic.Deliberate scope limits
The heuristic matches by convention, not by checking inbound relations. These cases still report AC0002:
"Primary Key"field (the helper is Code-only);PKorCodewithout aGetRecordOncemethod.Widening the heuristic would also change AC0013. An explicit
NotBlank = falseremains the opt-out.CodeFix rename
No behaviour change. In
NotBlankRequiredOnPrimaryKeyFieldCodeFixProvider,GetBooleanFalsePropertyValueandGetNotBlankFalsePropertyactually producedNotBlank = true. They are renamed toGetBooleanTruePropertyValueandGetNotBlankTrueProperty, andupdatedNotBlankPropertynow has correct casing.Verification
dotnet build ALCops.slnanddotnet test ALCops.sln: all green.dotnet format ALCops.sln --verify-no-changes: clean.Validate-Rules.ps1: OK./code-review, Sonnet, effort high): no correctness issues; review nits addressed inchore(AC0002): tighten setup-table wording from review.Docs: ALCops/alcops.dev#199
🤖 Generated with Claude Code