You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Kristian Rosenvold <kr...@gmail.com> on 2014/11/25 19:33:11 UTC

Adapting checkstyle rules ?

Can one of you checkstyle gurus tell me how to disable the checkstyle
rules that enforce bad practice ?

I'm referring to the checkstyle "meaningless javadoc required" rule,
how do I disable it permanently ?

Preferably in the parent pom :)

Kristian

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: Adapting checkstyle rules ?

Posted by Hervé BOUTEMY <he...@free.fr>.
the Maven Checkstyle coding style is written inside maven-checkstyle-plugin
see svn [1]

And when working on version 2.13, I created a dedicated component in Jira to 
track updates [2]

Notice MCHECKSTYLE-257 to better document this for the next plugin version...

Regards,

Hervé


[1] http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/main/resources/config/maven_checks.xml

[2] http://jira.codehaus.org/browse/MCHECKSTYLE/component/16600

Le mardi 25 novembre 2014 19:33:11 Kristian Rosenvold a écrit :
> Can one of you checkstyle gurus tell me how to disable the checkstyle
> rules that enforce bad practice ?
> 
> I'm referring to the checkstyle "meaningless javadoc required" rule,
> how do I disable it permanently ?
> 
> Preferably in the parent pom :)
> 
> Kristian
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: Adapting checkstyle rules ?

Posted by Lennart Jörelid <le...@gmail.com>.
Kristian,


For simplicity, and the ability to re-use the checkstyle configuration in a
multi-module reactor, I usually do this in two steps:


   1. Create a codestyle project in the root level of your project. This
   codestyle project contains the configuration files for checkstyle where the
   codestyle within the project is defined (i.e.
   src/main/resources/codestyle/checkstyle-suppressions.xml and
   src/main/resources/codestyle/checkstyle.xml).
   2. In your root pom, simply configure the checkstyle plugin to use your
   custom checkstyle.xml. Example snippet below.

You can see an example of this in the nazgul-codestyle project and
nazgul-tools-parent pom respectively. Published on repo central.


        <!-- Checkstyle configuration parameters. -->
<checkstyle.plugin.version>2.12</checkstyle.plugin.version>
*<checkstyle.config.location>codestyle/checkstyle.xml</checkstyle.config.location>
        <checkstyle.suppressions.location>codestyle/checkstyle-suppressions.xml</checkstyle.suppressions.location>*
       <checkstyle.violationSeverity>error</checkstyle.violationSeverity>


.... and ...

                <!--                    Enforces the defined code
style, as provided within the codestyle project.
Why:  Validates the codestyle.                    Used: Standard
lifecycle, mvn package.                -->                <plugin>
               <groupId>org.apache.maven.plugins</groupId>
       <artifactId>maven-checkstyle-plugin</artifactId>
    <version>${checkstyle.plugin.version}</version>
<configuration>
<skip>${skip.verify.code}</skip>
<configLocation>${checkstyle.config.location}</configLocation>
               <suppressionsFile>${checkstyle.suppressions.location}</suppressionsFile>

<failOnViolation>${breakOnFailure.checkstyle}</failOnViolation>

<violationSeverity>${checkstyle.violationSeverity}</violationSeverity>
                   </configuration>                    <executions>
                    <execution>
<id>verify</id>
<phase>${check.plugins.phase}</phase>
<goals>                                <goal>check</goal>
              </goals>                        </execution>
           <execution>                            <id>report</id>
                      <goals>
<goal>checkstyle</goal>                            </goals>
            </execution>                    </executions>
      <dependencies>                        *<dependency>
                            <groupId>se.jguru.nazgul.tools.codestyle</groupId>
                            <artifactId>nazgul-codestyle</artifactId>
                            <version>4.0.1</version>
                        </dependency>*
</dependencies>                </plugin>


2014-11-25 19:33 GMT+01:00 Kristian Rosenvold <kr...@gmail.com>
:

> Can one of you checkstyle gurus tell me how to disable the checkstyle
> rules that enforce bad practice ?
>
> I'm referring to the checkstyle "meaningless javadoc required" rule,
> how do I disable it permanently ?
>
> Preferably in the parent pom :)
>
> Kristian
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>


-- 

--
+==============================+
| Bästa hälsningar,
| [sw. "Best regards"]
|
| Lennart Jörelid
| EAI Architect & Integrator
|
| jGuru Europe AB
| Mölnlycke - Kista
|
| Email: lj@jguru.se
| URL:   www.jguru.se
| Phone
| (skype):    jgurueurope
| (intl):     +46 708 507 603
| (domestic): 0708 - 507 603
+==============================+