diff --git a/.github/check-md-links.json b/.github/check-md-links.json
index b6cf7559..ffd3959d 100644
--- a/.github/check-md-links.json
+++ b/.github/check-md-links.json
@@ -7,5 +7,5 @@
}
}
],
- "aliveStatusCodes": [200, 500, 503]
+ "aliveStatusCodes": [200, 500, 503, 429]
}
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 1ac3c40c..1f1c35c5 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -4,7 +4,7 @@ on:
push:
branches:
- main
- pull_request:
+ pull_request_target:
jobs:
build:
@@ -19,6 +19,11 @@ jobs:
steps:
- uses: actions/checkout@v4
+ if: github.event_name == 'push'
+ - uses: actions/checkout@v4
+ with:
+ ref: "${{ github.event.pull_request.merge_commit_sha }}"
+ if: github.event_name == 'pull_request_target'
- name: Set up JDK ${{ matrix.jdk }}
uses: actions/setup-java@v4
with:
@@ -29,8 +34,8 @@ jobs:
- name: Set up Maven
uses: stCarolas/setup-maven@v5
with:
- maven-version: 3.9.6
+ maven-version: 3.9.9
- name: Build with Maven
env:
BROWSER: chrome-container
- run: mvn -V --color always -ntp clean verify '-Djenkins.test.timeout=5000' '-Dgpg.skip'
+ run: mvn -V --color always -ntp clean verify '-Djenkins.test.timeout=5000' '-Dgpg.skip' -Pno-ui-tests
diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml
index 40048783..9a2e1a45 100644
--- a/.github/workflows/codeql.yml
+++ b/.github/workflows/codeql.yml
@@ -3,12 +3,8 @@ name: "CodeQL"
on:
push:
branches:
- - master
- - main
- pull_request:
- branches:
- - master
- main
+ pull_request_target:
schedule:
- cron: "32 3 * * 0"
@@ -27,8 +23,12 @@ jobs:
language: [ java ]
steps:
- - name: Checkout
- uses: actions/checkout@v4
+ - uses: actions/checkout@v4
+ if: github.event_name == 'push'
+ - uses: actions/checkout@v4
+ with:
+ ref: "${{ github.event.pull_request.merge_commit_sha }}"
+ if: github.event_name == 'pull_request_target'
- name: Setup Java
uses: actions/setup-java@v4
@@ -40,7 +40,7 @@ jobs:
- name: Set up Maven
uses: stCarolas/setup-maven@v5
with:
- maven-version: 3.9.6
+ maven-version: 3.9.9
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml
index 91932c76..5dd6cfc0 100644
--- a/.github/workflows/coverage.yml
+++ b/.github/workflows/coverage.yml
@@ -4,7 +4,7 @@ on:
push:
branches:
- main
- pull_request:
+ pull_request_target:
jobs:
coverage:
@@ -14,6 +14,11 @@ jobs:
steps:
- uses: actions/checkout@v4
+ if: github.event_name == 'push'
+ - uses: actions/checkout@v4
+ with:
+ ref: "${{ github.event.pull_request.merge_commit_sha }}"
+ if: github.event_name == 'pull_request_target'
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
@@ -24,11 +29,12 @@ jobs:
- name: Set up Maven
uses: stCarolas/setup-maven@v5
with:
- maven-version: 3.9.6
+ maven-version: 3.9.9
- name: Generate coverage with JaCoCo
run: mvn -V --color always -ntp clean verify -Pci
- name: Upload coverage to Codecov
- uses: codecov/codecov-action@v4.5.0
+ uses: codecov/codecov-action@v5.1.2
with:
- files: 'target/site/jacoco/jacoco.xml'
+ file: 'plugin/target/site/jacoco/jacoco.xml'
+ disable_search: true
token: ${{secrets.CODECOV_TOKEN}}
diff --git a/.github/workflows/enforce-labels.yml b/.github/workflows/enforce-labels.yml
index d58d2144..7e4c4280 100644
--- a/.github/workflows/enforce-labels.yml
+++ b/.github/workflows/enforce-labels.yml
@@ -1,6 +1,6 @@
name: Label Checker
on:
- pull_request:
+ pull_request_target:
types: [opened, labeled, unlabeled, synchronize]
jobs:
enforce-labels:
diff --git a/.github/workflows/pit-update-pr.yml b/.github/workflows/pit-update-pr.yml
index 9b640804..3ebd9edd 100644
--- a/.github/workflows/pit-update-pr.yml
+++ b/.github/workflows/pit-update-pr.yml
@@ -21,7 +21,7 @@ jobs:
java-version: '21'
check-latest: true
- name: Download artifact
- uses: dawidd6/action-download-artifact@v6
+ uses: dawidd6/action-download-artifact@v7
with:
workflow: ${{ github.event.workflow_run.workflow_id }}
name: pitest
diff --git a/.github/workflows/pit.yml b/.github/workflows/pit.yml
index cbfbd55f..e54e9683 100644
--- a/.github/workflows/pit.yml
+++ b/.github/workflows/pit.yml
@@ -23,7 +23,7 @@ jobs:
- name: Set up Maven
uses: stCarolas/setup-maven@v5
with:
- maven-version: 3.9.6
+ maven-version: 3.9.9
- name: Generate coverage with JaCoCo
run: mvn -V --color always -ntp clean verify -Ppit -Pci '-Dfeatures=+GIT(from[HEAD~1]),+gitci'
- name: Aggregate PIT coverage files
diff --git a/.github/workflows/quality-monitor.yml b/.github/workflows/quality-monitor.yml
index f5408b78..b27513df 100644
--- a/.github/workflows/quality-monitor.yml
+++ b/.github/workflows/quality-monitor.yml
@@ -23,7 +23,7 @@ jobs:
- name: Set up Maven
uses: stCarolas/setup-maven@v5
with:
- maven-version: 3.9.6
+ maven-version: 3.9.9
- name: Build with Maven
env:
BROWSER: chrome-container
@@ -36,3 +36,137 @@ jobs:
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
pr-number: ${{ steps.pr.outputs.number }}
+ config: >
+ {
+ "tests": {
+ "tools": [
+ {
+ "id": "test",
+ "name": "Tests",
+ "pattern": "**/target/*-reports/TEST*.xml"
+ }
+ ],
+ "name": "Tests"
+ },
+ "analysis": [
+ {
+ "name": "Style",
+ "id": "style",
+ "tools": [
+ {
+ "id": "checkstyle",
+ "pattern": "**/target/**checkstyle-result.xml"
+ },
+ {
+ "id": "pmd",
+ "pattern": "**/target/pmd-*/pmd.xml"
+ }
+ ]
+ },
+ {
+ "name": "Bugs",
+ "id": "bugs",
+ "icon": "bug",
+ "tools": [
+ {
+ "id": "spotbugs",
+ "sourcePath": "src/main/java",
+ "pattern": "**/target/spotbugsXml.xml"
+ }
+ ]
+ }
+ ],
+ "coverage": [
+ {
+ "name": "Code Coverage",
+ "tools": [
+ {
+ "id": "jacoco",
+ "name": "Line Coverage",
+ "metric": "line",
+ "sourcePath": "src/main/java",
+ "pattern": "**/target/site/jacoco/jacoco.xml"
+ },
+ {
+ "id": "jacoco",
+ "name": "Branch Coverage",
+ "metric": "branch",
+ "sourcePath": "src/main/java",
+ "pattern": "**/target/site/jacoco/jacoco.xml"
+ }
+ ]
+ }
+ ],
+ "metrics":
+ {
+ "name": "Toplevel Metrics",
+ "tools": [
+ {
+ "name": "Cyclomatic Complexity",
+ "id": "metrics",
+ "pattern": "**/metrics/pmd.xml",
+ "metric": "CYCLOMATIC_COMPLEXITY"
+ },
+ {
+ "name": "Cognitive Complexity",
+ "id": "metrics",
+ "pattern": "**/metrics/pmd.xml",
+ "metric": "COGNITIVE_COMPLEXITY"
+ },
+ {
+ "name": "Lines of Code",
+ "id": "metrics",
+ "pattern": "**/metrics/pmd.xml",
+ "metric": "LOC"
+ },
+ {
+ "name": "Non Commenting Source Statements",
+ "id": "metrics",
+ "pattern": "**/metrics/pmd.xml",
+ "metric": "NCSS"
+ },
+ {
+ "name": "Access to foreign data",
+ "id": "metrics",
+ "pattern": "**/metrics/pmd.xml",
+ "metric": "ACCESS_TO_FOREIGN_DATA"
+ },
+ {
+ "name": "Class cohesion",
+ "id": "metrics",
+ "pattern": "**/metrics/pmd.xml",
+ "metric": "COHESION"
+ },
+ {
+ "name": "Fan out",
+ "id": "metrics",
+ "pattern": "**/metrics/pmd.xml",
+ "metric": "FAN_OUT"
+ },
+ {
+ "name": "Number of accessors",
+ "id": "metrics",
+ "pattern": "**/metrics/pmd.xml",
+ "metric": "NUMBER_OF_ACCESSORS"
+ },
+ {
+ "name": "Weight of a class",
+ "id": "metrics",
+ "pattern": "**/metrics/pmd.xml",
+ "metric": "WEIGHT_OF_CLASS"
+ },
+ {
+ "name": "Weighted method count",
+ "id": "metrics",
+ "pattern": "**/metrics/pmd.xml",
+ "metric": "WEIGHED_METHOD_COUNT"
+ },
+ {
+ "name": "N-Path Complexity",
+ "id": "metrics",
+ "pattern": "**/metrics/pmd.xml",
+ "metric": "NPATH_COMPLEXITY"
+ }
+ ]
+ }
+ }
diff --git a/plugin/pom.xml b/plugin/pom.xml
index 95aa2ed1..ac2f48c4 100644
--- a/plugin/pom.xml
+++ b/plugin/pom.xml
@@ -5,7 +5,7 @@
org.jvnet.hudson.plugins
analysis-pom
- 10.2.0
+ 10.4.0
@@ -26,17 +26,17 @@
0.53.0
- 1.18.1
+ 1.18.3
- 2.2.0
+ 2.2.1
2.10.0
- 1.20.1
+ 1.20.4
1.87
- 1.3.2
+ 2.0.0
diff --git a/plugin/src/main/java/io/jenkins/plugins/coverage/metrics/color/ColorProvider.java b/plugin/src/main/java/io/jenkins/plugins/coverage/metrics/color/ColorProvider.java
index 1120f115..94039a49 100644
--- a/plugin/src/main/java/io/jenkins/plugins/coverage/metrics/color/ColorProvider.java
+++ b/plugin/src/main/java/io/jenkins/plugins/coverage/metrics/color/ColorProvider.java
@@ -34,7 +34,12 @@ public class ColorProvider {
* The color mapping to be used
*/
ColorProvider(final Map colorMapping) {
- availableColors = new EnumMap<>(colorMapping);
+ if (colorMapping.isEmpty()) {
+ availableColors = new EnumMap<>(ColorId.class);
+ }
+ else {
+ availableColors = new EnumMap<>(colorMapping);
+ }
}
/**
@@ -52,7 +57,7 @@ public static Color blendColors(final Color color1, final Color color2) {
}
/**
- * Blends two colors using weights that have to be greater then zero.
+ * Blends two colors using weights that have to be greater than zero.
*
* @param color1
* The first color
diff --git a/plugin/src/main/java/io/jenkins/plugins/coverage/metrics/color/ColorProviderFactory.java b/plugin/src/main/java/io/jenkins/plugins/coverage/metrics/color/ColorProviderFactory.java
index ae70eb52..e41d7710 100644
--- a/plugin/src/main/java/io/jenkins/plugins/coverage/metrics/color/ColorProviderFactory.java
+++ b/plugin/src/main/java/io/jenkins/plugins/coverage/metrics/color/ColorProviderFactory.java
@@ -45,7 +45,7 @@ public static ColorProvider createColorProvider(final Map colors
if (!colors.keySet().equals(CoverageColorJenkinsId.getAll()) || !verifyHexCodes(colors.values())) {
return createDefaultColorProvider();
}
- Map colorMap = new EnumMap<>();
+ Map colorMap = new EnumMap<>(ColorId.class);
// TODO: use dynamic text color (not provided yet)
colorMap.put(ColorId.INSUFFICIENT,
createDisplayColor(colors.get(CoverageColorJenkinsId.RED.getJenkinsColorId()), "#ffffff"));
diff --git a/plugin/src/main/java/io/jenkins/plugins/coverage/metrics/steps/CoverageRecorder.java b/plugin/src/main/java/io/jenkins/plugins/coverage/metrics/steps/CoverageRecorder.java
index 76f16b56..f8089a92 100644
--- a/plugin/src/main/java/io/jenkins/plugins/coverage/metrics/steps/CoverageRecorder.java
+++ b/plugin/src/main/java/io/jenkins/plugins/coverage/metrics/steps/CoverageRecorder.java
@@ -447,9 +447,13 @@ private void resolveAbsolutePaths(final Node rootNode, final FilePath workspace,
if (!pathMapping.isEmpty()) {
log.logInfo("Making paths of " + pathMapping.size() + " source code files relative to workspace root...");
var builder = new TreeStringBuilder();
- rootNode.getAllFileNodes().stream()
- .filter(file -> pathMapping.containsKey(file.getRelativePath()))
- .forEach(file -> file.setRelativePath(builder.intern(pathMapping.get(file.getRelativePath()))));
+ rootNode.getAllFileNodes().forEach(file -> {
+ String relativePath = file.getRelativePath();
+ if (pathMapping.containsKey(relativePath)) {
+ file.setRelativePath(builder.intern(pathMapping.get(relativePath)));
+ }
+ });
+
builder.dedup();
}
}
@@ -492,7 +496,7 @@ private Map> recordCoverageResults(final Run, ?> run,
try {
FileVisitorResult result = workspace.act(
- new CoverageReportScanner(parser, expandedPattern, "UTF-8", isSkipSymbolicLinks(),
+ new CoverageReportScanner(parser, expandedPattern, "UTF-8", !isSkipSymbolicLinks(),
ignoreErrors()));
log.merge(result.getLog());
diff --git a/pom.xml b/pom.xml
index d687895c..09126fde 100644
--- a/pom.xml
+++ b/pom.xml
@@ -16,7 +16,7 @@
1.8
3.13.0
- 3.1.2
+ 3.1.3
${java.version}
${java.version}
diff --git a/ui-tests/pom.xml b/ui-tests/pom.xml
index ca9b85a7..1532aa6d 100644
--- a/ui-tests/pom.xml
+++ b/ui-tests/pom.xml
@@ -5,7 +5,7 @@
edu.hm.hafner
codingstyle-pom
- 4.12.0
+ 4.16.0
@@ -16,8 +16,8 @@
UI Tests of Code Coverage Plugin
- 2.470
- 3.56
+ 2.491
+ 3.60
2.3
3.4.1
${project.groupId}.code.coverage.api.ui.tests
@@ -37,7 +37,7 @@
io.netty
netty-bom
- 4.1.112.Final
+ 4.1.117.Final
pom
import
@@ -48,12 +48,12 @@
org.jenkins-ci
acceptance-test-harness
- 5929.v295db_5f04eb_1
+ 6107.v8c73fa_b_8f784
com.fasterxml.jackson.core
jackson-databind
- 2.17.2
+ 2.18.2
test
@@ -172,7 +172,7 @@
org.apache.maven.plugins
maven-help-plugin
- 3.4.1
+ 3.5.1
show-profiles