Inspectopedia 2024.3 Help

Redundant 'if' statement

Reports an if statement that can be simplified to a single assignment or a return statement.

Example:

if(foo()) { return true; } else { return false; }

After applying the quick-fix the code looks as follows:

return foo();

Locating this inspection

By ID

Can be used to locate inspection in e.g. Qodana configuration files, where you can quickly enable or disable it, or adjust its settings.

RedundantIfStatementJS
Via Settings dialog

Path to the inspection settings via IntelliJ Platform IDE Settings dialog, when you need to adjust inspection settings directly from your IDE.

Settings or Preferences | Editor | Inspections | JavaScript and TypeScript | Control flow issues

Last modified: 03 December 2024