ch.acanda.maven.coan.checkstyle.CheckstyleIssue Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of code-analysis-maven-plugin Show documentation
Show all versions of code-analysis-maven-plugin Show documentation
The Code Analysis Maven Plugin runs several static analysis tools to check
your code for bugs, design and formatting problems.
package ch.acanda.maven.coan.checkstyle;
import ch.acanda.maven.coan.Issue;
import com.puppycrawl.tools.checkstyle.api.AuditEvent;
import java.nio.file.Path;
import java.nio.file.Paths;
public record CheckstyleIssue(AuditEvent event) implements Issue {
@Override
public Path file() {
return Paths.get(event.getFileName());
}
@Override
public int line() {
return event.getLine();
}
@Override
public int column() {
return event.getColumn();
}
@Override
public String name() {
final String sourceName = event.getSourceName();
final int pos = sourceName.lastIndexOf('.');
return pos == -1 ? sourceName : sourceName.substring(pos + 1);
}
@Override
public String description() {
return event.getMessage();
}
@Override
public Severity severity() {
return switch (event.getSeverityLevel()) {
case ERROR -> Severity.HIGHEST;
case WARNING -> Severity.HIGH;
case INFO -> Severity.MEDIUM;
case IGNORE -> Severity.IGNORE;
};
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy