Style issues
- 'String.format' call can be replaced with string templates
Reports String.format calls that can be replaced with string templates.
- 'arrayOf' call can be replaced with array literal [...]
Reports arrayOf calls that can be replaced with array literals [...].
- 'assert' call can be replaced with '!!' or '?:'
Reports assert calls that check a not null value of the declared variable.
- 'associate' can be replaced with 'associateBy' or 'associateWith'
Reports calls to associate() and associateTo() that can be replaced with associateBy() or associateWith().
- 'copy' method of data class is called without named arguments
Reports calls to a data class' copy() method without named arguments.
- 'filterIsInstance' call with a class literal argument
Reports calls of the Kotlin standard library function filterIsInstance with a class literal argument.
- 'if' condition can be replaced with lambda call
Reports isEmpty, isBlank, isNotEmpty, or isNotBlank calls in an if statement to assign a default value.
- 'map.get()' with not-null assertion operator (!!)
Reports map.get()!! that can be replaced with map.getValue(), map.getOrElse(), and so on.
- 'map.put()' can be converted to assignment
Reports map.put function calls that can be replaced with indexing operator ([]).
- 'protected' visibility is effectively 'private' in a final class
Reports protected visibility used inside of a final class.
- 'rangeTo' or the '..' call should be replaced with '..<'
Reports calls to rangeTo or the .
- 'rangeTo' or the '..' call should be replaced with 'until'
Reports calls to rangeTo or the .
- 'readLine' can be replaced with 'readln' or 'readlnOrNull'
Reports calls to readLine() that can be replaced with readln() or readlnOrNull().
- 'substring' call should be replaced with 'dropLast' call
Reports calls like s.substring(0, s.length - x) that can be replaced with s.dropLast(x).
- 'substring' call should be replaced with 'substringAfter'
Reports calls like s.substring(s.indexOf(x)) that can be replaced with s.substringAfter(x).
- 'substring' call should be replaced with 'substringBefore'
Reports calls like s.substring(0, s.indexOf(x)) that can be replaced with s.substringBefore(x).
- 'substring' call should be replaced with 'take' call
Reports calls like s.substring(0, x) that can be replaced with s.take(x).
- 'substring' call should be replaced with indexing operator
Reports calls like "abc".substring(0, 1) that can be replaced with "abc"[0].
- 'to' call should be replaced with infix form
Reports to function calls that can be replaced with the infix form.
- 'when' that can be simplified by introducing an argument
Reports a when expression that can be simplified by introducing a subject argument.
- Accessor call that can be replaced with property access syntax
Reports Java get and set method calls that can be replaced with the Kotlin synthetic properties.
- Assert boolean could be replaced with assert equality
Reports calls to assertTrue() and assertFalse() that can be replaced with assert equality functions.
- Assignment can be replaced with operator assignment
Reports modifications of variables with a simple assignment (such as y = y + x) that can be replaced with an operator assignment.
- Boolean expression can be simplified
Reports boolean expression parts that can be reduced to constants.
- Boolean literal argument without parameter name
Reports call arguments with Boolean type without explicit parameter names specified.
- Boxed properties should be replaced with unboxed
Reports boxed Range.start and Range.endInclusive properties.
- Call chain on collection could be converted into 'Sequence' to improve performance
Reports call chain on a Collection that should be converted into Sequence.
- Call chain on collection type can be simplified
Reports two-call chains replaceable by a single call.
- Call of 'toString' could be replaced with string template
Reports toString function calls that can be replaced with a string template.
- Can be replaced with binary operator
Reports function calls that can be replaced with binary operators, in particular comparison-related ones.
- Can be replaced with function reference
Reports function literal expressions that can be replaced with function references.
- Can be replaced with lambda
Reports a function reference expression that can be replaced with a function literal (lambda).
- Cascade 'if' can be replaced with 'when'
Reports if statements with three or more branches that can be replaced with the when expression.
- Class member can have 'private' visibility
Reports declarations that can be made private to follow the encapsulation principle.
- Collection count can be converted to size
Reports calls to Collection<T>.count().
- Convert Pair constructor to 'to' function
Reports a Pair constructor invocation that can be replaced with a to() infix function call.
- Convert to primary constructor
Reports a secondary constructor that can be replaced with a more concise primary constructor.
- Convert try / finally to use() call
Reports a try-finally block with resource.close() in finally which can be converted to a resource.use() call.
- Equality check can be used instead of elvis for nullable boolean check
Reports cases when an equality check should be used instead of the elvis operator.
- Explicit 'get' or 'set' call
Reports explicit calls to get or set functions which can be replaced by an indexing operator [].
- Expression body syntax is preferable here
Reports return expressions (one-liners or when) that can be replaced with expression body syntax.
- Fully qualified name can be replaced with existing import alias
Reports fully qualified names that can be replaced with an existing import alias.
- Function should have 'operator' modifier
Reports a function that matches one of the operator conventions but lacks the operator keyword.
- Function with '= { ... }' and inferred return type
Reports functions with = { ..
- Guard clause can be replaced with Kotlin's function call
Reports guard clauses that can be replaced with a function call.
- If-Null return/break/... foldable to '?:'
Reports an if expression that checks variable being null or not right after initializing it that can be converted into an elvis operator in the initializer.
- If-Then foldable to '?.'
Reports if-then expressions that can be folded into safe-access (?.) expressions.
- If-Then foldable to '?:'
Reports if-then expressions that can be folded into elvis (?:) expressions.
- Implicit 'this'
Reports usages of implicit this.
- Java Collections static method call can be replaced with Kotlin stdlib
Reports a Java Collections static method call that can be replaced with Kotlin stdlib.
- Java Map.forEach method call should be replaced with Kotlin's forEach
Reports a Java Map.forEach method call that can be replaced with Kotlin's forEach.
- Java methods should be replaced with Kotlin analog
Reports a Java method call that can be replaced with a Kotlin function, for example, System.out.println().
- Join declaration and assignment
Reports property declarations that can be joined with the following assignment.
- Lambda argument inside parentheses
Reports lambda expressions in parentheses which can be moved outside.
- Library function call could be simplified
Reports library function calls which could be replaced by simplified one.
- Local 'var' is never modified and can be declared as 'val'
Reports local variables declared with the var keyword that are never modified.
- Loop can be replaced with stdlib operations
Reports for loops that can be replaced with a sequence of stdlib operations (like map, filter, and so on).
- Main parameter is not necessary
Reports main function with an unused single parameter.
- Manually incremented index variable can be replaced with use of 'withIndex()'
Reports for loops with a manually incremented index variable.
- Might be 'const'
Reports top-level val properties in objects that might be declared as const for better performance and Java interoperability.
- Multiple operators with different precedence
Reports binary expressions that consist of different operators without parentheses.
- Negated boolean expression can be simplified
Reports negated boolean expressions that can be simplified.
- Negated call can be simplified
Reports negation isEmpty() and isNotEmpty() for collections and String, or isBlank() and isNotBlank() for String.
- Nested lambda has shadowed implicit parameter
Reports nested lambdas with shadowed implicit parameters.
- Non-canonical modifier order
Reports modifiers that do not follow the order recommended by the style guide.
- Non-idiomatic 'is' type check for an object
Reports non-idiomatic is type checks for an object.
- Not-null assertion can be replaced with 'return'
Reports not-null assertion (!!) calls that can be replaced with the elvis operator and return (?: return).
- Object literal can be converted to lambda
Reports anonymous object literals implementing a Java interface with a single abstract method that can be converted into a call with a lambda expression.
- Optionally expected annotation has no actual annotation
Reports optionally expected annotations without actual annotation in some platform modules.
- Range can be converted to indices or iteration
Reports until and rangeTo operators that can be replaced with Collection.indices or iteration over collection inside for loop.
- Redundant 'asSequence' call
Reports redundant asSequence() call that can never have a positive performance effect.
- Redundant 'else' in 'if'
Reports redundant else in if with return.
- Redundant 'runCatching' call
Reports runCatching calls that are immediately followed by getOrThrow.
- Remove unnecessary parentheses
Reports redundant empty parentheses in annotation entries.
- Replace 'mapIndexed' with List generator
Reports a mapIndexed call that can be replaced by List generator.
- Replace 'until' with '..<' operator
Reports until that can be replaced with ..< operator.
- Return or assignment can be lifted out
Reports if, when, and try statements that can be converted to expressions by lifting the return statement or an assignment out.
- Safe cast with 'return' should be replaced with 'if' type check
Reports safe cast with return that can be replaced with if type check.
- Scope function can be converted to another one
Reports scope functions (let, run, apply, also) that can be converted between each other.
- Scope function with nested forEach can be simplified
Reports forEach functions in the scope functions such as also or apply that can be simplified.
- Size check can be replaced with 'isNotEmpty()'
Reports size checks of Collections/Array/String that should be replaced with isNotEmpty().
- Size zero check can be replaced with 'isEmpty()'
Reports size == 0 checks on Collections/Array/String that should be replaced with isEmpty().
- String concatenation that can be converted to string template
Reports string concatenation that can be converted to a string template.
- Suspicious 'asDynamic' member invocation
Reports usages of asDynamic function on a receiver of dynamic type.
- Trailing comma recommendations
Reports trailing commas that do not follow the recommended style guide.
- Two comparisons should be converted to a range check
Reports two consecutive comparisons that can be converted to a range check.
- Type parameter can have 'in' or 'out' variance
Reports type parameters that can have in or out variance.
- Unlabeled return inside lambda
Reports unlabeled return expressions inside inline lambda.
- Use destructuring declaration
Reports declarations that can be destructured.
- Variable declaration could be moved inside 'when'
Reports variable declarations that can be moved inside a when expression.
- Verbose nullability and emptiness check
Reports combination of null and emptiness checks that can be simplified into a single check.