Skip to content

Commit

Permalink
Don't reuse no-source directory
Browse files Browse the repository at this point in the history
  • Loading branch information
elharo committed Dec 6, 2024
1 parent e5161a7 commit 1fbece3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,9 @@ protected File generateReport(CheckstyleReport mojo, File pluginXmlFile) throws
File outputDir = mojo.getReportOutputDirectory();
String filename = mojo.getOutputName() + ".html";

return new File(outputDir, filename);
File file = new File(outputDir, filename);

return file;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public class CheckstyleReportTest extends AbstractCheckstyleTestCase {
public void testNoSource() throws Exception {
File generatedReport = generateReport(getGoal(), "no-source-plugin-config.xml");
assertTrue(new File(generatedReport.getAbsolutePath()).exists());
generatedReport.delete();
}

public void testMinConfiguration() throws Exception {
Expand Down Expand Up @@ -112,8 +113,6 @@ private void generateReport(String pluginXml) throws Exception {
assertTrue("Test cache file exists", new File(cacheFile).exists());
}

File outputDir = mojo.getReportOutputDirectory();

File useFile = (File) getVariableValueFromObject(mojo, "useFile");
if (useFile != null) {
assertTrue("Test useFile exists", useFile.exists());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ under the License.
<plugin>
<artifactId>maven-checkstyle-plugin</artifactId>
<configuration>
<outputDirectory>${basedir}/target/test-harness/checkstyle/no-source</outputDirectory>
<outputDirectory>${basedir}/target/test-harness/checkstyle/test-source-directory</outputDirectory>
<enableRulesSummary>true</enableRulesSummary>
<enableSeveritySummary>true</enableSeveritySummary>
<enableFilesSummary>true</enableFilesSummary>
<includes>**/*.java</includes>
<configLocation>sun_checks.xml</configLocation>
<headerLocation>${basedir}/src/test/test-sources/LICENSE.txt</headerLocation>
<cacheFile>${basedir}/target/test-harness/checkstyle/no-source/checkstyle-cachefile</cacheFile>
<outputFile>${basedir}/target/test-harness/checkstyle/no-source/checkstyle-result.xml</outputFile>
<cacheFile>${basedir}/target/test-harness/checkstyle/test-source-directory/checkstyle-cachefile</cacheFile>
<outputFile>${basedir}/target/test-harness/checkstyle/test-source-directory/checkstyle-result.xml</outputFile>
<outputFileFormat>xml</outputFileFormat>
<failsOnError>false</failsOnError>
<sourceDirectories>
Expand Down

0 comments on commit 1fbece3

Please sign in to comment.