All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ch.acanda.maven.coan.pmd.PmdIssue Maven / Gradle / Ivy

Go to download

The Code Analysis Maven Plugin runs several static analysis tools to check your code for bugs, design and formatting problems.

There is a newer version: 1.13.0
Show newest version
package ch.acanda.maven.coan.pmd;

import ch.acanda.maven.coan.Issue;
import net.sourceforge.pmd.reporting.RuleViolation;

import java.nio.file.Path;
import java.nio.file.Paths;

public record PmdIssue(RuleViolation violation) implements Issue {

    @Override
    public Path file() {
        return Paths.get(violation.getFileId().getAbsolutePath());
    }

    @Override
    public int line() {
        return violation.getBeginLine();
    }

    @Override
    public int column() {
        return violation.getBeginColumn();
    }

    @Override
    public String name() {
        return violation.getRule().getName();
    }

    @Override
    public String description() {
        return violation.getDescription();
    }

    @Override
    public Severity severity() {
        return switch (violation.getRule().getPriority()) {
            case HIGH -> Severity.HIGHEST;
            case MEDIUM_HIGH -> Severity.HIGH;
            case MEDIUM -> Severity.MEDIUM;
            case MEDIUM_LOW -> Severity.LOW;
            case LOW -> Severity.LOWEST;
        };
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy