From cd9dfae79adad102b1f1c292acbf8fd279587ee2 Mon Sep 17 00:00:00 2001 From: Ulli Hafner Date: Wed, 1 Jan 2025 15:10:40 +0100 Subject: [PATCH] Use new parser API. --- plugin/pom.xml | 22 ++++++++++--------- .../core/model/IssueReportScanner.java | 2 +- .../model/StaticAnalysisLabelProvider.java | 9 ++++---- .../groovy/DynamicDocumentParser.java | 2 +- .../warnings/groovy/DynamicLineParser.java | 6 ++--- 5 files changed, 21 insertions(+), 20 deletions(-) diff --git a/plugin/pom.xml b/plugin/pom.xml index 3cb5e85e1d..06405778b9 100644 --- a/plugin/pom.xml +++ b/plugin/pom.xml @@ -5,7 +5,7 @@ org.jvnet.hudson.plugins analysis-pom - 9.0.0 + 10.0.0 @@ -38,16 +38,16 @@ scm:git:https://github.com/jenkinsci/${project.artifactId}-plugin.git scm:git:git@github.com:jenkinsci/${project.artifactId}-plugin.git - v11.10.0 + HEAD https://github.com/jenkinsci/${project.artifactId}-plugin - 11.13.0 + 12.0.0 -SNAPSHOT ${project.groupId}.warnings.ng - 12.9.1 + 13.0.0-SNAPSHOT ${analysis-model-api.version} 335.v525cd64ec76b_ @@ -73,6 +73,12 @@ + + + edu.hm.hafner + analysis-model + ${analysis-model-api.version} + org.eclipse.collections @@ -91,15 +97,10 @@ - - io.jenkins.plugins - analysis-model-api - ${analysis-model-api.version} - io.jenkins.plugins plugin-util-api - 5.1.0 + 6.0.0-SNAPSHOT io.jenkins.plugins @@ -578,6 +579,7 @@ .*Thresholds .*Test.* + .*Benchmark.* .*TaskScanner.* io.jenkins.plugins.analysis.core.assertions diff --git a/plugin/src/main/java/io/jenkins/plugins/analysis/core/model/IssueReportScanner.java b/plugin/src/main/java/io/jenkins/plugins/analysis/core/model/IssueReportScanner.java index 69a3ff020c..c41e4f2162 100644 --- a/plugin/src/main/java/io/jenkins/plugins/analysis/core/model/IssueReportScanner.java +++ b/plugin/src/main/java/io/jenkins/plugins/analysis/core/model/IssueReportScanner.java @@ -49,7 +49,7 @@ public IssueReportScanner(final String filePattern, final String encoding, @Override protected Optional processFile(final Path file, final Charset charset, final FilteredLog log) { try { - Report fileReport = parser.parseFile(new FileReaderFactory(file, charset)); + Report fileReport = parser.parse(new FileReaderFactory(file, charset)); log.logInfo("Successfully parsed file %s", file); log.logInfo("-> found %s (skipped %s)", diff --git a/plugin/src/main/java/io/jenkins/plugins/analysis/core/model/StaticAnalysisLabelProvider.java b/plugin/src/main/java/io/jenkins/plugins/analysis/core/model/StaticAnalysisLabelProvider.java index ca35d63022..7886d37a44 100644 --- a/plugin/src/main/java/io/jenkins/plugins/analysis/core/model/StaticAnalysisLabelProvider.java +++ b/plugin/src/main/java/io/jenkins/plugins/analysis/core/model/StaticAnalysisLabelProvider.java @@ -7,8 +7,7 @@ import edu.hm.hafner.analysis.Issue; import edu.hm.hafner.analysis.Report; -import edu.hm.hafner.analysis.registry.ParserDescriptor; -import edu.hm.hafner.analysis.registry.ParserDescriptor.Type; +import edu.hm.hafner.analysis.Report.IssueType; import edu.hm.hafner.util.Generated; import edu.hm.hafner.util.VisibleForTesting; import edu.umd.cs.findbugs.annotations.CheckForNull; @@ -75,7 +74,7 @@ public StaticAnalysisLabelProvider(final String id, @CheckForNull final String n */ public StaticAnalysisLabelProvider(final String id, @CheckForNull final String name, final DescriptionProvider descriptionProvider) { - this(id, name, descriptionProvider, Type.WARNING); + this(id, name, descriptionProvider, IssueType.WARNING); } /** @@ -91,7 +90,7 @@ public StaticAnalysisLabelProvider(final String id, @CheckForNull final String n * the type of the parser */ public StaticAnalysisLabelProvider(final String id, @CheckForNull final String name, - final DescriptionProvider descriptionProvider, final ParserDescriptor.Type type) { + final DescriptionProvider descriptionProvider, final IssueType type) { this.id = id; this.descriptionProvider = descriptionProvider; this.icon = getIcon(type); @@ -99,7 +98,7 @@ public StaticAnalysisLabelProvider(final String id, @CheckForNull final String n changeName(name); } - private String getIcon(final ParserDescriptor.Type type) { + private String getIcon(final IssueType type) { switch (type) { case BUG: return "symbol-solid/bug plugin-font-awesome-api"; diff --git a/plugin/src/main/java/io/jenkins/plugins/analysis/warnings/groovy/DynamicDocumentParser.java b/plugin/src/main/java/io/jenkins/plugins/analysis/warnings/groovy/DynamicDocumentParser.java index 776744cd94..b928a2594d 100644 --- a/plugin/src/main/java/io/jenkins/plugins/analysis/warnings/groovy/DynamicDocumentParser.java +++ b/plugin/src/main/java/io/jenkins/plugins/analysis/warnings/groovy/DynamicDocumentParser.java @@ -39,7 +39,7 @@ class DynamicDocumentParser extends IssueParser { @Override @SuppressWarnings("PMD.DoNotUseThreads") - public Report parse(final ReaderFactory reader) throws ParsingException { + public Report parseReport(final ReaderFactory reader) throws ParsingException { Report report = new Report(); Matcher matcher = pattern.matcher(reader.readString() + "\n"); diff --git a/plugin/src/main/java/io/jenkins/plugins/analysis/warnings/groovy/DynamicLineParser.java b/plugin/src/main/java/io/jenkins/plugins/analysis/warnings/groovy/DynamicLineParser.java index 96f34883fd..3e87b6fe5d 100644 --- a/plugin/src/main/java/io/jenkins/plugins/analysis/warnings/groovy/DynamicLineParser.java +++ b/plugin/src/main/java/io/jenkins/plugins/analysis/warnings/groovy/DynamicLineParser.java @@ -39,10 +39,10 @@ class DynamicLineParser extends LookaheadParser { } @Override - public Report parse(final ReaderFactory reader) throws ParsingException { + public Report parseReport(final ReaderFactory reader) throws ParsingException { fileName = reader.getFileName(); - - return super.parse(reader); + + return super.parseReport(reader); } @Override