Author: dennisl Date: Fri Jul 10 09:10:36 2009 New Revision: 792847 URL: http://svn.apache.org/viewvc?rev=792847&view=rev Log: [MCHECKSTYLE-113] Set the number of accepted violations for checkstyle:check
o Renamed the parameter from allowedViolations to maxAllowedViolations, to match better with the parameter names suggested in MCHECKSTYLE-104, if we later decide to implement that. Modified: maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleViolationCheckMojo.java Modified: maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleViolationCheckMojo.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleViolationCheckMojo.java?rev=792847&r1=792846&r2=792847&view=diff ============================================================================== --- maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleViolationCheckMojo.java (original) +++ maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleViolationCheckMojo.java Fri Jul 10 09:10:36 2009 @@ -73,13 +73,13 @@ private boolean failOnViolation; /** - * The number of allowed violations. The execution fails only if the number - * of violations is above this limit. + * The maximum number of allowed violations. The execution fails only if the + * number of violations is above this limit. * - * @parameter expression="${checkstyle.allowedViolations}" default-value="0" + * @parameter expression="${checkstyle.maxAllowedViolations}" default-value="0" * @since 2.3 */ - private int allowedViolations = 0; + private int maxAllowedViolations = 0; /** * The lowest severity level that is considered a violation. @@ -136,15 +136,15 @@ xpp.setInput( breader ); int violations = countViolations( xpp ); - if ( violations > allowedViolations ) + if ( violations > maxAllowedViolations ) { if ( failOnViolation ) { String msg = "You have " + violations + " Checkstyle violation" + ( ( violations > 1 ) ? "s" : "" ) + "."; - if ( allowedViolations > 0 ) + if ( maxAllowedViolations > 0 ) { - msg += " The number of allowed violations is " + allowedViolations + "."; + msg += " The maximum number of allowed violations is " + maxAllowedViolations + "."; } throw new MojoFailureException( msg ); }