forked from jenkinsci/analysis-model
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProtoLintParser.java
38 lines (32 loc) · 1.2 KB
/
ProtoLintParser.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package edu.hm.hafner.analysis.parser;
import java.util.Optional;
import java.util.regex.Matcher;
import edu.hm.hafner.analysis.Issue;
import edu.hm.hafner.analysis.IssueBuilder;
import edu.hm.hafner.analysis.RegexpLineParser;
import edu.hm.hafner.analysis.Severity;
/**
* Parser for ProtoLint.
*
* @author David Hart
* @see <a href="https://github.com/yoheimuta/protolint">https://github.com/yoheimuta/protolint</a>
*/
public class ProtoLintParser extends RegexpLineParser {
private static final long serialVersionUID = -8347619672754062010L;
private static final String PROTO_LINT_PATTERN = "^\\[(?<file>[^:]+):(?<line>\\d+):(?<column>\\d+)\\] (?<message>.+)$";
/**
* Creates a new instance.
*/
public ProtoLintParser() {
super(PROTO_LINT_PATTERN);
}
@Override
protected Optional<Issue> createIssue(final Matcher matcher, final IssueBuilder builder) {
return builder.setFileName(matcher.group("file"))
.setLineStart(matcher.group("line"))
.setColumnStart(matcher.group("column"))
.setMessage(matcher.group("message"))
.setSeverity(Severity.WARNING_NORMAL)
.buildOptional();
}
}