fix(PC0030): suppress on setup table parameterless Get()#286
Merged
Conversation
Setup tables (single-record configuration tables like General Ledger Setup, Sales & Receivables Setup, etc.) gain near-zero benefit from SetLoadFields. Microsoft's BaseApp uses SetLoadFields on setup tables in only 1.8% of cases. Changes: - Add shared TableHelper.IsSetupTable() in ALCops.Common with relaxed heuristic (single Code PK field named "Primary Key" or "PrimaryKey", case-insensitive) - Suppress PC0030 when Get() has no arguments AND table is a setup table - Refactor AC0013 (FieldGroupsRequired) to use shared helper - Add 4 new test cases (2 NoDiagnostic, 2 HasDiagnostic) - Update existing test fixtures to use non-setup-table PK names Closes #283 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The unqualified field reference format from PR #284 was not properly applied during the merge conflict resolution. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.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.
Summary
Suppresses PC0030 when a parameterless
Get()is called on a setup table. Setup tables (single-record configuration tables) gain near-zero benefit fromSetLoadFields.Changes
ALCops.Common/Helpers/TableHelper.IsSetupTable()with relaxed heuristic (single Code PK field named "Primary Key" or "PrimaryKey", case-insensitive)Get()has zero arguments AND the table matches the setup table heuristicTableHelper.IsSetupTable()instead of private methodRationale
SetLoadFieldson setup tables in only 1.8% of cases (~54 out of ~2,977)SalesSetup.Get()without SetLoadFields as the correct patternCloses #283