GeezerVison is showing github.com — Enable CA18XX rules with suggestion severity by xtqqczze · Pull Request #13924 · PowerShell/PowerShell
Conversation
xtqqczze
commented
Oct 29, 2020
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Promote CA18XX rules with suggestion severity to warning:
- CA1821: Remove empty Finalizers
- CA1824: Mark assemblies with NeutralResourcesLanguageAttribute
- CA1826: Do not use Enumerable methods on indexable collections
- CA1828: Do not use CountAsync() or LongCountAsync() when AnyAsync() can be used
- CA1832: Use AsSpan or AsMemory instead of Range-based indexers when appropriate
- CA1833: Use AsSpan or AsMemory instead of Range-based indexers when appropriate
Criteria used to select rules for this PR:
- currently at suggestion severity
- within the CA18XX range
- no existing violations.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
xtqqczze
changed the title
Enable CA1828: Do not use CountAsync() or LongCountAsync() when AnyAsync() can be used
Enable CA18XX rules with suggestion severity
Oct 29, 2020
* CA1821: Remove empty Finalizers
* CA1824: Mark assemblies with NeutralResourcesLanguageAttribute
* CA1826: Do not use Enumerable methods on indexable collections
* CA1828: Do not use CountAsync() or LongCountAsync() when AnyAsync() can be used
* CA1832: Use AsSpan or AsMemory instead of Range-based indexers when appropriate
* CA1833: Use AsSpan or AsMemory instead of Range-based indexers when appropriate
|
I suppose our goal is to make the existing codebase modern. If there is no code that falls under these rules, we can save time and leave the default values for such rules. Moreover, the default value is "suggestion" so we will see these recommendations anyway.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
I suppose our goal is to make the existing codebase modern. If there is no code that falls under these rules, we can save time and leave the default values for such rules. Moreover, the default value is "suggestion" so we will see these recommendations anyway.
By setting these rules to warning we can ensure regressions do not pass CI.
We cannot rely on suggestion severity because contributors may not be using an IDE with live analysis available. For example, the default in VS Code is for live analysis not to be enabled.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
I mean today (before next milestone start) we can fix many style and formatting issues with small commits and postpone a rest of the work.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
I mean today (before next milestone start) we can fix many style and formatting issues with small commits and postpone a rest of the work.
Ilya (@iSazonov) OK, I see your point. For future PRs I can focus on style and formatting issues. We may as well merge this PR though.
|
iSazonov reacted with thumbs up emoji
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
xtqqczze can you please tell if my understanding is correct:
- With
severity = warning (unlike severity = suggestion) a rule will generate a build failure?
- The fact that CIs for this PR passed means that we currently do Not have violations of rules that are changed by this PR?
- Why these specific CA18XX rules were changed in this PR (and not other rules)? What is special about these CA18XX rules so that they were chosen to be updated?
Thank you.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Andrew (@anmenaga)
- With
severity = warning (unlike severity = suggestion) a rule will generate a build failure?
Correct, with TreatErrorsAsWarnings enabled (which it is), a rule with warning severity will generate a build failure.
- The fact that CIs for this PR passed means that we currently do Not have violations of rules that are changed by this PR?
Correct, there no existing violations of these rules.
- Why these specific CA18XX rules were changed in this PR (and not other rules)? What is special about these CA18XX rules so that they were chosen to be updated?
The rules were chosen from the CA18XX range that were already at suggestion severity, and did not generate any build failures. There is nothing special about the CA18XX range other than it is easier to test and submit a PR for a smaller number of rules at a time.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
What is special about these CA18XX rules so that they were chosen to be updated?
It is a best practice from .Net team and forcing these rules helps us to avoid bad patterns. If there is any edge cases, we can always suppress these rules locally with the directive.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Reviewers
+1 more reviewer
Reviewers whose approvals may not affect merge requirements
Uh oh!
There was an error while loading. Please reload this page.
Labels
CL-CodeCleanup
Indicates that a PR should be marked as a Code Cleanup change in the Change Log
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch 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.
|