This is an automated email from the ASF dual-hosted git repository.
claude pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/creadur-rat.git
The following commit(s) were added to refs/heads/master by this push:
new b58ed6b2 RAT-435: checkstyle fixes for root package (#375)
b58ed6b2 is described below
commit b58ed6b27147fa1ef9501683469389b259d3a692
Author: Claude Warren <[email protected]>
AuthorDate: Wed Oct 30 17:59:49 2024 +0000
RAT-435: checkstyle fixes for root package (#375)
* checkstyle fixes for root package
* removed unsued throws
* Minor fixes
* added documentation concerning methods called by reflection
---------
Co-authored-by: P. Ottlinger <[email protected]>
Co-authored-by: P. Ottlinger <[email protected]>
---
.../main/java/org/apache/rat/BuilderParams.java | 11 +++++-----
.../org/apache/rat/ConfigurationException.java | 10 ++++-----
.../src/main/java/org/apache/rat/Defaults.java | 25 ++++++++--------------
.../java/org/apache/rat/DeprecationReporter.java | 12 +++++------
.../org/apache/rat/ImplementationException.java | 12 +++++------
.../main/java/org/apache/rat/OptionCollection.java | 8 +++----
.../src/main/java/org/apache/rat/Report.java | 4 ++--
.../java/org/apache/rat/ReportConfiguration.java | 22 +++++++++----------
.../src/main/java/org/apache/rat/VersionInfo.java | 14 ++++++------
src/changes/changes.xml | 4 +++-
10 files changed, 59 insertions(+), 63 deletions(-)
diff --git a/apache-rat-core/src/main/java/org/apache/rat/BuilderParams.java
b/apache-rat-core/src/main/java/org/apache/rat/BuilderParams.java
index 530d43ca..d4be7769 100644
--- a/apache-rat-core/src/main/java/org/apache/rat/BuilderParams.java
+++ b/apache-rat-core/src/main/java/org/apache/rat/BuilderParams.java
@@ -26,14 +26,13 @@ import org.apache.rat.analysis.IHeaderMatcher;
import org.apache.rat.license.ILicenseFamily;
/**
- * Parameters that can be set by the BUILDER_PARAM ComponentType. The name of
the method listed here
+ * Parameters that can be set by the BUILDER_PARAM ComponentType. The name of
the method listed here
* should be the same as the name specified in the ConfigComponent.
*/
public interface BuilderParams {
-
/**
* Gets one of the contained methods by name.
- *
+ *
* @param name the name of the method to get.
* @return the Method.
*/
@@ -50,15 +49,17 @@ public interface BuilderParams {
/**
* Gets a mapping of matcher names to matchers.
- *
+ *
* @return the mapping of matcher names to matchers.
*/
Map<String, IHeaderMatcher> matcherMap();
+ // the above method is called by reflection.
/**
* Gets a sorted set of registered license families.
- *
+ *
* @return the sorted set of license families.
*/
SortedSet<ILicenseFamily> licenseFamilies();
+ // the above method is called by reflection
}
diff --git
a/apache-rat-core/src/main/java/org/apache/rat/ConfigurationException.java
b/apache-rat-core/src/main/java/org/apache/rat/ConfigurationException.java
index bf0705cd..d5add9fe 100644
--- a/apache-rat-core/src/main/java/org/apache/rat/ConfigurationException.java
+++ b/apache-rat-core/src/main/java/org/apache/rat/ConfigurationException.java
@@ -19,28 +19,28 @@
package org.apache.rat;
/**
- * An exception thrown when there is an issue with the Configuration.
+ * An exception thrown when there is an issue with the configuration.
*/
public class ConfigurationException extends RuntimeException {
private static final long serialVersionUID = 7257245932787579431L;
- public static ConfigurationException from(Exception e) {
+ public static ConfigurationException from(final Exception e) {
if (e instanceof ConfigurationException) {
return (ConfigurationException) e;
}
return new ConfigurationException(e);
}
- public ConfigurationException(String message, Throwable cause) {
+ public ConfigurationException(final String message, final Throwable cause)
{
super(message, cause);
}
- public ConfigurationException(String message) {
+ public ConfigurationException(final String message) {
super(message);
}
- public ConfigurationException(Throwable cause) {
+ public ConfigurationException(final Throwable cause) {
super(cause);
}
diff --git a/apache-rat-core/src/main/java/org/apache/rat/Defaults.java
b/apache-rat-core/src/main/java/org/apache/rat/Defaults.java
index 76a10027..bc7ef27d 100644
--- a/apache-rat-core/src/main/java/org/apache/rat/Defaults.java
+++ b/apache-rat-core/src/main/java/org/apache/rat/Defaults.java
@@ -18,8 +18,6 @@
*/
package org.apache.rat;
-import static java.lang.String.format;
-
import java.io.File;
import java.net.MalformedURLException;
import java.net.URI;
@@ -30,9 +28,7 @@ import java.util.Collection;
import java.util.Set;
import java.util.SortedSet;
import java.util.TreeSet;
-import java.util.function.Supplier;
-import org.apache.rat.config.exclusion.ExclusionProcessor;
import org.apache.rat.config.exclusion.StandardCollection;
import org.apache.rat.configuration.Format;
import org.apache.rat.configuration.LicenseReader;
@@ -43,6 +39,8 @@ import org.apache.rat.license.LicenseSetFactory;
import org.apache.rat.license.LicenseSetFactory.LicenseFilter;
import org.apache.rat.utils.DefaultLog;
+import static java.lang.String.format;
+
/**
* A class that provides the standard system defaults for the
ReportConfiguration.
* Properties in this class may be overridden or added to by configuration
options in the various UIs.
@@ -51,20 +49,19 @@ import org.apache.rat.utils.DefaultLog;
public final class Defaults {
/** The default configuration file from the package. */
private static final URI DEFAULT_CONFIG_URI;
- /** The path to the default configuration file */
+ /** The path to the default configuration file. */
private static final String DEFAULT_CONFIG_PATH =
"/org/apache/rat/default.xml";
- /** The default ARCHIVES processing style */
+ /** The default ARCHIVES processing style. */
public static final ReportConfiguration.Processing ARCHIVE_PROCESSING =
ReportConfiguration.Processing.NOTIFICATION;
- /** The default STANDARD processing style */
+ /** The default STANDARD processing style. */
public static final ReportConfiguration.Processing STANDARD_PROCESSING =
ReportConfiguration.Processing.ABSENCE;
- /** The default license families to list */
+ /** The default license families to list. */
public static final LicenseFilter LIST_FAMILIES = LicenseFilter.NONE;
- /** The default licenses to list */
+ /** The default licenses to list. */
public static final LicenseFilter LIST_LICENSES = LicenseFilter.NONE;
/** The license set factory to build license sets based upon default
options */
private final LicenseSetFactory setFactory;
- private final Supplier<ExclusionProcessor> exclusionSupplier;
// TODO look at this static block with respect to the init() static method
and figure out if we need both.
static {
@@ -99,9 +96,8 @@ public final class Defaults {
* Builder constructs instances.
* @param uris The set of URIs to read.
*/
- private Defaults(final Set<URI> uris, final Supplier<ExclusionProcessor>
exclusionSupplier) {
+ private Defaults(final Set<URI> uris) {
this.setFactory = Defaults.readConfigFiles(uris);
- this.exclusionSupplier = exclusionSupplier;
}
/**
@@ -166,7 +162,6 @@ public final class Defaults {
public static final class Builder {
/** The list of URIs that we wil read to configure the Defaults */
private final Set<URI> fileNames = new TreeSet<>();
- private final Supplier<ExclusionProcessor> exclusionSupplier;
private Builder() {
if (DEFAULT_CONFIG_URI == null) {
@@ -174,8 +169,6 @@ public final class Defaults {
} else {
fileNames.add(DEFAULT_CONFIG_URI);
}
- exclusionSupplier = () -> new
ExclusionProcessor().addExcludedCollection(StandardCollection.MISC)
- .addExcludedCollection(StandardCollection.HIDDEN_DIR);
}
/**
@@ -249,7 +242,7 @@ public final class Defaults {
* @return the current defaults object.
*/
public Defaults build() {
- return new Defaults(fileNames, exclusionSupplier);
+ return new Defaults(fileNames);
}
}
}
diff --git
a/apache-rat-core/src/main/java/org/apache/rat/DeprecationReporter.java
b/apache-rat-core/src/main/java/org/apache/rat/DeprecationReporter.java
index 05083dd7..f55f3a3c 100644
--- a/apache-rat-core/src/main/java/org/apache/rat/DeprecationReporter.java
+++ b/apache-rat-core/src/main/java/org/apache/rat/DeprecationReporter.java
@@ -18,8 +18,6 @@
*/
package org.apache.rat;
-import static java.lang.String.format;
-
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@@ -29,17 +27,19 @@ import java.util.function.Consumer;
import org.apache.commons.cli.Option;
import org.apache.rat.utils.DefaultLog;
+import static java.lang.String.format;
+
/**
* Reporting methods for deprecated objects.
*/
public final class DeprecationReporter {
- private DeprecationReporter() {
- // DO NOT INSTANTIATE
- }
/**
* Deprecated Command line option consumer.
*/
+ private DeprecationReporter() {
+ // DO NOT INSTANTIATE
+ }
/**
* Creates the consumer that will log usage of deprecated operations to
the default log.
@@ -105,7 +105,7 @@ public final class DeprecationReporter {
*/
boolean forRemoval() default false;
/**
- * The component type
+ * The component type.
* @return the component type.
*/
String use() default "";
diff --git
a/apache-rat-core/src/main/java/org/apache/rat/ImplementationException.java
b/apache-rat-core/src/main/java/org/apache/rat/ImplementationException.java
index c4439383..76bd2f7c 100644
--- a/apache-rat-core/src/main/java/org/apache/rat/ImplementationException.java
+++ b/apache-rat-core/src/main/java/org/apache/rat/ImplementationException.java
@@ -19,28 +19,28 @@
package org.apache.rat;
/**
- * An exception thrown when there is an issue with the configuration.
+ * An exception thrown when there is an issue with the implementation of an
extension point.
*/
public class ImplementationException extends RuntimeException {
private static final long serialVersionUID = 7257245932787579431L;
-
- public static ImplementationException makeInstance(Exception e) {
+
+ public static ImplementationException makeInstance(final Exception e) {
if (e instanceof ImplementationException) {
return (ImplementationException) e;
}
return new ImplementationException(e);
}
- public ImplementationException(String message, Throwable cause) {
+ public ImplementationException(final String message, final Throwable
cause) {
super(message, cause);
}
- public ImplementationException(String message) {
+ public ImplementationException(final String message) {
super(message);
}
- public ImplementationException(Throwable cause) {
+ public ImplementationException(final Throwable cause) {
super(cause);
}
diff --git a/apache-rat-core/src/main/java/org/apache/rat/OptionCollection.java
b/apache-rat-core/src/main/java/org/apache/rat/OptionCollection.java
index 3d7abbc1..8969abf6 100644
--- a/apache-rat-core/src/main/java/org/apache/rat/OptionCollection.java
+++ b/apache-rat-core/src/main/java/org/apache/rat/OptionCollection.java
@@ -44,9 +44,9 @@ import org.apache.rat.commandline.Arg;
import org.apache.rat.commandline.ArgumentContext;
import org.apache.rat.commandline.StyleSheets;
import org.apache.rat.config.exclusion.StandardCollection;
+import org.apache.rat.document.impl.DocumentName;
import org.apache.rat.document.impl.DocumentNameMatcher;
import org.apache.rat.document.impl.FileDocument;
-import org.apache.rat.document.impl.DocumentName;
import org.apache.rat.help.Licenses;
import org.apache.rat.license.LicenseSetFactory;
import org.apache.rat.report.IReportable;
@@ -74,7 +74,8 @@ public final class OptionCollection {
public static final Option HELP = new Option("?", "help", false, "Print
help for the RAT command line interface and exit.");
/** Provide license definition listing */
- public static final Option HELP_LICENSES =
Option.builder().longOpt("help-licenses").desc("Print help for the RAT command
line interface and exit.").build();
+ public static final Option HELP_LICENSES =
Option.builder().longOpt("help-licenses")
+ .desc("Print help for the RAT command line interface and
exit.").build();
/** A mapping of {@code argName(value)} values to a description of those
values. */
private static final Map<String, Supplier<String>> ARGUMENT_TYPES;
@@ -203,11 +204,10 @@ public final class OptionCollection {
* @param baseDirectory the base directory where files will be found.
* @param cl the parsed command line.
* @return a ReportConfiguration
- * @throws IOException on error.
* @see #parseCommands(String[], Consumer)
* @see #parseCommands(String[], Consumer, boolean)
*/
- static ReportConfiguration createConfiguration(final String baseDirectory,
final CommandLine cl) throws IOException {
+ static ReportConfiguration createConfiguration(final String baseDirectory,
final CommandLine cl) {
final ReportConfiguration configuration = new ReportConfiguration();
new ArgumentContext(configuration, cl).processArgs();
if (StringUtils.isNotBlank(baseDirectory)) {
diff --git a/apache-rat-core/src/main/java/org/apache/rat/Report.java
b/apache-rat-core/src/main/java/org/apache/rat/Report.java
index ebc61879..1c11b7a9 100644
--- a/apache-rat-core/src/main/java/org/apache/rat/Report.java
+++ b/apache-rat-core/src/main/java/org/apache/rat/Report.java
@@ -19,8 +19,8 @@
package org.apache.rat;
import org.apache.commons.cli.Options;
-import org.apache.rat.utils.DefaultLog;
import org.apache.rat.help.Help;
+import org.apache.rat.utils.DefaultLog;
/**
* The CLI based configuration object for report generation.
@@ -44,7 +44,7 @@ public final class Report {
}
/**
- * Prints the usage message on System.out
+ * Prints the usage message on {@code System.out}.
* @param opts The defined options.
*/
private static void printUsage(final Options opts) {
diff --git
a/apache-rat-core/src/main/java/org/apache/rat/ReportConfiguration.java
b/apache-rat-core/src/main/java/org/apache/rat/ReportConfiguration.java
index ddde5cff..7c927a64 100644
--- a/apache-rat-core/src/main/java/org/apache/rat/ReportConfiguration.java
+++ b/apache-rat-core/src/main/java/org/apache/rat/ReportConfiguration.java
@@ -55,7 +55,7 @@ import org.apache.rat.utils.ReportingSet;
/**
* A configuration object is used by the front end to invoke the
- * {@link Reporter}. The sole purpose of the front ends is to create the
+ * {@link Reporter}. The sole purpose of the frontends is to create the
* configuration and invoke the {@link Reporter}.
*/
public class ReportConfiguration {
@@ -93,7 +93,7 @@ public class ReportConfiguration {
/** The LicenseSetFactory for the configuration */
private final LicenseSetFactory licenseSetFactory;
- /**
+ /**
* {@code true} if we are adding license headers to the files.
*/
private boolean addingLicenses;
@@ -270,7 +270,7 @@ public class ReportConfiguration {
* @param collection the StandardCollection to exclude.
* @see ExclusionProcessor#addExcludedCollection(StandardCollection)
*/
- public void addExcludedCollection(StandardCollection collection) {
+ public void addExcludedCollection(final StandardCollection collection) {
exclusionProcessor.addExcludedCollection(collection);
}
@@ -279,7 +279,7 @@ public class ReportConfiguration {
* @param collection the StandardCollection to exclude.
* @see ExclusionProcessor#addFileProcessor(StandardCollection)
*/
- public void addExcludedFileProcessor(StandardCollection collection) {
+ public void addExcludedFileProcessor(final StandardCollection collection) {
exclusionProcessor.addFileProcessor(collection);
}
@@ -287,7 +287,7 @@ public class ReportConfiguration {
* Excludes files that match a FileFilter.
* @param fileFilter the file filter to match.
*/
- public void addExcludedFilter(FileFilter fileFilter) {
+ public void addExcludedFilter(final FileFilter fileFilter) {
exclusionProcessor.addExcludedFilter(DocumentNameMatcherSupplier.from(fileFilter));
}
@@ -297,11 +297,11 @@ public class ReportConfiguration {
* @param patterns the collection of patterns to exclude.
* @see ExclusionProcessor#addIncludedPatterns(Iterable)
*/
- public void addExcludedPatterns(Iterable<String> patterns) {
+ public void addExcludedPatterns(final Iterable<String> patterns) {
exclusionProcessor.addExcludedPatterns(patterns);
}
- public void addIncludedCollection(StandardCollection collection) {
+ public void addIncludedCollection(final StandardCollection collection) {
exclusionProcessor.addIncludedCollection(collection);
}
@@ -310,7 +310,7 @@ public class ReportConfiguration {
* exclusion of the same files.
* @param fileFilter the filter to identify files that should be included.
*/
- public void addIncludedFilter(FileFilter fileFilter) {
+ public void addIncludedFilter(final FileFilter fileFilter) {
exclusionProcessor.addIncludedFilter(DocumentNameMatcherSupplier.from(fileFilter));
}
@@ -319,7 +319,7 @@ public class ReportConfiguration {
* the same files.
* @param patterns The iterable of Strings containing the patterns.
*/
- public void addIncludedPatterns(Iterable<String> patterns) {
+ public void addIncludedPatterns(final Iterable<String> patterns) {
exclusionProcessor.addIncludedPatterns(patterns);
}
@@ -328,7 +328,7 @@ public class ReportConfiguration {
* @param baseDir the DocumentName for the base directory.
* @return the DocumentNameMatcher for the base directory.
*/
- public DocumentNameMatcher getNameMatcher(DocumentName baseDir) {
+ public DocumentNameMatcher getNameMatcher(final DocumentName baseDir) {
return exclusionProcessor.getNameMatcher(baseDir);
}
@@ -756,7 +756,7 @@ public class ReportConfiguration {
}
/**
- * Does not actually close the delegate. But does perform a flush.
+ * Does not actually close the delegate. But does perform a flush.
* @throws IOException on Error.
*/
@Override
diff --git a/apache-rat-core/src/main/java/org/apache/rat/VersionInfo.java
b/apache-rat-core/src/main/java/org/apache/rat/VersionInfo.java
index 621b4127..d12c02aa 100644
--- a/apache-rat-core/src/main/java/org/apache/rat/VersionInfo.java
+++ b/apache-rat-core/src/main/java/org/apache/rat/VersionInfo.java
@@ -29,7 +29,7 @@ public final class VersionInfo {
private final Package pkg;
/**
- * Simple testing output. Prints values from default constructor.
+ * Simple testing output. Prints values from default constructor.
* @param args not used.
*/
public static void main(final String[] args) {
@@ -72,7 +72,7 @@ public final class VersionInfo {
}
/**
- * Gets the implementation version of the package. Will return
"VERSION-NUMVER" if
+ * Gets the implementation version of the package. Will return
"VERSION-NUMBER" if
* package information is not available.
* @return the implementation version.
*/
@@ -81,7 +81,7 @@ public final class VersionInfo {
}
/**
- * Gets the implementation vendor of the package. Will return
"VENDOR-NAME" if
+ * Gets the implementation vendor of the package. Will return
"VENDOR-NAME" if
* package information is not available.
* @return the implementation vendor
*/
@@ -90,7 +90,7 @@ public final class VersionInfo {
}
/**
- * Gets the implementation title of the package. Will return "TITLE" if
+ * Gets the implementation title of the package. Will return "TITLE" if
* package information is not available.
* @return the implementation title
*/
@@ -99,7 +99,7 @@ public final class VersionInfo {
}
/**
- * Gets the specification version of the package. Will return
"SPEC-VERSION" if
+ * Gets the specification version of the package. Will return
"SPEC-VERSION" if
* package information is not available.
* @return the specification version.
*/
@@ -108,7 +108,7 @@ public final class VersionInfo {
}
/**
- * Gets the specification vendor of the package. Will return
"SPEC-VENDOR" if
+ * Gets the specification vendor of the package. Will return "SPEC-VENDOR"
if
* package information is not available.
* @return the specification vendor
*/
@@ -117,7 +117,7 @@ public final class VersionInfo {
}
/**
- * Gets the specification title of the package. Will return "SPEC-TITLE"
if
+ * Gets the specification title of the package. Will return "SPEC-TITLE" if
* package information is not available.
* @return the specification title
*/
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index dc12c15a..2250faa8 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -72,6 +72,9 @@ The <action> type attribute can be one of:
</release>
-->
<release version="0.17-SNAPSHOT" date="xxxx-yy-zz" description="Current
SNAPSHOT - release to be done">
+ <action issue="RAT-435" type="fix" dev="claudenw">
+ Fix checkstyle issues in root package.
+ </action>
<action issue="RAT-431" type="fix" dev="claudenw">
Fix checkstyle issues in report.
</action>
@@ -87,7 +90,6 @@ The <action> type attribute can be one of:
<action issue="RAT-424" type="fix" dev="claudenw">
Fix checkstyle issues in document.
</action>
- </action>
<action issue="RAT-420" type="fix" dev="claudenw">
Fix checkstyle issues in config.
</action>