You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Ben M. (Jira)" <ji...@apache.org> on 2019/12/11 15:36:00 UTC

[jira] [Comment Edited] (MCHECKSTYLE-356) print the checkstyle violations in descending order of line number

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

Ben M. edited comment on MCHECKSTYLE-356 at 12/11/19 3:35 PM:
--------------------------------------------------------------

I am working an an PR.

The mean part about this is: countViolations(Parser) does so many things besides counting violations. Some of them are:
 * checking, if printing violations is wanted.
 * actually printing violations
 * counting violations
 * counting ignored violations
 * checking ignored violations count > 0 and logging
 * Keeping track of file changes

I'll create a {{Violation}} value class for this and collect the violations first. After this, we can print it (in any order) and fail.


was (Author: mampf86):
I am working an an PR.

The mean part about this is: countViolations(Parser) does so many things besides counting violations. I'll create a {{Violation}} value class for this and collect the violations first. After this, we can print it (in any order) and fail.

> print the checkstyle violations in descending order of line number
> ------------------------------------------------------------------
>
>                 Key: MCHECKSTYLE-356
>                 URL: https://issues.apache.org/jira/browse/MCHECKSTYLE-356
>             Project: Maven Checkstyle Plugin
>          Issue Type: Improvement
>          Components: checkstyle:checkstyle
>            Reporter: Jagadish Prasath Ramu
>            Priority: Major
>
> By default, the report form checkstyle prints the errors as it is found from beginning to end of file i.e.,
>  
> e.g:
> Line 5: Unused import
> Line 10: Missing space etc.,
>  
> Instead, it would be better if the report is printed in the reverse order 
> e.g:
> Line 10: Missing space etc.,
> Line 5: Unused import.
>  
> As we fix the issues one by one, we end up changing the code and the line number changes. It results in missing the exact line number in which the remaining errors has occurred. So, we end up running the checkstyle multiple times. Instead, if there is an option to print the results in descending order (of a file's line number), it might help to avoid this inconvenience. 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)