You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

In order to improve readability (Why readability matters) here are some code style guidelines for the JMeter project.

Java

  • 4 spaces for indentation
    • No tabs (warning)
  • "Soft" line length of ~80
    • "Hard" line length of 120
      • Except for imports or other places where breaking the line wouldn't aid readability
  • Spacing between elements on a line e.g.
    • if (...
    • while (...
    • methodCall(arg1, arg2)
    • "con" + "cat"
  • Braces are always used with if, else, for, do and while statements, even when the body is empty or only a single statement
  • Import order
  • Import spacing
  • No .* imports
  • Line length of methods (soft limit of 50?)
  • Line length of classes (soft limit of 500?)

Java 8 Specific

  • Use of Optional
  • Default/static methods on Interfaces
  • Lambdas where possible (max ~5 lines)

See Also

  • No labels