Skip to content

Fix warnings found with new analyzer CA1860: Prefer Length/Count/IsEmpty property check over Any() #81583

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

Merged
merged 5 commits into from
Feb 7, 2023

Conversation

buyaa-n
Copy link
Contributor

@buyaa-n buyaa-n commented Feb 3, 2023

  • Fix warnings found with the new analyzer CA1860: Prefer Length/Count/IsEmpty property check over Any(), and updated its severity.

@buyaa-n buyaa-n requested a review from stephentoub February 3, 2023 05:42
@ghost ghost added the area-Meta label Feb 3, 2023
@ghost ghost assigned buyaa-n Feb 3, 2023
@ghost
Copy link

ghost commented Feb 3, 2023

Tagging subscribers to this area: @dotnet/area-meta
See info in area-owners.md if you want to be subscribed.

Issue Details
  • Fix warnings found with the new analyzer CA1860: Prefer Length/Count/IsEmpty property check over Any(), and updated its severity.
  • Fix new warnings found with property support update of CA1859 Use concrete types when possible for improved performance. Hopefully it covers all (only run main clr+libs and mono+libs builds)
Author: buyaa-n
Assignees: buyaa-n
Labels:

area-Meta

Milestone: -

@@ -468,6 +468,9 @@ dotnet_diagnostic.CA1858.severity = warning
# CA1859: Use concrete types when possible for improved performance
dotnet_diagnostic.CA1859.severity = warning
Copy link
Member

Choose a reason for hiding this comment

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

Do things get out of hand if you turn on analysis of internal stuff too?

Copy link
Member

Choose a reason for hiding this comment

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

By default it's only private and you can opt-in to internal as well? We should definitely aim to opt in.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, the default is private and you can opt-in to internal and public too.

Support for internal and public is in a PR that is about to be merged: dotnet/roslyn-analyzers#6421

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I tried with internal a lot flagged that looks valid, now dotnet/roslyn-analyzers#6421 is merged, probably better wait until it is ready for consumption for the repo before enable the internal API surface

Copy link
Member

@stephentoub stephentoub left a comment

Choose a reason for hiding this comment

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

Changes generally look good, but there are more places that need to be fixed as CI highlights.

@marek-safar marek-safar merged commit 6450398 into dotnet:main Feb 7, 2023
@buyaa-n buyaa-n deleted the CA1860-fixes branch February 7, 2023 15:19
@ghost ghost locked as resolved and limited conversation to collaborators Mar 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants