Repository navigation
stylecheck: allow error strings to begin with proper nouns - #1739
Open
ChrisJr404 wants to merge 1 commit into
Open
ChrisJr404 wants to merge 1 commit into
ChrisJr404 wants to merge 1 commit into
Conversation
ST1005 flags any error string that starts with a capital letter unless the first word looks like an initialism or a function name. That means correctly written strings like "Docker failed to start" get reported, because "Docker" is a single capitalized word. Add a proper_nouns option, mirroring the existing initialisms list, so the first word may be an allowed proper noun. It ships with a default set of common names and can be extended per project. Closes: dominikhgh-424
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 bat
32A7
ch 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.
ST1005 reports error strings that start with a capital letter, unless the first word already looks like an initialism (it has an inner uppercase letter or a digit) or a function name. That leaves single capitalized words like "Docker" or "Travis" being flagged even though the capitalization is correct for a proper noun.
This adds a proper_nouns option that works the same way as initialisms: a configurable list, merged the same way, normalized on load, with a default set of common names (Docker, Kubernetes, Postgres, Terraform, and so on). If the first word matches an entry, the string is left alone. Matching is case sensitive and only applies to the first word.
I kept the default list small and conservative on purpose since it is easy to bikeshed, so happy to add or drop names if you have preferences.
Closes: gh-424