From 721d251739758988311b7b2584f6d505e3c0ccb0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 5 Jun 2024 09:29:35 +0000 Subject: [PATCH 1/2] Bump edu.hm.hafner:codingstyle-pom from 4.5.0 to 4.12.0 Bumps [edu.hm.hafner:codingstyle-pom](https://github.com/uhafner/codingstyle-pom) from 4.5.0 to 4.12.0. - [Release notes](https://github.com/uhafner/codingstyle-pom/releases) - [Changelog](https://github.com/uhafner/codingstyle-pom/blob/main/CHANGELOG.md) - [Commits](https://github.com/uhafner/codingstyle-pom/compare/v4.5.0...v4.12.0) --- updated-dependencies: - dependency-name: edu.hm.hafner:codingstyle-pom dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- ui-tests/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui-tests/pom.xml b/ui-tests/pom.xml index e41d593af8..abe7caf3ff 100644 --- a/ui-tests/pom.xml +++ b/ui-tests/pom.xml @@ -5,7 +5,7 @@ edu.hm.hafner codingstyle-pom - 4.5.0 + 4.12.0 From 098dc6019e3462dfc20fcebd78ec4159732e2db9 Mon Sep 17 00:00:00 2001 From: Ulli Hafner Date: Wed, 5 Jun 2024 16:06:38 +0200 Subject: [PATCH 2/2] Fix warnings. --- .../analysis/core/steps/AnalysisExecution.java | 12 +++++++++++- .../plugins/analysis/warnings/AnalysisResult.java | 1 + .../plugins/analysis/warnings/AnalysisSummary.java | 1 + .../plugins/analysis/warnings/DashboardTable.java | 3 ++- .../plugins/analysis/warnings/IssuesColumn.java | 1 - .../analysis/warnings/StatisticProperties.java | 1 - .../analysis/warnings/IssuesColumnUiTest.java | 2 +- 7 files changed, 16 insertions(+), 5 deletions(-) diff --git a/plugin/src/main/java/io/jenkins/plugins/analysis/core/steps/AnalysisExecution.java b/plugin/src/main/java/io/jenkins/plugins/analysis/core/steps/AnalysisExecution.java index 02f53ff0bb..af50a6496a 100644 --- a/plugin/src/main/java/io/jenkins/plugins/analysis/core/steps/AnalysisExecution.java +++ b/plugin/src/main/java/io/jenkins/plugins/analysis/core/steps/AnalysisExecution.java @@ -4,6 +4,8 @@ import java.nio.charset.Charset; import java.util.Optional; +import edu.hm.hafner.util.Ensure; + import org.jenkinsci.plugins.workflow.graph.FlowNode; import org.jenkinsci.plugins.workflow.steps.StepContext; import org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution; @@ -136,6 +138,14 @@ protected Charset getCharset(final String charset) { } protected PipelineResultHandler createResultHandler() throws IOException, InterruptedException { - return new PipelineResultHandler(getRun(), getContext().get(FlowNode.class)); + return new PipelineResultHandler(getRun(), getFlowNode()); + } + + private FlowNode getFlowNode() throws IOException, InterruptedException { + var flowNode = getContext().get(FlowNode.class); + + Ensure.that(flowNode).isNotNull("FlowNode is not defined in the context of " + this); + + return flowNode; } } diff --git a/ui-tests/src/main/java/io/jenkins/plugins/analysis/warnings/AnalysisResult.java b/ui-tests/src/main/java/io/jenkins/plugins/analysis/warnings/AnalysisResult.java index 8466598aca..67a6d4bb9e 100644 --- a/ui-tests/src/main/java/io/jenkins/plugins/analysis/warnings/AnalysisResult.java +++ b/ui-tests/src/main/java/io/jenkins/plugins/analysis/warnings/AnalysisResult.java @@ -371,6 +371,7 @@ By getXpath() { * @throws NoSuchElementException * if the tab could not be found */ + @SuppressWarnings("PMD.UnnecessaryFullyQualifiedName") // false positives static Tab valueWithHref(final String href) { for (Tab tab : Tab.values()) { if (tab.contentId.equals(href.substring(1))) { diff --git a/ui-tests/src/main/java/io/jenkins/plugins/analysis/warnings/AnalysisSummary.java b/ui-tests/src/main/java/io/jenkins/plugins/analysis/warnings/AnalysisSummary.java index 1ff4bb1740..56921d8511 100644 --- a/ui-tests/src/main/java/io/jenkins/plugins/analysis/warnings/AnalysisSummary.java +++ b/ui-tests/src/main/java/io/jenkins/plugins/analysis/warnings/AnalysisSummary.java @@ -43,6 +43,7 @@ public class AnalysisSummary extends PageObject { * @param id * the type of the result page (e.g. simian, checkstyle, cpd, etc.) */ + @SuppressWarnings("PMD.ConstructorCallsOverridableMethod") public AnalysisSummary(final Build parent, final String id) { super(parent, parent.url(id)); diff --git a/ui-tests/src/main/java/io/jenkins/plugins/analysis/warnings/DashboardTable.java b/ui-tests/src/main/java/io/jenkins/plugins/analysis/warnings/DashboardTable.java index 16cebf0f9c..c980d71474 100644 --- a/ui-tests/src/main/java/io/jenkins/plugins/analysis/warnings/DashboardTable.java +++ b/ui-tests/src/main/java/io/jenkins/plugins/analysis/warnings/DashboardTable.java @@ -35,6 +35,7 @@ public class DashboardTable extends PageObject { * the type of the result page (e.g. simian, checkstyle, cpd, etc.) */ @SuppressFBWarnings("MC") + @SuppressWarnings("PMD.ConstructorCallsOverridableMethod") public DashboardTable(final Build parent, final URL url) { super(parent, url); @@ -63,7 +64,7 @@ public DashboardTable(final Build parent, final URL url) { List>> lines = rows.stream().skip(1) .map(dom -> dom.findElements(by.tagName("td")).stream().map(td -> { - if (td.findElements(by.tagName("a")).size() == 0) { + if (td.findElements(by.tagName("a")).isEmpty()) { return Arrays.asList(td.getText(), null); } else { diff --git a/ui-tests/src/main/java/io/jenkins/plugins/analysis/warnings/IssuesColumn.java b/ui-tests/src/main/java/io/jenkins/plugins/analysis/warnings/IssuesColumn.java index 721704d7ee..cf06309933 100644 --- a/ui-tests/src/main/java/io/jenkins/plugins/analysis/warnings/IssuesColumn.java +++ b/ui-tests/src/main/java/io/jenkins/plugins/analysis/warnings/IssuesColumn.java @@ -53,7 +53,6 @@ private WebElement findCell(final WebElement table, final String name) { for (WebElement row : rows) { if (row.getAttribute("id").startsWith("job_")) { return row.findElement(By.xpath("td[" + columnIndex + "]")); - } } throw new NoSuchElementException("Cannot find a valid project row"); diff --git a/ui-tests/src/main/java/io/jenkins/plugins/analysis/warnings/StatisticProperties.java b/ui-tests/src/main/java/io/jenkins/plugins/analysis/warnings/StatisticProperties.java index 85a6a7a869..7d744f962c 100644 --- a/ui-tests/src/main/java/io/jenkins/plugins/analysis/warnings/StatisticProperties.java +++ b/ui-tests/src/main/java/io/jenkins/plugins/analysis/warnings/StatisticProperties.java @@ -60,5 +60,4 @@ public String getUrl(final String prefix) { } return prefix + "/" + url; } - } diff --git a/ui-tests/src/test/java/io/jenkins/plugins/analysis/warnings/IssuesColumnUiTest.java b/ui-tests/src/test/java/io/jenkins/plugins/analysis/warnings/IssuesColumnUiTest.java index d6655b3dc7..56c6265ea4 100644 --- a/ui-tests/src/test/java/io/jenkins/plugins/analysis/warnings/IssuesColumnUiTest.java +++ b/ui-tests/src/test/java/io/jenkins/plugins/analysis/warnings/IssuesColumnUiTest.java @@ -101,7 +101,7 @@ public void shouldShowConfiguredToolOnlyWithLink() { private void addCheckStyle(final FreeStyleJob job) { job.addPublisher(IssuesRecorder.class, recorder -> { - recorder.setTool(UiTest.CHECKSTYLE_TOOL); + recorder.setTool(CHECKSTYLE_TOOL); recorder.setEnabledForFailure(true); }); }