-
Notifications
You must be signed in to change notification settings - Fork 468
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
Fixing grammer of & improving CA1836 messages. #4210
Fixing grammer of & improving CA1836 messages. #4210
Conversation
src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/xlf/MicrosoftNetCoreAnalyzersResources.fr.xlf
Outdated
Show resolved
Hide resolved
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.
Minor suggestion, otherwise LGTM.
Tagging @mavasani
@@ -1411,7 +1411,7 @@ | |||
<value>For determining whether the object contains or not any items, prefer using 'IsEmpty' property rather than retrieving the number of items from the 'Count' property and comparing it to 0 or 1.</value> | |||
</data> | |||
<data name="PreferIsEmptyOverCountMessage" xml:space="preserve"> | |||
<value>Prefer 'IsEmpty' over 'Count' to determine whether the object contains or not any items</value> | |||
<value>Prefer 'IsEmpty' over 'Count' to determine whether the object is empty.</value> |
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.
@BrunoJuchli Sorry I missed it, the message string should not end with a period.
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.
Yes, this will cause build failure.
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.
Also tagging @jozkee for review.
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.
Thank you. I've removed the trailing period in the Message.
@mavasani
I've also done so in the French and in the German translations (even though it did have a trailing period before). I guess that's ok (but the build is not checking translations for correctness in that regard) -- right?
I haven't checked/fixed other languages. I could but then I believe it would probably be best to create a separate PR and remove all the trailing periods of all the translated messages - do you concur?
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.
@BrunoJuchli You are right, the analyzer only check the English message, title and description entries. I was thinking about checking the other languages but that would probably require to discuss with native speakers to see what they think. Basically we wrote this analyzer to ensure that there is a consistent style in how messages are shown to the user (at least partially).
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 once you remove the period at the end of the new message string and update all the xlf files accordingly.
65cbfaf
to
b1c2122
Compare
Codecov Report
@@ Coverage Diff @@
## master #4210 +/- ##
=======================================
Coverage 95.83% 95.84%
=======================================
Files 1177 1177
Lines 268158 268158
Branches 16192 16192
=======================================
+ Hits 256997 257010 +13
+ Misses 9084 9066 -18
- Partials 2077 2082 +5 |
@@ -1411,7 +1411,7 @@ | |||
<value>For determining whether the object contains or not any items, prefer using 'IsEmpty' property rather than retrieving the number of items from the 'Count' property and comparing it to 0 or 1.</value> | |||
</data> | |||
<data name="PreferIsEmptyOverCountMessage" xml:space="preserve"> | |||
<value>Prefer 'IsEmpty' over 'Count' to determine whether the object contains or not any items</value> | |||
<value>Prefer 'IsEmpty' over 'Count' to determine whether the object is empty</value> |
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.
I think you need to mention two alternatives to properly use "whether".
<value>Prefer 'IsEmpty' over 'Count' to determine whether the object is empty</value> | |
<value>Prefer 'IsEmpty' over 'Count' to determine whether the object is empty or not</value> |
<value>Prefer 'IsEmpty' over 'Count' to determine whether the object is empty</value> | |
<value>Prefer 'IsEmpty' over 'Count' to determine whether or not the object is empty</value> |
We could even rephrase to not use the word
<value>Prefer 'IsEmpty' over 'Count' to determine whether the object is empty</value> | |
<value>Prefer 'IsEmpty' over 'Count' to determine if the object is empty</value> |
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.
@jozkee
I'm not a native speaker so I looked it up.,The first two resources I found don't back that up
( https://english.stackexchange.com/a/48773/398754, http://www.youtube.com/watch?v=Klnroe1UBRs&t=1m23s <-- here making a specific example with whether and stating that "or not" is not necessary).
So I think it's rather a stylistic choice. Personally I would go for the shorter version unless there's ambiguity.
That would make me lean toward the if
version (probably also most commonly understood by non native speakers; every programmer will know if
introduces a condition). Though the guy in the youtube video said that whether
specifies a binary condition and if
goes well with multiple options.
Maybe we could have an odd number of native speakers vote on a version? :D
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.
Lets go with the changes and if required/based on feedback, we can change them in future.
@BrunoJuchli Can you please rebuild locally to resolve conflicts? |
@mavasani I just rebased on current master and force pushed. Strangely this PR doesn't seem to pick up the change, though stackoverflow states multiple times force-pushing to a branch that has an open PR is getting updated. |
b1c2122
to
14af6c7
Compare
Closing and re-opening PR to retrigger tests, as we checked in new CI validation step for generated files. |
src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/xlf/MicrosoftNetCoreAnalyzersResources.cs.xlf
Outdated
Show resolved
Hide resolved
src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/xlf/MicrosoftNetCoreAnalyzersResources.de.xlf
Outdated
Show resolved
Hide resolved
14af6c7
to
86623e8
Compare
old : Prefer 'IsEmpty' over 'Count' to determine whether the object contains or not any items new: Prefer 'IsEmpty' over 'Count' to determine whether the object is empty.
86623e8
to
5f98c98
Compare
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
@buyaa-n Please feel free to review and merge if the changes look good to you. Thanks!
Improving the message of PreferIsEmptyOverCountMessage (CA1836):
old : Prefer 'IsEmpty' over 'Count' to determine whether the object contains or not any items
new: Prefer 'IsEmpty' over 'Count' to determine whether the object is empty
Also slightly improved the german & french translations.