Search in sources :

Example 1 with Location

use of org.sonar.scanner.externalissue.ReportParser.Location in project sonarqube by SonarSource.

the class ExternalIssueImporter method importIssue.

private boolean importIssue(Issue issue) {
    NewExternalIssue externalIssue = context.newExternalIssue().engineId(issue.engineId).ruleId(issue.ruleId).severity(Severity.valueOf(issue.severity)).type(RuleType.valueOf(issue.type));
    if (issue.effortMinutes != null) {
        externalIssue.remediationEffortMinutes(Long.valueOf(issue.effortMinutes));
    }
    NewIssueLocation primary = fillLocation(context, externalIssue.newLocation(), issue.primaryLocation);
    if (primary != null) {
        knownFiles.add(issue.primaryLocation.filePath);
        externalIssue.at(primary);
        if (issue.secondaryLocations != null) {
            for (Location l : issue.secondaryLocations) {
                NewIssueLocation secondary = fillLocation(context, externalIssue.newLocation(), l);
                if (secondary != null) {
                    externalIssue.addLocation(secondary);
                }
            }
        }
        externalIssue.save();
        return true;
    } else {
        unknownFiles.add(issue.primaryLocation.filePath);
        return false;
    }
}
Also used : NewIssueLocation(org.sonar.api.batch.sensor.issue.NewIssueLocation) NewExternalIssue(org.sonar.api.batch.sensor.issue.NewExternalIssue) NewIssueLocation(org.sonar.api.batch.sensor.issue.NewIssueLocation) Location(org.sonar.scanner.externalissue.ReportParser.Location)

Aggregations

NewExternalIssue (org.sonar.api.batch.sensor.issue.NewExternalIssue)1 NewIssueLocation (org.sonar.api.batch.sensor.issue.NewIssueLocation)1 Location (org.sonar.scanner.externalissue.ReportParser.Location)1