Update: handle parentheses in multiline-ternary (fixes #13195) #13367
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.
Prerequisites checklist
What is the purpose of this pull request? (put an "X" next to an item)
[X] Bug fix
fixes #13195
This bug fix can produce more warnings for options
"always"
and"always-multiline"
, and fewer warnings for option"never"
.What changes did you make? (Give an overview)
The rule will now treat parentheses around
test
,consequent
, andalternate
as a part of them.The following added invalid tests for
"always"
and"always-multiline"
would be valid without this change:The following added valid tests for
"never
would be invalid without this change:All other added test cases are regression tests only (they were already valid/invalid).
Also, the reported location will now include parentheses.
Is there anything you'd like reviewers to focus on?
"never"
does not actually enforce that the entire ternary expression is on one line. This added test was already valid before this change:I'll open a separate issue for this.