Checkstyle

Checkstyle is a development tool to help programmers write Java code that adheres to a coding standard. It automates the process of checking Java code to spare humans of this boring (but important) task.

http://checkstyle.sourceforge.net/

Enabling Checkstyle

Checkstyle can be used by a command line interface or integrated in the build process(e.g., An Ant task). Additionally plug-ins are written by third-parties, such as Maven Checkstyle and Gradle Checkstyle. Take a Maven project as an example, to enable Checkstyle, first add following lines in your configuration:

build:
    environment:
        java: 'java-8-oracle'

    nodes:
        analysis:
            tests:
                override:
                    -
                        command: 'mvn checkstyle:checkstyle'
                        analysis:
                            file: 'path/to/checkstyle-result.xml' #path to analysis result of Checkstyle
                            format: 'general-checkstyle' #supported format by Scrutinizer

then configure Checkstyle under the build element or reporting element in your pom.xml :

<project>

    ...
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <version>2.17</version>
                <dependencies>
                    <dependency>
                        <groupId>com.puppycrawl.tools</groupId>
                        <artifactId>checkstyle</artifactId>
                        <version>7.0</version>
                    </dependency>
                    <dependency>
                        <groupId>com.github.sevntu.checkstyle</groupId>
                        <artifactId>sevntu-checkstyle-maven-plugin</artifactId>
                        <version>1.21.0</version>
                    </dependency>
                </dependencies>

                <configuration>
                    <configLocation>checkstyle-ruleset.xml</configLocation>
                    <failOnViolation>false</failOnViolation>
                </configuration>
            </plugin>
        </plugins>
    </build>
    ...

</project>