Skip to content

Don't raise CA1861 in for attribute arguments#7044

Merged
mavasani merged 1 commit into
dotnet:mainfrom
CollinAlpert:issue-7033
Nov 30, 2023
Merged

Don't raise CA1861 in for attribute arguments#7044
mavasani merged 1 commit into
dotnet:mainfrom
CollinAlpert:issue-7033

Conversation

@CollinAlpert

Copy link
Copy Markdown

This PR modifies the AvoidConstArraysAnalyzer to not raise for attribute arguments.

Is there any possibility to use the IAttributeOperation API? Otherwise I am stuck using the current workaround to check for an attribute.

Fixes #7033

@CollinAlpert CollinAlpert requested a review from a team as a code owner November 19, 2023 12:20
@codecov

codecov Bot commented Nov 19, 2023

Copy link
Copy Markdown

Codecov Report

Merging #7044 (2166899) into main (b924542) will increase coverage by 0.00%.
Report is 3 commits behind head on main.
The diff coverage is 100.00%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7044   +/-   ##
=======================================
  Coverage   96.43%   96.43%           
=======================================
  Files        1412     1412           
  Lines      336522   336577   +55     
  Branches    11119    11119           
=======================================
+ Hits       324513   324576   +63     
+ Misses       9207     9200    -7     
+ Partials     2802     2801    -1     

@mavasani

Copy link
Copy Markdown

Is there any possibility to use the IAttributeOperation API? Otherwise I am stuck using the current workaround to check for an attribute.

Feel free to use lightup for now and a tracking issue + comment to remove the added lightup code. Not sure if we want to move all the way to the MS.CA API that added IAttributeOperation support and prevent analyzers from running on older VS/compiler.

@mavasani

Copy link
Copy Markdown

@CollinAlpert IMO your current fix looks good to me without having to switch to IAttributeOperation. Let me know if you are fine for me to merge or want to attempt adding lightup for IAttributeOperation

@CollinAlpert

Copy link
Copy Markdown
Author

I see. I am fine with merging, adding lightup would be too much unnecessary effort IMO.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CA1861 false positive in method attribute

2 participants