Browse Source

Add separate rules for javadoc

tags/v7.0.0
parent
commit
400d7526bc
6 changed files with 112 additions and 34 deletions
  1. +16
    -3
      README.md
  2. +5
    -23
      conf/checkstyle-base.xml
  3. +76
    -0
      conf/checkstyle-javadoc.xml
  4. +2
    -7
      conf/pmd-base.xml
  5. +12
    -0
      conf/pmd-javadoc.xml
  6. +1
    -1
      pom.xml

+ 16
- 3
README.md View File

@@ -32,7 +32,8 @@ For PMD:
<configuration>
<linkXRef>false</linkXRef>
<rulesets>
<ruleset>pmd.xml</ruleset>
<ruleset>pmd-base.xml</ruleset>
<ruleset>pmd-javadoc.xml</ruleset>
</rulesets>
</configuration>
</plugin>
@@ -50,10 +51,23 @@ For Checkstyle:
<executions>
<execution>
<id>verify-style</id>
<phase>process-classes</phase>
<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>
@@ -69,7 +83,6 @@ For Checkstyle:
<dependency>
</dependencies>
<configuration>
<configLocation>checkstyle.xml</configLocation>
<failOnViolation>true</failOnViolation>
<logViolationsToConsole>true</logViolationsToConsole>
</configuration>


conf/checkstyle.xml → conf/checkstyle-base.xml View File

@@ -7,7 +7,7 @@
<!-- Translation: not in scope of this file -->
<!-- UniqueProperties: not in scope of this file -->
<module name="JavadocPackage"/>
<!-- JavadocPackage: in separate ruleset -->
<module name="NewlineAtEndOfFile">
<property name="lineSeparator" value="lf"/>
</module>
@@ -67,8 +67,8 @@
<module name="AnnotationUseStyle">
<property name="elementStyle" value="compact"/>
</module>
<!-- MissingDeprecated: no javadoc checking -->
<!-- MissingOverride: no javadoc checking -->
<!-- MissingDeprecated: in separate ruleset -->
<!-- MissingOverride: in separate ruleset -->
<module name="PackageAnnotation"/>
<!-- SuppressWarnings: adding this annotation is always developers choice to suppress some rules
and requiring suppressing checkstyle rule checking, when also suppressing warning is not optimal -->
@@ -98,7 +98,7 @@
</module>
<!-- CLASS -->
<!-- DesignForExtension: this rule is mostly javadocs -->
<!-- DesignForExtension: in separate ruleset -->
<module name="FinalClass"/>
<module name="HideUtilityClassConstructor"/>
<!-- InnerTypeLast: sometime interface declarations can be intertwined with methods -->
@@ -195,25 +195,7 @@
<module name="UnusedImports"/>
<!-- JAVADOC -->
<module name="AtclauseOrder">
<property name="tagOrder" value="@param, @return, @throws, @deprecated"/>
<property name="target" value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF, VARIABLE_DEF"/>
</module>
<!-- JavadocMethod: don't check javadocs -->
<module name="JavadocParagraph"/>
<!-- JavadocStyle: don't check javadocs -->
<module name="JavadocTagContinuationIndentation"/>
<!-- JavadocType: don't check javadocs -->
<!-- JavadocVariable: don't check javadocs -->
<module name="NonEmptyAtclauseDescription"/>
<module name="SingleLineJavadoc">
<property name="ignoreInlineTags" value="false"/>
</module>
<module name="SummaryJavadoc">
<property name="forbiddenSummaryFragments"
value="^@return the *|^This method returns |^A [{]@code [a-zA-Z0-9]+[}]( is a )"/>
</module>
<!-- WriteTag: no sensible defaults -->
<!-- whole section in separate ruleset -->
<!-- METRICS -->
<module name="BooleanExpressionComplexity"/>

+ 76
- 0
conf/checkstyle-javadoc.xml View File

@@ -0,0 +1,76 @@
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
<module name="Checker">
<property name="charset" value="UTF-8"/>
<module name="JavadocPackage"/>
<module name="SuppressWarningsFilter" />
<module name="TreeWalker">
<module name="SuppressWithNearbyCommentFilter">
<property name="commentFormat" value="SUPPRESS (\w+)"/>
<property name="checkFormat" value="$1"/>
<property name="influenceFormat" value="0"/>
</module>
<module name="SuppressWithNearbyCommentFilter">
<property name="commentFormat" value="SUPPRESS NEXT (\w+)"/>
<property name="checkFormat" value="$1"/>
<property name="influenceFormat" value="1"/>
</module>
<module name="SuppressWithNearbyCommentFilter">
<property name="commentFormat" value="SUPPRESS NEXT (\d+) (\w+)"/>
<property name="checkFormat" value="$2"/>
<property name="influenceFormat" value="$1"/>
</module>
<module name="SuppressWithNearbyCommentFilter">
<property name="commentFormat" value="SUPPRESS FILE (\w+)"/>
<property name="checkFormat" value="$1"/>
<property name="influenceFormat" value="9999"/>
</module>

<module name="InvalidJavadocPosition"/>
<module name="JavadocBlockTagLocation" />
<module name="MissingDeprecated"/>
<module name="MissingOverride"/>
<module name="DesignForExtension"/>
<module name="AtclauseOrder">
<property name="tagOrder" value="@param, @return, @throws, @deprecated"/>
<property name="target" value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF, VARIABLE_DEF"/>
</module>
<module name="MissingJavadocMethod" />
<module name="MissingJavadocPackage" />
<module name="MissingJavadocType" />
<module name="JavadocMethod">
<property name="scope" value="protected"/>
<property name="validateThrows" value="true" />
<property name="allowUndeclaredRTE" value="true" />
<property name="allowThrowsTagsForSubclasses" value="true" />
</module>
<module name="JavadocParagraph"/>
<module name="JavadocStyle"/>
<module name="JavadocTagContinuationIndentation"/>
<module name="JavadocType">
<property name="scope" value="protected"/>
</module>
<module name="JavadocVariable">
<property name="scope" value="protected"/>
</module>
<module name="NonEmptyAtclauseDescription"/>
<module name="SingleLineJavadoc">
<property name="ignoreInlineTags" value="true"/>
</module>
<module name="SummaryJavadoc">
<property name="forbiddenSummaryFragments"
value="^@return the *|^This method returns |^A [{]@code [a-zA-Z0-9]+[}]( is a )"/>
</module>
<module name="SuppressWarningsHolder">
<property name="aliasList" value="
com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocStyleCheck=javadoc,
com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck=javadoc,
com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocTypeCheck=javadoc,
com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocVariableCheck=javadoc,
" />
</module>
</module>
</module>

conf/pmd.xml → conf/pmd-base.xml View File

@@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
name="perfectable"
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
<description>Perfectable PMD rule set</description>
<description>Perfectable PMD Rule Set: Base</description>
<rule ref="category/java/bestpractices.xml">
<!-- there can be readable assertions that dont need message -->
<exclude name="JUnitAssertionsShouldIncludeMessage" />
@@ -108,12 +108,7 @@
</properties>
</rule>

<rule ref="category/java/documentation.xml">
<!-- Code is documentation. -->
<exclude name="CommentRequired"/>
<!-- This rule also targets javadocs, which could be arbitrarily large -->
<exclude name="CommentSize" />
</rule>
<!-- category/java/documentation.xml is in separate ruleset -->
<rule ref="category/java/errorprone.xml">
<!-- This rule checks for three types of data flow anomaly: UR, DU and UD.
UR is compiler error and DU and DD is mostly false-positives. -->

+ 12
- 0
conf/pmd-javadoc.xml View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<ruleset xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
name="perfectable"
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
<description>Perfectable PMD Rule Set: Javadoc</description>

<rule ref="category/java/documentation.xml">
<!-- This rule also targets javadocs, which could be arbitrarily large -->
<exclude name="CommentSize" />
</rule>
</ruleset>

+ 1
- 1
pom.xml View File

@@ -4,7 +4,7 @@

<groupId>org.perfectable</groupId>
<artifactId>buildable</artifactId>
<version>6.0.1-SNAPSHOT</version>
<version>7.0.0-SNAPSHOT</version>

<name>Buildable</name>
<description>Restrictive configurations for Java static analysis tools</description>


Loading…
Cancel
Save