You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2020/07/12 18:55:23 UTC

[GitHub] [maven-checkstyle-plugin] stefan-paal-innoq opened a new pull request #34: MCHECKSTYLE-99: should use default test

stefan-paal-innoq opened a new pull request #34:
URL: https://github.com/apache/maven-checkstyle-plugin/pull/34


   MCHECKSTYLE-99: <includeTestSourceDirectory> should use default test sources xref output dir: ${project.reporting.outputDirectory}/xref-test
   
   - add parameter xrefTestLocation
   - use xrefTestLocation to create jxr report links for test source file
   - add integration tests
   
   Following this checklist to help us incorporate your 
   contribution quickly and easily:
   
    - [x] Make sure there is a [JIRA issue](https://issues.apache.org/jira/browse/MCHECKSTYLE) filed 
          for the change (usually before you start working on it).  Trivial changes like typos do not 
          require a JIRA issue.  Your pull request should address just this issue, without 
          pulling in other changes.
    - [x] Each commit in the pull request should have a meaningful subject line and body.
    - [x] Format the pull request title like `[MCHECKSTYLE-XXX] - Fixes bug in ApproximateQuantiles`,
          where you replace `MCHECKSTYLE-XXX` with the appropriate JIRA issue. Best practice
          is to use the JIRA issue title in the pull request title and in the first line of the 
          commit message.
    - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
    - [x] Run `mvn clean verify` to make sure basic checks pass. A more thorough check will 
          be performed on your pull request automatically.
    - [x] You have run the integration tests successfully (`mvn -Prun-its clean verify`).
   
   If your pull request is about ~20 lines of code you don't need to sign an
   [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf) if you are unsure
   please ask on the developers list.
   
   To make clear that you license your contribution under 
   the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
   you have to acknowledge this by using the following check-box.
   
    - [x] I hereby declare this contribution to be licenced under the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
   
    - [] In any other case, please file an [Apache Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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



[GitHub] [maven-checkstyle-plugin] elharo commented on a change in pull request #34: [MCHECKSTYLE-99] should use default test

Posted by GitBox <gi...@apache.org>.
elharo commented on a change in pull request #34:
URL: https://github.com/apache/maven-checkstyle-plugin/pull/34#discussion_r479749129



##########
File path: src/main/java/org/apache/maven/plugins/checkstyle/AbstractCheckstyleReport.java
##########
@@ -780,6 +770,53 @@ private void generateMainReport( CheckstyleResults results, ResourceBundle bundl
         generator.generateReport( results );
     }
 
+    private void initializeXrefLocation( CheckstyleReportGenerator generator )
+    {
+      String relativePath = determineRelativePath( xrefLocation );
+      if ( xrefLocation.exists() || checkMavenJxrPluginIsConfigured() )
+      {
+          // XRef was already generated by manual execution of a lifecycle binding
+          // the report is on its way
+          generator.setXrefLocation( relativePath );
+      }
+    }
+
+    private void initializeXrefTestLocation( CheckstyleReportGenerator generator )
+    {
+      String relativePath = determineRelativePath( xrefTestLocation );
+      if ( xrefTestLocation.exists() || checkMavenJxrPluginIsConfigured() )
+      {
+          // XRef was already generated by manual execution of a lifecycle binding
+          // the report is on its way
+          generator.setXrefTestLocation( relativePath );
+      }
+    }
+
+    private String determineRelativePath( File location )
+    {
+      String relativePath = PathTool.getRelativePath( getOutputDirectory(), location.getAbsolutePath() );
+      if ( StringUtils.isEmpty( relativePath ) )

Review comment:
       Yes, that method likely doesn't do what you think it does and we need to get rid of it.  Possibly use Apache commons or even more clearly don't use a utility method. Looking at the code I think what you want here is "is not null or zero length"  but does allow whitespace. It's a crap shoot whether any given isEmpty method has those semantics or not.  The one you picked doesn't. 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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



[GitHub] [maven-checkstyle-plugin] asfgit closed pull request #34: [MCHECKSTYLE-99] should use default test

Posted by GitBox <gi...@apache.org>.
asfgit closed pull request #34:
URL: https://github.com/apache/maven-checkstyle-plugin/pull/34


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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



[GitHub] [maven-checkstyle-plugin] stefan-paal-innoq commented on a change in pull request #34: [MCHECKSTYLE-99] should use default test

Posted by GitBox <gi...@apache.org>.
stefan-paal-innoq commented on a change in pull request #34:
URL: https://github.com/apache/maven-checkstyle-plugin/pull/34#discussion_r479736853



##########
File path: src/main/java/org/apache/maven/plugins/checkstyle/AbstractCheckstyleReport.java
##########
@@ -780,6 +770,53 @@ private void generateMainReport( CheckstyleResults results, ResourceBundle bundl
         generator.generateReport( results );
     }
 
+    private void initializeXrefLocation( CheckstyleReportGenerator generator )
+    {
+      String relativePath = determineRelativePath( xrefLocation );
+      if ( xrefLocation.exists() || checkMavenJxrPluginIsConfigured() )
+      {
+          // XRef was already generated by manual execution of a lifecycle binding
+          // the report is on its way
+          generator.setXrefLocation( relativePath );
+      }
+    }
+
+    private void initializeXrefTestLocation( CheckstyleReportGenerator generator )
+    {
+      String relativePath = determineRelativePath( xrefTestLocation );
+      if ( xrefTestLocation.exists() || checkMavenJxrPluginIsConfigured() )
+      {
+          // XRef was already generated by manual execution of a lifecycle binding
+          // the report is on its way
+          generator.setXrefTestLocation( relativePath );
+      }
+    }
+
+    private String determineRelativePath( File location )
+    {
+      String relativePath = PathTool.getRelativePath( getOutputDirectory(), location.getAbsolutePath() );
+      if ( StringUtils.isEmpty( relativePath ) )

Review comment:
       i use the `StringUtils` class which is already used in the class, hence `org.codehaus.plexus.util.StringUtils`. should we use something different here?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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



[GitHub] [maven-checkstyle-plugin] elharo commented on a change in pull request #34: [MCHECKSTYLE-99] should use default test

Posted by GitBox <gi...@apache.org>.
elharo commented on a change in pull request #34:
URL: https://github.com/apache/maven-checkstyle-plugin/pull/34#discussion_r470088921



##########
File path: src/main/java/org/apache/maven/plugins/checkstyle/AbstractCheckstyleReport.java
##########
@@ -780,6 +770,53 @@ private void generateMainReport( CheckstyleResults results, ResourceBundle bundl
         generator.generateReport( results );
     }
 
+    private void initializeXrefLocation( CheckstyleReportGenerator generator )
+    {
+      String relativePath = determineRelativePath( xrefLocation );
+      if ( xrefLocation.exists() || checkMavenJxrPluginIsConfigured() )
+      {
+          // XRef was already generated by manual execution of a lifecycle binding
+          // the report is on its way
+          generator.setXrefLocation( relativePath );
+      }
+    }
+
+    private void initializeXrefTestLocation( CheckstyleReportGenerator generator )
+    {
+      String relativePath = determineRelativePath( xrefTestLocation );
+      if ( xrefTestLocation.exists() || checkMavenJxrPluginIsConfigured() )
+      {
+          // XRef was already generated by manual execution of a lifecycle binding
+          // the report is on its way
+          generator.setXrefTestLocation( relativePath );
+      }
+    }
+
+    private String determineRelativePath( File location )
+    {
+      String relativePath = PathTool.getRelativePath( getOutputDirectory(), location.getAbsolutePath() );
+      if ( StringUtils.isEmpty( relativePath ) )

Review comment:
       which StringUtils is this?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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



[GitHub] [maven-checkstyle-plugin] stefan-paal-innoq commented on a change in pull request #34: [MCHECKSTYLE-99] should use default test

Posted by GitBox <gi...@apache.org>.
stefan-paal-innoq commented on a change in pull request #34:
URL: https://github.com/apache/maven-checkstyle-plugin/pull/34#discussion_r479753346



##########
File path: src/main/java/org/apache/maven/plugins/checkstyle/AbstractCheckstyleReport.java
##########
@@ -780,6 +770,53 @@ private void generateMainReport( CheckstyleResults results, ResourceBundle bundl
         generator.generateReport( results );
     }
 
+    private void initializeXrefLocation( CheckstyleReportGenerator generator )
+    {
+      String relativePath = determineRelativePath( xrefLocation );
+      if ( xrefLocation.exists() || checkMavenJxrPluginIsConfigured() )
+      {
+          // XRef was already generated by manual execution of a lifecycle binding
+          // the report is on its way
+          generator.setXrefLocation( relativePath );
+      }
+    }
+
+    private void initializeXrefTestLocation( CheckstyleReportGenerator generator )
+    {
+      String relativePath = determineRelativePath( xrefTestLocation );
+      if ( xrefTestLocation.exists() || checkMavenJxrPluginIsConfigured() )
+      {
+          // XRef was already generated by manual execution of a lifecycle binding
+          // the report is on its way
+          generator.setXrefTestLocation( relativePath );
+      }
+    }
+
+    private String determineRelativePath( File location )
+    {
+      String relativePath = PathTool.getRelativePath( getOutputDirectory(), location.getAbsolutePath() );
+      if ( StringUtils.isEmpty( relativePath ) )

Review comment:
       ok, i get it and agree. i have just used what was already there :-)
   
   the call to PathTool.getRelativePath should actually either return a zero-length string or a valid path. the null check and the whitespaces trimming are just a kind of defensive implementation. we could just look for a zero-length string, e.g. with "relativePath.isEmpty" if that suits you more. 
   
   pushed another commit with explicit evaluation of the string content, including the null check and whitespace trimming.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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