Skip to content

Commit

Permalink
[MCHECKSTYLE-435] Remove deprecated RSS feature
Browse files Browse the repository at this point in the history
This closes #117
  • Loading branch information
michael-o committed May 14, 2023
1 parent 71bc1ff commit b08abc2
Show file tree
Hide file tree
Showing 31 changed files with 2 additions and 671 deletions.
26 changes: 0 additions & 26 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -172,25 +172,6 @@ under the License.
<artifactId>plexus-utils</artifactId>
<version>3.5.1</version>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-velocity</artifactId>
<version>1.2</version>
<exclusions>
<exclusion>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-container-default</artifactId>
</exclusion>
<exclusion>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-component-api</artifactId>
</exclusion>
<exclusion>
<groupId>velocity</groupId>
<artifactId>velocity</artifactId>
</exclusion>
</exclusions>
</dependency>

<!-- checkstyle -->
<dependency>
Expand All @@ -204,13 +185,6 @@ under the License.
<version>3.12.0</version>
</dependency>

<!-- misc -->
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity</artifactId>
<version>1.7</version>
</dependency>

<!-- test -->
<dependency>
<groupId>org.codehaus.plexus</groupId>
Expand Down
3 changes: 0 additions & 3 deletions src/it/MCHECKSTYLE-357-with-header-override/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,6 @@
<plugins>
<plugin>
<artifactId>maven-checkstyle-plugin</artifactId>
<configuration>
<enableRSS>true</enableRSS>
</configuration>
<reportSets>
<reportSet>
<reports>
Expand Down
3 changes: 0 additions & 3 deletions src/it/MCHECKSTYLE-357-with-header-override/verify.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,4 @@ assert new File(basedir, 'target/checkstyle-checker.xml').exists();
assert new File(basedir, 'target/checkstyle-result.xml').exists();
assert new File(basedir, 'target/checkstyle-rules.xml').exists();

File rssFile = new File( basedir, 'target/site/checkstyle.rss' );
assert rssFile.exists();

return true;
3 changes: 0 additions & 3 deletions src/it/MCHECKSTYLE-357/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,6 @@
<plugins>
<plugin>
<artifactId>maven-checkstyle-plugin</artifactId>
<configuration>
<enableRSS>true</enableRSS>
</configuration>
<reportSets>
<reportSet>
<reports>
Expand Down
3 changes: 0 additions & 3 deletions src/it/MCHECKSTYLE-357/verify.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,4 @@ assert new File(basedir, 'target/checkstyle-checker.xml').exists();
assert new File(basedir, 'target/checkstyle-result.xml').exists();
assert new File(basedir, 'target/checkstyle-rules.xml').exists();

File rssFile = new File( basedir, 'target/site/checkstyle.rss' );
assert rssFile.exists();

return true;
3 changes: 0 additions & 3 deletions src/it/checkstyle-goal/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>@project.version@</version>
<configuration>
<enableRSS>true</enableRSS>
</configuration>
</plugin>
</plugins>
</build>
Expand Down
15 changes: 1 addition & 14 deletions src/it/checkstyle-goal/verify.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,7 @@ assert new File( basedir, 'target/checkstyle-checker.xml' ).exists();
assert new File( basedir, 'target/checkstyle-header.txt' ).exists();
assert new File( basedir, 'target/checkstyle-result.xml' ).exists();

File rssFile = new File( basedir, 'target/site/checkstyle.rss' );
assert rssFile.exists();

def rss = new XmlParser().parse( rssFile );

def channel = rss.channel[0]

assert channel.title.text() == 'check-pass - Checkstyle report'

def item = channel.item[0]
assert item != null
assert item.title.text().startsWith('File: 1,')

def html = new File( basedir, 'target/site/checkstyle.html' ).text;
assert html.contains( '<meta charset="UTF-8" />' );

return true;
return true;
3 changes: 0 additions & 3 deletions src/it/checkstyle-report/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,6 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>@project.version@</version>
<configuration>
<enableRSS>true</enableRSS>
</configuration>
<reportSets>
<reportSet>
<reports>
Expand Down
16 changes: 1 addition & 15 deletions src/it/checkstyle-report/verify.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,4 @@ assert new File(basedir, 'target/checkstyle-checker.xml').exists();
assert new File(basedir, 'target/checkstyle-header.txt').exists();
assert new File(basedir, 'target/checkstyle-result.xml').exists();

File rssFile = new File( basedir, 'target/site/checkstyle.rss' );
assert rssFile.exists();

def rss = new XmlParser().parse( rssFile );

def channel = rss.channel[0]

assert channel.title.text() == 'check-pass - Checkstyle report'

def item = channel.item[0]
assert item != null
assert item.title.text().startsWith('File: 1,')


return true;
return true;
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.Locale;
import java.util.Map;
Expand All @@ -51,8 +50,6 @@
import org.apache.maven.plugins.checkstyle.exec.CheckstyleExecutorException;
import org.apache.maven.plugins.checkstyle.exec.CheckstyleExecutorRequest;
import org.apache.maven.plugins.checkstyle.exec.CheckstyleResults;
import org.apache.maven.plugins.checkstyle.rss.CheckstyleRssGenerator;
import org.apache.maven.plugins.checkstyle.rss.CheckstyleRssGeneratorRequest;
import org.apache.maven.reporting.AbstractMavenReport;
import org.apache.maven.reporting.MavenReportException;
import org.codehaus.plexus.configuration.PlexusConfiguration;
Expand All @@ -67,8 +64,6 @@
*
*/
public abstract class AbstractCheckstyleReport extends AbstractMavenReport {
public static final String PLUGIN_RESOURCES = "org/apache/maven/plugins/checkstyle";

protected static final String JAVA_FILES = "**\\/*.java";

private static final String DEFAULT_CONFIG_LOCATION = "sun_checks.xml";
Expand Down Expand Up @@ -342,15 +337,6 @@ public abstract class AbstractCheckstyleReport extends AbstractMavenReport {
@Parameter(property = "checkstyle.enable.files.summary", defaultValue = "true")
private boolean enableFilesSummary;

/**
* 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 = "false")
@Deprecated
private boolean enableRSS;

/**
* The Plugin Descriptor
*/
Expand Down Expand Up @@ -446,15 +432,6 @@ public abstract class AbstractCheckstyleReport extends AbstractMavenReport {
@Component
protected ResourceManager locator;

/**
* CheckstyleRssGenerator.
*
* @since 2.4
*/
@Component(role = CheckstyleRssGenerator.class, hint = "default")
@Deprecated
protected CheckstyleRssGenerator checkstyleRssGenerator;

/**
* @since 2.5
*/
Expand Down Expand Up @@ -519,14 +496,7 @@ public void executeReport(Locale locale) throws MavenReportException {
CheckstyleResults results = checkstyleExecutor.executeCheckstyle(request);

ResourceBundle bundle = getBundle(locale);
generateReportStatics();
generateMainReport(results, bundle, effectiveConfigLocation);
if (enableRSS) {
CheckstyleRssGeneratorRequest checkstyleRssGeneratorRequest =
new CheckstyleRssGeneratorRequest(this.project, this.getCopyright(), outputDirectory, getLog());
checkstyleRssGenerator.generateRSS(results, checkstyleRssGeneratorRequest);
}

} catch (CheckstyleException e) {
throw new MavenReportException("Failed during checkstyle configuration", e);
} catch (CheckstyleExecutorException e) {
Expand Down Expand Up @@ -647,32 +617,6 @@ protected DefaultLogger getConsoleListener() throws MavenReportException {
return consoleListener;
}

private void generateReportStatics() throws MavenReportException {
ReportResource rresource = new ReportResource(PLUGIN_RESOURCES, outputDirectory);
try {
rresource.copy("images/rss.png");
} catch (IOException e) {
throw new MavenReportException("Unable to copy static resources.", e);
}
}

private String getCopyright() {
String copyright;
int currentYear = Calendar.getInstance().get(Calendar.YEAR);
if (StringUtils.isNotEmpty(project.getInceptionYear())
&& !String.valueOf(currentYear).equals(project.getInceptionYear())) {
copyright = project.getInceptionYear() + " - " + currentYear;
} else {
copyright = String.valueOf(currentYear);
}

if ((project.getOrganization() != null)
&& StringUtils.isNotEmpty(project.getOrganization().getName())) {
copyright = copyright + " " + project.getOrganization().getName();
}
return copyright;
}

private void generateMainReport(CheckstyleResults results, ResourceBundle bundle, String configLocation) {
CheckstyleReportGenerator generator =
new CheckstyleReportGenerator(getSink(), bundle, project.getBasedir(), siteTool, configLocation);
Expand All @@ -681,7 +625,6 @@ private void generateMainReport(CheckstyleResults results, ResourceBundle bundle
generator.setEnableRulesSummary(enableRulesSummary);
generator.setEnableSeveritySummary(enableSeveritySummary);
generator.setEnableFilesSummary(enableFilesSummary);
generator.setEnableRSS(enableRSS);
generator.setCheckstyleConfig(results.getConfiguration());
if (linkXRef) {
initializeXrefLocation(generator);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,6 @@ public class CheckstyleReportGenerator {

private boolean enableFilesSummary;

@Deprecated
private boolean enableRSS;

private final SiteTool siteTool;

private String xrefLocation;
Expand Down Expand Up @@ -94,7 +91,6 @@ public CheckstyleReportGenerator(
this.enableRulesSummary = true;
this.enableSeveritySummary = true;
this.enableFilesSummary = true;
this.enableRSS = false;
this.iconTool = new IconTool(sink, bundle);
}

Expand Down Expand Up @@ -172,18 +168,6 @@ private void doHeading() {
sink.text(String.format(bundle.getString("report.checkstyle.ruleset"), ruleset));
sink.text(".");

if (enableRSS) {
sink.nonBreakingSpace();
sink.link("checkstyle.rss");
sink.figure();
sink.figureCaption();
sink.text("rss feed");
sink.figureCaption_();
sink.figureGraphics("images/rss.png");
sink.figure_();
sink.link_();
}

sink.paragraph_();
sink.section1_();
}
Expand Down Expand Up @@ -689,16 +673,6 @@ public void setEnableFilesSummary(boolean enableFilesSummary) {
this.enableFilesSummary = enableFilesSummary;
}

@Deprecated
public boolean isEnableRSS() {
return enableRSS;
}

@Deprecated
public void setEnableRSS(boolean enableRSS) {
this.enableRSS = enableRSS;
}

public String getXrefLocation() {
return xrefLocation;
}
Expand Down

This file was deleted.

Loading

0 comments on commit b08abc2

Please sign in to comment.