Inspectopedia 2024.3 Help

Redundant constructs

'when' has only 'else' branch and can be simplified   New in this release

Reports when expressions with only an else branch that can be simplified.

Condition of 'if' expression is constant   New in this release

Reports if expressions that have true or false constant literal condition and can be simplified.

Constructor parameter is never used as a property   New in this release

Reports primary constructor parameters that can have val or var removed.

Null-checks can be replaced with safe-calls   New in this release

Reports chained null-checks that can be replaced with safe-calls.

Obvious explicit type   New in this release

Reports local variables' explicitly given types which are obvious and thus redundant, like val f: Foo = Foo().

Property is explicitly assigned to constructor parameter   New in this release

Reports properties that are explicitly assigned to primary constructor parameters.

Redundant '?: return null'   New in this release

Reports redundant ?: return null.

Redundant 'Companion' reference   New in this release

Reports redundant Companion reference.

Redundant 'Unit'   New in this release

Reports redundant Unit expressions.

Redundant 'Unit' return type   New in this release

Reports a redundant Unit return type which can be omitted.

Redundant 'constructor' keyword   New in this release

Reports a redundant 'constructor' keyword on primary constructors.

Redundant 'if' statement  

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

Redundant 'inner' modifier   New in this release

Reports the inner modifier on a class as redundant if it doesn't reference members of its outer class.

Redundant 'requireNotNull' or 'checkNotNull' call   New in this release

Reports redundant requireNotNull or checkNotNull call on non-nullable expressions.

Redundant 'return' label   New in this release

Reports redundant return labels outside of lambda expressions.

Redundant 'suspend' modifier   New in this release

Reports suspend modifier as redundant if no other suspending functions are called inside.

Redundant 'with' call   New in this release

Reports redundant with function calls that don't access anything from the receiver.

Redundant SAM constructor   New in this release

Reports SAM (Single Abstract Method) constructor usages which can be replaced with lambdas.

Redundant argument-based 'let' call   New in this release

Reports a redundant argument-based let call.

Redundant backticks   New in this release

Reports redundant backticks in references.

Redundant call of conversion method   New in this release

Reports redundant calls to conversion methods (for example, toString() on a String or toDouble() on a Double).

Redundant call to 'toString()' in string template   New in this release

Reports calls to toString() in string templates that can be safely removed.

Redundant constructor body   New in this release

Reports empty bodies of secondary constructors.

Redundant creation of lambda or anonymous function   New in this release

Reports lambdas or anonymous functions that are created and used immediately.

Redundant curly braces in string template   New in this release

Reports usages of curly braces in string templates around simple identifiers.

Redundant diagnostic suppression   New in this release

Reports usages of @Suppress annotations that can be safely removed because the compiler diagnostic they affect is no longer applicable in this context.

Redundant double negation  

Reports redundant double negations.

Redundant empty primary constructor   New in this release

Reports empty primary constructors when they are implicitly available anyway.

Redundant enum constructor invocation   New in this release

Reports redundant constructor invocation on an enum entry.

Redundant explicit 'this'   New in this release

Reports an explicit this when it can be omitted.

Redundant labeled return on the last expression in a lambda   New in this release

Reports labeled returns used on the last expressions in lambdas.

Redundant lambda arrow   New in this release

Reports redundant lambda arrows in lambdas without parameters.

Redundant modality modifier   New in this release

Reports the modality modifiers that match the default modality of an element (final for most elements, open for members with an override).

Redundant nullable return type   New in this release

Reports functions and variables with nullable return type which never return or become null.

Redundant overriding method   New in this release

Reports redundant overriding declarations.

Redundant property getter   New in this release

Reports redundant property getters.

Redundant property setter   New in this release

Reports redundant property setters.

Redundant qualifier name   New in this release

Reports redundant qualifiers (or their parts) on class names, functions, and properties.

Redundant receiver-based 'let' call   New in this release

Reports redundant receiver-based let calls.

Redundant semicolon  

Reports redundant semicolons (;) that can be safely removed.

Redundant setter parameter type   New in this release

Reports explicitly specified parameter types in property setters.

Redundant spread operator   New in this release

Reports the use of a redundant spread operator for a family of arrayOf function calls.

Redundant string template   New in this release

Reports single-expression string templates that can be safely removed.

Redundant value argument   New in this release

Reports arguments that are equal to the default values of the corresponding parameters.

Redundant visibility modifier   New in this release

Reports visibility modifiers that match the default visibility of an element (public for most elements, protected for members that override a protected member).

Replace empty class body   New in this release

Reports declarations of classes and objects with an empty body.

Should be replaced with 'equals(..., ignoreCase = true)'   New in this release

Reports case-insensitive comparisons that can be replaced with equals(..., ignoreCase = true).

Simplifiable 'when'   New in this release

Reports when expressions with the constant true or false branches.

Unnecessary '@OptIn' annotation   New in this release

Reports unnecessary opt-in annotations that can be safely removed.

Unnecessary local variable  

Reports local variables that are used only in the very next return statement or are exact copies of other variables.

Unnecessary parentheses in function call with lambda   New in this release

Reports redundant empty parentheses of function calls where the only parameter is a lambda that's outside the parentheses.

Unnecessary supertype qualification   New in this release

Reports super member calls with redundant supertype qualification.

Unnecessary type argument   New in this release

Reports function calls with type arguments that can be automatically inferred.

Unused import directive   New in this release

Reports redundant import statements.

Unused loop index   New in this release

Reports for loops iterating over a collection using the withIndex() function and not using the index variable.

Unused receiver parameter   New in this release

Reports receiver parameter of extension functions and properties that is not used.

Unused symbol   New in this release

Reports symbols that are not used or not reachable from entry points.

Last modified: 11 September 2024