use of org.sonar.api.batch.sensor.issue.NewIssue in project sonarqube by SonarSource.
the class OneBlockerIssuePerFileSensor method processFile.
@Override
protected void processFile(InputFile inputFile, SensorContext context, RuleKey ruleKey, String languageKey) {
NewIssue newIssue = context.newIssue().overrideSeverity(Severity.BLOCKER).forRule(ruleKey);
newIssue.at(newIssue.newLocation().on(inputFile).message("This issue is generated on each file. Severity is blocker, whatever quality profile")).save();
}
use of org.sonar.api.batch.sensor.issue.NewIssue in project sonarqube by SonarSource.
the class OneCodeSmellIssuePerTestLineSensor method createIssues.
private static void createIssues(InputFile file, SensorContext context, String repo) {
RuleKey ruleKey = RuleKey.of(repo, RULE_KEY);
for (int line = 1; line <= file.lines(); line++) {
TextRange text = file.selectLine(line);
// do not count empty lines, which can be a pain with end-of-file return
if (text.end().lineOffset() == 0) {
continue;
}
NewIssue newIssue = context.newIssue();
newIssue.forRule(ruleKey).at(newIssue.newLocation().on(file).at(text).message("This code smell issue is generated on each line of a test file")).save();
}
}
use of org.sonar.api.batch.sensor.issue.NewIssue in project sonarqube by SonarSource.
the class OneCodeSmellIssuePerLineSensor method createIssues.
private static void createIssues(InputFile file, SensorContext context, String repo) {
RuleKey ruleKey = RuleKey.of(repo, RULE_KEY);
for (int line = 1; line <= file.lines(); line++) {
TextRange text = file.selectLine(line);
// do not count empty lines, which can be a pain with end-of-file return
if (text.end().lineOffset() == 0) {
continue;
}
NewIssue newIssue = context.newIssue();
newIssue.forRule(ruleKey).at(newIssue.newLocation().on(file).at(text).message("This code smell issue is generated on each line")).save();
}
}
use of org.sonar.api.batch.sensor.issue.NewIssue in project sonarqube by SonarSource.
the class OneIssuePerFileSensor method processFile.
@Override
protected void processFile(InputFile inputFile, SensorContext context, RuleKey ruleKey, String languageKey) {
NewIssue newIssue = context.newIssue().forRule(ruleKey).gap(settings.getDouble(EFFORT_TO_FIX_PROPERTY).orElse(0.0));
newIssue.at(newIssue.newLocation().on(inputFile).message("This issue is generated on each file")).save();
}
use of org.sonar.api.batch.sensor.issue.NewIssue in project sonarqube by SonarSource.
the class OneIssuePerModuleSensor method analyse.
private void analyse(SensorContext context, String language, String repo) {
RuleKey ruleKey = RuleKey.of(repo, RULE_KEY);
NewIssue newIssue = context.newIssue();
newIssue.forRule(ruleKey).at(newIssue.newLocation().on(context.module()).message("This issue is generated on each module")).save();
}
Aggregations