Skip to content

Commit

Permalink
Merge pull request #173 from jenkinsci/filename-id
Browse files Browse the repository at this point in the history
  • Loading branch information
uhafner committed Jun 7, 2024
2 parents 6853f8a + 468e5b8 commit 779ff98
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 122 deletions.
109 changes: 2 additions & 107 deletions plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.jvnet.hudson.plugins</groupId>
<artifactId>analysis-pom</artifactId>
<version>8.4.0</version>
<version>8.5.0</version>
<relativePath />
</parent>

Expand All @@ -25,7 +25,7 @@
<gitHubRepo>jenkinsci/coverage-plugin</gitHubRepo>

<!-- Library Dependencies Versions -->
<coverage-model.version>0.43.0</coverage-model.version>
<coverage-model.version>0.45.0</coverage-model.version>
<jsoup.version>1.17.2</jsoup.version>

<!-- Jenkins Plug-in Dependencies Versions -->
Expand Down Expand Up @@ -312,111 +312,6 @@

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>${maven-pmd-plugin.version}</version>
<configuration>
<linkXRef>false</linkXRef>
<targetJdk>${java.version}</targetJdk>
<skip>true</skip>
</configuration>
<dependencies>
<dependency>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd-core</artifactId>
<version>${pmd.version}</version>
</dependency>
<dependency>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd-java</artifactId>
<version>${pmd.version}</version>
</dependency>
<dependency>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd-javascript</artifactId>
<version>${pmd.version}</version>
</dependency>
<dependency>
<groupId>edu.hm.hafner</groupId>
<artifactId>codingstyle</artifactId>
<version>${codingstyle.config.version}</version>
<classifier>config</classifier>
</dependency>
</dependencies>
<executions>
<execution>
<id>run-pmd-java</id>
<goals>
<goal>pmd</goal>
<goal>check</goal>
<goal>cpd</goal>
</goals>
<phase>verify</phase>
<configuration>
<targetDirectory>${project.build.directory}/pmd-java</targetDirectory>
<rulesets>
<ruleset>pmd-java-configuration.xml</ruleset>
</rulesets>
<includeTests>false</includeTests>
<minimumTokens>50</minimumTokens>
<skip>${pmd.skip}</skip>
<excludes>
<exclude>**/steps/CoverageMetricColumn*</exclude>
</excludes>
</configuration>
</execution>
<execution>
<id>run-pmd-tests</id>
<goals>
<goal>pmd</goal>
<goal>check</goal>
<goal>cpd</goal>
</goals>
<phase>verify</phase>
<configuration>
<targetDirectory>${project.build.directory}/pmd-tests</targetDirectory>
<rulesets>
<ruleset>pmd-tests-configuration.xml</ruleset>
</rulesets>
<includeTests>true</includeTests>
<minimumTokens>100</minimumTokens>
<excludeRoots>
<excludeRoot>src/main/java</excludeRoot>
<excludeRoot>${project.build.directory}/generated-test-sources/injected</excludeRoot>
<excludeRoot>${project.build.directory}/generated-test-sources/test-annotations</excludeRoot>
<excludeRoot>${project.build.directory}/generated-test-sources/assertj-assertions</excludeRoot>
</excludeRoots>
<skip>${pmd.skip}</skip>
</configuration>
</execution>
<execution>
<id>run-pmd-javascript</id>
<goals>
<goal>pmd</goal>
<goal>check</goal>
</goals>
<phase>verify</phase>
<configuration>
<targetDirectory>${project.build.directory}/pmd-javascript</targetDirectory>
<rulesets>
<ruleset>pmd-javascript-configuration.xml</ruleset>
</rulesets>
<includeTests>false</includeTests>
<language>javascript</language>
<compileSourceRoots>
<compileSourceRoot>src/main/resources</compileSourceRoot>
<compileSourceRoot>src/main/webapp/js</compileSourceRoot>
</compileSourceRoots>
<includes>
<include>**/*.js</include>
</includes>
<skip>${pmd.skip}</skip>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.assertj</groupId>
<artifactId>assertj-assertions-generator-maven-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ void shouldIgnoreErrors() {
Run<?, ?> failure = buildWithResult(job, Result.FAILURE);

assertThat(getConsoleLog(failure))
.contains("java.lang.IllegalArgumentException: There is already a child [METHOD] Enumerate()");
.contains("java.lang.IllegalArgumentException: There is already the same child [METHOD] Enumerate()");

job.setDefinition(new CpsFlowDefinition(
"node {\n"
Expand All @@ -40,8 +40,7 @@ void shouldIgnoreErrors() {
Run<?, ?> success = buildWithResult(job, Result.SUCCESS);

assertThat(getConsoleLog(success))
.doesNotContain("java.lang.IllegalArgumentException")
.contains("[-ERROR-] Found a duplicate method 'Enumerate' with signature '()' in 'VisualOn.Data.DataSourceProvider'");
.doesNotContain("java.lang.IllegalArgumentException");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ public enum Tab {
* @return the tab
* @throws NoSuchElementException if the tab could not be found
*/
@SuppressWarnings("PMD.UnnecessaryFullyQualifiedName")
static Tab valueWithHref(final String href) {
for (Tab tab : Tab.values()) {
if (tab.id.equals(href.substring(1))) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public class CoverageSummary extends PageObject {
* @param id
* the type of the result page (e.g. simian, checkstyle, cpd, etc.)
*/
@SuppressWarnings("PMD.ConstructorCallsOverridableMethod")
public CoverageSummary(final Build parent, final String id) {
super(parent, parent.url(id));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public void setMergeToOneReport(final boolean mergeReports) {
*/
public AdapterThreshold createThresholdsPageArea() {
ensureAdvancedOptionsIsActivated();
String path = createPageArea("thresholds", () -> this.threshold.click());
String path = createPageArea("thresholds", this.threshold::click);
return new AdapterThreshold(this, path);
}

Expand All @@ -72,7 +72,7 @@ public AdapterThreshold createThresholdsPageArea() {
public AdapterThreshold createThresholdsPageArea(final AdapterThresholdTarget thresholdTarget, final double unhealthyThreshold,
final double unstableThreshold, final boolean failUnhealthy) {
ensureAdvancedOptionsIsActivated();
String path = createPageArea("thresholds", () -> this.threshold.click());
String path = createPageArea("thresholds", this.threshold::click);
AdapterThreshold adapterThreshold = new AdapterThreshold(this, path);
adapterThreshold.setThresholdTarget(thresholdTarget);
adapterThreshold.setUnhealthyThreshold(unhealthyThreshold);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,17 @@ public void testCoverageReportAfterSomeBuildsWithReports() {
report.open();

FileCoverageTable coverageTable = report.getCoverageTable();
CoverageReportTest.verifyFileCoverageTableContent(coverageTable,
verifyFileCoverageTableContent(coverageTable,
new String[] {"edu.hm.hafner.util", "edu.hm.hafner.util", "edu.hm.hafner.util"},
new String[] {"Ensure.java", "FilteredLog.java", "Generated.java"},
new String[] {"80.00%", "100.00%", "n/a"},
new String[] {"86.96%", "100.00%", "n/a"});

String coverageTree = report.getCoverageTree();
CoverageReportTest.verifyCoverageTreeAfterSomeBuildsWithReports(coverageTree);
verifyCoverageTreeAfterSomeBuildsWithReports(coverageTree);

String coverageOverview = report.getCoverageOverview();
CoverageReportTest.verifyCoverageOverviewAfterSomeBuildsWithReports(coverageOverview);
verifyCoverageOverviewAfterSomeBuildsWithReports(coverageOverview);
}

/**
Expand All @@ -80,13 +80,13 @@ public void testCoverageReportAfterOneBuildWithReport() {
report.open();

FileCoverageTable coverageTable = report.getCoverageTable();
CoverageReportTest.verifyFileCoverageTableNumberOfMaxEntries(coverageTable, 307);
verifyFileCoverageTableNumberOfMaxEntries(coverageTable, 307);

String coverageTree = report.getCoverageTree();
CoverageReportTest.verifyCoverageTreeAfterOneBuildWithReport(coverageTree);
verifyCoverageTreeAfterOneBuildWithReport(coverageTree);

String coverageOverview = report.getCoverageOverview();
CoverageReportTest.verifyCoverageOverviewAfterOneBuildWithReport(coverageOverview);
verifyCoverageOverviewAfterOneBuildWithReport(coverageOverview);
}

/**
Expand All @@ -101,19 +101,19 @@ public void testCoverageTableWithMultiplePages() {
report.open();

FileCoverageTable table = report.openFileCoverageTable();
CoverageReportTest.verifyFileCoverageTableContent(table,
verifyFileCoverageTableContent(table,
new String[] {"edu.hm.hafner.analysis", "edu.hm.hafner.analysis", "edu.hm.hafner.analysis"},
new String[] {"AbstractPackageDetector.java", "CSharpNamespaceDetector.java", "Categories.java"},
new String[] {"88.24%", "100.00%", "100.00%"},
new String[] {"50.00%", "n/a", "100.00%"});
table.openTablePage(2);
CoverageReportTest.verifyFileCoverageTableContent(table,
verifyFileCoverageTableContent(table,
new String[] {"edu.hm.hafner.analysis", "edu.hm.hafner.analysis", "edu.hm.hafner.analysis"},
new String[] {"IssueBuilder.java", "IssueDifference.java", "IssueParser.java"},
new String[] {"100.00%", "100.00%", "83.33%"},
new String[] {"100.00%", "92.86%", "n/a"});
table.openTablePage(3);
CoverageReportTest.verifyFileCoverageTableContent(table,
verifyFileCoverageTableContent(table,
new String[] {"edu.hm.hafner.analysis", "edu.hm.hafner.analysis", "edu.hm.hafner.analysis"},
new String[] {"PackageDetectors.java", "PackageNameResolver.java", "ParsingCanceledException.java"},
new String[] {"92.31%", "100.00%", "0.00%"},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public void testTrendChartAfterSomeBuildsWithReports() {
FreeStyleJob job = getJobWithFirstBuildAndDifferentReports(InCaseCoverageDecreasedConfiguration.DONT_FAIL);
buildSuccessfully(job);
MainPanel mainPanel = new MainPanel(job);
MainPanelTest.verifyTrendChartWithTwoReports(mainPanel, 1, 2);
verifyTrendChartWithTwoReports(mainPanel, 1, 2);
}

/**
Expand Down

0 comments on commit 779ff98

Please sign in to comment.