1
votes

I have the following modules set in my checkstyle.xml under the TreeWalker module

<module name="NestedIfDepth">
  <property name="max" value="3" />
</module>
<module name="NestedTryDepth">
  <property name="max" value="3" />
</module>

But if i say write more than 3 nested IF statements it does not throw a checkstyle error during my maven install

The Checkstyle plugin is configured in the POM as follows:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-checkstyle-plugin</artifactId>
  <version>2.8</version>
</plugin>
1
Are you sure Maven is using your checkstyle.xml config file? Please provide the checkstyle plugin configuration you are using in your pom.xml. - Brent Worden
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-checkstyle-plugin</artifactId> <version>2.8</version> </plugin> - Ayan Pal

1 Answers

0
votes

When using Maven Checkstyle Plugin with custom checks, the plugin needs to be configured with the location of the custom checkstyle checker configuration:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-checkstyle-plugin</artifactId>
  <version>2.8</version>
  <configuration>
    <configLocation>[filename for custom checkstyle config file]</configLocation>
  </configuration>
</plugin>