Skip to content
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 comparison doc to list CA1507 and S3376 #750

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

drieseng
Copy link
Contributor

Update comparison doc to list CA1507 as equivalent of MA0043, and S3376 as similar to MA0058.

@drieseng
Copy link
Contributor Author

drieseng commented Sep 12, 2024

@meziantou, can you confirm that CA1507 is indeed an equivalent of MA0043 and not just similar.

@meziantou
Copy link
Owner

can you confirm that CA1507 is indeed an equivalent of MA0043 and not just similar

There are similar but there are differences:

  • MA0047 only report arguments of ArgumentException and derived types
  • CA1507 reports for all arguments when the parameter name is paramName or propertyName. I haven't tested it, but InvalidEnumArgumentException's parameter name is argumentName. Maybe it doesn't report it correctly.
  • CA1507 suggest nameof for property name when the parameter name is propertyName

@drieseng
Copy link
Contributor Author

can you confirm that CA1507 is indeed an equivalent of MA0043 and not just similar

There are similar but there are differences:

I'll move CA1507 / MA0047 to the similar table.

  • MA0047 only report arguments of ArgumentException and derived types
  • CA1507 reports for all arguments when the parameter name is paramName or propertyName. I haven't tested it, but InvalidEnumArgumentException's parameter name is argumentName. Maybe it doesn't report it correctly.

It indeed does not cover InvalidEnumArgumentException.

  • CA1507 suggest nameof for property name when the parameter name is propertyName

Not very useful, if you ask me.

I had disabled MA0047 in favor of CA1507 in our code base, but I think I'll revert this.

Copy link

This pull request is stale because it has been open for 60 days with no activity.

@github-actions github-actions bot added the stale label Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants