forked from jenkinsci/analysis-model
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSonarQubeDiffParser.java
More file actions
42 lines (34 loc) · 1.17 KB
/
SonarQubeDiffParser.java
File metadata and controls
42 lines (34 loc) · 1.17 KB
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
39
40
41
42
package edu.hm.hafner.analysis.parser;
import org.json.JSONObject;
/**
* Class which parses SonarQube reports taken from SonarQube differential scan report (preview).
*
* @author Carles Capdevila
*/
public class SonarQubeDiffParser extends SonarQubeParser {
private static final long serialVersionUID = -47634856667313368L;
private static final String ISSUE_IS_NEW = "isNew";
private static final String COMPONENT_MODULE_KEY = "moduleKey";
private static final String ISSUE_START_LINE = "startLine";
private static final String ISSUE_END_LINE = "endLine";
@Override
boolean accepts(final JSONObject object) {
return !object.has("total");
}
@Override
boolean filterIssue(final JSONObject issue) {
return issue.optBoolean(ISSUE_IS_NEW, false);
}
@Override
String getModulePath(final JSONObject component, final JSONObject issue) {
return parseModulePath(component, COMPONENT_MODULE_KEY);
}
@Override
int parseStart(final JSONObject issue) {
return issue.optInt(ISSUE_START_LINE);
}
@Override
int parseEnd(final JSONObject issue) {
return issue.optInt(ISSUE_END_LINE);
}
}