diff --git a/src/main/groovy/org/codehaus/mojo/spotbugs/BaseViolationCheckMojo.groovy b/src/main/groovy/org/codehaus/mojo/spotbugs/BaseViolationCheckMojo.groovy index 22236fc8a..caacba769 100644 --- a/src/main/groovy/org/codehaus/mojo/spotbugs/BaseViolationCheckMojo.groovy +++ b/src/main/groovy/org/codehaus/mojo/spotbugs/BaseViolationCheckMojo.groovy @@ -44,9 +44,7 @@ import org.codehaus.plexus.resource.ResourceManager abstract class BaseViolationCheckMojo extends AbstractMojo { - /** - * Location where generated html will be created. - */ + /** Location where generated html will be created. */ @Parameter(defaultValue = '${project.reporting.outputDirectory}', required = true) File outputDirectory @@ -82,39 +80,27 @@ abstract class BaseViolationCheckMojo extends AbstractMojo { @Parameter(property = "spotbugs.outputXmlFilename", defaultValue = "spotbugsXml.xml") String spotbugsXmlOutputFilename - /** - * Doxia Site Renderer. - */ + /** Doxia Site Renderer. */ @Component(role = Renderer.class) Renderer siteRenderer - /** - * Directory containing the class files for Spotbugs to analyze. - */ + /** Directory containing the class files for Spotbugs to analyze. */ @Parameter(defaultValue = '${project.build.outputDirectory}', required = true) File classFilesDirectory - /** - * Directory containing the test class files for Spotbugs to analyze. - */ + /** Directory containing the test class files for Spotbugs to analyze. */ @Parameter(defaultValue = '${project.build.testOutputDirectory}', required = true) File testClassFilesDirectory - /** - * Location of the Xrefs to link to. - */ + /** Location of the Xrefs to link to. */ @Parameter(defaultValue = '${project.reporting.outputDirectory}/xref') File xrefLocation - /** - * Location of the Test Xrefs to link to. - */ + /** Location of the Test Xrefs to link to. */ @Parameter(defaultValue = '${project.reporting.outputDirectory}/xref-test') File xrefTestLocation - /** - * The directories containing the sources to be compiled. - */ + /** The directories containing the sources to be compiled. */ @Parameter(defaultValue = '${project.compileSourceRoots}', required = true, readonly = true) List compileSourceRoots @@ -134,9 +120,7 @@ abstract class BaseViolationCheckMojo extends AbstractMojo { @Parameter(defaultValue = "false", property = "spotbugs.includeTests") boolean includeTests - /** - * List of artifacts this plugin depends on. Used for resolving the Spotbugs core plugin. - */ + /** List of artifacts this plugin depends on. Used for resolving the Spotbugs core plugin. */ @Parameter(property = "plugin.artifacts", required = true, readonly = true) List pluginArtifacts @@ -146,27 +130,19 @@ abstract class BaseViolationCheckMojo extends AbstractMojo { @Parameter(property = "localRepository", required = true, readonly = true) ArtifactRepository localRepository - /** - * Remote repositories which will be searched for the coreplugin jar. - */ + /** Remote repositories which will be searched for the coreplugin jar. */ @Parameter(property = "project.remoteArtifactRepositories", required = true, readonly = true) List remoteArtifactRepositories - /** - * Maven Session. - */ + /** Maven Session. */ @Parameter (defaultValue = '${session}', required = true, readonly = true) MavenSession session - /** - * Maven Project. - */ + /** Maven Project. */ @Parameter(property = "project", required = true, readonly = true) MavenProject project - /** - * Encoding used for xml files. Default value is UTF-8. - */ + /** Encoding used for xml files. Default value is UTF-8. */ @Parameter(defaultValue = "UTF-8", readonly = true) String xmlEncoding @@ -188,24 +164,18 @@ abstract class BaseViolationCheckMojo extends AbstractMojo { @Parameter(defaultValue = '${project.reporting.outputEncoding}', property = "outputEncoding") String outputEncoding - /** - * Threshold of minimum bug severity to report. Valid values are High, Default, Low, Ignore, and Exp (for experimental). - */ + /** Threshold of minimum bug severity to report. Valid values are High, Default, Low, Ignore, and Exp (for experimental). */ @Parameter(defaultValue = "Default", property = "spotbugs.threshold") String threshold - /** - * Artifact resolver, needed to download the coreplugin jar. - */ + /** Artifact resolver, needed to download the coreplugin jar. */ @Component(role = ArtifactResolver.class) ArtifactResolver artifactResolver /** * File name of the include filter. Only bugs in matching the filters are reported. - * *

* Potential values are a filesystem path, a URL, or a classpath resource. - * *

* This parameter is resolved as resource, URL, then file. If successfully * resolved, the contents of the configuration is copied into the @@ -220,10 +190,8 @@ abstract class BaseViolationCheckMojo extends AbstractMojo { /** * File name of the exclude filter. Bugs matching the filters are not reported. - * *

* Potential values are a filesystem path, a URL, or a classpath resource. - * *

* This parameter is resolved as resource, URL, then file. If successfully * resolved, the contents of the configuration is copied into the @@ -238,10 +206,8 @@ abstract class BaseViolationCheckMojo extends AbstractMojo { /** * File names of the baseline files. Bugs found in the baseline files won't be reported. - * *

* Potential values are a filesystem path, a URL, or a classpath resource. - * *

* This parameter is resolved as resource, URL, then file. If successfully * resolved, the contents of the configuration is copied into the @@ -263,9 +229,7 @@ abstract class BaseViolationCheckMojo extends AbstractMojo { @Parameter(defaultValue = "Default", property = "spotbugs.effort") String effort - /** - * Turn on Spotbugs debugging. - */ + /** Turn on Spotbugs debugging. */ @Parameter(defaultValue = "false", property = "spotbugs.debug") boolean debug @@ -296,10 +260,8 @@ abstract class BaseViolationCheckMojo extends AbstractMojo { /** * The plugin list to include in the report. This is a comma-delimited list. - * *

* Potential values are a filesystem path, a URL, or a classpath resource. - * *

* This parameter is resolved as resource, URL, then file. If successfully * resolved, the contents of the configuration is copied into the @@ -430,9 +392,7 @@ abstract class BaseViolationCheckMojo extends AbstractMojo { @Parameter(property = "spotbugs.maxAllowedViolations", defaultValue = "0") int maxAllowedViolations - /** - * Disable bugs log. - */ + /** Disable bugs log. */ @Parameter(defaultValue = "false", property = "spotbugs.quiet") boolean quiet diff --git a/src/main/groovy/org/codehaus/mojo/spotbugs/PluginArtifact.groovy b/src/main/groovy/org/codehaus/mojo/spotbugs/PluginArtifact.groovy index 92ed151fe..ff3cbadda 100644 --- a/src/main/groovy/org/codehaus/mojo/spotbugs/PluginArtifact.groovy +++ b/src/main/groovy/org/codehaus/mojo/spotbugs/PluginArtifact.groovy @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,9 +16,18 @@ package org.codehaus.mojo.spotbugs class PluginArtifact { + /** The group id. */ String groupId + + /** The artifact id. */ String artifactId + + /** The version. */ String version + + /** The type defaulted as jar. */ String type = "jar" + + /** The classifier. */ String classifier } diff --git a/src/main/groovy/org/codehaus/mojo/spotbugs/ResourceHelper.groovy b/src/main/groovy/org/codehaus/mojo/spotbugs/ResourceHelper.groovy index 62be1836c..e15dc8bf0 100644 --- a/src/main/groovy/org/codehaus/mojo/spotbugs/ResourceHelper.groovy +++ b/src/main/groovy/org/codehaus/mojo/spotbugs/ResourceHelper.groovy @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,8 +23,13 @@ import org.codehaus.plexus.resource.ResourceManager final class ResourceHelper { + /** The log. */ Log log + + /** The output directory. */ File outputDirectory + + /** The resource manager. */ ResourceManager resourceManager ResourceHelper(Log log, File outputDirectory, ResourceManager resourceManager) { diff --git a/src/main/groovy/org/codehaus/mojo/spotbugs/SourceFileIndexer.groovy b/src/main/groovy/org/codehaus/mojo/spotbugs/SourceFileIndexer.groovy index e0c7dde8c..d5ead41a7 100644 --- a/src/main/groovy/org/codehaus/mojo/spotbugs/SourceFileIndexer.groovy +++ b/src/main/groovy/org/codehaus/mojo/spotbugs/SourceFileIndexer.groovy @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,9 +27,7 @@ import java.nio.file.Paths */ class SourceFileIndexer { - /** - * List of source files found in the current Maven project - */ + /** List of source files found in the current Maven project. */ private List allSourceFiles /** @@ -113,6 +111,7 @@ class SourceFileIndexer { /** * Normalize path to use forward slash. + *

* This will facilitate searches. * * @param path Path to clean up diff --git a/src/main/groovy/org/codehaus/mojo/spotbugs/SpotBugsGui.groovy b/src/main/groovy/org/codehaus/mojo/spotbugs/SpotBugsGui.groovy index 4689852a8..0d13a34d2 100644 --- a/src/main/groovy/org/codehaus/mojo/spotbugs/SpotBugsGui.groovy +++ b/src/main/groovy/org/codehaus/mojo/spotbugs/SpotBugsGui.groovy @@ -47,40 +47,26 @@ import org.codehaus.plexus.resource.ResourceManager @Mojo(name = "gui", requiresDependencyResolution = ResolutionScope.TEST, requiresProject = true) class SpotBugsGui extends AbstractMojo implements SpotBugsPluginsTrait { - /** - * locale to use for Resource bundle. - */ + /** Locale to use for Resource bundle. */ static Locale locale = Locale.ENGLISH - /** - * Directory containing the class files for Spotbugs to analyze. - */ + /** Directory containing the class files for Spotbugs to analyze. */ @Parameter(defaultValue = '${project.build.outputDirectory}', required = true) File classFilesDirectory - /** - * Turn on Spotbugs debugging. - * - */ + /** Turn on Spotbugs debugging. */ @Parameter(defaultValue = "false", property="spotbugs.debug") boolean debug - /** - * List of artifacts this plugin depends on. Used for resolving the Spotbugs core plugin. - */ + /** List of artifacts this plugin depends on. Used for resolving the Spotbugs core plugin. */ @Parameter(property="plugin.artifacts", required = true, readonly = true) List pluginArtifacts - /** - * Effort of the bug finders. Valid values are Min, Default and Max. - * - */ + /** Effort of the bug finders. Valid values are Min, Default and Max. */ @Parameter(defaultValue = "Default", property="spotbugs.effort") String effort - /** - * The plugin list to include in the report. This is a SpotbugsInfo.COMMA-delimited list. - */ + /** The plugin list to include in the report. This is a SpotbugsInfo.COMMA-delimited list. */ @Parameter(property="spotbugs.pluginList") String pluginList @@ -94,23 +80,15 @@ class SpotBugsGui extends AbstractMojo implements SpotBugsPluginsTrait { @Parameter PluginArtifact[] plugins - /** - * Artifact resolver, needed to download the coreplugin jar. - */ + /** Artifact resolver, needed to download the coreplugin jar. */ @Component(role = ArtifactResolver.class) ArtifactResolver artifactResolver - /** - * Used to look up Artifacts in the remote repository. - * - */ + /** Used to look up Artifacts in the remote repository. */ @Component(role = RepositorySystem.class) RepositorySystem factory - /** - * List of Remote Repositories used by the resolver. - * - */ + /** List of Remote Repositories used by the resolver. */ @Parameter(property = "project.remoteArtifactRepositories", required = true, readonly = true) List remoteRepositories @@ -121,30 +99,19 @@ class SpotBugsGui extends AbstractMojo implements SpotBugsPluginsTrait { @Parameter(property = "localRepository", required = true, readonly = true) ArtifactRepository localRepository - /** - * Maven Session. - */ + /** Maven Session. */ @Parameter (defaultValue = '${session}', required = true, readonly = true) MavenSession session - /** - * Maven Project. - * - */ + /** Maven Project. */ @Parameter(property="project", required = true, readonly = true) MavenProject project - /** - * Resource bundle for a specific locale. - * - */ + /** Resource bundle for a specific locale. */ @Parameter(readonly = true) ResourceBundle bundle - /** - * Specifies the directory where the Spotbugs native xml output will be generated. - * - */ + /** Specifies the directory where the Spotbugs native xml output will be generated. */ @Parameter(defaultValue = '${project.build.directory}', required = true) File spotbugsXmlOutputDirectory diff --git a/src/main/groovy/org/codehaus/mojo/spotbugs/SpotBugsInfo.groovy b/src/main/groovy/org/codehaus/mojo/spotbugs/SpotBugsInfo.groovy index 10c353c41..f707e05ef 100644 --- a/src/main/groovy/org/codehaus/mojo/spotbugs/SpotBugsInfo.groovy +++ b/src/main/groovy/org/codehaus/mojo/spotbugs/SpotBugsInfo.groovy @@ -24,70 +24,63 @@ package org.codehaus.mojo.spotbugs */ interface SpotBugsInfo { - /** - * The name of the Plug-In. - */ + /** The name of the Plug-In. */ static final String PLUGIN_NAME = "spotbugs" - /** - * The name of the property resource bundle (Filesystem). - */ + /** The name of the property resource bundle (Filesystem). */ static final String BUNDLE_NAME = "spotbugs" - /** - * The key to get the name of the Plug-In from the bundle. - */ + /** The key to get the name of the Plug-In from the bundle. */ static final String NAME_KEY = "report.spotbugs.name" - /** - * The key to get the description of the Plug-In from the bundle. - */ + /** The key to get the description of the Plug-In from the bundle. */ static final String DESCRIPTION_KEY = "report.spotbugs.description" - /** - * The key to get the source directory message of the Plug-In from the bundle. - */ + /** The key to get the source directory message of the Plug-In from the bundle. */ static final String SOURCE_ROOT_KEY = "report.spotbugs.sourceRoot" - /** - * The key to get the source directory message of the Plug-In from the bundle. - */ + /** The key to get the source directory message of the Plug-In from the bundle. */ static final String TEST_SOURCE_ROOT_KEY = "report.spotbugs.testSourceRoot" - /** - * The key to get the java source message of the Plug-In from the bundle. - */ + /** The key to get the java source message of the Plug-In from the bundle. */ static final String JAVA_SOURCES_KEY = "report.spotbugs.javasources" - /** - * The extensions to search files for. - */ + /** The extensions to search files for. */ static final String[] EXTENSIONS = [ "class" ] + /** The comma character. */ static final String COMMA = "," + /** The forward slash character. */ static final String FORWARD_SLASH = '/' + /** The backward slash character. */ static final String BACKWARD_SLASH = '\\' - /** - * The character to separate URL tokens. - */ + /** The character to separate URL tokens. */ static final String URL_SEPARATOR = "/" + /** The blank character. */ static final String BLANK = " " + /** The period character. */ static final String PERIOD = "." + /** The end of line separator. */ static final EOL = System.lineSeparator() + /** The url static string. */ static final String URL = "url" + /** The static class suffix. */ static final String CLASS_SUFFIX = '.class' + /** The spotbugs efforts as max, min, and default as default. */ Map spotbugsEfforts = [Max: "max", Min: "min", Default: "default"] + /** The spotbugs thresholds as high, experimental, low, medium, and default as medium. */ Map spotbugsThresholds = [High: "high", Exp: "experimental", Low: "low", Medium: "medium", Default: "medium"] + /** The spotbugs priority as unknown, high, medium, and low. */ List spotbugsPriority = ["unknown", "High", "Medium", "Low"] } diff --git a/src/main/groovy/org/codehaus/mojo/spotbugs/SpotBugsMojo.groovy b/src/main/groovy/org/codehaus/mojo/spotbugs/SpotBugsMojo.groovy index 1358ce5c7..bf846d047 100644 --- a/src/main/groovy/org/codehaus/mojo/spotbugs/SpotBugsMojo.groovy +++ b/src/main/groovy/org/codehaus/mojo/spotbugs/SpotBugsMojo.groovy @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -52,10 +52,7 @@ import java.util.stream.Collectors @Mojo(name = "spotbugs", requiresDependencyResolution = ResolutionScope.TEST, requiresProject = true, threadSafe = true) class SpotBugsMojo extends AbstractMavenReport implements SpotBugsPluginsTrait { - /** - * Location where generated html will be created allowed to be not read only as defined in AbstractMavenParent. - * - */ + /** Location where generated html will be created allowed to be not read only as defined in AbstractMavenParent. */ @Parameter(defaultValue = '${project.reporting.outputDirectory}', required = true) File outputDirectory @@ -142,39 +139,27 @@ class SpotBugsMojo extends AbstractMavenReport implements SpotBugsPluginsTrait { @Parameter(property = "spotbugs.outputXmlFilename", defaultValue = "spotbugsXml.xml") String spotbugsXmlOutputFilename - /** - * Doxia Site Renderer. - */ + /** Doxia Site Renderer. */ @Component(role = Renderer.class) Renderer siteRenderer - /** - * Directory containing the class files for Spotbugs to analyze. - */ + /** Directory containing the class files for Spotbugs to analyze. */ @Parameter(defaultValue = '${project.build.outputDirectory}', required = true) File classFilesDirectory - /** - * Directory containing the test class files for Spotbugs to analyze. - */ + /** Directory containing the test class files for Spotbugs to analyze. */ @Parameter(defaultValue = '${project.build.testOutputDirectory}', required = true) File testClassFilesDirectory - /** - * Location of the Xrefs to link to. - */ + /** Location of the Xrefs to link to. */ @Parameter(defaultValue = '${project.reporting.outputDirectory}/xref') File xrefLocation - /** - * Location of the Test Xrefs to link to. - */ + /** Location of the Test Xrefs to link to. */ @Parameter(defaultValue = '${project.reporting.outputDirectory}/xref-test') File xrefTestLocation - /** - * The directories containing the sources to be compiled. - */ + /** The directories containing the sources to be compiled. */ @Parameter(defaultValue = '${project.compileSourceRoots}', required = true, readonly = true) List compileSourceRoots @@ -194,22 +179,15 @@ class SpotBugsMojo extends AbstractMavenReport implements SpotBugsPluginsTrait { @Parameter(defaultValue = "false", property = "spotbugs.includeTests") boolean includeTests - /** - * Run Spotbugs with -sourcepath parameter populated with the known source roots. - */ + /** Run Spotbugs with -sourcepath parameter populated with the known source roots. */ @Parameter(defaultValue = "false", property = "spotbugs.addSourceDirs") boolean addSourceDirs - /** - * List of artifacts this plugin depends on. Used for resolving the Spotbugs core plugin. - */ + /** List of artifacts this plugin depends on. Used for resolving the Spotbugs core plugin. */ @Parameter(property = "plugin.artifacts", required = true, readonly = true) List pluginArtifacts - /** - * List of Remote Repositories used by the resolver. - * - */ + /** List of Remote Repositories used by the resolver. */ @Parameter(property = "project.remoteArtifactRepositories", required = true, readonly = true) List remoteRepositories @@ -219,27 +197,19 @@ class SpotBugsMojo extends AbstractMavenReport implements SpotBugsPluginsTrait { @Parameter(property = "localRepository", required = true, readonly = true) ArtifactRepository localRepository - /** - * Remote repositories which will be searched for the coreplugin jar. - */ + /** Remote repositories which will be searched for the coreplugin jar. */ @Parameter(property = "project.remoteArtifactRepositories", required = true, readonly = true) List remoteArtifactRepositories - /** - * Maven Session. - */ + /** Maven Session. */ @Parameter (defaultValue = '${session}', required = true, readonly = true) MavenSession session - /** - * Maven Project. - */ + /** Maven Project. */ @Parameter(property = "project", required = true, readonly = true) MavenProject project - /** - * Encoding used for xml files. Default value is UTF-8. - */ + /** Encoding used for xml files. Default value is UTF-8. */ @Parameter(defaultValue = "UTF-8", readonly = true) String xmlEncoding @@ -261,21 +231,15 @@ class SpotBugsMojo extends AbstractMavenReport implements SpotBugsPluginsTrait { @Parameter(defaultValue = '${project.reporting.outputEncoding}', property = "outputEncoding") String outputEncoding - /** - * Threshold of minimum bug severity to report. Valid values are High, Default, Low, Ignore, and Exp (for experimental). - */ + /** Threshold of minimum bug severity to report. Valid values are High, Default, Low, Ignore, and Exp (for experimental). */ @Parameter(defaultValue = "Default", property = "spotbugs.threshold") String threshold - /** - * Artifact resolver, needed to download the coreplugin jar. - */ + /** Artifact resolver, needed to download the coreplugin jar. */ @Component(role = ArtifactResolver.class) ArtifactResolver artifactResolver - /** - * Used to look up Artifacts in the remote repository. - */ + /** Used to look up Artifacts in the remote repository. */ @Component(role = RepositorySystem.class) RepositorySystem factory @@ -388,10 +352,7 @@ class SpotBugsMojo extends AbstractMavenReport implements SpotBugsPluginsTrait { @Parameter(defaultValue = "Default", property = "spotbugs.effort") String effort - /** - * Turn on Spotbugs debugging. - * - */ + /** Turn on Spotbugs debugging. */ @Parameter(defaultValue = "false", property = "spotbugs.debug") boolean debug @@ -577,12 +538,16 @@ class SpotBugsMojo extends AbstractMavenReport implements SpotBugsPluginsTrait { @Parameter(property = "spotbugs.systemPropertyVariables") Map systemPropertyVariables + /** The bug count. */ int bugCount + /** The error count. */ int errorCount + /** The resource bundle. */ ResourceBundle bundle + /** The output spotbugs file. */ File outputSpotbugsFile /** diff --git a/src/main/groovy/org/codehaus/mojo/spotbugs/SpotBugsPluginsTrait.groovy b/src/main/groovy/org/codehaus/mojo/spotbugs/SpotBugsPluginsTrait.groovy index a22f59262..24acd6495 100644 --- a/src/main/groovy/org/codehaus/mojo/spotbugs/SpotBugsPluginsTrait.groovy +++ b/src/main/groovy/org/codehaus/mojo/spotbugs/SpotBugsPluginsTrait.groovy @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/groovy/org/codehaus/mojo/spotbugs/SpotbugsReportGenerator.groovy b/src/main/groovy/org/codehaus/mojo/spotbugs/SpotbugsReportGenerator.groovy index 110ce67f0..3e1203bd8 100644 --- a/src/main/groovy/org/codehaus/mojo/spotbugs/SpotbugsReportGenerator.groovy +++ b/src/main/groovy/org/codehaus/mojo/spotbugs/SpotbugsReportGenerator.groovy @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/groovy/org/codehaus/mojo/spotbugs/XDocsReporter.groovy b/src/main/groovy/org/codehaus/mojo/spotbugs/XDocsReporter.groovy index 61b9434e4..ad610d63a 100644 --- a/src/main/groovy/org/codehaus/mojo/spotbugs/XDocsReporter.groovy +++ b/src/main/groovy/org/codehaus/mojo/spotbugs/XDocsReporter.groovy @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License.