jenkinsconsolespotbugs

WARNING: Unknown parameter(s) found for class type 'io.jenkins.plugins.analysis.warnings.FindBugs': unstableTotalAll


I'm seeing the following log line on a Jenkins job (using Pipeline syntax)

WARNING: Unknown parameter(s) found for class type 'io.jenkins.plugins.analysis.warnings.FindBugs': unstableTotalAll

after which there's a notable delay of usually 3-4 minutes in the Jenkins console. e.g.

17:07:27  WARNING: Unknown parameter(s) found for class type 'io.jenkins.plugins.analysis.warnings.FindBugs': unstableTotalAll
17:10:47  [FindBugs] Searching for all files in 'directory path' that match the pattern '**/spotbugsXml.xml'

Google is not showing an exact match for this issue. Any ideas on what's happening and what causes the delay?


Solution

  • The original FindBugs plugin took this argument, but it has been depreciated. The replacement is Warnings NG which also supports unstableTotalAll. But it was being used incorrectly. e.g.

    recordIssues enabledForFailure: true, tools: [findBugs([pattern: '**/spotbugsXml.xml', unstableTotalAll: null])]
    

    should have been

    recordIssues enabledForFailure: true, unstableTotalAll: 1, tools: [findBugs([pattern: '**/spotbugsXml.xml'])]
    

    after which there's a notable delay of usually 3-4 minutes in the Jenkins console

    Jenkins seems very inefficient when uploading these files. A way to avoid this hit is to check the files for a static analysis issue before uploading it. e.g.

    def files = findFiles(glob: '**/spotbugsXml.xml')
    
    files.each { file ->
        println file.name
        println file.path
        def contents = readFile(file.path)
        if (contents.indexOf('<BugInstance')) {
            println 'Contains bugs so calling recordIssues'
        }
        else {
            println 'Does NOT contain bugs so NOT calling recordIssues'
        }
    }