feat(ipa): IPA-112 excempt trailing abbreviations - #1473
Draft
maks-m-mongo-leaf wants to merge 1 commit into
Draft
feat(ipa): IPA-112 excempt trailing abbreviations#1473maks-m-mongo-leaf wants to merge 1 commit into
maks-m-mongo-leaf wants to merge 1 commit into
Conversation
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.
Proposed changes
Jira ticket: CLOUDP-442116
The
xgen-IPA-112-field-names-are-camel-caserule incorrectly flagged field names that include units-of-measure (UoM) abbreviations such asGB,MB,KB,TB,PB,GHz,MHz,KHz,Mbps,Kbps,Gbps,Tbps. These abbreviations are legitimately uppercase in camelCase field names (e.g.diskGB,memoryMB,cpuGHz) but the underlyingcasing()function treated each uppercase letter as a separate word, causing false-positive violations.The fix normalises known UoM abbreviations before the camelCase check by lowercasing their trailing letters (e.g.
diskGB→diskGbfor validation purposes only; the original name is preserved in any error message). The normalisation only applies when the abbreviation is preceded by a lowercase letter or digit and is followed by an uppercase letter or end-of-string — so invalid cases likeGBSize,DISKGB,diskGBs, anddiskGBMBstill correctly fail.As a result, the two per-field spectral overrides for
AdvancedAutoScalingSettings/properties/diskGBandAutoScalingSettings/properties/diskGBinipa-spectral.yamlare also removed, as they are no longer needed.Checklist
Changes to Spectral
Further comments
The normalisation is a pre-processing step only — the original field name is always used in the violation message. Known tradeoff: UoM abbreviations that coincide with other acronyms (e.g.
GB= Great Britain,MB= Message Bus) will be incorrectly allowed. This is considered acceptable given the domain context of the Atlas API.