Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Added information related to import order from AMBARI-19149

...

  • We use 2 spaces instead of 4.
  • Variable Declarations:
    “It is preferred that each variable be given its own line and comment. They should be listed in alphabetical order.”
    Comment only where it makes sense. - No need to do alphabetical sorting.
  • “JavaScript does not have block scope, so defining variables in blocks can confuse programmers who are experienced with other C family languages. Define all variables at the top of the function.” - This does not need to be followed.

Java Import Order

Some IDEs define their default import order differently and this can cause a lot of problems when creating patches and merging commits to different branches. The following are the checkstyle rules which are applied while executing the test phase of the build. Your IDE of choice should be updated to match these settings:

  • The use of the wild card character, '*', should be avoided and all imports should be explicitly stated.
  • The following order should be used for all import statements:
    • java
    • javax
    • org
    • com
    • other 

UI Unit Tests

All patches must be accompanied by unit tests ensuring good coverage.  When unit tests are not applicable (e.g., stylistic or layout changes, etc.), you must explicitly state in the JIRA that unit tests are not applicable.

...