maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] asfgit closed pull request #1: MCHECKSTYLE-344 Fix category resolution when reporting violation
Date Sat, 24 Feb 2018 22:20:51 GMT
asfgit closed pull request #1: MCHECKSTYLE-344 Fix category resolution when reporting violation
URL: https://github.com/apache/maven-checkstyle-plugin/pull/1
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/src/main/java/org/apache/maven/plugins/checkstyle/RuleUtil.java b/src/main/java/org/apache/maven/plugins/checkstyle/RuleUtil.java
index 79e943e..ff53a3e 100644
--- a/src/main/java/org/apache/maven/plugins/checkstyle/RuleUtil.java
+++ b/src/main/java/org/apache/maven/plugins/checkstyle/RuleUtil.java
@@ -92,7 +92,7 @@ public static String getCategory( String eventSrcName )
         }
 
         int end = eventSrcName.lastIndexOf( '.' );
-        eventSrcName = eventSrcName.substring( 0,  end );
+        eventSrcName = end == -1 ? eventSrcName : eventSrcName.substring( 0,  end );
 
         if ( CHECKSTYLE_PACKAGE.equals( eventSrcName ) )
         {
diff --git a/src/test/java/org/apache/maven/plugins/checkstyle/RuleUtilTest.java b/src/test/java/org/apache/maven/plugins/checkstyle/RuleUtilTest.java
index 4b827c4..457be55 100644
--- a/src/test/java/org/apache/maven/plugins/checkstyle/RuleUtilTest.java
+++ b/src/test/java/org/apache/maven/plugins/checkstyle/RuleUtilTest.java
@@ -1,6 +1,6 @@
 package org.apache.maven.plugins.checkstyle;
 
-import org.apache.maven.plugins.checkstyle.RuleUtil;
+import junit.framework.TestCase;
 
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
@@ -21,8 +21,6 @@
  * under the License.
  */
 
-import junit.framework.TestCase;
-
 public class RuleUtilTest
     extends TestCase
 {
@@ -40,6 +38,7 @@ public void testGetCategory()
         assertEquals( "misc", RuleUtil.getCategory( CHECKSTYLE_PACKAGE + ".FinalParametersCheck"
) );
         assertEquals( "test", RuleUtil.getCategory( CHECKSTYLE_PACKAGE + ".test.FinalParametersCheck"
) );
         assertEquals( "extension", RuleUtil.getCategory( "test.FinalParametersCheck" ) );
+        assertEquals( "extension", RuleUtil.getCategory( "copyright" ) );
         assertNull( RuleUtil.getCategory( (String) null ) );
     }
 


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message