Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MPMD-411] Implement getOutputPath and identify getOutputName as deprecated, #179

Merged
merged 2 commits into from
Dec 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/main/java/org/apache/maven/plugins/pmd/CpdReport.java
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,14 @@ private void executeCpd() throws MavenReportException {
/**
* {@inheritDoc}
*/
@Override
@Deprecated
public String getOutputName() {
return "cpd";
}

@Override
public String getOutputPath() {
return "cpd";
}
}
6 changes: 6 additions & 0 deletions src/main/java/org/apache/maven/plugins/pmd/PmdReport.java
Original file line number Diff line number Diff line change
Expand Up @@ -543,10 +543,16 @@ private String determineAuxClasspath() throws MavenReportException {
* {@inheritDoc}
*/
@Override
@Deprecated
public String getOutputName() {
return "pmd";
}

@Override
public String getOutputPath() {
return "pmd";
}

/**
* Create and return the correct renderer for the output type.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ protected File generateReport(AbstractPmdReport mojo, File pluginXmlFile) throws
testMavenProject = builder.build(pluginXmlFile, buildingRequest).getProject();

File outputDir = mojo.getReportOutputDirectory();
String filename = mojo.getOutputName() + ".html";
String filename = mojo.getOutputPath() + ".html";

return new File(outputDir, filename);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,9 @@ public void testSkipEmptyReportConfiguration() throws Exception {
public void testEmptyReportConfiguration() throws Exception {
// verify the generated files do exist, even if there are no violations
File generatedReport = generateReport(getGoal(), "empty-report/cpd-empty-report-plugin-config.xml");
assertTrue(new File(generatedReport.getAbsolutePath()).exists());
assertTrue(
generatedReport.getAbsolutePath() + " does not exist",
new File(generatedReport.getAbsolutePath()).exists());

String str = readFile(generatedReport);
assertFalse(lowerCaseContains(str, "Hello.java"));
Expand Down
Loading