This is an automated email from the ASF dual-hosted git repository.

eolivelli pushed a commit to branch MCHECKSTYLE-385
in repository https://gitbox.apache.org/repos/asf/maven-checkstyle-plugin.git

commit 556444febb8f6731f5a408fd655ece9a43494871
Author: Benjamin Marwell <bmarw...@gmail.com>
AuthorDate: Fri Dec 13 21:12:55 2019 +0100

    [[MCHECKSTYLE-385] Removed useless list for counting violations.
---
 .../plugins/checkstyle/CheckstyleViolationCheckMojo.java    | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git 
a/src/main/java/org/apache/maven/plugins/checkstyle/CheckstyleViolationCheckMojo.java
 
b/src/main/java/org/apache/maven/plugins/checkstyle/CheckstyleViolationCheckMojo.java
index 9a0c4ba..993992d 100644
--- 
a/src/main/java/org/apache/maven/plugins/checkstyle/CheckstyleViolationCheckMojo.java
+++ 
b/src/main/java/org/apache/maven/plugins/checkstyle/CheckstyleViolationCheckMojo.java
@@ -667,8 +667,7 @@ public class CheckstyleViolationCheckMojo
             : RuleUtil.parseMatchers( violationIgnore.split( "," ) );
 
         int ignored = 0;
-
-        List<Violation> actualViolations = new ArrayList<>();
+        int countedViolations = 0;
 
         for ( Violation violation : violations )
         {
@@ -683,18 +682,16 @@ public class CheckstyleViolationCheckMojo
                 continue;
             }
 
-            actualViolations.add( violation );
+            countedViolations++;
         }
 
-        final int count = actualViolations.size();
-
         if ( ignored > 0 )
         {
-            getLog().info( "Ignored " + ignored + " error" + ( ( ignored > 1L 
) ? "s" : "" ) + ", " + count
-                + " violation" + ( ( count > 1 ) ? "s" : "" ) + " remaining." 
);
+            getLog().info( "Ignored " + ignored + " error" + ( ( ignored > 1L 
) ? "s" : "" ) + ", " + countedViolations
+                + " violation" + ( ( countedViolations > 1 ) ? "s" : "" ) + " 
remaining." );
         }
 
-        return count;
+        return countedViolations;
     }
 
     private void printViolations( List<Violation> violations )

Reply via email to