Class FindBugsTask

java.lang.Object
org.apache.tools.ant.ProjectComponent
org.apache.tools.ant.Task
edu.umd.cs.findbugs.anttask.AbstractFindBugsTask
edu.umd.cs.findbugs.anttask.FindBugsTask
All Implemented Interfaces:
Cloneable

public class FindBugsTask extends AbstractFindBugsTask
FindBugs in Java class files. This task can take the following arguments:
  • adjustExperimental (boolean default false)
  • adjustPriority (passed to -adjustPriority)
  • applySuppression (exclude any warnings that match a suppression filter supplied in a project file)
  • auxAnalyzepath (class, jar, zip files or directories containing classes to analyze)
  • auxClasspath (classpath or classpathRef)
  • baselineBugs (xml file containing baseline bugs)
  • class (class, jar, zip or directory containing classes to analyze)
  • classpath (classpath for running FindBugs)
  • cloud (cloud id)
  • conserveSpace (boolean - default false)
  • debug (boolean default false)
  • effort (enum min|default|max)
  • excludeFilter (filter filename)
  • failOnError (boolean - default false)
  • home (findbugs install dir)
  • includeFilter (filter filename)
  • maxRank (maximum rank issue to be reported)
  • jvm (Set the command used to start the VM)
  • jvmargs (any additional jvm arguments)
  • omitVisitors (collection - comma seperated)
  • onlyAnalyze (restrict analysis to find bugs to given comma-separated list of classes and packages - See the textui argument description for details)
  • output (enum text|xml|xml:withMessages|html - default xml)
  • outputFile (name of output file to create)
  • nested (boolean default true)
  • noClassOk (boolean default false)
  • pluginList (list of plugin Jar files to load)
  • projectFile (project filename)
  • projectName (project name, for display in generated HTML)
  • userPrefs (user preferences filename)
  • quietErrors (boolean - default false)
  • relaxed (boolean - default false)
  • reportLevel (enum experimental|low|medium|high)
  • sort (boolean default true)
  • stylesheet (name of stylesheet to generate HTML: default is "default.xsl")
  • systemProperty (a system property to set)
  • timestampNow (boolean - default false)
  • visitors (collection - comma seperated)
  • chooseVisitors (selectively enable/disable visitors)
  • workHard (boolean default false)
  • setSetExitCode (boolean default true)
Of these arguments, the home is required. projectFile is required if nested <class> or <auxAnalyzepathinvalid input: '&gt' elements are not specified. the <class> tag defines the location of either a class, jar file, zip file, or directory containing classes.

Since:
Ant 1.5
Version:
$Revision: 1.56 $
Author:
Mike Fagan mfagan@tde.com, Michael Tamm mail@michaeltamm.de, Scott Wolk
  • Constructor Details

    • FindBugsTask

      public FindBugsTask()
  • Method Details

    • setWorkHard

      public void setWorkHard(boolean workHard)
      Set the workHard flag.
      Parameters:
      workHard - true if we want findbugs to run with workHard option enabled
    • setSetExitCode

      public void setSetExitCode(boolean setExitCode)
      Set the exit code flag.
      Parameters:
      setExitCode - If true then the exit code will be returned to the main ant job
    • setNested

      public void setNested(boolean nested)
      Set the nested flag.
      Parameters:
      nested - This option enables or disables scanning of nested jar and zip files found in the list of files and directories to be analyzed. By default, scanning of nested jar/zip files is enabled
    • setNoClassOk

      public void setNoClassOk(boolean noClassOk)
      Set the noClassOk flag.
      Parameters:
      noClassOk - true if we should generate no-error output if no classfiles are specified
    • setRelaxed

      public void setRelaxed(boolean relaxed)
      Set the relaxed flag.
      Parameters:
      relaxed - true if we want findbugs to run with relaxed option enabled
    • setAdjustExperimental

      public void setAdjustExperimental(boolean adjustExperimental)
      Set the adjustExperimental flag
      Parameters:
      adjustExperimental - true if we want experimental bug patterns to have lower priority
    • setAdjustPriority

      public void setAdjustPriority(String adjustPriorityString)
    • setVisitors

      public void setVisitors(String commaSeperatedString)
      Set the specific visitors to use
    • setChooseVisitors

      public void setChooseVisitors(String commaSeperatedString)
      Set the specific visitors to use
    • setOmitVisitors

      public void setOmitVisitors(String commaSeperatedString)
      Set the specific visitors to use
    • setOutput

      public void setOutput(String format)
      Set the output format
    • setStylesheet

      public void setStylesheet(String stylesheet)
      Set the stylesheet filename for HTML generation.
    • setReportLevel

      public void setReportLevel(String level)
      Set the report level
    • setSort

      public void setSort(boolean flag)
      Set the sorted flag
    • setTimestampNow

      public void setTimestampNow(boolean flag)
      Set the timestampNow flag
    • setQuietErrors

      public void setQuietErrors(boolean flag)
      Set the quietErrors flag
    • setApplySuppression

      public void setApplySuppression(boolean flag)
      Set the quietErrors flag
    • setWarningsProperty

      public void setWarningsProperty(String name)
      Tells this task to set the property with the given name to "true" when bugs were found.
    • setEffort

      public void setEffort(String effort)
      Set effort level.
      Parameters:
      effort - the effort level
    • setCloud

      public void setCloud(String cloudId)
    • setMaxRank

      public void setMaxRank(int maxRank)
    • setProjectName

      public void setProjectName(String projectName)
      Set project name
      Parameters:
      projectName - the project name
    • setConserveSpace

      public void setConserveSpace(boolean flag)
      Set the conserveSpace flag.
    • setExcludeFilter

      public void setExcludeFilter(File filterFile)
      Set the exclude filter file
    • setIncludeFilter

      public void setIncludeFilter(File filterFile)
      Set the exclude filter file
    • setBaselineBugs

      public void setBaselineBugs(File baselineBugs)
      Set the exclude filter file
    • setProjectFile

      public void setProjectFile(File projectFile)
      Set the project file
    • setUserPreferencesFile

      public void setUserPreferencesFile(File userPreferencesFile)
      Set the project file
    • setAuxClasspath

      public void setAuxClasspath(org.apache.tools.ant.types.Path src)
      the auxclasspath to use.
    • createAuxClasspath

      public org.apache.tools.ant.types.Path createAuxClasspath()
      Path to use for auxclasspath.
    • setAuxClasspathRef

      public void setAuxClasspathRef(org.apache.tools.ant.types.Reference r)
      Adds a reference to a sourcepath defined elsewhere.
    • setAuxAnalyzepath

      public void setAuxAnalyzepath(org.apache.tools.ant.types.Path src)
      the auxAnalyzepath to use.
    • createAuxAnalyzepath

      public org.apache.tools.ant.types.Path createAuxAnalyzepath()
      Path to use for auxAnalyzepath.
    • setAuxAnalyzepathRef

      public void setAuxAnalyzepathRef(org.apache.tools.ant.types.Reference r)
      Adds a reference to a sourcepath defined elsewhere.
    • setSourcePath

      public void setSourcePath(org.apache.tools.ant.types.Path src)
      the sourcepath to use.
    • createSourcePath

      public org.apache.tools.ant.types.Path createSourcePath()
      Path to use for sourcepath.
    • setSourcePathRef

      public void setSourcePathRef(org.apache.tools.ant.types.Reference r)
      Adds a reference to a source path defined elsewhere.
    • createClass

      public FindBugsTask.ClassLocation createClass()
      Add a class location
    • setOutputFile

      public void setOutputFile(String outputFileName)
      Set name of output file.
    • setOnlyAnalyze

      public void setOnlyAnalyze(String filter)
      Set the packages or classes to analyze
    • addFileset

      public void addFileset(org.apache.tools.ant.types.FileSet fs)
      Add a nested fileset of classes or jar files.
    • checkParameters

      protected void checkParameters()
      Check that all required attributes have been set
      Overrides:
      checkParameters in class AbstractFindBugsTask
    • beforeExecuteJavaProcess

      protected void beforeExecuteJavaProcess()
      Specified by:
      beforeExecuteJavaProcess in class AbstractFindBugsTask
    • afterExecuteJavaProcess

      protected void afterExecuteJavaProcess(int rc)
      Overrides:
      afterExecuteJavaProcess in class AbstractFindBugsTask
    • configureFindbugsEngine

      protected void configureFindbugsEngine()
      Specified by:
      configureFindbugsEngine in class AbstractFindBugsTask