Version 3

    Introduction

     

    GateIn tries to align with other projects at jboss.org where possible. Therefore code formatting rules were mostly inspired from JBoss AS7 project.

     

    General rules

    • Line width limit - 128
    • Indentation in java files - 4
    • Indentation in xml files - 2

     

    Example java file:

    https://github.com/gatein/gatein-portal/blob/master/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfig.java

     

    Build level enforcement

     

    GateIn leverages maven checkstyle plugin to enforce proper formatting. All rules are explained with comments directly in the config file. Please check the current state here:

     

    https://github.com/gatein/gatein-portal/blob/master/build-config/src/main/resources/gatein-portal-checkstyle/checkstyle.xml

     

    More detailed info about specific rules can be obtained in chestyle plugin documentation.

     

    Checkstyle plugin only enforces java files formatting. Formatting of all other files should be validate by person merging commits into git repository.

     

    IDE support

    For each major IDE there is formatting configuration availabe:

     

    https://github.com/gatein/gatein-portal/tree/master/ide-configs

     

    Eclipse formatting rules are the most valid and reference ones because it is impossible to provide perfectly matching formatting configuration for IntelliJ IDEA and Netbeans. It is possible and advised to configure IntelliJ IDEA to use Eclipse formatting configuration via plugin like explained here