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

Allow else when {...} in MandatoryBracesIfStatements rule #3905

Merged
merged 2 commits into from
Jun 25, 2021
Merged

Allow else when {...} in MandatoryBracesIfStatements rule #3905

merged 2 commits into from
Jun 25, 2021

Conversation

schalkms
Copy link
Member

This allows multi-line when statements following an else without requiring braces.

Fixes #3708

This allows multi-line when statements following an else without requiring braces.

Fixes #3708
@schalkms schalkms added this to the 1.18.0 milestone Jun 25, 2021
@codecov
Copy link

codecov bot commented Jun 25, 2021

Codecov Report

Merging #3905 (9bec25a) into main (66f20e7) will decrease coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             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     
Impacted Files Coverage Δ
...ules/style/optional/MandatoryBracesIfStatements.kt 68.75% <100.00%> (+2.08%) ⬆️
...ls/src/main/kotlin/io/github/detekt/psi/KtFiles.kt 73.52% <0.00%> (-4.25%) ⬇️
...rturbosch/detekt/rules/style/UnusedPrivateClass.kt 73.33% <0.00%> (+3.33%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 66f20e7...9bec25a. Read the comment docs.

@@ -56,5 +57,6 @@ class MandatoryBracesIfStatements(config: Config = Config.empty) : Rule(config)
private fun KtIfExpression.isNotBlockOrIfExpression(): Boolean =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The names of both extension functions seem wrong to me. The change has not exactly made it any better ;)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Those names should really be improved.
I'll change it in a separate PR.

@schalkms schalkms merged commit 54a42d5 into detekt:main Jun 25, 2021
@schalkms schalkms deleted the #3708-fix_MandatoryBracesIfStatements branch June 25, 2021 19:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow multi-line when statement following an else without requiring braces
3 participants