Inspectopedia 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) }

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.1, Qodana for JVM 2024.1,

Can be installed with plugin:

Kotlin, 241.16690-IJ

Last modified: 29 April 2024