use of org.sonar.maven.model.XmlLocation in project sonar-java by SonarSource.
the class PomCheckContextImplTest method fakeLocatedTreeWithUnknownColumn.
private static LocatedTree fakeLocatedTreeWithUnknownColumn(int line) {
LocatedTreeImpl tree = new LocatedTreeImpl() {
};
tree.setStartLocation(new XmlLocation(line, 0));
tree.setEndLocation(new XmlLocation(line, 0));
return tree;
}
use of org.sonar.maven.model.XmlLocation in project sonar-java by SonarSource.
the class PomCheckContextImpl method getSecondaryAnalyzerMessage.
@VisibleForTesting
AnalyzerMessage getSecondaryAnalyzerMessage(JavaCheck check, File file, Location location) {
TextSpan ts;
if (location.onLine()) {
ts = textSpanForLine(file, location.line);
} else {
XmlLocation startLocation = location.tree.startLocation();
XmlLocation endLocation = location.tree.endLocation();
ts = new TextSpan(startLocation.line(), offsetFromColumn(startLocation.column()), endLocation.line(), offsetFromColumn(endLocation.column()));
if (ts.isEmpty()) {
ts = textSpanForLine(file, startLocation.line());
}
}
return new AnalyzerMessage(check, file, ts, location.msg, 0);
}
use of org.sonar.maven.model.XmlLocation in project sonar-java by SonarSource.
the class PomCheckContextImplTest method fakeLocatedTree.
private static LocatedTree fakeLocatedTree(int line, int column, int size) {
LocatedTreeImpl tree = new LocatedTreeImpl() {
};
tree.setStartLocation(new XmlLocation(line, column, 0));
tree.setEndLocation(new XmlLocation(line, column + size, size));
return tree;
}
Aggregations