KT.LIBRARY_CODE_MUST_SPECIFY_RETURN_TYPE
Public APIs doesn't have an explicit return type
Functions/properties exposed as public APIs of a library should have an explicit return type. Inferred return type can easily be changed by mistake which may lead to breaking changes.
Noncompliant Code
Copy
// code from a library
val strs = listOf("foo, bar")
fun bar() = 5
class Parser {
fun parse() = ...
}
Compliant Code
Copy
// code from a library
val strs: List<String> = listOf("foo, bar")
fun bar(): Int = 5
class Parser {
fun parse(): ParsingResult = ...
}
Options
-
excludes
(default:['**']
)path filter