-
Notifications
You must be signed in to change notification settings - Fork 88
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
Stricter check_option_description
for single-letter words
#171
Conversation
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
@@ -467,7 +467,7 @@ fn check_option_description(errors: &Errors, desc: &str, span: Span) { | |||
(Some(x), _) if x.is_lowercase() => {} | |||
// If both the first and second letter are not lowercase, | |||
// this is likely an initialism which should be allowed. | |||
(Some(x), Some(y)) if !x.is_lowercase() && !y.is_lowercase() => {} | |||
(Some(x), Some(y)) if !x.is_lowercase() && (y.is_alphanumeric() && !y.is_lowercase()) => {} |
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.
is_alphanumeric
and not is_alphabetic
to still support initialisms like I2C
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.
Seems to me that initialisms like I2C are already accepted:
!'2'.is_lowercase() = true
'2'.is_alphanumeric() && !'2'.is_lowercase() = true
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.
Yep, they are (even edited my message to say "still"). I'm just justifying my use of is_alphanumeric
over is_alphabetic
, which would prevent initialisms like I2C
Worth noting that this is technically a "breaking change" for any code that happens to already have such descriptions in its structs |
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.
This probably needs unit tests.
79011ca
to
964e798
Compare
``` /// A parameter ``` Would be accepted as a parameter description even though it starts with an uppercase letter, because argh would consider the word "A" to be an initialism, which it's not
Would be accepted as a parameter description even though it starts with
an uppercase letter, because argh would consider the word "A" to be an
initialism, which it's not