Skip to content

Files

Latest commit

 

History

History
34 lines (23 loc) · 622 Bytes

UnusedPrivateProperty.md

File metadata and controls

34 lines (23 loc) · 622 Bytes

Pattern: Unused private property

Issue: -

Description

An unused private property can be removed to simplify the source file.

This rule also detects unused constructor parameters since these can become properties of the class when they are declared with val or var.

Example of incorrect code:

class Foo {
  private val unused = "unused"
}

Example of correct code:

class Foo {
  private val used = "used"

  fun greet() {
    println(used)
  }
}

Further Reading