@VisibleForTesting void reportIssue(AnalyzerMessage analyzerMessage, RuleKey key, InputPath inputPath, Double cost) { Preconditions.checkNotNull(context); JavaIssue issue = JavaIssue.create(context, key, cost); AnalyzerMessage.TextSpan textSpan = analyzerMessage.primaryLocation(); if (textSpan == null) { // either an issue at file or folder level issue.setPrimaryLocationOnFile(inputPath, analyzerMessage.getMessage()); } else { if (!textSpan.onLine()) { Preconditions.checkState(!textSpan.isEmpty(), "Issue location should not be empty"); } issue.setPrimaryLocation((InputFile) inputPath, analyzerMessage.getMessage(), textSpan.startLine, textSpan.startCharacter, textSpan.endLine, textSpan.endCharacter); } issue.addFlow(inputFromIOFile(analyzerMessage.getFile()), analyzerMessage.flows).save(); }
@VisibleForTesting void reportIssueAfterSQ52(AnalyzerMessage analyzerMessage, RuleKey key, InputPath inputPath, Double cost) { JavaIssue issue = JavaIssue.create(context, key, cost); AnalyzerMessage.TextSpan textSpan = analyzerMessage.primaryLocation(); if (textSpan == null) { // either an issue at file or folder level issue.setPrimaryLocationOnFile(inputPath, analyzerMessage.getMessage()); } else { issue.setPrimaryLocation((InputFile) inputPath, analyzerMessage.getMessage(), textSpan.startLine, textSpan.startCharacter, textSpan.endLine, textSpan.endCharacter); } for (AnalyzerMessage location : analyzerMessage.secondaryLocations) { AnalyzerMessage.TextSpan secondarySpan = location.primaryLocation(); issue.addSecondaryLocation( inputFromIOFile(location.getFile()), secondarySpan.startLine, secondarySpan.startCharacter, secondarySpan.endLine, secondarySpan.endCharacter, location.getMessage()); } issue.save(); }
public static JavaIssue create(SensorContext context, RuleKey ruleKey, @Nullable Double effortToFix) { NewIssue newIssue = context.newIssue() .forRule(ruleKey) .gap(effortToFix); return new JavaIssue(newIssue); }
public JavaIssue addFlow(InputFile file, List<List<AnalyzerMessage>> flows) { for (List<AnalyzerMessage> flow : flows) { newIssue.addFlow(flow.stream() .map(am -> newIssue.newLocation() .on(file) .at(range(file, am.primaryLocation())) .message(am.getMessage())) .collect(Collectors.toList())); } return this; }
public static JavaIssue create(SensorContext context, RuleKey ruleKey, @Nullable Double effortToFix) { NewIssue newIssue = context.newIssue() .forRule(ruleKey) .gap(effortToFix); return new JavaIssue(newIssue); }
public JavaIssue addFlow(InputFile file, List<List<AnalyzerMessage>> flows) { for (List<AnalyzerMessage> flow : flows) { newIssue.addFlow(flow.stream() .map(am -> newIssue.newLocation() .on(file) .at(range(file, am.primaryLocation())) .message(am.getMessage())) .collect(Collectors.toList())); } return this; }
@VisibleForTesting void reportIssue(AnalyzerMessage analyzerMessage, RuleKey key, InputPath inputPath, Double cost) { Preconditions.checkNotNull(context); JavaIssue issue = JavaIssue.create(context, key, cost); AnalyzerMessage.TextSpan textSpan = analyzerMessage.primaryLocation(); if (textSpan == null) { // either an issue at file or folder level issue.setPrimaryLocationOnFile(inputPath, analyzerMessage.getMessage()); } else { if (!textSpan.onLine()) { Preconditions.checkState(!textSpan.isEmpty(), "Issue location should not be empty"); } issue.setPrimaryLocation((InputFile) inputPath, analyzerMessage.getMessage(), textSpan.startLine, textSpan.startCharacter, textSpan.endLine, textSpan.endCharacter); } issue.addFlow(inputFromIOFile(analyzerMessage.getFile()), analyzerMessage.flows).save(); }
public static JavaIssue create(SensorContext context, RuleKey ruleKey, @Nullable Double effortToFix) { NewIssue newIssue = context.newIssue() .forRule(ruleKey) .effortToFix(effortToFix); return new JavaIssue(newIssue); }