Inspectopedia 2024.3 Help

Boolean literal argument without parameter name

Reports call arguments with Boolean type without explicit parameter names specified.

When multiple boolean literals are passed sequentially, it's easy to forget parameter ordering that could lead to mistakes. Explicit parameter names allow for easier code reading and understanding.

Example:

fun check(checkName: Boolean, checkAddress: Boolean, checkPhone: Boolean) {} fun usage() { check(true, false, true) // What does this mean? }

The quick-fix adds missing parameter names:

fun check(checkName: Boolean, checkAddress: Boolean, checkPhone: Boolean) {} fun usage() { check(checkName = true, checkAddress = false, checkPhone = true) }

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.

BooleanLiteralArgument
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 | Kotlin | Style issues

Inspection options

Here you can find the description of settings available for the Boolean literal argument without parameter name inspection, and the reference of their default values.

Report also on call with single boolean literal argument

Not selected

Inspection Details

By default bundled with:

IntelliJ IDEA 2024.3, Qodana for JVM 2024.3,

Can be installed with plugin:

Kotlin, 243.23126-IJ

Last modified: 03 December 2024