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

Refactor PropertiesShouldNotBeWriteOnlyAnalyzer (CA1044) #6871

Merged
merged 1 commit into from
Aug 28, 2023

Conversation

Youssef1313
Copy link
Member

No description provided.

@Youssef1313 Youssef1313 requested a review from a team as a code owner August 20, 2023 08:52

// not raising a violation for when:
// property is overridden because the issue can only be fixed in the base type
// property is the implementation of any interface member
if (property.IsOverride || property.IsImplementationOfAnyInterfaceMember())
if (property.IsOverride || GetRule(property) is not DiagnosticDescriptor descriptor || property.IsImplementationOfAnyInterfaceMember())
Copy link
Member Author

Choose a reason for hiding this comment

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

NOTE: The checks in GetRule were previously done after calling IsImplementationOfAnyInterfaceMember.

I think that checks in GetRule are a lot cheaper and can eliminate lots of properties. So this might slightly have a performance impact. This analyzer is generally fast enough though.

@codecov
Copy link

codecov bot commented Aug 20, 2023

Codecov Report

Merging #6871 (b9bc28c) into main (3587540) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6871   +/-   ##
=======================================
  Coverage   96.39%   96.39%           
=======================================
  Files        1403     1403           
  Lines      330977   330975    -2     
  Branches    10890    10889    -1     
=======================================
  Hits       319055   319055           
+ Misses       9188     9186    -2     
  Partials     2734     2734           

@mavasani mavasani merged commit 0139464 into dotnet:main Aug 28, 2023
14 checks passed
@Youssef1313 Youssef1313 deleted the make-write-only branch August 28, 2023 07:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants