Skip to content

BracesOnIfStatements: fix false-positive when chained#7444

Merged
BraisGabin merged 1 commit into
detekt:mainfrom
bomiyr:braces_on_if_statements_false_positive_in_chain
Jul 7, 2024
Merged

BracesOnIfStatements: fix false-positive when chained#7444
BraisGabin merged 1 commit into
detekt:mainfrom
bomiyr:braces_on_if_statements_false_positive_in_chain

Conversation

@bomiyr
Copy link
Copy Markdown
Contributor

@bomiyr bomiyr commented Jul 5, 2024

BracesOnIfStatements configured with multiLine=always/consistent reports violation in case of if-else-if-else chained with other expressions. For example:

if (true) {
    ""
} else if (true) {
    ""
} else {
    ""
}.trim()

This MR fixes such issues

@detekt-ci detekt-ci added the rules label Jul 5, 2024
@codecov
Copy link
Copy Markdown

codecov Bot commented Jul 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.68%. Comparing base (f29f50c) to head (8937249).

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #7444   +/-   ##
=========================================
  Coverage     84.68%   84.68%           
- Complexity     4167     4169    +2     
=========================================
  Files           572      572           
  Lines         11926    11930    +4     
  Branches       2462     2466    +4     
=========================================
+ Hits          10099    10103    +4     
  Misses          582      582           
  Partials       1245     1245           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Copy Markdown
Member

@schalkms schalkms left a comment

Choose a reason for hiding this comment

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

Thanks
Looks good

@schalkms schalkms added this to the 2.0.0 milestone Jul 7, 2024
@BraisGabin BraisGabin merged commit 9b901e5 into detekt:main Jul 7, 2024
@BraisGabin BraisGabin added the pick request Marker for PRs that should be ported to the 1.0 release branch label Jul 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pick request Marker for PRs that should be ported to the 1.0 release branch rules

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants