Skip to content

Enable CA2208: Instantiate argument exceptions correctly#13898

Closed
xtqqczze wants to merge 5 commits intoPowerShell:masterfrom
xtqqczze:CA2208
Closed

Enable CA2208: Instantiate argument exceptions correctly#13898
xtqqczze wants to merge 5 commits intoPowerShell:masterfrom
xtqqczze:CA2208

Conversation

@xtqqczze
Copy link
Copy Markdown
Contributor

@xtqqczze xtqqczze commented Oct 26, 2020

@ghost ghost assigned TravisEz13 Oct 26, 2020
@xtqqczze xtqqczze force-pushed the CA2208 branch 2 times, most recently from 2de4f05 to 4d04613 Compare October 27, 2020 01:53
@xtqqczze xtqqczze mentioned this pull request Oct 27, 2020
8 tasks
@xtqqczze xtqqczze requested a review from iSazonov October 27, 2020 15:07
@xtqqczze xtqqczze force-pushed the CA2208 branch 2 times, most recently from fe01162 to 6efd015 Compare October 27, 2020 17:28
@xtqqczze xtqqczze requested a review from iSazonov October 27, 2020 17:28
Copy link
Copy Markdown
Collaborator

@iSazonov iSazonov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert types. We shouldn't change types.

@xtqqczze
Copy link
Copy Markdown
Contributor Author

@iSazonov I will revert all changes not part of the CodeFix, and suppress the rule with the justification linking to the tracking issue: #13909

@xtqqczze xtqqczze marked this pull request as ready for review October 27, 2020 20:34
@xtqqczze xtqqczze changed the title Enable: CA2208: Instantiate argument exceptions correctly Enable CA2208: Instantiate argument exceptions correctly Oct 27, 2020
@ghost
Copy link
Copy Markdown

ghost commented Nov 6, 2020

This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days.
Maintainer, please provide feedback and/or mark it as Waiting on Author

@ghost ghost added the Review - Needed The PR is being reviewed label Nov 6, 2020
@xtqqczze
Copy link
Copy Markdown
Contributor Author

xtqqczze commented Nov 8, 2020

closing/reopening to restart tests

@xtqqczze xtqqczze closed this Nov 8, 2020
@xtqqczze xtqqczze reopened this Nov 8, 2020
@xtqqczze
Copy link
Copy Markdown
Contributor Author

xtqqczze commented Jul 3, 2021

Rebased and fixed up to address @iSazonov review.

@iSazonov iSazonov added the CL-CodeCleanup Indicates that a PR should be marked as a Code Cleanup change in the Change Log label Jul 4, 2021
@xtqqczze
Copy link
Copy Markdown
Contributor Author

xtqqczze commented Jul 5, 2021

Blocked by #15604.

@xtqqczze xtqqczze requested a review from PaulHigin as a code owner November 14, 2022 05:40
@pull-request-quantifier-deprecated
Copy link
Copy Markdown

This PR has 36 quantified lines of changes. In general, a change size of upto 200 lines is ideal for the best PR experience!


Quantification details

Label      : Extra Small
Size       : +29 -7
Percentile : 14.4%

Total files changed: 16

Change summary by file extension:
.globalconfig : +2 -2
.cs : +27 -5

Change counts above are quantified counts, based on the PullRequestQuantifier customizations.

Why proper sizing of changes matters

Optimal pull request sizes drive a better predictable PR flow as they strike a
balance between between PR complexity and PR review overhead. PRs within the
optimal size (typical small, or medium sized PRs) mean:

  • Fast and predictable releases to production:
    • Optimal size changes are more likely to be reviewed faster with fewer
      iterations.
    • Similarity in low PR complexity drives similar review times.
  • Review quality is likely higher as complexity is lower:
    • Bugs are more likely to be detected.
    • Code inconsistencies are more likely to be detected.
  • Knowledge sharing is improved within the participants:
    • Small portions can be assimilated better.
  • Better engineering practices are exercised:
    • Solving big problems by dividing them in well contained, smaller problems.
    • Exercising separation of concerns within the code changes.

What can I do to optimize my changes

  • Use the PullRequestQuantifier to quantify your PR accurately
    • Create a context profile for your repo using the context generator
    • Exclude files that are not necessary to be reviewed or do not increase the review complexity. Example: Autogenerated code, docs, project IDE setting files, binaries, etc. Check out the Excluded section from your prquantifier.yaml context profile.
    • Understand your typical change complexity, drive towards the desired complexity by adjusting the label mapping in your prquantifier.yaml context profile.
    • Only use the labels that matter to you, see context specification to customize your prquantifier.yaml context profile.
  • Change your engineering behaviors
    • For PRs that fall outside of the desired spectrum, review the details and check if:
      • Your PR could be split in smaller, self-contained PRs instead
      • Your PR only solves one particular issue. (For example, don't refactor and code new features in the same PR).

How to interpret the change counts in git diff output

  • One line was added: +1 -0
  • One line was deleted: +0 -1
  • One line was modified: +1 -1 (git diff doesn't know about modified, it will
    interpret that line like one addition plus one deletion)
  • Change percentiles: Change characteristics (addition, deletion, modification)
    of this PR in relation to all other PRs within the repository.


Was this comment helpful? 👍  :ok_hand:  :thumbsdown: (Email)
Customize PullRequestQuantifier for this repository.

@iSazonov
Copy link
Copy Markdown
Collaborator

I think now it is more useful benefit from new APIs like ArgumentNullException.ThrowIfNull(). They exclude most of CA2208.

@iSazonov iSazonov closed this Dec 13, 2022
@ghost ghost removed the Review - Needed The PR is being reviewed label Dec 13, 2022
@xtqqczze xtqqczze deleted the CA2208 branch August 28, 2025 22:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CL-CodeCleanup Indicates that a PR should be marked as a Code Cleanup change in the Change Log Extra Small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix CA2208: Instantiate argument exceptions correctly

3 participants