From cbf3751a152d542715cf2b2219ab1de0850b2730 Mon Sep 17 00:00:00 2001 From: Michael Osipov Date: Thu, 18 Aug 2022 22:04:27 +0200 Subject: [PATCH] [MCHECKSTYLE-418] Deprecate RSS feature and disable by default --- .../pom.xml | 3 +++ src/it/MCHECKSTYLE-357/pom.xml | 3 +++ src/it/checkstyle-goal/pom.xml | 3 +++ src/it/checkstyle-report/pom.xml | 5 ++++- .../checkstyle/AbstractCheckstyleReport.java | 18 +++++++++++------- .../checkstyle/CheckstyleReportGenerator.java | 11 +++++++---- .../checkstyle/rss/CheckstyleRssGenerator.java | 1 + .../rss/CheckstyleRssGeneratorRequest.java | 3 ++- .../rss/DefaultCheckstyleRssGenerator.java | 3 ++- .../checkstyle/rss/VelocityTemplate.java | 3 ++- 10 files changed, 38 insertions(+), 15 deletions(-) diff --git a/src/it/MCHECKSTYLE-357-with-header-override/pom.xml b/src/it/MCHECKSTYLE-357-with-header-override/pom.xml index e38034e6..6a0d9906 100644 --- a/src/it/MCHECKSTYLE-357-with-header-override/pom.xml +++ b/src/it/MCHECKSTYLE-357-with-header-override/pom.xml @@ -187,6 +187,9 @@ maven-checkstyle-plugin + + true + diff --git a/src/it/MCHECKSTYLE-357/pom.xml b/src/it/MCHECKSTYLE-357/pom.xml index dfbdb97f..4ac7dc9b 100644 --- a/src/it/MCHECKSTYLE-357/pom.xml +++ b/src/it/MCHECKSTYLE-357/pom.xml @@ -172,6 +172,9 @@ maven-checkstyle-plugin + + true + diff --git a/src/it/checkstyle-goal/pom.xml b/src/it/checkstyle-goal/pom.xml index 20ac9fd9..821dcb22 100644 --- a/src/it/checkstyle-goal/pom.xml +++ b/src/it/checkstyle-goal/pom.xml @@ -41,6 +41,9 @@ org.apache.maven.plugins maven-checkstyle-plugin @pom.version@ + + true + diff --git a/src/it/checkstyle-report/pom.xml b/src/it/checkstyle-report/pom.xml index 04e45b7b..686c43cf 100644 --- a/src/it/checkstyle-report/pom.xml +++ b/src/it/checkstyle-report/pom.xml @@ -46,7 +46,7 @@ org.apache.maven.plugins maven-site-plugin @sitePluginVersion@ - + @@ -56,6 +56,9 @@ org.apache.maven.plugins maven-checkstyle-plugin @pom.version@ + + true + diff --git a/src/main/java/org/apache/maven/plugins/checkstyle/AbstractCheckstyleReport.java b/src/main/java/org/apache/maven/plugins/checkstyle/AbstractCheckstyleReport.java index f6df100c..583c5f3a 100644 --- a/src/main/java/org/apache/maven/plugins/checkstyle/AbstractCheckstyleReport.java +++ b/src/main/java/org/apache/maven/plugins/checkstyle/AbstractCheckstyleReport.java @@ -251,7 +251,7 @@ public abstract class AbstractCheckstyleReport /** * Specifies the location of the source directory to be used for Checkstyle. - * + * * @deprecated instead use {@link #sourceDirectories}. For version 3.0.0, this parameter is only defined to break * the build if you use it! */ @@ -267,7 +267,7 @@ public abstract class AbstractCheckstyleReport // Compatibility with all Maven 3: default of 'project.compileSourceRoots' is done manually because of MNG-5440 @Parameter private List sourceDirectories; - + /** * Specifies the location of the test source directory to be used for Checkstyle. * @@ -278,7 +278,7 @@ public abstract class AbstractCheckstyleReport @Parameter @Deprecated private File testSourceDirectory; - + /** * Specifies the location of the test source directories to be used for Checkstyle. * Default value is ${project.testCompileSourceRoots}. @@ -355,8 +355,11 @@ public abstract class AbstractCheckstyleReport /** * Specifies if the RSS should be enabled or not. + * + * @deprecated This feature will be removed in a future version. */ - @Parameter( property = "checkstyle.enable.rss", defaultValue = "true" ) + @Parameter( property = "checkstyle.enable.rss", defaultValue = "false" ) + @Deprecated private boolean enableRSS; /** @@ -397,7 +400,7 @@ public abstract class AbstractCheckstyleReport /** * When using custom treeWalkers, specify their names here so the checks * inside the treeWalker end up the the rule-summary. - * + * * @since 2.11 */ @Parameter @@ -406,7 +409,7 @@ public abstract class AbstractCheckstyleReport /** * Specifies whether modules with a configured severity of ignore should be omitted during Checkstyle * invocation. - * + * * @since 3.0.0 */ @Parameter( defaultValue = "false" ) @@ -466,6 +469,7 @@ public abstract class AbstractCheckstyleReport * @since 2.4 */ @Component( role = CheckstyleRssGenerator.class, hint = "default" ) + @Deprecated protected CheckstyleRssGenerator checkstyleRssGenerator; /** @@ -602,7 +606,7 @@ private List collectArtifacts( String hint ) private List getCheckstylePluginDependenciesAsArtifacts( Map plugins, String hint ) { List artifacts = new ArrayList<>(); - + Plugin checkstylePlugin = plugins.get( plugin.getGroupId() + ":" + plugin.getArtifactId() ); if ( checkstylePlugin != null ) { diff --git a/src/main/java/org/apache/maven/plugins/checkstyle/CheckstyleReportGenerator.java b/src/main/java/org/apache/maven/plugins/checkstyle/CheckstyleReportGenerator.java index 47c34607..bd241b09 100644 --- a/src/main/java/org/apache/maven/plugins/checkstyle/CheckstyleReportGenerator.java +++ b/src/main/java/org/apache/maven/plugins/checkstyle/CheckstyleReportGenerator.java @@ -65,6 +65,7 @@ public class CheckstyleReportGenerator private boolean enableFilesSummary; + @Deprecated private boolean enableRSS; private final SiteTool siteTool; @@ -97,7 +98,7 @@ public CheckstyleReportGenerator( Sink sink, ResourceBundle bundle, File basedir this.enableRulesSummary = true; this.enableSeveritySummary = true; this.enableFilesSummary = true; - this.enableRSS = true; + this.enableRSS = false; this.iconTool = new IconTool( sink, bundle ); } @@ -717,7 +718,7 @@ private boolean isTestSource( final String absoluteFilename ) return true; } } - + return false; } @@ -761,11 +762,13 @@ public void setEnableFilesSummary( boolean enableFilesSummary ) this.enableFilesSummary = enableFilesSummary; } + @Deprecated public boolean isEnableRSS() { return enableRSS; } + @Deprecated public void setEnableRSS( boolean enableRSS ) { this.enableRSS = enableRSS; @@ -791,12 +794,12 @@ public void setXrefTestLocation( String xrefTestLocation ) this.xrefTestLocation = xrefTestLocation; } - public List getTestSourceDirectories() + public List getTestSourceDirectories() { return testSourceDirectories; } - public void setTestSourceDirectories( List testSourceDirectories ) + public void setTestSourceDirectories( List testSourceDirectories ) { this.testSourceDirectories = testSourceDirectories; } diff --git a/src/main/java/org/apache/maven/plugins/checkstyle/rss/CheckstyleRssGenerator.java b/src/main/java/org/apache/maven/plugins/checkstyle/rss/CheckstyleRssGenerator.java index 149648c5..c90adc45 100644 --- a/src/main/java/org/apache/maven/plugins/checkstyle/rss/CheckstyleRssGenerator.java +++ b/src/main/java/org/apache/maven/plugins/checkstyle/rss/CheckstyleRssGenerator.java @@ -26,6 +26,7 @@ * @author Olivier Lamy * @since 2.4 */ +@Deprecated public interface CheckstyleRssGenerator { void generateRSS( CheckstyleResults results, CheckstyleRssGeneratorRequest checkstyleRssGeneratorRequest ) diff --git a/src/main/java/org/apache/maven/plugins/checkstyle/rss/CheckstyleRssGeneratorRequest.java b/src/main/java/org/apache/maven/plugins/checkstyle/rss/CheckstyleRssGeneratorRequest.java index 356066f2..8813217a 100644 --- a/src/main/java/org/apache/maven/plugins/checkstyle/rss/CheckstyleRssGeneratorRequest.java +++ b/src/main/java/org/apache/maven/plugins/checkstyle/rss/CheckstyleRssGeneratorRequest.java @@ -28,6 +28,7 @@ * @author Olivier Lamy * @since 2.4 */ +@Deprecated public class CheckstyleRssGeneratorRequest { private MavenProject mavenProject; @@ -35,7 +36,7 @@ public class CheckstyleRssGeneratorRequest private String copyright; private File outputDirectory; - + private Log log; public CheckstyleRssGeneratorRequest( MavenProject mavenProject, String copyright, File outputDirectory, Log log ) diff --git a/src/main/java/org/apache/maven/plugins/checkstyle/rss/DefaultCheckstyleRssGenerator.java b/src/main/java/org/apache/maven/plugins/checkstyle/rss/DefaultCheckstyleRssGenerator.java index 03c12804..c8d03dd1 100644 --- a/src/main/java/org/apache/maven/plugins/checkstyle/rss/DefaultCheckstyleRssGenerator.java +++ b/src/main/java/org/apache/maven/plugins/checkstyle/rss/DefaultCheckstyleRssGenerator.java @@ -41,6 +41,7 @@ * @since 2.4 */ @Component( role = CheckstyleRssGenerator.class, hint = "default" ) +@Deprecated public class DefaultCheckstyleRssGenerator implements CheckstyleRssGenerator { @@ -78,5 +79,5 @@ public void generateRSS( CheckstyleResults results, CheckstyleRssGeneratorReques throw new MavenReportException( "Unable to generate checkstyle.rss.", e ); } } - + } diff --git a/src/main/java/org/apache/maven/plugins/checkstyle/rss/VelocityTemplate.java b/src/main/java/org/apache/maven/plugins/checkstyle/rss/VelocityTemplate.java index 4ee2b7a6..0919bd23 100644 --- a/src/main/java/org/apache/maven/plugins/checkstyle/rss/VelocityTemplate.java +++ b/src/main/java/org/apache/maven/plugins/checkstyle/rss/VelocityTemplate.java @@ -51,6 +51,7 @@ * @author Joakim Erdfelt * */ +@Deprecated public class VelocityTemplate { private String templateDirectory; @@ -94,7 +95,7 @@ public void generate( String outputFilename, String template, Context context ) { outputFile.getParentFile().mkdirs(); } - + try ( Writer writer = new OutputStreamWriter( new FileOutputStream( outputFile ), StandardCharsets.UTF_8 ) ) { getVelocity().getEngine().mergeTemplate( templateDirectory + "/" + template, context, writer );