diff --git a/src/it/html-report/verify.groovy b/src/it/html-report/verify.groovy index 227a40978..3d35e444c 100644 --- a/src/it/html-report/verify.groovy +++ b/src/it/html-report/verify.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/BaseViolationCheckMojo.groovy b/src/main/groovy/org/codehaus/mojo/spotbugs/BaseViolationCheckMojo.groovy index 22236fc8a..92ed9c84a 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 @@ -364,7 +326,7 @@ abstract class BaseViolationCheckMojo extends AbstractMojo { /** * SiteTool. * - * @since 2.1-SNAPSHOT + * @since 2.1 */ @Component(role = SiteTool.class) SiteTool siteTool @@ -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..4e539014d 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 @@ -498,7 +459,7 @@ class SpotBugsMojo extends AbstractMavenReport implements SpotBugsPluginsTrait { /** * SiteTool. * - * @since 2.1-SNAPSHOT + * @since 2.1 */ @Component(role = SiteTool.class) SiteTool siteTool @@ -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 b13252abd..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. @@ -32,100 +32,61 @@ import org.codehaus.plexus.util.PathTool */ class SpotbugsReportGenerator implements SpotBugsInfo { - /** - * The key to get the value if the line number is not available. - */ + /** The key to get the value if the line number is not available. */ static final String NOLINE_KEY = "report.spotbugs.noline" - /** - * The key to get the column title for the line. - */ + /** The key to get the column title for the line. */ static final String COLUMN_LINE_KEY = "report.spotbugs.column.line" - /** - * The key to get the column title for the bug. - */ + /** The key to get the column title for the bug. */ static final String COLUMN_BUG_KEY = "report.spotbugs.column.bug" - /** - * The key to get the column title for the bugs. - */ + /** The key to get the column title for the bugs. */ static final String COLUMN_BUGS_KEY = "report.spotbugs.column.bugs" - /** - * The key to get the column title for the category. - */ + /** The key to get the column title for the category. */ static final String COLUMN_CATEGORY_KEY = "report.spotbugs.column.category" - /** - * The key to get the column title for the priority. - */ + /** The key to get the column title for the priority. */ static final String COLUMN_PRIORITY_KEY = "report.spotbugs.column.priority" - /** - * The key to get the column title for the details. - */ + /** The key to get the column title for the details. */ static final String COLUMN_DETAILS_KEY = "report.spotbugs.column.details" - /** - * The key to get the report title of the Plug-In from the bundle. - */ + /** The key to get the report title of the Plug-In from the bundle. */ static final String REPORT_TITLE_KEY = "report.spotbugs.reporttitle" - /** - * The key to get the report link title of the Plug-In from the bundle. - */ + /** The key to get the report link title of the Plug-In from the bundle. */ static final String LINKTITLE_KEY = "report.spotbugs.linktitle" - /** - * The key to get the report link of the Plug-In from the bundle. - */ + /** The key to get the report link of the Plug-In from the bundle. */ static final String LINK_KEY = "report.spotbugs.link" - /** - * The key to get the files title of the Plug-In from the bundle. - */ + /** The key to get the files title of the Plug-In from the bundle. */ static final String FILES_KEY = "report.spotbugs.files" - /** - * The key to get the threshold of the report from the bundle. - */ + /** The key to get the threshold of the report from the bundle. */ static final String THRESHOLD_KEY = "report.spotbugs.threshold" - /** - * The key to get the effort of the report from the bundle. - */ + /** The key to get the effort of the report from the bundle. */ static final String EFFORT_KEY = "report.spotbugs.effort" - /** - * The key to get the link to SpotBugs description page from the bundle. - */ + /** The key to get the link to SpotBugs description page from the bundle. */ static final String DETAILSLINK_KEY = "report.spotbugs.detailslink" - /** - * The key to get the version title for SpotBugs from the bundle. - * - */ + /** The key to get the version title for SpotBugs from the bundle. */ static final String VERSIONTITLE_KEY = "report.spotbugs.versiontitle" - /** - * The key to get the files title of the Plug-In from the bundle. - */ + /** The key to get the files title of the Plug-In from the bundle. */ static final String SUMMARY_KEY = "report.spotbugs.summary" - /** - * The key to column title for the Class. - */ + /** The key to column title for the Class. */ static final String COLUMN_CLASS_KEY = "report.spotbugs.column.class" - /** - * The key to column title for the Classes. - */ + /** The key to column title for the Classes. */ static final String COLUMN_CLASSES_KEY = "report.spotbugs.column.classes" - /** - * The key to column title for the errors. - */ + /** The key to column title for the errors. */ static final String COLUMN_ERRORS_KEY = "report.spotbugs.column.errors" /** @@ -135,119 +96,73 @@ class SpotbugsReportGenerator implements SpotBugsInfo { */ static final String COLUMN_FILES_KEY = "report.spotbugs.column.files" - /** - * The key to column title for the files. - */ + /** The key to column title for the files. */ static final String COLUMN_MISSINGCLASSES_KEY = "report.spotbugs.column.missingclasses" - /** - * The sink to write the report to. - */ + /** The sink to write the report to. */ Sink sink - /** - * The bundle to get the messages from. - */ + /** The bundle to get the messages from. */ ResourceBundle bundle - /** - * The logger to write logs to. - */ + /** The logger to write logs to. */ Log log - /** - * The threshold of bugs severity. - */ + /** The threshold of bugs severity. */ String threshold - /** - * The used effort for searching bugs. - */ + /** The used effort for searching bugs. */ String effort - /** - * The name of the current class which is analysed by SpotBugs. - */ + /** The name of the current class which is analysed by SpotBugs. */ String currentClassName - /** - * Signals if the jxr report plugin is enabled. - */ + /** Signals if the jxr report plugin is enabled. */ boolean isJXRReportEnabled - /** - * The running total of bugs reported. - */ + /** The running total of bugs reported. */ int bugCount - /** - * The running total of missing classes reported. - */ + /** The running total of missing classes reported. */ int missingClassCount - /** - * The running total of files analyzed. - */ + /** The running total of files analyzed. */ int fileCount - /** - * The Set of missing classes names reported. - */ + /** The Set of missing classes names reported. */ Set missingClassSet = new HashSet() - /** - * The running total of errors reported. - */ + /** The running total of errors reported. */ int errorCount - /** - * Location where generated html will be created. - */ + /** Location where generated html will be created. */ File outputDirectory - /** - * Location of the Xrefs to link to. - */ + /** Location of the Xrefs to link to. */ File xrefLocation - /** - * Location of the Test Xrefs to link to. - */ + /** Location of the Test Xrefs to link to. */ File xrefTestLocation - /** - * The directories containing the sources to be compiled. - */ + /** The directories containing the sources to be compiled. */ List compileSourceRoots - /** - * The directories containing the test-sources to be compiled. - */ + /** The directories containing the test-sources to be compiled. */ List testSourceRoots - /** - * Run Spotbugs on the tests. - */ + /** Run Spotbugs on the tests. */ boolean includeTests - /** - * Doxia site tool. - */ + /** Doxia site tool. */ SiteTool siteTool - /** - * Base directory. - */ + /** Base directory. */ File basedir - /** - * Spotbugs results. - */ + /** Spotbugs results. */ GPathResult spotbugsResults - /** - * Bug classes. - */ + /** Bug classes. */ List bugClasses /** diff --git a/src/main/groovy/org/codehaus/mojo/spotbugs/XDocsReporter.groovy b/src/main/groovy/org/codehaus/mojo/spotbugs/XDocsReporter.groovy index 481876cb2..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. @@ -27,59 +27,37 @@ import org.apache.maven.plugin.logging.Log */ class XDocsReporter { - /** - * The key to get the value if the line number is not available. - */ + /** The key to get the value if the line number is not available. */ static final String NOLINE_KEY = "report.spotbugs.noline" - /** - * The bundle to get the messages from. - */ + /** The bundle to get the messages from. */ ResourceBundle bundle - /** - * The logger to write logs to. - */ + /** The logger to write logs to. */ Log log - /** - * The threshold of bugs severity. - */ + /** The threshold of bugs severity. */ String threshold - /** - * The used effort for searching bugs. - */ + /** The used effort for searching bugs. */ String effort - /** - * The output Writer stream. - */ + /** The output Writer stream. */ Writer outputWriter - /** - * Spotbugs Results. - */ + /** Spotbugs Results. */ GPathResult spotbugsResults - /** - * Bug Classes. - */ + /** Bug Classes. */ List bugClasses - /** - * The directories containing the sources to be compiled. - */ + /** The directories containing the sources to be compiled. */ List compileSourceRoots - /** - * The directories containing the test sources to be compiled. - */ + /** The directories containing the test sources to be compiled. */ List testSourceRoots - /** - * The output encoding. - */ + /** The output encoding. */ String outputEncoding /**