diktat icon indicating copy to clipboard operation
diktat copied to clipboard

Improve the reporting of `WRONG_ORDER_IN_CLASS_LIKE_STRUCTURES` check

Open 0x6675636b796f75676974687562 opened this issue 2 years ago • 0 comments

DiKTat requires that private fields named logger are placed before constant values. The code below is correct:

import java.util.logging.Logger

object C {
    private val logger = Logger.getLogger("")

    const val CONST0 = "This is a constant"

    val val0 = Logger.getLogger("")

    val val1 = Logger.getLogger("")
}

There're two issues with the above, though:

  • This behaviour is not documented.
  • Error reporting could be improved.

Environment information

  • diktat version: 1.2.3