Code Formatting - BloomReach Experience - Open Source CMS

Code Formatting

Formatting Files for IDEs

IntelliJ IDEA

hippo_intellij_code_style.xml

The code style xml file contains formatting for Java, XML, JSP(X), Freemarker, HTML, CSS, LessCSS, Sass, SCSS, Stylus, Javascript, Coffeescript, Typescript and JSON.
To install it go through the following steps:

  • Copy the settings XML file to the code styles directory. Its location is platform dependent, and is listed below. Please note that you need to replace <product-name> with the name and version of IDEA you use.

    • Mac OS X:

      ~/Library/Preferences/<product-name>/codestyles/
    • Linux:

      ~/.<product-name>/config/codeStyles/
    • Windows:

      <User home>\.<product-name>\config\codeStyles\

  • Start IntelliJ

  • In the Preferences go to "Editor" - "Code Style" - "Scheme" and choose the previously imported style from the drop-down box

  • Optionally apply the style to one project only by clicking on "Copy to Project" and selecting "Use per project settings" afterwards

  • In Idea >= 10, use File -> Export/Import settings. This will allow you to select/deselect from many categories of settings (including code style).

Eclipse

hippo-eclipse-formatting.xml

  • Important: you still need to configure to use spaces instead of tabs.

  • Important: Eclipse formatting rules don't incorporate package import order or when wildcard importing should be used. See imports section below how it should be configured manually.

  • The Eclipse formatting file is not actively maintained and may not be up-to-date.

Formatting for Specific Languages

When you encounter a source file which is not compliant to the formatting rules, before making other changes, first commit (only) the formatting changes!
Did you find this page helpful?
How could this documentation serve you better?
On this page
    Did you find this page helpful?
    How could this documentation serve you better?