Simple If State on multiple lines without brackets

Answered

Hello,

I cant find the right settings to do something like this on code cleanup:

if(foo)
bar1()
else
bar2()
0
1 comment

Hello,

The corresponding code inspection is considered an aesthetic one (rather than resulting in actual code enhancement), and therefore is not added to the list of cleanup code inspections by default.

The cleanup code inspection list cannot be customized at the moment, but I created a new feature request for it just now: IDEA-248814. Feel free to vote for the issue.

In the meantime, you can run this inspection via the Analyze | Run Inspection by Name menu option (Ctrl+Alt+Shift+I) for the opened file, whole project or any other custom scope of files:

In the Inspection Results window, you will be able to review all reported problems and bulk-fix them on file level:

Alternatively, you can perform the same bulk-fix operation as a quick fix action from the Alt+Enter context menu invoked on any 'if' statement in the file:

0

Please sign in to leave a comment.