mirror of
https://github.com/github/codeql.git
synced 2026-04-30 03:05:15 +02:00
AlertSuppression: allow //lgtm comments to scope over the next line
This commit is contained in:
@@ -8,7 +8,15 @@
|
||||
private import codeql.suppression.AlertSuppression as AS
|
||||
private import semmle.code.cpp.Element
|
||||
|
||||
class SingleLineComment extends Comment {
|
||||
class AstNode extends Locatable {
|
||||
predicate hasLocationInfo(
|
||||
string filepath, int startline, int startcolumn, int endline, int endcolumn
|
||||
) {
|
||||
this.getLocation().hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn)
|
||||
}
|
||||
}
|
||||
|
||||
class SingleLineComment extends Comment, AstNode {
|
||||
private string text;
|
||||
|
||||
SingleLineComment() {
|
||||
@@ -26,14 +34,8 @@ class SingleLineComment extends Comment {
|
||||
not text.matches("%\n%")
|
||||
}
|
||||
|
||||
predicate hasLocationInfo(
|
||||
string filepath, int startline, int startcolumn, int endline, int endcolumn
|
||||
) {
|
||||
this.getLocation().hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn)
|
||||
}
|
||||
|
||||
/** Gets the text in this comment, excluding the leading //. */
|
||||
string getText() { result = text }
|
||||
}
|
||||
|
||||
import AS::Make<SingleLineComment>
|
||||
import AS::Make<AstNode, SingleLineComment>
|
||||
|
||||
Reference in New Issue
Block a user