本文整理汇总了Java中org.sonar.api.batch.sensor.issue.NewIssue.gap方法的典型用法代码示例。如果您正苦于以下问题:Java NewIssue.gap方法的具体用法?Java NewIssue.gap怎么用?Java NewIssue.gap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.sonar.api.batch.sensor.issue.NewIssue
的用法示例。
在下文中一共展示了NewIssue.gap方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: savePreciseIssue
import org.sonar.api.batch.sensor.issue.NewIssue; //导入方法依赖的package包/类
private void savePreciseIssue(PreciseIssue issue) {
NewIssue newIssue = sensorContext.newIssue();
InputFile primaryFile = Preconditions.checkNotNull(fileSystem.inputFile(fileSystem.predicates().is(issue.primaryLocation().file())));
newIssue
.forRule(ruleKey(issue.check()))
.at(newLocation(primaryFile, newIssue, issue.primaryLocation()));
if (issue.cost() != null) {
newIssue.gap(issue.cost());
}
InputFile secondaryFile;
for (IssueLocation secondary : issue.secondaryLocations()) {
secondaryFile = fileSystem.inputFile(fileSystem.predicates().is(secondary.file()));
if (secondaryFile == null) {
secondaryFile = primaryFile;
}
newIssue.addLocation(newLocation(secondaryFile, newIssue, secondary));
}
newIssue.save();
}
示例2: saveLineIssue
import org.sonar.api.batch.sensor.issue.NewIssue; //导入方法依赖的package包/类
private void saveLineIssue(LineIssue issue) {
NewIssue newIssue = sensorContext.newIssue();
InputFile primaryFile = Preconditions.checkNotNull(fileSystem.inputFile(fileSystem.predicates().is(issue.file())));
NewIssueLocation primaryLocation = newIssue.newLocation()
.message(issue.message())
.on(primaryFile)
.at(primaryFile.selectLine(issue.line()));
newIssue
.forRule(ruleKey(issue.check()))
.at(primaryLocation);
if (issue.cost() != null) {
newIssue.gap(issue.cost());
}
newIssue.save();
}
示例3: savePreciseIssue
import org.sonar.api.batch.sensor.issue.NewIssue; //导入方法依赖的package包/类
private void savePreciseIssue(PreciseIssue issue) {
NewIssue newIssue = sensorContext.newIssue();
InputFile primaryFile = Preconditions.checkNotNull(fileSystem.inputFile(fileSystem.predicates().is(issue.primaryLocation().file())));
newIssue
.forRule(ruleKey(issue.check()))
.at(newLocation(primaryFile, newIssue, issue.primaryLocation()));
if (issue.cost() != null) {
newIssue.gap(issue.cost());
}
InputFile secondaryFile;
for (org.sonar.plugins.json.api.visitors.issue.IssueLocation secondary : issue.secondaryLocations()) {
secondaryFile = fileSystem.inputFile(fileSystem.predicates().is(secondary.file()));
if (secondaryFile == null) {
secondaryFile = primaryFile;
}
newIssue.addLocation(newLocation(secondaryFile, newIssue, secondary));
}
newIssue.save();
}
示例4: saveFileIssue
import org.sonar.api.batch.sensor.issue.NewIssue; //导入方法依赖的package包/类
private void saveFileIssue(FileIssue issue) {
NewIssue newIssue = sensorContext.newIssue();
InputFile primaryFile = Preconditions.checkNotNull(fileSystem.inputFile(fileSystem.predicates().is(issue.file())));
NewIssueLocation primaryLocation = newIssue.newLocation()
.message(issue.message())
.on(primaryFile);
newIssue
.forRule(ruleKey(issue.check()))
.at(primaryLocation);
if (issue.cost() != null) {
newIssue.gap(issue.cost());
}
InputFile secondaryFile;
for (IssueLocation secondary : issue.secondaryLocations()) {
secondaryFile = fileSystem.inputFile(fileSystem.predicates().is(secondary.file()));
if (secondaryFile == null) {
secondaryFile = primaryFile;
}
newIssue.addLocation(newLocation(secondaryFile, newIssue, secondary));
}
newIssue.save();
}
示例5: saveFileIssue
import org.sonar.api.batch.sensor.issue.NewIssue; //导入方法依赖的package包/类
private void saveFileIssue(FileIssue issue) {
NewIssue newIssue = sensorContext.newIssue();
InputFile primaryFile = Preconditions.checkNotNull(fileSystem.inputFile(fileSystem.predicates().is(issue.file())));
NewIssueLocation primaryLocation = newIssue.newLocation()
.message(issue.message())
.on(primaryFile);
newIssue
.forRule(ruleKey(issue.check()))
.at(primaryLocation);
if (issue.cost() != null) {
newIssue.gap(issue.cost());
}
InputFile secondaryFile;
for (org.sonar.plugins.json.api.visitors.issue.IssueLocation secondary : issue.secondaryLocations()) {
secondaryFile = fileSystem.inputFile(fileSystem.predicates().is(secondary.file()));
if (secondaryFile == null) {
secondaryFile = primaryFile;
}
newIssue.addLocation(newLocation(secondaryFile, newIssue, secondary));
}
newIssue.save();
}