-
Notifications
You must be signed in to change notification settings - Fork 14
CLOUDP-272000: Boolean field names avoid "is" prefix #593
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One comment, otherwise LGTM
| if (property.type === 'boolean') { | ||
| if (IS_PREFIX_REGEX.test(input)) { | ||
| const suggestedName = input.charAt(2).toLowerCase() + input.slice(3); | ||
| const errorMessage = `Boolean field "${input}" should not use the "is" prefix. Use "${suggestedName}" instead.`; | ||
| return collectAndReturnViolation(path, RULE_NAME, errorMessage); | ||
| } | ||
| } | ||
|
|
||
| collectAdoption(path, RULE_NAME); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if (property.type === 'boolean') { | |
| if (IS_PREFIX_REGEX.test(input)) { | |
| const suggestedName = input.charAt(2).toLowerCase() + input.slice(3); | |
| const errorMessage = `Boolean field "${input}" should not use the "is" prefix. Use "${suggestedName}" instead.`; | |
| return collectAndReturnViolation(path, RULE_NAME, errorMessage); | |
| } | |
| } | |
| collectAdoption(path, RULE_NAME); | |
| if (property.type !== 'boolean') { | |
| return; | |
| } | |
| if (IS_PREFIX_REGEX.test(input)) { | |
| const suggestedName = input.charAt(2).toLowerCase() + input.slice(3); | |
| const errorMessage = `Boolean field "${input}" should not use the "is" prefix. Use "${suggestedName}" instead.`; | |
| return collectAndReturnViolation(path, RULE_NAME, errorMessage); | |
| } | |
| collectAdoption(path, RULE_NAME); |
Right now it would collect adoption for all properties that aren't booleans
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's correct, nice catch!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Proposed changes
Jira ticket: CLOUDP-272000
Adds
xgen-IPA-112-boolean-field-names-avoid-is-prefixrule47 violations are found to be exempted in the MMS code
Checklist
Changes to Spectral
Further comments