Skip to content

Best Practices #1 maven checkstyle plugin enforcements

chronical edited this page May 3, 2017 · 4 revisions

Table of contents:


Automatic Coding Best Practices Enforcement

  • fails if more than 2 exceptions are found (there are 2 warnings that can not be refactored in a decent way)
  • character encoding: UTF-8
  • check there are no tab characters
  • checks that the outer type name and the file name match. For example, the class Foo must be in a file named Foo.java.
  • restrict using Unicode escapes (e.g. \u221e).
  • line length is maximum 130
  • checks there are no * imports (import java.*)
  • checks that each top-level class, interfaces or enum resides in a source file of its own.
  • checks that chosen statements are not line-wrapped.
  • checks there are no empty blocks (if (something) {})
  • checks for braces around code blocks.
  • checks for whitespace around operators and instructions (+, -, *, if etc)
  • checks for only one statement per line
  • checks there are no multiple variable declarations
  • checks the default case for switch is not missing
  • checks that the package is contained in the io.cloudslang.content package and the name starts with a lower letter and contains only low letters and digits
  • checks variable names (camelCase)
  • checks indentation
  • checks the distance from the variable declaration and variable usage is not greater than 3
  • checks comments indentation
Clone this wiki locally