Skip to content

Instantly share code, notes, and snippets.

@keith-turner
Created March 10, 2015 19:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save keith-turner/ee0deafe88fa9f5bc43f to your computer and use it in GitHub Desktop.
Save keith-turner/ee0deafe88fa9f5bc43f to your computer and use it in GitHub Desktop.
Example Checkstyle rule for Accumulo Public API
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.14</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<configuration>
<checkstyleRules>
<module name="Checker">
<module name="TreeWalker">
<module name="AvoidStarImport"/>
<module name="RegexpSinglelineJava">
<!--check that only Accumulo public APIs are imported-->
<property name="format" value="import\s+org\.apache\.accumulo\.(.*\.(impl|thrift)\..*|(?!core|minicluster).*|core\.(?!client|data|security\.Authorizations|security\.ColumnVisibility).*|core\.data\.(?!Key|Mutation|Value|Range|Condition|ConditionalMutation|ByteSequence|PartialKey|ColumnUpdate).*)"/>
<property name="ignoreComments" value="true"/>
<property name="message" value="Accumulo non-public classes imported"/>
</module>
</module>
</module>
</checkstyleRules>
<failOnViolation>true</failOnViolation>
</configuration>
<executions>
<execution>
<id>check-style</id>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
@keith-turner
Copy link
Author

What this rule checks for differs from what specified in the Accumulo README as the public API. Opened ACCUMULO-3657 to address this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment