Reports redundant semicolons (';') which may be removed.

Kotlin does not require semicolon at the end of each statement or expression line. Associated 'Remove redundant semicolon' quick-fix allows to amend the code.

Example:


  val myMap = mapOf("one" to 1, "two" to 2);
  myMap.forEach { (key, value) ->  print("$key -> $value")};

After the quick-fix is applied:


  val myMap = mapOf("one" to 1, "two" to 2)
  myMap.forEach { (key, value) ->  print("$key -> $value")}

There are two cases though where ';' is required:

  1. Statements placed on a single line need to be separated with semicolon:
    
      map.forEach { val (key, value) = it; println("$key -> $value") }
    
  2. 'enum' class having a list of enums and also properties or functions requires ';' after the enum list:
    
      enum class Mode {
        SILENT, VERBOSE;
    
        fun isSilent(): Boolean = this == SILENT
      }