Search in sources :

Example 1 with IssueLocation

use of org.sonarsource.sonarlint.core.client.api.common.analysis.IssueLocation in project sonarlint-intellij by SonarSource.

the class IssueProcessor method transformFlows.

private List<LiveIssue.Flow> transformFlows(PsiFile psiFile, List<Issue.Flow> flows, String rule) {
    List<LiveIssue.Flow> transformedFlows = new LinkedList<>();
    for (Issue.Flow f : flows) {
        List<LiveIssue.IssueLocation> newLocations = new LinkedList<>();
        for (IssueLocation loc : f.locations()) {
            RangeMarker range;
            try {
                range = matcher.match(psiFile, loc);
            } catch (Exception e) {
                LOGGER.error("Error finding secondary location for issue", e, rule, String.valueOf(loc.getStartLine()), String.valueOf(loc.getStartLineOffset()), String.valueOf(loc.getEndLine()), String.valueOf(loc.getEndLineOffset()));
                return Collections.emptyList();
            }
            newLocations.add(new LiveIssue.IssueLocation(range, loc.getMessage()));
        }
        LiveIssue.Flow newFlow = new LiveIssue.Flow(newLocations);
        transformedFlows.add(newFlow);
    }
    return transformedFlows;
}
Also used : Issue(org.sonarsource.sonarlint.core.client.api.common.analysis.Issue) RangeMarker(com.intellij.openapi.editor.RangeMarker) LinkedList(java.util.LinkedList) IssueLocation(org.sonarsource.sonarlint.core.client.api.common.analysis.IssueLocation)

Aggregations

RangeMarker (com.intellij.openapi.editor.RangeMarker)1 LinkedList (java.util.LinkedList)1 Issue (org.sonarsource.sonarlint.core.client.api.common.analysis.Issue)1 IssueLocation (org.sonarsource.sonarlint.core.client.api.common.analysis.IssueLocation)1