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:
[email protected]