Skip to content

Commit

Permalink
Use new parser API.
Browse files Browse the repository at this point in the history
  • Loading branch information
uhafner committed Jan 1, 2025
1 parent 4588c1b commit cd9dfae
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 20 deletions.
22 changes: 12 additions & 10 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>9.0.0</version>
<version>10.0.0</version>
<relativePath />
</parent>

Expand Down Expand Up @@ -38,16 +38,16 @@
<scm>
<connection>scm:git:https://github.com/jenkinsci/${project.artifactId}-plugin.git</connection>
<developerConnection>scm:git:git@github.com:jenkinsci/${project.artifactId}-plugin.git</developerConnection>
<tag>v11.10.0</tag>
<tag>HEAD</tag>
<url>https://github.com/jenkinsci/${project.artifactId}-plugin</url>
</scm>

<properties>
<revision>11.13.0</revision>
<revision>12.0.0</revision>
<changelist>-SNAPSHOT</changelist>
<module.name>${project.groupId}.warnings.ng</module.name>

<analysis-model-api.version>12.9.1</analysis-model-api.version>
<analysis-model-api.version>13.0.0-SNAPSHOT</analysis-model-api.version>
<analysis-model-tests.version>${analysis-model-api.version}</analysis-model-tests.version>
<pull-request-monitoring.version>335.v525cd64ec76b_</pull-request-monitoring.version>

Expand All @@ -73,6 +73,12 @@

<dependencies>

<!-- Temporary -->
<dependency>
<groupId>edu.hm.hafner</groupId>
<artifactId>analysis-model</artifactId>
<version>${analysis-model-api.version}</version>
</dependency>
<!-- Project Library Dependencies -->
<dependency>
<groupId>org.eclipse.collections</groupId>
Expand All @@ -91,15 +97,10 @@
</dependency>

<!-- Required Jenkins Plug-in Dependencies -->
<dependency>
<groupId>io.jenkins.plugins</groupId>
<artifactId>analysis-model-api</artifactId>
<version>${analysis-model-api.version}</version>
</dependency>
<dependency>
<groupId>io.jenkins.plugins</groupId>
<artifactId>plugin-util-api</artifactId>
<version>5.1.0</version>
<version>6.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.jenkins.plugins</groupId>
Expand Down Expand Up @@ -578,6 +579,7 @@
<excludes combine.children="append">
<exclude>.*Thresholds</exclude>
<exclude>.*Test.*</exclude>
<exclude>.*Benchmark.*</exclude>
<exclude>.*TaskScanner.*</exclude>
</excludes>
<entryPointClassPackage>io.jenkins.plugins.analysis.core.assertions</entryPointClassPackage>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public IssueReportScanner(final String filePattern, final String encoding,
@Override
protected Optional<Report> 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)",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}

/**
Expand All @@ -91,15 +90,15 @@ 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);

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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit cd9dfae

Please sign in to comment.