LC0092 (NamingPattern): align affix handling with the shared MandatoryAffixes helper? #446
Arthurvdv
started this conversation in
Suggestions
Replies: 1 comment
|
@Arthurvdv I’d favor aligning LC0092 with LC0054 and PC0021 by using the shared MandatoryAffixes helper. Initially, this should use the SDK-compatible loose semantics so that LC0092 does not report names that AppSourceCop considers valid. I would suggest asking Microsoft for an alignment on their side, but they would argue with changes in well-known behavior. At the same time, we could introduce an internal strictAffixes switch, defaulting to false, and implement the stricter behavior behind it:
This gives us consistent behavior and fixes the current mandatorySuffix gap now, while preserving the option to expose strict affix validation as a configurable rule setting later. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
@MODUSCarstenScholling I'd like your view on aligning affix handling across rules.
Context
For #436 we introduced a shared
ALCops.Common.Helpers.MandatoryAffixeshelper, now used by LC0054 and PC0021. It mirrors the SDK's own affix validation (GetMandatoryNameAffixes/RuleIdentifiersMustHaveValidAffixes) with loose semantics: every configured value frommandatoryPrefix,mandatorySuffix, andmandatoryAffixesis a valid candidate at either end of a name. It strips at most one affix per end, trims residual whitespace, and never produces an empty name.LC0092 has its own affix logic that sits in between:
mandatoryPrefix+mandatoryAffixes, but ignoresmandatorySuffixQuestion
Should LC0092 adopt the shared helper (full SDK-loose semantics), or is there value in keeping a stricter/explicit interpretation where prefix means start-only and suffix means end-only?
Arguments for aligning (loose, shared helper):
mandatorySuffixblind spot in LC0092Arguments for keeping/tightening:
"ABC"stripped from"Rebate ABC")On long-term relevance: namespaces reduce the need for affixes on object names, but AppSourceCop still mandates affixes on fields in table extensions, enum value extensions, and other extension-object members, which namespaces don't cover. So this won't resolve itself soon.
We're keeping LC0092 as-is for now; no urgency. Open to either direction, including a middle ground (adopt the helper but fix only the
mandatorySuffixgap with strict end-matching).Generated with Claude Fable 5
All reactions