A parameter of a private function is never read
What it finds
A private function can be changed with all of its callers, so a parameter it ignores can go. Overrides, operators and annotated functions are left alone, as their signature is given, and so are parameters named _ or starting with unused. A parameter of a function type with a receiver counts as read where the body calls it on a receiver, as ext.block().
From the rule's source, unused_parameter.rs.
class Formatter { private fun format(value: Int, width: Int): String = value.toString()tx0 reports: the parameter width is never read fun public(value: Int, unusedHere: Int) = value private fun ignored(_unusedFlag: Boolean, unusedSize: Int) = 1 override fun toString() = format(1, 2) + ignored(true, 1)} private fun Project.android(block: AndroidExtension.() -> Unit) { val ext = extensions.getByType(AndroidExtension::class.java) ext.block()} Turn it on, off or suppress it
The rule runs from the strict tier up. To turn it on in a lower tier, give it a level in tx0.toml:
[rules]
"tx0/kotlin:unused-parameter" = "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:unused-parameter] reason="..."tx0 explain tx0/kotlin:unused-parameter shows the same in the terminal. Found a false positive? Report it.