Class SpotBugsOperation
- Since:
- 1.0
- Author:
- Erik C. Thauvin
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe error message indicating that the provided SpotBugs location is invalid.Fields inherited from class rife.bld.operations.AbstractProcessOperation
classpath_, DEFAULT_JAVA_TOOL, environment_, errorProcessor_, errorProcessorThread_, javaOptions_, javaTool_, mainClass_, module_, modulePath_, outputProcessor_, outputProcessorThread_, process_, successful_ -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns whether experimental bug patterns will have their priority lowered.adjustExperimental(boolean adjustExperimental) Lower priority of experimental Bug Patterns.Returns the collection of adjusted priorities.adjustPriority(String name, int priority) Adjust the priority of warnings for a given detector (simple or fully qualified class name) or bug pattern, or suppress it completely.adjustPriority(String name, Priority priority) Adjust the priority of warnings for a given detector (simple or fully qualified class name) or bug pattern, or suppress it completely.analyze()Returns the collection of files configured to be analyzed.Specifies files to analyze for bugs.Specifies files to analyze for bugs.Specifies files to analyze for bugs.analyze(Collection<?> files) Specifies files to analyze for bugs.booleanReturns whether suppression from filter files is applied.applySuppression(boolean applySuppression) Exclude any bugs that match suppression filter loaded from fbp file.Returns the auxiliary classpath used for analysis.auxClasspath(String... paths) Set the auxiliary classpath for analysis.auxClasspath(Collection<String> paths) Set the auxiliary classpath for analysis.Returns the configured bug categories to report.bugCategories(String... categories) 0nly report bugs in given categories.bugCategories(Collection<String> categories) 0nly report bugs in given categories.Returns the collection of bug reporter decorators that are enabled/disabled.bugReporters(String... reporters) Bug reporter decorators to explicitly enable/disable.bugReporters(Collection<String> reporters) Bug reporter decorators to explicitly enable/disable.Returns the collection of chosen plugin enable/disable decorators.choosePlugins(String... plugins) Selectively enable/disable plugins.choosePlugins(Collection<String> plugins) Selectively enable/disable plugins.Returns the collection of chosen visitor enable/disable decorators.chooseVisitors(String... visitors) Selectively enable/disable detectors.chooseVisitors(Collection<String> visitors) Selectively enable/disable detectors.booleandebug()Retrieves the debug state.debug(boolean debug) Sets the debug mode for the SpotBugs operation.booleanReturns whether detailed messages are enabled.detailedMessage(boolean detailedMessage) Sets whether detailed messages should be printed.booleanReturns whether warnings that differ only by line number are combined.dontCombineWarnings(boolean dontCombineWarnings) Don't combine warnings that differ only in line number.effort()Returns the configured analysis effort level.Set the analysis effort level.emacs()Returns the Emacs bug reports file.Produce the bug reports in Emacs format.Produce the bug reports in Emacs format.Produce the bug reports in Emacs format.exclude()Returns the configured filter file used to exclude bugs.Report all bug instances except those matching the filter specified by the filter file.Report all bug instances except those matching the filter specified by the filter file.Report all bug instances except those matching the filter specified by the filter file.Returns the exclude file used to exclude bugs.excludeBugs(File excludeFile) Exclude bugs that are also reported in the baseline XML output.excludeBugs(String excludeFile) Exclude bugs that are also reported in the baseline XML output.excludeBugs(Path excludeFile) Exclude bugs that are also reported in the baseline XML output.voidexecute()Performs the operation.Part of the execute operation constructs the command list to use for building the process.booleanReturns whether experimental bug patterns are included in the report.experimental(boolean experimental) Report of any confidence level including experimental bug patterns.fromProject(BaseProject project) Configures a compile operation from aBaseProject.fromProject(BaseProject project, boolean includeTest) Configures a compile operation from aBaseProject.booleanhigh()Returns whether only high-priority bugs will be reported.high(boolean high) Report only high-priority bugs.home()Returns the SpotBugs home directory.Specify SpotBugs home directory.Specify SpotBugs home directory.Specify SpotBugs home directory.html()Returns the HTML output file.Generate HTML output.Generate HTML output.Generate HTML output.Generate HTML output.Generate HTML output.Generate HTML output.ignoreFailure(boolean ignoreFailures) Sets the flag to indicate whether failures should be ignored.booleanReturn the ignore failures flag.include()Returns the include filter file.Only report bug instances that match the filter specified by filter file.Only report bug instances that match the filter specified by filter file.booleanReturns whether the line number should be included in source file URIs.includeLineNumber(boolean includeLineNumber) Enable or disable line number in source file URIs.jvmArgs()Returns the collection of JVM arguments configured for the SpotBugs run.Specifies arguments to pass to the JVM.jvmArgs(Collection<String> args) Specifies arguments to pass to the JVM.booleanReturns whether long bug codes are enabled.longBugCodes(boolean longBugCodes) Report long bug codes.booleanlow()low(boolean low) Report all bugs.intmaxHeap()Returns the configured maximum Java heap size in megabytes.maxHeap(int size) Specifies the maximum Java heap size in megabytes.intmaxRank()Returns the configured maximum bug rank threshold.maxRank(int maxRank) Only report issues with a bug rank at least as scary as that provided.booleanmedium()Returns whether medium-priority bugs are reported.medium(boolean medium) Report medium and high-priority bugs.booleannested()Returns whether nested jar/zip scanning is enabled.nested(boolean nested) This option enables or disables scanning of nested jar and zip files found in the list of files and directories to be analyzed.booleanReturns whether an empty warning file is allowed when no classes are specified.noClassOk(boolean noClassOk) Output an empty warning file if no classes are specified.Returns the collection of visitors configured to be omitted.omitVisitors(String... visitors) Omit named visitors.omitVisitors(Collection<String> visitors) Omit named visitors.Returns the collection of analyze-only patterns configured.onlyAnalyze(String... patterns) Restrict analysis to find bugs to ist of classes and packages.onlyAnalyze(Collection<String> patterns) Restrict analysis to find bugs to ist of classes and packages.output()Returns the configured XML bug report output file.Sets the XML bug report file path.Sets the XML bug report file path.Sets the XML bug report file path.static intParses the given string into an integer.static intparseIntOrDefault(String s, int defaultValue) Parses the given string into an integer.Returns the collection of plugin jar files to load.pluginList(String... plugins) Specify a list of plugin Jar files to load.pluginList(Collection<String> plugins) Specify a list of plugin Jar files to load.booleanprogress()Retrieves the current progress setting.progress(boolean progress) Display progress in the terminal window.Returns the configured descriptive project name.projectName(String name) Descriptive name of the project.booleanrelaxed()Returns whether relaxed reporting mode is enabled.relaxed(boolean relaxed) Relaxed reporting mode.release()Returns the configured release name for the analyzed application.Set the release name of the analyzed application.sarif()Returns the SARIF bug reports file.Produce the bug reports in SARIF 2.1.0.Produce the bug reports in SARIF 2.1.0.Produce the bug reports in SARIF 2.1.0.booleanReturns whether bug instances will be sorted by class name.sortByClass(boolean sortByClass) Sort reported bug instances by class name.Returns the source info file containing line numbers for fields/classes.sourceInfo(File sourceInfo) Specify the source info file (line numbers for fields/classes)sourceInfo(String sourceInfo) Specify the source info file (line numbers for fields/classes)sourceInfo(Path sourceInfo) Specify the source info file (line numbers for fields/classes)Returns the source path for analyzed classes.sourcePath(File... path) Set the source path for analyzed classes.sourcePath(String... path) Set the source path for analyzed classes.sourcePath(Path... path) Set the source path for analyzed classes.sourcePath(Collection<?> path) Set the source path for analyzed classes.Returns the SpotBugs jar file.spotBugsJar(File jar) Sets the SpotBugs jar file.spotBugsJar(String jar) Sets the SpotBugs jar file.spotBugsJar(Path jarPath) Sets the SpotBugs jar file.booleanReturns whether the timestamp of results will be set to the current time.timestampNow(boolean timeStampNow) Set the timestamp of results to be the current time.visitors()Returns the collection of named visitors to run.Run only named visitors.visitors(Collection<String> visitors) Run only named visitors.booleanworkHard()Returns whether analysis effort should be at leastEffort.DEFAULT.workHard(boolean workHard) Ensure analysis effort is at leastEffort.DEFAULT.Methods inherited from class rife.bld.operations.AbstractProcessOperation
classpath, classpath, classpath, environment, environment, environment, errorProcessor, errorProcessor, executeStartProcess, javaOptions, javaOptions, javaTool, javaTool, mainClass, mainClass, module, module, modulePath, modulePath, modulePath, outputProcessor, outputProcessor, process, workDirectory, workDirectoryMethods inherited from class rife.bld.operations.AbstractOperation
executeOnce, executeOnce, silent, silent
-
Field Details
-
INVALID_SPOTBUGS_LOCATION
The error message indicating that the provided SpotBugs location is invalid.- See Also:
-
-
Constructor Details
-
SpotBugsOperation
public SpotBugsOperation()
-
-
Method Details
-
execute
public void execute() throws IOException, FileUtilsErrorException, InterruptedException, ExitStatusExceptionPerforms the operation.- Overrides:
executein classAbstractProcessOperation<SpotBugsOperation>- Throws:
InterruptedException- when the operation was interruptedIOException- when an exception occurred during the execution of the processFileUtilsErrorException- when an exception occurred during the retrieval of the operation outputExitStatusException- when the exit status was changed during the operation
-
executeConstructProcessCommandList
Part of the execute operation constructs the command list to use for building the process.- Specified by:
executeConstructProcessCommandListin classAbstractProcessOperation<SpotBugsOperation>- Returns:
- a list of strings representing the commands or an empty list if no commands are constructed.
-
fromProject
Configures a compile operation from aBaseProject.Sets the following from the project:
analyzetobuildMainDirectory-
auxClasspathtocompileMainClasspath nestedandtimestampNowtotrueoutputtoreports/spotbugs/spotbugs.xmlin thebuildDirectoryprojectNameto theproject namesarifto {@code reports/spotbugs/spotbugs.sarif) in the</li> {@link BaseProject#buildDirectory() buildDirectory}</li> <li>{@link #sourcePath() sourcePath} to {@link BaseProject#srcMainJavaDirectory() srcMainJavaDirectory} and {@link BaseProject#srcMainResourcesDirectory() srcMainResourceDirectory}</li> </ul> @param project the project to configure the compile operation from @return this operation instance @see #fromProject(BaseProject, boolean)
- Specified by:
fromProjectin classAbstractProcessOperation<SpotBugsOperation>
-
parseIntOrDefault
Parses the given string into an integer.If the string is null, empty, or cannot be parsed as an integer, it returns the specified default value.
- Parameters:
s- the string to parse as an integerdefaultValue- the value to return if parsing fails- Returns:
- the parsed integer value, or the default value if parsing fails
-
parseIntOrDefault
Parses the given string into an integer.If the string cannot be parsed, returns a default value of
-1.- Parameters:
s- the string to be parsed into an integer- Returns:
- the parsed integer value, or
-1if parsing fails
-
adjustExperimental
Lower priority of experimental Bug Patterns.- Parameters:
adjustExperimental- set totrueto lower priority,falseotherwise- Returns:
- this operation
-
adjustExperimental
public boolean adjustExperimental()Returns whether experimental bug patterns will have their priority lowered.- Returns:
trueif experimental patterns priorities are adjusted,falseotherwise
-
adjustPriorities
Returns the collection of adjusted priorities.Each element is formatted as:
name=value- Returns:
- a collection containing the adjusted priorities as strings
-
adjustPriority
Adjust the priority of warnings for a given detector (simple or fully qualified class name) or bug pattern, or suppress it completely.An unsigned integer sets the priority to an absolute value.
Note that
-1is equivalentPriority.RAISE, and semantically increases the priority.- Parameters:
name- the detector or bug pattern namepriority- the priority level to adjust- See Also:
-
adjustPriority
Adjust the priority of warnings for a given detector (simple or fully qualified class name) or bug pattern, or suppress it completely.- Parameters:
name- the detector or bug pattern namepriority- the priority level to adjust- Returns:
- this operation
- See Also:
-
analyze
Specifies files to analyze for bugs.- Parameters:
files- array of file paths to analyze- Returns:
- this operation
- See Also:
-
analyze
Specifies files to analyze for bugs.- Parameters:
files- array of files to analyze- Returns:
- this operation
- See Also:
-
analyze
Specifies files to analyze for bugs.- Parameters:
files- array of files to analyze- Returns:
- this operation
- See Also:
-
analyze
Specifies files to analyze for bugs.- Parameters:
files- collection of files to analyze- Returns:
- this operation
- See Also:
-
analyze
Returns the collection of files configured to be analyzed.- Returns:
- a collection containing the files to analyze
-
applySuppression
Exclude any bugs that match suppression filter loaded from fbp file.- Parameters:
applySuppression- set totrueto enable,falseotherwise- Returns:
- this operation
-
applySuppression
public boolean applySuppression()Returns whether suppression from filter files is applied.- Returns:
trueif suppression is applied,falseotherwise
-
auxClasspath
Set the auxiliary classpath for analysis.This classpath should include all jar files and directories containing classes that are part of the program being analyzed, but you do not want to have analyzed for bugs.
- Parameters:
paths- the auxiliary paths to set- Returns:
- this operation
- See Also:
-
auxClasspath
Set the auxiliary classpath for analysis.This classpath should include all jar files and directories containing classes that are part of the program being analyzed, but you do not want to have analyzed for bugs.
- Parameters:
paths- the auxiliary paths to set- Returns:
- this operation
- See Also:
-
auxClasspath
Returns the auxiliary classpath used for analysis.- Returns:
- a collection containing the auxiliary classpath entries
-
bugCategories
0nly report bugs in given categories.- Parameters:
categories- the bug categories- Returns:
- this operation
- See Also:
-
bugCategories
0nly report bugs in given categories.- Parameters:
categories- the bug categories- Returns:
- this operation
- See Also:
-
bugCategories
Returns the configured bug categories to report.- Returns:
- a collection containing the bug categories
-
bugReporters
Bug reporter decorators to explicitly enable/disable.Prefix the reporter name with
-to disable.- Parameters:
reporters- the reporters to enable/disable- Returns:
- this operation
- See Also:
-
bugReporters
Bug reporter decorators to explicitly enable/disable.Prefix the reporter name with
-to disable.- Parameters:
reporters- the reporters to enable/disable- Returns:
- this operation
- See Also:
-
bugReporters
Returns the collection of bug reporter decorators that are enabled/disabled.- Returns:
- a collection containing the bug reporters
-
choosePlugins
Selectively enable/disable plugins.Prefix the plugin name with
-to disable.- Parameters:
plugins- the plugins to enable/disable- Returns:
- this operation
- See Also:
-
choosePlugins
Selectively enable/disable plugins.Prefix the plugin name with
-to disable.- Parameters:
plugins- the plugins to enable/disable- Returns:
- this operation
- See Also:
-
choosePlugins
Returns the collection of chosen plugin enable/disable decorators.- Returns:
- a collection containing the chosen plugin strings
-
chooseVisitors
Selectively enable/disable detectors.Prefix the detector name with
-to disable.- Parameters:
visitors- the visitors to enable/disable- Returns:
- this operation
- See Also:
-
chooseVisitors
Selectively enable/disable detectors.Prefix the detector name with
-to disable.- Parameters:
visitors- the visitors to enable/disable- Returns:
- this operation
- See Also:
-
chooseVisitors
Returns the collection of chosen visitor enable/disable decorators.- Returns:
- a collection containing the chosen visitor strings
-
debug
Sets the debug mode for the SpotBugs operation.- Parameters:
debug-trueto enable,falseotherwise- Returns:
- this operation
-
debug
public boolean debug()Retrieves the debug state.- Returns:
trueif debug mode is enabled,falseotherwise.
-
detailedMessage
Sets whether detailed messages should be printed.- Parameters:
detailedMessage-trueto enable,falseotherwise- Returns:
- this operation
-
detailedMessage
public boolean detailedMessage()Returns whether detailed messages are enabled.- Returns:
trueif detailed messages will be printed,falseotherwise
-
dontCombineWarnings
Don't combine warnings that differ only in line number.- Parameters:
dontCombineWarnings- set totrueto enable,falseotherwise- Returns:
- this operation
-
dontCombineWarnings
public boolean dontCombineWarnings()Returns whether warnings that differ only by line number are combined.- Returns:
trueif warnings are not combined,falseotherwise
-
effort
Set the analysis effort level.The
Effort.MINdisables several analyses that increase precision but also increase memory consumption. You may want to try this option if you find that SpotBugs with theEffort.LESSstill runs out of memory, or takes an unusually long time to complete its analysis.The
Effort.LESSdisables some analyses that increase precision but also increase memory consumption. You may want to try this option if you find that SpotBugs with theEffort.MORE/Effort.DEFAULTruns out of memory, or takes an unusually long time to complete its analysis.The
Effort.MOREruns several analyses to find bugs, this is theEffort.DEFAULT.The
Effort.MAXenable analyses which increase precision and find more bugs, but which may require more memory and take more time to complete.- Parameters:
effort- the effort level- Returns:
- this operation
- See Also:
-
effort
Returns the configured analysis effort level.- Returns:
- the
Effortconfigured for this operation, ornullif none
-
emacs
Produce the bug reports in Emacs format.- Parameters:
file- the output file- Returns:
- this operation
- See Also:
-
emacs
Produce the bug reports in Emacs format.- Parameters:
file- the output file- Returns:
- this operation
- See Also:
-
emacs
Produce the bug reports in Emacs format.- Parameters:
file- the output file- Returns:
- this operation
- See Also:
-
emacs
Returns the Emacs bug reports file.- Returns:
- the bug reports file
-
exclude
Report all bug instances except those matching the filter specified by the filter file.- Parameters:
excludeFilter- the filter file- Returns:
- this operation
- See Also:
-
exclude
Report all bug instances except those matching the filter specified by the filter file.- Parameters:
excludeFilter- the filter file- Returns:
- this operation
- See Also:
-
exclude
Report all bug instances except those matching the filter specified by the filter file.- Parameters:
excludeFilter- the filter file- Returns:
- this operation
- See Also:
-
exclude
Returns the configured filter file used to exclude bugs.- Returns:
- the exclude filter
File, ornullif none configured
-
excludeBugs
Exclude bugs that are also reported in the baseline XML output.- Parameters:
excludeFile- the exclude file- Returns:
- this operation
- See Also:
-
excludeBugs
Exclude bugs that are also reported in the baseline XML output.- Parameters:
excludeFile- the exclude file- Returns:
- this operation
- See Also:
-
excludeBugs
Exclude bugs that are also reported in the baseline XML output.- Parameters:
excludeFile- the exclude file- Returns:
- this operation
- See Also:
-
excludeBugs
Returns the exclude file used to exclude bugs.- Returns:
- the exclude file
-
experimental
Report of any confidence level including experimental bug patterns.- Parameters:
experimental- set totrueto enable,falseotherwise- Returns:
- this operation
-
experimental
public boolean experimental()Returns whether experimental bug patterns are included in the report.- Returns:
trueif experimental patterns are reported,falseotherwise
-
fromProject
Configures a compile operation from aBaseProject.Sets the following from the project:
analyzetobuildMainDirectory-
auxClasspathtocompileMainClasspath outputtoreports/spotbugs/spotbugs.xmlin thebuildDirectoryprojectNameto theproject namesarifto {@code reports/spotbugs/spotbugs.sarif) in the</li> {@link BaseProject#buildDirectory() buildDirectory}</li> * <li>{@link #sourcePath() sourcePath} to {@link BaseProject#srcMainJavaDirectory() srcMainJavaDirectory} and {@link BaseProject#srcMainResourcesDirectory() srcMainResourceDirectory}</li> <li>{@link #timestampNow() timestampNow} to {@code true}</li> </ul> <p> If {@code includeTest} is enabled, the {@code test} directories are also included. </p> @param project the project to configure the compile operation from @param includeTest set to {@code true} to include test directories, {@code false} otherwise @return this operation instance @see #fromProject(BaseProject)
-
high
Report only high-priority bugs.- Parameters:
high- set totrueto enable,falseotherwise- Returns:
- this operation
-
high
public boolean high()Returns whether only high-priority bugs will be reported.- Returns:
trueif only high-priority bugs are reported,falseotherwise
-
home
Specify SpotBugs home directory.- Parameters:
home- the home directory- Returns:
- this operation
- See Also:
-
home
Specify SpotBugs home directory.- Parameters:
home- the home directory- Returns:
- this operation
- See Also:
-
home
Specify SpotBugs home directory.- Parameters:
home- the home directory- Returns:
- this operation
- See Also:
-
home
Returns the SpotBugs home directory.- Returns:
- the SpotBugs home path, or
nullif not set
-
html
Generate HTML output.- Parameters:
file- the output file- Returns:
- this operation
- See Also:
-
html
Generate HTML output.- Parameters:
filePath- the output file- Returns:
- this operation
- See Also:
-
html
Generate HTML output.- Parameters:
file- the output file- Returns:
- this operation
- See Also:
-
html
Returns the HTML output file.- Returns:
- the HTML output file
-
html
Generate HTML output.By default, SpotBugs will use the default.xsl XSLT stylesheet to generate the HTML: you can find this file in spotbugs.jar, or in the SpotBugs source or binary distributions. Variants of this option include:
plain.xslfancy.xslfancy-hist.xsl
The
plain.xslstylesheet does not use JavaScript or DOM, and may work better with older web browsers, or for printing.The
fancy.xslstylesheet uses DOM and JavaScript for navigation and CSS for visual presentation.The
fancy-hist.xslan evolution of fancy.xsl stylesheet. It makes extensive use of DOM and JavaScript for dynamically filtering the lists of bugs.If you want to specify your own XSLT stylesheet to perform the transformation to HTML, specify the option as
myStylesheet.xsl, the filename of the stylesheet you want to use.- Parameters:
file- the output filestylesheet- the stylesheet to use- Returns:
- this operation
- See Also:
-
html
Generate HTML output.By default, SpotBugs will use the default.xsl XSLT stylesheet to generate the HTML: you can find this file in spotbugs.jar, or in the SpotBugs source or binary distributions. Variants of this option include:
plain.xslfancy.xslfancy-hist.xsl
The
plain.xslstylesheet does not use JavaScript or DOM, and may work better with older web browsers, or for printing.The
fancy.xslstylesheet uses DOM and JavaScript for navigation and CSS for visual presentation.The
fancy-hist.xslan evolution of fancy.xsl stylesheet. It makes extensive use of DOM and JavaScript for dynamically filtering the lists of bugs.If you want to specify your own XSLT stylesheet to perform the transformation to HTML, specify the option as
myStylesheet.xsl, the filename of the stylesheet you want to use.- Parameters:
filePath- the output filestylesheet- the stylesheet to use- Returns:
- this operation
- See Also:
-
html
Generate HTML output.By default, SpotBugs will use the default.xsl XSLT stylesheet to generate the HTML: you can find this file in spotbugs.jar, or in the SpotBugs source or binary distributions. Variants of this option include:
plain.xslfancy.xslfancy-hist.xsl
The
plain.xslstylesheet does not use JavaScript or DOM, and may work better with older web browsers, or for printing.The
fancy.xslstylesheet uses DOM and JavaScript for navigation and CSS for visual presentation.The
fancy-hist.xslan evolution of fancy.xsl stylesheet. It makes extensive use of DOM and JavaScript for dynamically filtering the lists of bugs.If you want to specify your own XSLT stylesheet to perform the transformation to HTML, specify the option as
myStylesheet.xsl, the filename of the stylesheet you want to use.- Parameters:
file- the output filestylesheet- the stylesheet to use- Returns:
- this operation
- See Also:
-
ignoreFailure
Sets the flag to indicate whether failures should be ignored.The default is enabled.
- Parameters:
ignoreFailures-trueto enable,falseto disable.- Returns:
- this operation
-
ignoreFailures
public boolean ignoreFailures()Return the ignore failures flag.- Returns:
trueif enabled,falseotherwise
-
include
-
include
Only report bug instances that match the filter specified by filter file.- Parameters:
includeFilter- the filter file- Returns:
- this operation
- See Also:
-
include
Only report bug instances that match the filter specified by filter file.- Parameters:
includeFilter- the filter file- Returns:
- this operation
- See Also:
-
include
Returns the include filter file.- Returns:
- the include filter
File, ornullif none configured
-
includeLineNumber
Enable or disable line number in source file URIs.While clicking on the URI works in IntelliJ IDEA, Visual Studio Code, etc.; it might not in terminal emulators.
< Enabled by default.
- Parameters:
includeLineNumber-trueto enable,falseotherwise- Returns:
- this operation
-
includeLineNumber
public boolean includeLineNumber()Returns whether the line number should be included in source file URIs.- Returns:
trueif the line number should be included,falseotherwise
-
jvmArgs
Specifies arguments to pass to the JVM.- Parameters:
args- the args to pass to JVM- Returns:
- this operation
- See Also:
-
jvmArgs
Specifies arguments to pass to the JVM.- Parameters:
args- the args to pass to JVM- Returns:
- this operation
- See Also:
-
jvmArgs
Returns the collection of JVM arguments configured for the SpotBugs run.- Returns:
- a collection containing JVM arguments
-
longBugCodes
Report long bug codes.- Parameters:
longBugCodes- set totrueto enable,falseotherwise- Returns:
- this operation
-
longBugCodes
public boolean longBugCodes()Returns whether long bug codes are enabled.- Returns:
trueif long bug codes will be reported,falseotherwise
-
low
Report all bugs.- Parameters:
low- set totrueto enable,falseotherwise- Returns:
- this operation
-
low
public boolean low() -
maxHeap
Specifies the maximum Java heap size in megabytes.The default is 256. More memory may be required to analyze very large programs or libraries.
- Parameters:
size- the maximum heap size in megabytes- Returns:
- this operation
-
maxHeap
public int maxHeap()Returns the configured maximum Java heap size in megabytes.- Returns:
- the maximum heap size in megabytes
-
maxRank
Only report issues with a bug rank at least as scary as that provided.- Parameters:
maxRank- the maximum rank- Returns:
- this operation
-
maxRank
public int maxRank()Returns the configured maximum bug rank threshold.- Returns:
- the maximum rank value
-
medium
Report medium and high-priority bugs.This is the default setting.
- Parameters:
medium- set totrueto enable,falseotherwise- Returns:
- this operation
-
medium
public boolean medium()Returns whether medium-priority bugs are reported.- Returns:
trueif medium (and higher) priority bugs are reported,falseotherwise
-
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.
- Parameters:
nested- set totrueto enable,falseotherwise- Returns:
- this operation
-
nested
public boolean nested()Returns whether nested jar/zip scanning is enabled.- Returns:
trueif nested scanning is enabled,falseotherwise
-
noClassOk
Output an empty warning file if no classes are specified.- Parameters:
noClassOk- set totrueto enable,falseotherwise- Returns:
- this operation
-
noClassOk
public boolean noClassOk()Returns whether an empty warning file is allowed when no classes are specified.- Returns:
trueif an empty warning file is allowed,falseotherwise
-
omitVisitors
Omit named visitors.- Parameters:
visitors- the visitors to omit- Returns:
- this operation
- See Also:
-
omitVisitors
Omit named visitors.- Parameters:
visitors- the visitors to omit- Returns:
- this operation
- See Also:
-
omitVisitors
Returns the collection of visitors configured to be omitted.- Returns:
- a collection containing the visitors to omit
-
onlyAnalyze
Restrict analysis to find bugs to ist of classes and packages.Unlike filtering, this option avoids running analysis on classes and packages that are not explicitly matched: for large projects, this may greatly reduce the amount of time needed to run the analysis. (However, some detectors may produce inaccurate results if they aren’t run on the entire application.)
Classes should be specified using their full classnames (including package).
Packages should be specified in the same way they would in a Java import statement to import all classes in the package (i.e., add
.*to the full name of the package). Replace.*with.-to also analyze all subpackages.Items starting with
!are treated as exclusions, removing otherwise-included classes from analysis.- Parameters:
patterns- the patterns to analyze- Returns:
- this operation
- See Also:
-
onlyAnalyze
Restrict analysis to find bugs to ist of classes and packages.Unlike filtering, this option avoids running analysis on classes and packages that are not explicitly matched: for large projects, this may greatly reduce the amount of time needed to run the analysis. (However, some detectors may produce inaccurate results if they aren’t run on the entire application.)
Classes should be specified using their full classnames (including package).
Packages should be specified in the same way they would in a Java import statement to import all classes in the package (i.e., add
.*to the full name of the package). Replace.*with.-to also analyze all subpackages.Items starting with
!are treated as exclusions, removing otherwise-included classes from analysis.- Parameters:
patterns- the patterns to analyze- Returns:
- this operation
- See Also:
-
onlyAnalyze
Returns the collection of analyze-only patterns configured.- Returns:
- a collection of analyze-only patterns
-
output
Sets the XML bug report file path.The default is:
spotbugs.xml- Parameters:
file- the file path- Returns:
- this operation
- See Also:
-
output
Sets the XML bug report file path.The default is:
spotbugs.xml- Parameters:
file- the file path- Returns:
- this operation
- See Also:
-
output
Sets the XML bug report file path.The default is:
spotbugs.xml- Parameters:
filePath- the file path- Returns:
- this operation
- See Also:
-
output
Returns the configured XML bug report output file.- Returns:
- the output
File
-
pluginList
Specify a list of plugin Jar files to load.- Parameters:
plugins- the plugin list- Returns:
- this operation
- See Also:
-
pluginList
Specify a list of plugin Jar files to load.- Parameters:
plugins- the plugin list- Returns:
- this operation
- See Also:
-
pluginList
Returns the collection of plugin jar files to load.- Returns:
- a collection containing the plugin jar files
-
progress
Display progress in the terminal window.- Parameters:
progress- set totrueto enable,falseotherwise- Returns:
- this operation
-
progress
public boolean progress()Retrieves the current progress setting.- Returns:
trueif progress display is enabled,falseotherwise
-
projectName
Descriptive name of the project.- Parameters:
name- the project name- Returns:
- this operation
-
projectName
Returns the configured descriptive project name.- Returns:
- the project name, or
nullif not configured
-
relaxed
Relaxed reporting mode.For many detectors, this option suppresses the heuristics used to avoid reporting false positives.
- Parameters:
relaxed- set totrueto enable,falseotherwise- Returns:
- this operation
-
relaxed
public boolean relaxed()Returns whether relaxed reporting mode is enabled.- Returns:
trueif relaxed mode is enabled,falseotherwise
-
release
Set the release name of the analyzed application.- Parameters:
release- the release name- Returns:
- this operation
-
release
Returns the configured release name for the analyzed application.- Returns:
- the release name, or
nullif not set
-
sarif
Produce the bug reports in SARIF 2.1.0.- Parameters:
file- the output file- Returns:
- this operation
- See Also:
-
sarif
Produce the bug reports in SARIF 2.1.0.- Parameters:
file- the output file- Returns:
- this operation
- See Also:
-
sarif
Produce the bug reports in SARIF 2.1.0.- Parameters:
filePath- the output file- Returns:
- this operation
- See Also:
-
sarif
Returns the SARIF bug reports file.- Returns:
- the bug reports file
-
sortByClass
public boolean sortByClass()Returns whether bug instances will be sorted by class name.- Returns:
trueif enabled,falseotherwise
-
sortByClass
Sort reported bug instances by class name.- Parameters:
sortByClass- set totrueto enable,falseotherwise- Returns:
- this operation
-
sourceInfo
Specify the source info file (line numbers for fields/classes)- Parameters:
sourceInfo- the source info file- Returns:
- this operation
- See Also:
-
sourceInfo
Specify the source info file (line numbers for fields/classes)- Parameters:
sourceInfo- the source info file- Returns:
- this operation
- See Also:
-
sourceInfo
Specify the source info file (line numbers for fields/classes)- Parameters:
sourceInfo- the source info file- Returns:
- this operation
- See Also:
-
sourceInfo
Returns the source info file containing line numbers for fields/classes.- Returns:
- the source info file
-
sourcePath
Set the source path for analyzed classes.- Parameters:
path- the source path- Returns:
- this operation
- See Also:
-
sourcePath
Set the source path for analyzed classes. * @see #sourcePathPaths(Collection)- Parameters:
path- the source path- Returns:
- this operation
- See Also:
-
sourcePath
Set the source path for analyzed classes.- Parameters:
path- the source path- Returns:
- this operation
- See Also:
-
sourcePath
Returns the source path for analyzed classes.- Returns:
- a collection containing the source paths
-
sourcePath
Set the source path for analyzed classes.- Parameters:
path- the source path- Returns:
- this operation
- See Also:
-
spotBugsJar
Returns the SpotBugs jar file.- Returns:
- the SpotBugs jar file
-
spotBugsJar
Sets the SpotBugs jar file.- Parameters:
jar- the SpotBugs jar file- Returns:
- this operation
- See Also:
-
spotBugsJar
Sets the SpotBugs jar file.- Parameters:
jarPath- the SpotBugs jar file- Returns:
- this operation
- See Also:
-
spotBugsJar
Sets the SpotBugs jar file.- Parameters:
jar- the SpotBugs jar file- Returns:
- this operation
- See Also:
-
timestampNow
Set the timestamp of results to be the current time.- Parameters:
timeStampNow- set totrueto enable,falseotherwise- Returns:
- this operation
-
timestampNow
public boolean timestampNow()Returns whether the timestamp of results will be set to the current time.- Returns:
trueif timestampNow is enabled,falseotherwise
-
visitors
Run only named visitors.- Parameters:
visitors- the visitors to run- Returns:
- this operation
- See Also:
-
visitors
Run only named visitors.- Parameters:
visitors- the visitors to run- Returns:
- this operation
- See Also:
-
visitors
Returns the collection of named visitors to run.- Returns:
- a collection containing the visitors
-
workHard
Ensure analysis effort is at leastEffort.DEFAULT.- Parameters:
workHard- set totrueto enable,falseotherwise- Returns:
- this operation
-
workHard
public boolean workHard()Returns whether analysis effort should be at leastEffort.DEFAULT.- Returns:
trueif enabled,falseotherwise
-