Skip to content

Update SA1008 to require a space before the opening parenthesis if it's the left operand of a range expression - #3895

Merged
sharwell merged 1 commit into
DotNetAnalyzers:masterfrom
bjornhellander:feature/sa1008-range-left-operand
Nov 25, 2025
Merged

sharwell merged 1 commit into
DotNetAnalyzers:masterfrom
bjornhellander:feature/sa1008-range-left-operand

Conversation

@bjornhellander

@bjornhellander bjornhellander commented Oct 17, 2024 •

Copy link
Copy Markdown
Contributor

Fixes #3894. There were code to forbid space before a parenthesizes expression which is part of a range expression. I updated that to only apply to the right operand.

Also added a collection expression test for SA1008, since it seemed related and I didn't find an existing test for it.

@codecov

codecov Bot commented Oct 17, 2024 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.45%. Comparing base (2dc4507) to head (2d7e105).
⚠️ Report is 90 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff             @@
##           master    #3895       +/-   ##
===========================================
+ Coverage        0   97.45%   +97.45%     
===========================================
  Files           0      953      +953     
  Lines           0   112729   +112729     
  Branches        0     3728     +3728     
===========================================
+ Hits            0   109861   +109861     
- Misses          0     1900     +1900     
- Partials        0      968      +968     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

…'s the left operand of a range expression. Also add test for SA1008 in collection expression.

DotNetAnalyzers#3894
@sharwell
sharwell enabled auto-merge November 25, 2025 20:11
@sharwell
sharwell merged commit 60b1b1c into DotNetAnalyzers:master Nov 25, 2025
@sharwell sharwell added this to the 1.2-beta.next milestone Nov 25, 2025
@bjornhellander
bjornhellander deleted the feature/sa1008-range-left-operand branch November 29, 2025 10:22
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.

SA1008 false positive on range expression with first operand in parentheses

2 participants