Set the "failureProperty" with a meaningful message (feature request 1725475).
This commit is contained in:
parent
c59a39378f
commit
02da493e64
|
|
@ -287,7 +287,10 @@
|
|||
<property name="checkstyle.pattern.todo" value="NOTHingWillMatCH_-"/>
|
||||
<property name="check.config" location="checkstyle_checks.xml"/>
|
||||
<property name="translation.severity" value="ignore"/>
|
||||
<checkstyle config="${check.config}">
|
||||
<checkstyle config="${check.config}"
|
||||
failOnViolation="false"
|
||||
failureProperty="checkstyle.failure.property"
|
||||
>
|
||||
<fileset dir="src/checkstyle"
|
||||
includes="**/*.java,**/*.properties"
|
||||
excludes="**/Generated*.java,**/gui/*,**/transmogrify/*"/>
|
||||
|
|
@ -300,6 +303,10 @@
|
|||
<property key="checkstyle.suppressions.file"
|
||||
file="suppressions.xml"/>
|
||||
</checkstyle>
|
||||
|
||||
<fail if="checkstyle.failure.property"
|
||||
message="Checkstyle failed: ${checkstyle.failure.property}"
|
||||
/>
|
||||
</target>
|
||||
|
||||
<target name="checkstyle.style" depends="compile.checkstyle"
|
||||
|
|
|
|||
|
|
@ -328,13 +328,17 @@ public class CheckStyleTask extends Task
|
|||
&& (numWarnings <= mMaxWarnings);
|
||||
|
||||
// Handle the return status
|
||||
if (!ok && (mFailureProperty != null)) {
|
||||
getProject().setProperty(mFailureProperty, "true");
|
||||
}
|
||||
if (!ok) {
|
||||
final String failureMsg =
|
||||
"Got " + numErrs + " errors and " + numWarnings
|
||||
+ " warnings.";
|
||||
if (mFailureProperty != null) {
|
||||
getProject().setProperty(mFailureProperty, failureMsg);
|
||||
}
|
||||
|
||||
if (!ok && mFailOnViolation) {
|
||||
throw new BuildException("Got " + numErrs + " errors and "
|
||||
+ numWarnings + " warnings.", getLocation());
|
||||
if (mFailOnViolation) {
|
||||
throw new BuildException(failureMsg, getLocation());
|
||||
}
|
||||
}
|
||||
}
|
||||
finally {
|
||||
|
|
|
|||
|
|
@ -14,23 +14,28 @@
|
|||
|
||||
<ul>
|
||||
<li>
|
||||
checkstyle-all.jar contained some classes from jakarta commons-collections twice. (bug 1630361)
|
||||
checkstyle-all.jar contained some classes from jakarta
|
||||
commons-collections twice. (bug 1630361)
|
||||
</li>
|
||||
<li>
|
||||
Multiple string literal check now ignores annotations by default (bug 1560940).
|
||||
It is possible to retain the old behaviour by setting the new check property
|
||||
Multiple string literal check now ignores annotations by
|
||||
default (bug 1560940). It is possible to retain the old
|
||||
behaviour by setting the new check property
|
||||
ignoreOccurrenceContext to an empty value.
|
||||
</li>
|
||||
<li>
|
||||
The calculated value of NPath complexity was subject to integer overflow,
|
||||
so complex code was not always flagged (bug 1654769).
|
||||
The calculated value of NPath complexity was subject to
|
||||
integer overflow, so complex code was not always flagged (bug
|
||||
1654769).
|
||||
</li>
|
||||
<li>
|
||||
Fixed misleading documentation for BooleanExpressionComplexity check (bug 1579227).
|
||||
Fixed misleading documentation for BooleanExpressionComplexity
|
||||
check (bug 1579227).
|
||||
</li>
|
||||
<li>
|
||||
Fixed Java parser error for array brackets in wildcard generic types (bug 1394014).
|
||||
Thanks to Paul Constantinides for submitting the fix (patch 1422247).
|
||||
Fixed Java parser error for array brackets in wildcard generic
|
||||
types (bug 1394014). Thanks to Paul Constantinides for
|
||||
submitting the fix (patch 1422247).
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
|
@ -45,6 +50,10 @@
|
|||
<li>
|
||||
Added an entry for <tt>Checkstyle-IDEA</tt> on the home page.
|
||||
</li>
|
||||
<li>
|
||||
Set the <tt>failureProperty</tt> with a meaningful message
|
||||
(feature request 1725475).
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue