Skip to content

Commit

Permalink
[JENKINS-73175] Improve handling of duplicate nodes.
Browse files Browse the repository at this point in the history
File nodes are now correctly mapped using the name and path.
Additionally, method and class nodes now get a unique ID even when
the report does not create one. For this option, the `ignoreErrors`
property needs to be activated.
  • Loading branch information
uhafner committed Jun 7, 2024
1 parent 689ebf9 commit d25c924
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 109 deletions.
107 changes: 1 addition & 106 deletions plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit d25c924

Please sign in to comment.