-
Notifications
You must be signed in to change notification settings - Fork 466
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
Update CA1806 to allow user defined methods #3483
Conversation
|
||
Configurable Rules: [CA1806](https://docs.microsoft.com/en-us/visualstudio/code-quality/CA1806) | ||
|
||
Option Values: Names of additional methods (separated by '|') for CA1806. |
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.
Do we want to also allow types? Same question for namespaces? IMO types could make sense but I fail to see any point for namespaces.
Codecov Report
@@ Coverage Diff @@
## master #3483 +/- ##
==========================================
+ Coverage 95.10% 95.27% +0.16%
==========================================
Files 1053 1046 -7
Lines 238158 235810 -2348
Branches 15498 15262 -236
==========================================
- Hits 226510 224667 -1843
+ Misses 9929 9464 -465
+ Partials 1719 1679 -40 |
...etAnalyzers/Core/Microsoft.CodeQuality.Analyzers/Maintainability/DoNotIgnoreMethodResults.cs
Outdated
Show resolved
Hide resolved
...etAnalyzers/Core/Microsoft.CodeQuality.Analyzers/Maintainability/DoNotIgnoreMethodResults.cs
Outdated
Show resolved
Hide resolved
@@ -1436,4 +1436,7 @@ | |||
<data name="EventsShouldNotHaveBeforeOrAfterPrefixTitle" xml:space="preserve"> | |||
<value>Events should not have 'Before' or 'After' prefix</value> | |||
</data> | |||
<data name="DoNotIgnoreMethodResultsMessageUserDefinedMethod" xml:space="preserve"> | |||
<value>'{0}' calls '{1'} but does not use the value the method returns. This method is defined as a user-option. Use the result in a conditional statement, assign the result to a variable, or pass it as an argument to another method.</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.
<value>'{0}' calls '{1'} but does not use the value the method returns. This method is defined as a user-option. Use the result in a conditional statement, assign the result to a variable, or pass it as an argument to another method.</value> | |
<value>'{0}' calls '{1}' but does not use the value the method returns. This method is defined as a user-option. Use the result in a conditional statement, assign the result to a variable, or pass it as an argument to another method.</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.
Wondering why the test framework did not fail the tests when 2 arguments are being provided for expected diagnostics?
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 that's weird.
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.
Ok so the test framework is not failing when extra arguments are provided. {1'}
is not parsed properly and so not considered as a placeholder. The .WithArguments()
can take more arguments that required and won't fail. Might be worth improving this behavior.
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.
@sharwell for the suggestion. Possibly file a suggestion issue on roslyn-sdk repo for the testing library?
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.
@@ -132,6 +132,11 @@ | |||
<target state="translated">{0} volá {1}, ale nepoužívá hodnotu, kterou tato metoda vrací. O metodách Linq se ví, že nemají vedlejší účinky. Použijte výsledek v podmíněném příkazu, přiřaďte výsledek proměnné nebo ho předejte jako argument jiné metodě.</target> | |||
<note /> | |||
</trans-unit> | |||
<trans-unit id="DoNotIgnoreMethodResultsMessageUserDefinedMethod"> | |||
<source>'{0}' calls '{1'} but does not use the value the method returns. This method is defined as a user-option. Use the result in a conditional statement, assign the result to a variable, or pass it as an argument to another method.</source> |
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.
@Evangelink You would need to rebuild locally to also update the xlf files :-)
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.
🤦
Fix #3479