Inspectopedia Help

Redundant 'if' statement

Reports if statements which can be simplified to a single statement.

Example:

fun test(): Boolean { if (foo()) { return true } else { return false } }

After the quick-fix is applied:

fun test(): Boolean { return foo() }

Inspection options

Here you can find the description of settings available for the Redundant 'if' statement inspection, and the reference of their default values.

Ignore chained 'if' statements

Default: Selected

Inspection Details

By default bundled with:

IntelliJ IDEA 2024.1, Qodana for JVM 2024.1,

Can be installed with plugin:

Kotlin, 241.16690-IJ

Last modified: 29 April 2024