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

SA1114: Allow all valid trivia #3259

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

nxtn
Copy link
Contributor

@nxtn nxtn commented Dec 5, 2020

Allow all valid trivia (especially #if in argument list) by simply counting the line breaks in between.

You want more tests?

Fixes #3284

@codecov
Copy link

codecov bot commented Dec 5, 2020

Codecov Report

Merging #3259 (1c1193a) into master (363a36c) will increase coverage by 0.10%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #3259      +/-   ##
==========================================
+ Coverage   93.48%   93.58%   +0.10%     
==========================================
  Files        1001     1017      +16     
  Lines      109640   109960     +320     
  Branches     3722     3764      +42     
==========================================
+ Hits       102492   102910     +418     
+ Misses       6218     6113     -105     
- Partials      930      937       +7     

@TaffarelJr
Copy link

Any chance of getting some traction on this? It's been almost 2 years.
Getting really tired of this false positive.

@bjornhellander
Copy link
Contributor

Seems to be tests missing here. Any other opinions?

@bjornhellander
Copy link
Contributor

I had another look. This PR allows trivia in all cases that SA1114 checks, e.g. array declarations and attribute argument lists, not only method invocations. I am also pretty sure it allows more kinds of trivia than @vweijsters' earlier fix for directive trivia in method declarations, e.g. #define. I'm not saying this is necessarily a problem, bit a bit odd to e.g. allow a #define inside an indexer declaration.

Other ways forward could be to 1) apply @vweijsters' change for method declarations for invocations as well (but this PR reduces code quite a bit, so I like the general idea of it), or 2) do a mix, where we are still strict about what trivia to allow, and maybe even in what places, but try to reduce code in a similar way to this PR. I would vote for alternative 2. What do you think, @sharwell?

Tests should still be added, regardless of path taken.

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.

SA1114: False positive on argument list with directives
3 participants