Findbugs doesn't run on projects containing only test classes
-------------------------------------------------------------

                 Key: MFINDBUGS-132
                 URL: http://jira.codehaus.org/browse/MFINDBUGS-132
             Project: Maven 2.x FindBugs Plugin
          Issue Type: Bug
    Affects Versions: 2.3.2
            Reporter: Bruce Mackenzie Nielsen


We discovered that if a project only contains test classes and no "normal" 
classes, the canGenerateReport() function returns false, as it only checks for 
the existence of class files on the classFilesDirectory path. If includeTests 
is set to true, the function should also check for the existence of class files 
on the testClassFilesDirectory path.
 
A patch to the function could look like this:

{noformat} 
  boolean canGenerateReport() {
 
    def canGenerate = false
    log.info("Inside canGenerateReport..... ${canGenerate} ")
 
    log.info("Inside canGenerateReport..... skip " + skip + ", 
classFilesDirectory.exists() " + classFilesDirectory.exists())
 
    if ( !skip && classFilesDirectory.exists() ) {
 
      classFilesDirectory.eachFileRecurse {
        if ( it.name.contains('.class') )
        canGenerate = true
      }
    }
 
    if ( !skip && testClassFilesDirectory.exists() && includeTests ) {
 
      testClassFilesDirectory.eachFileRecurse {
        if ( it.name.contains('.class') )
        canGenerate = true
      }
    }
 
    log.info("canGenerate is ${canGenerate}")
 
    return canGenerate
  }
{noformat}

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to