maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Guillaume Boué (JIRA) <j...@apache.org>
Subject [jira] [Commented] (MCHECKSTYLE-329) Checkstyle plugin does not show the number of errors if the severity is configured to be 'warning'.
Date Sun, 20 Nov 2016 16:24:58 GMT

    [ https://issues.apache.org/jira/browse/MCHECKSTYLE-329?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15681401#comment-15681401
] 

Guillaume Boué commented on MCHECKSTYLE-329:
--------------------------------------------

I don't think there is an issue here. The number of violations is visible in the error message.
With your configuration, on a sample project, the build fails with:

{noformat}
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:2.17:check
(default-cli) on project ...: You have 2 Checkstyle violations.
{noformat}

which gives the number of violations.

This number can be different than the number of Checkstyle errors shown in the logs at the
end of the Checkstyle invocation, which looks like {{[INFO] There are 2 errors reported by
Checkstyle 6.11.2 with ...}}. This log line shows how many checkstyle errors have been reported
by Checkstyle, but there can be more violations if there are also checkstyle warnings and
{{<violationSeverity>warning</violationSeverity>}} is set.

Put another way, with {{<property name="severity" value="warning"/>}}, you're telling
Checkstyle to emit warnings instead of errors, so that log line will not appear.

> Checkstyle plugin does not show the number of errors if the severity is configured to
be 'warning'.
> ---------------------------------------------------------------------------------------------------
>
>                 Key: MCHECKSTYLE-329
>                 URL: https://issues.apache.org/jira/browse/MCHECKSTYLE-329
>             Project: Maven Checkstyle Plugin
>          Issue Type: Bug
>    Affects Versions: 2.17
>            Reporter: Tran Hoang Chuong
>            Priority: Minor
>
> I have configured the maven checkstyle module as follow:
> {noformat}
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-checkstyle-plugin</artifactId>
> <version>2.17</version>
> <configuration>
> 	<includeTestSourceDirectory>false</includeTestSourceDirectory>
> 	<violationSeverity>warning</violationSeverity>
> 	<checkstyleRules>
> 		<module name="Checker">
> 			<property name="severity" value="warning"/>
> 			<module name="TreeWalker">
> 				<property name="fileExtensions" value="java"/>
> 				<module name="JavadocMethod">
> 					<property name="scope" value="protected"/>
> 					<property name="validateThrows" value="true"/>
> 					<property name="allowedAnnotations"
> 							  value="Override, Test, Before, BeforeClass, After, AfterClass"/>
> 					<property name="allowThrowsTagsForSubclasses" value="true"/>
> 				</module>
> 				<module name="MissingOverride"/>
> 				<module name="MissingDeprecated"/>
> 				<module name="AvoidStarImport"/>
> 				<module name="UnusedImports">
> 					<property name="processJavadoc" value="true"/>
> 				</module>
> 				<module name="ModifierOrder"/>
> 				<module name="RedundantModifier">
> 					<property name="tokens" value="INTERFACE_DEF"/>
> 				</module>
> 				<module name="OneTopLevelClass"/>
> 			</module>
> 			<module name="Header">
> 				<property name="header" value="/*"/>
> 				<property name="fileExtensions" value="java"/>
> 			</module>
> 			<module name="RegexpSingleline">
> 				<property name="severity" value="info"/>
> 				<property name="message" value="Line has trailing spaces."/>
> 				<property name="format" value="\s+$"/>
> 				<property name="fileExtensions" value="java"/>
> 			</module>
> 		</module>
> 	</checkstyleRules>
> </configuration>
> </plugin>
> {noformat}
> Executing mvn checkstyle:check does not give me the number of violations.
> However, it does give me the number if I comment out these lines:{{<violationSeverity>warning</violationSeverity>}}
> {{<property name="severity" value="warning"/>}}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message