mirror of
https://github.com/github/codeql.git
synced 2026-04-27 17:55:19 +02:00
AlertSuppression: allow //lgtm comments to scope over the next line
This commit is contained in:
@@ -8,7 +8,17 @@
|
||||
private import codeql.suppression.AlertSuppression as AS
|
||||
private import javascript as JS
|
||||
|
||||
class SingleLineComment extends JS::Locatable {
|
||||
class AstNode extends JS::Locatable {
|
||||
AstNode() { not this.(JS::HTML::TextNode).getText().regexpMatch("\\s*") }
|
||||
|
||||
predicate hasLocationInfo(
|
||||
string filepath, int startline, int startcolumn, int endline, int endcolumn
|
||||
) {
|
||||
this.getLocation().hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn)
|
||||
}
|
||||
}
|
||||
|
||||
class SingleLineComment extends AstNode {
|
||||
private string text;
|
||||
|
||||
SingleLineComment() {
|
||||
@@ -20,13 +30,7 @@ class SingleLineComment extends JS::Locatable {
|
||||
not text.matches("%\n%")
|
||||
}
|
||||
|
||||
predicate hasLocationInfo(
|
||||
string filepath, int startline, int startcolumn, int endline, int endcolumn
|
||||
) {
|
||||
this.getLocation().hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn)
|
||||
}
|
||||
|
||||
string getText() { result = text }
|
||||
}
|
||||
|
||||
import AS::Make<SingleLineComment>
|
||||
import AS::Make<AstNode, SingleLineComment>
|
||||
|
||||
Reference in New Issue
Block a user