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

ch.acanda.maven.coan.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;

import lombok.RequiredArgsConstructor;
import net.sourceforge.pmd.RuleViolation;

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

@RequiredArgsConstructor
public class PmdIssue implements Issue {

    private final RuleViolation violation;

    @Override
    public Path getFile() {
        return Paths.get(violation.getFilename());
    }

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

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

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

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

    @Override
    public Severity getSeverity() {
        switch (violation.getRule().getPriority()) {
            case HIGH:
                return Severity.HIGHEST;
            case MEDIUM_HIGH:
                return Severity.HIGH;
            case MEDIUM:
                return Severity.MEDIUM;
            case MEDIUM_LOW:
                return Severity.LOW;
            case LOW:
                return Severity.LOWEST;
            default:
                throw new IllegalStateException("Unexpected PMD rule priority: " + violation.getRule().getPriority());
        }
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy