Search in sources :

Example 1 with PreciseHtmlIssue

use of org.sonar.plugins.html.checks.PreciseHtmlIssue in project sonar-web by SonarSource.

the class HtmlSensor method locationForIssue.

private static NewIssueLocation locationForIssue(InputFile inputFile, HtmlIssue issue, NewIssue newIssue) {
    NewIssueLocation location = newIssue.newLocation().on(inputFile).message(issue.message());
    Integer line = issue.line();
    if (issue instanceof PreciseHtmlIssue) {
        PreciseHtmlIssue preciseHtmlIssue = (PreciseHtmlIssue) issue;
        location.at(inputFile.newRange(issue.line(), preciseHtmlIssue.startColumn(), preciseHtmlIssue.endLine(), preciseHtmlIssue.endColumn()));
    } else if (line != null) {
        location.at(inputFile.selectLine(line));
    }
    return location;
}
Also used : NewIssueLocation(org.sonar.api.batch.sensor.issue.NewIssueLocation) PreciseHtmlIssue(org.sonar.plugins.html.checks.PreciseHtmlIssue)

Aggregations

NewIssueLocation (org.sonar.api.batch.sensor.issue.NewIssueLocation)1 PreciseHtmlIssue (org.sonar.plugins.html.checks.PreciseHtmlIssue)1