use of org.sonarsource.sonarlint.core.container.model.DefaultServerFlow in project sonarlint-core by SonarSource.
the class IssueStorePaths method toApiIssue.
public static ServerIssue toApiIssue(Sonarlint.ServerIssue pbIssue, String idePath) {
var issue = new DefaultServerIssue();
issue.setAssigneeLogin(pbIssue.getAssigneeLogin());
issue.setLineHash(pbIssue.getLineHash());
if (pbIssue.getPrimaryLocation().hasTextRange()) {
var textRange = pbIssue.getPrimaryLocation().getTextRange();
issue.setTextRange(new TextRange(textRange.getStartLine(), textRange.getStartLineOffset(), textRange.getEndLine(), textRange.getEndLineOffset()));
issue.setCodeSnippet(trimToNull(pbIssue.getPrimaryLocation().getCodeSnippet()));
}
issue.setFilePath(idePath);
issue.setMessage(pbIssue.getPrimaryLocation().getMsg());
issue.setSeverity(pbIssue.getSeverity());
issue.setType(pbIssue.getType());
issue.setCreationDate(Instant.ofEpochMilli(pbIssue.getCreationDate()));
issue.setResolution(pbIssue.getResolution());
issue.setKey(pbIssue.getKey());
issue.setRuleKey(pbIssue.getRuleRepository() + ":" + pbIssue.getRuleKey());
for (Sonarlint.ServerIssue.Flow f : pbIssue.getFlowList()) {
issue.getFlows().add(new DefaultServerFlow(f.getLocationList()));
}
return issue;
}
Aggregations