A function without parameters only returns a literal, which a constant says more simply

tx0/kotlin:function-only-returns-literalallwarningstyle/conventionsdepth faststyle

What it finds

fun maxRetries() = 3 is a constant written as a function. A const val or a property says so. Overrides, open, abstract and expect or actual members are left out.

From the rule's source, constant_function.rs.

Example from the rule's tests
fun maxRetries() = 3tx0 reports: maxRetries only returns 3fun name(): String {tx0 reports: name only returns    return "service"}override fun id() = 4fun now() = System.currentTimeMillis()
Highlighted lines are the ones tx0 reports, with its message under each; the other lines are left alone.

Turn it on, off or suppress it

The rule runs from the all tier up. To turn it on in a lower tier, give it a level in tx0.toml:

tx0.toml
[rules]
"tx0/kotlin:function-only-returns-literal" = "warning"

To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:

// tx0: ignore[tx0/kotlin:function-only-returns-literal] reason="..."

tx0 explain tx0/kotlin:function-only-returns-literal shows the same in the terminal. Found a false positive? Report it.