Skip to content

Commit

Permalink
Apply PR suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-parasoft committed Dec 23, 2024
1 parent 8b0ee22 commit c4b3236
Showing 1 changed file with 8 additions and 26 deletions.
34 changes: 8 additions & 26 deletions src/main/java/edu/hm/hafner/analysis/parser/ValeParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,35 +41,17 @@ protected void parseJsonObject(final Report report, final JSONObject jsonReport,
}

private Issue createIssue(final IssueBuilder issueBuilder, final String fileName, final JSONObject data) {
String checker = data.getString(CHECK);
String message = data.getString(MESSAGE_KEY);
String severity = data.getString(SEVERITY_KEY);
String link = data.getString(LINK_KEY);
int line = data.getInt(LINE_KEY);
JSONArray span = data.getJSONArray(SPAN_KEY);
int startColumn = span.getInt(0);
int endColumn = span.getInt(1);
final Severity analysisSeverity;
switch (severity) {
case "error":
analysisSeverity = Severity.ERROR;
break;
case "warning":
analysisSeverity = Severity.WARNING_NORMAL;
break;
case "suggestion":
analysisSeverity = Severity.WARNING_LOW;
break;
default:
analysisSeverity = Severity.WARNING_NORMAL;
break;
}
return issueBuilder.setFileName(fileName).setDescription(checker)
.setMessage(message).setSeverity(analysisSeverity)
.setReference(link)
int line = data.getInt(LINE_KEY);
return issueBuilder.setFileName(fileName)
.setDescription(data.getString(CHECK))
.setMessage(data.getString(MESSAGE_KEY))
.setSeverity(Severity.guessFromString(data.getString(SEVERITY_KEY)))
.setReference(data.getString(LINK_KEY))
.setLineStart(line)
.setLineEnd(line)
.setColumnStart(startColumn).setColumnEnd(endColumn)
.setColumnStart(span.getInt(0))
.setColumnEnd(span.getInt(1))
.buildAndClean();
}
}

0 comments on commit c4b3236

Please sign in to comment.