Restrictive configurations for Java static analysis tools.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Paweł Płazieński 0e4a154fc0 Release version 7.1.0 5 months ago
conf Adjust checkstyle rules to version 8.32 5 months ago
.gitignore added gitignore 4 years ago
LICENSE Create license 4 years ago
README.md Add separate rules for javadoc 6 months ago
pom.xml Release version 7.1.0 5 months ago

README.md

buildable

Buildable is a set of very restrictive configurations for static analysis tools for Java, distributed as a single maven artifact.

Usage

To use these configurations, add a following plugin section to your pom file and define buildable.version property (or just replace variable).

For PMD:

<plugin>
	<groupId>org.apache.maven.plugins</groupId>
	<artifactId>maven-pmd-plugin</artifactId>
	<version>3.7</version>
	<dependencies>
		<dependency>
			<groupId>org.perfectable</groupId>
			<artifactId>buildable</artifactId>
			<version>${buildable.version}</version>
		</dependency>
	</dependencies>
	<executions>
		<execution>
		    <id>pmd-check</id>
			<goals>
				<goal>check</goal>
			</goals>
			<phase>process-sources</phase>
		</execution>
	</executions>
	<configuration>
		<linkXRef>false</linkXRef>
		<rulesets>
			<ruleset>pmd-base.xml</ruleset>
			<ruleset>pmd-javadoc.xml</ruleset>
		</rulesets>
	</configuration>
</plugin>

You can also add <suppressMarker>SUPPRESS</suppressMarker> in configuration to have single tag working with Checkstyle.

For Checkstyle:

<plugin>
	<groupId>org.apache.maven.plugins</groupId>
	<artifactId>maven-checkstyle-plugin</artifactId>
	<version>2.17</version>
	<executions>
		<execution>
			<id>verify-style</id>
			<phase>process-sources</phase>
			<goals>
				<goal>check</goal>
			</goals>
			<configuration>
				<configLocation>checkstyle-base.xml</configLocation>
			</configuration>
		</execution>
		<execution>
			<id>verify-javadoc</id>
			<phase>process-sources</phase>
			<goals>
				<goal>check</goal>
			</goals>
			<configuration>
				<configLocation>checkstyle-javadoc.xml</configLocation>
			</configuration>
		</execution>
	</executions>
	<dependencies>
		<dependency>
			<groupId>com.puppycrawl.tools</groupId>
			<artifactId>checkstyle</artifactId>
			<version>7.2</version>
		</dependency>
		<dependency>
			<groupId>org.perfectable</groupId>
			<artifactId>buildable</artifactId>
			<version>${buildable.version}</version>
		<dependency>
	</dependencies>
	<configuration>
		<failOnViolation>true</failOnViolation>
		<logViolationsToConsole>true</logViolationsToConsole>
	</configuration>
</plugin>

If you don't want your build to fail because of analysis violations, replace check goal with pmd for PMD or replace failOnViolation with false for Checkstyle.