Repository navigation
Allow multiline conditional expressions - #4336
Merged
Merged
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
The focused behavior change has regression coverage, with only a nonblocking documentation synchronization issue remaining.
1 open issue
What changed in this PR
Updates SA1143 to allow multiline branches in expanded conditional expressions, addressing #4335.
Changes:
- Relaxes branch-length restrictions while preserving operator placement checks.
- Adds arithmetic and C# 9 target-typed object creation tests.
- Documents the allowance with an example.
| File | Description |
|---|---|
| test/StyleCop.Analyzers.Test/ReadabilityRules/SA1143UnitTests.cs | Covers multiline arithmetic branches. |
| test/StyleCop.Analyzers.Test.CSharp9/ReadabilityRules/SA1143CSharp9UnitTests.cs | Covers multiline target-typed object creation. |
| src/StyleCop.Analyzers/ReadabilityRules/SA1143ConditionalExpressionsMustBeFormattedConsistently.cs | Permits multiline expanded branches. |
| documentation/SA1143.md | Explains and illustrates the updated layout. |
Review effort: Balanced
Update localized documentation for the multiline branch allowance. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
AArnott
previously approved these changes
Oct 17, 2026
AArnott
enabled auto-merge
October 17, 2026 18:41
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #4336 +/- ##
========================================
Coverage 97.66% 97.67%
========================================
Files 1331 1332 +1
Lines 147246 147661 +415
Branches 4977 4989 +12
========================================
+ Hits 143813 144222 +409
- Misses 2176 2178 +2
- Partials 1257 1261 +4 🚀 New features to boost your workflow:
|
AArnott
disabled auto-merge
October 17, 2026 18:51
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
AArnott
enabled auto-merge
October 17, 2026 18:58
This was referenced Nov 11, 2026
Bump StyleCop.Analyzers from 1.2.0-beta.556 to 1.3.180
microsoftgraph/aspnetcore-webhooks-sample#436
Open
This was referenced Nov 22, 2026
Open
[DPDBT] Bump Microsoft.CodeAnalysis.Analyzers and 6 others
sergey-rybalkin/CommandLine.Generators#63
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Fixes #4335