Allow else when {...} in MandatoryBracesIfStatements rule#3905
Merged
schalkms merged 2 commits intoJun 25, 2021
Conversation
This allows multi-line when statements following an else without requiring braces. Fixes #3708
Codecov Report
@@ Coverage Diff @@
## main #3905 +/- ##
============================================
- Coverage 83.55% 83.53% -0.02%
- Complexity 3118 3120 +2
============================================
Files 456 456
Lines 8973 8996 +23
Branches 1746 1753 +7
============================================
+ Hits 7497 7515 +18
- Misses 564 565 +1
- Partials 912 916 +4
Continue to review full report at Codecov.
|
cortinico
approved these changes
Jun 25, 2021
marschwar
approved these changes
Jun 25, 2021
| @@ -56,5 +57,6 @@ class MandatoryBracesIfStatements(config: Config = Config.empty) : Rule(config) | |||
| private fun KtIfExpression.isNotBlockOrIfExpression(): Boolean = | |||
Contributor
There was a problem hiding this comment.
The names of both extension functions seem wrong to me. The change has not exactly made it any better ;)
Member
Author
There was a problem hiding this comment.
Thanks! Those names should really be improved.
I'll change it in a separate PR.
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.
This allows multi-line when statements following an else without requiring braces.
Fixes #3708