Inspectopedia Help

Redundant constructs

'when' has only 'else' branch and can be simplified  

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

Condition of 'if' expression is constant  

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

Constructor parameter is never used as a property  

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

Null-checks can be replaced with safe-calls  

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

Obvious explicit type  

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

Property is explicitly assigned to constructor parameter  

Reports properties that are explicitly assigned to primary constructor parameters.

Redundant '?: return null'  

Reports redundant ?: return null.

Redundant 'Companion' reference  

Reports redundant Companion reference.

Redundant 'Unit'  

Reports redundant Unit expressions.

Redundant 'Unit' return type  

Reports a redundant Unit return type which can be omitted.

Redundant 'constructor' keyword  

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  

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

Redundant 'requireNotNull' or 'checkNotNull' call  

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

Redundant 'return' label  

Reports redundant return labels outside of lambda expressions.

Redundant 'suspend' modifier  

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

Redundant 'with' call  

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

Redundant SAM constructor  

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

Redundant argument-based 'let' call  

Reports a redundant argument-based let call.

Redundant backticks  

Reports redundant backticks in references.

Redundant call of conversion method  

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

Redundant call to 'toString()' in string template  

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

Redundant constructor body  

Reports empty bodies of secondary constructors.

Redundant creation of lambda or anonymous function  

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

Redundant curly braces in string template  

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

Redundant diagnostic suppression  

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  

Reports empty primary constructors when they are implicitly available anyway.

Redundant enum constructor invocation  

Reports redundant constructor invocation on an enum entry.

Redundant explicit 'this'  

Reports an explicit this when it can be omitted.

Redundant lambda arrow  

Reports redundant lambda arrows in lambdas without parameters.

Redundant modality modifier  

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  

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

Redundant overriding method  

Reports redundant overriding declarations.

Redundant property getter  

Reports redundant property getters.

Redundant property setter  

Reports redundant property setters.

Redundant qualifier name  

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

Redundant receiver-based 'let' call  

Reports redundant receiver-based let calls.

Redundant semicolon  

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

Redundant setter parameter type  

Reports explicitly specified parameter types in property setters.

Redundant spread operator  

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

Redundant string template  

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

Redundant value argument  

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

Redundant visibility modifier  

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  

Reports declarations of classes and objects with an empty body.

Should be replaced with 'equals(..., ignoreCase = true)'  

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

Simplifiable 'when'  

Reports when expressions with the constant true or false branches.

Unnecessary '@OptIn' annotation  

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  

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

Unnecessary supertype qualification  

Reports super member calls with redundant supertype qualification.

Unnecessary type argument  

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

Unused import directive  

Reports redundant import statements.

Unused loop index  

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

Unused receiver parameter  

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

Unused symbol  

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

Last modified: 18 June 2024