GeezerVison is showing github.com — AlertSuppression: allow //lgtm comments to scope over the next line · github/codeql@c176606
File treeExpand file treeCollapse file tree Open diff view settings test/query-tests/AlertSuppression
test/query-tests/AlertSuppression
test/query-tests/AlertSuppression
test/query-tests/AlertSuppression
test/query-tests/analysis/suppression
test/query-tests/AlertSuppression
shared/util/codeql/suppression
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: cpp/ql/src/AlertSuppression.ql +10-8Lines changed: 10 additions & 8 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 8 | 8 | private import codeql.suppression.AlertSuppression as AS | 9 | 9 | private import semmle.code.cpp.Element | 10 | 10 |
| 11 | | -class SingleLineComment extends Comment { | | 11 | +class AstNode extends Locatable { | | 12 | + predicate hasLocationInfo( | | 13 | + string filepath, int startline, int startcolumn, int endline, int endcolumn | | 14 | + ) { | | 15 | + this.getLocation().hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn) | | 16 | + } | | 17 | +} | | 18 | + | | 19 | +class SingleLineComment extends Comment, AstNode { | 12 | 20 | private string text; | 13 | 21 |
| 14 | 22 | SingleLineComment() { | @@ -26,14 +34,8 @@ class SingleLineComment extends Comment { | 26 | 34 | not text.matches("%\n%") | 27 | 35 | } | 28 | 36 |
| 29 | | - predicate hasLocationInfo( | 30 | | - string filepath, int startline, int startcolumn, int endline, int endcolumn | 31 | | - ) { | 32 | | - this.getLocation().hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn) | 33 | | - } | 34 | | - | 35 | 37 | /** Gets the text in this comment, excluding the leading //. */ | 36 | 38 | string getText() { result = text } | 37 | 39 | } | 38 | 40 |
| 39 | | -import AS::Make<SingleLineComment> | | 41 | +import AS::Make<AstNode, SingleLineComment> |
Collapse file Copy file name to clipboardExpand all lines: cpp/ql/test/query-tests/AlertSuppression/AlertSuppression.expected +56Lines changed: 56 additions & 0 deletions Large diffs are not rendered by default. Collapse file Copy file name to clipboardExpand all lines: csharp/ql/src/AlertSuppression.ql +9-1Lines changed: 9 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 8 | 8 | private import codeql.suppression.AlertSuppression as AS | 9 | 9 | private import semmle.code.csharp.Comments | 10 | 10 |
| | 11 | +class AstNode extends Element { | | 12 | + predicate hasLocationInfo( | | 13 | + string filepath, int startline, int startcolumn, int endline, int endcolumn | | 14 | + ) { | | 15 | + this.getLocation().hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn) | | 16 | + } | | 17 | +} | | 18 | + | 11 | 19 | class SingleLineComment extends CommentLine { | 12 | 20 | SingleLineComment() { | 13 | 21 | // Must be either `// ...` or `/* ... */` on a single line. | @@ -21,4 +29,4 @@ class SingleLineComment extends CommentLine { | 21 | 29 | } | 22 | 30 | } | 23 | 31 |
| 24 | | -import AS::Make<SingleLineComment> | | 32 | +import AS::Make<AstNode, SingleLineComment> |
Collapse file Copy file name to clipboardExpand all lines: csharp/ql/test/query-tests/AlertSuppression/AlertSuppression.expected +52Lines changed: 52 additions & 0 deletions Large diffs are not rendered by default. Collapse file Copy file name to clipboardExpand all lines: go/ql/src/AlertSuppression.ql +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -15,4 +15,4 @@ class SingleLineComment extends G::Comment { | 15 | 15 | } | 16 | 16 | } | 17 | 17 |
| 18 | | -import AS::Make<SingleLineComment> | | 18 | +import AS::Make<G::Locatable, SingleLineComment> |
Collapse file Copy file name to clipboardExpand all lines: java/ql/src/AlertSuppression.ql +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -18,4 +18,4 @@ class SingleLineComment extends Javadoc { | 18 | 18 | string getText() { result = this.getChild(0).getText() } | 19 | 19 | } | 20 | 20 |
| 21 | | -import AS::Make<SingleLineComment> | | 21 | +import AS::Make<Top, SingleLineComment> |
Collapse file Copy file name to clipboardExpand all lines: java/ql/test/query-tests/AlertSuppression/AlertSuppression.expected +56Lines changed: 56 additions & 0 deletions Large diffs are not rendered by default. Collapse file Copy file name to clipboardExpand all lines: javascript/ql/src/AlertSuppression.ql +12-8Lines changed: 12 additions & 8 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 8 | 8 | private import codeql.suppression.AlertSuppression as AS | 9 | 9 | private import javascript as JS | 10 | 10 |
| 11 | | -class SingleLineComment extends JS::Locatable { | | 11 | +class AstNode extends JS::Locatable { | | 12 | + AstNode() { not this.(JS::HTML::TextNode).getText().regexpMatch("\\s*") } | | 13 | + | | 14 | + predicate hasLocationInfo( | | 15 | + string filepath, int startline, int startcolumn, int endline, int endcolumn | | 16 | + ) { | | 17 | + this.getLocation().hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn) | | 18 | + } | | 19 | +} | | 20 | + | | 21 | +class SingleLineComment extends AstNode { | 12 | 22 | private string text; | 13 | 23 |
| 14 | 24 | SingleLineComment() { | @@ -20,13 +30,7 @@ class SingleLineComment extends JS::Locatable { | 20 | 30 | not text.matches("%\n%") | 21 | 31 | } | 22 | 32 |
| 23 | | - predicate hasLocationInfo( | 24 | | - string filepath, int startline, int startcolumn, int endline, int endcolumn | 25 | | - ) { | 26 | | - this.getLocation().hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn) | 27 | | - } | 28 | | - | 29 | 33 | string getText() { result = text } | 30 | 34 | } | 31 | 35 |
| 32 | | -import AS::Make<SingleLineComment> | | 36 | +import AS::Make<AstNode, SingleLineComment> |
Collapse file Copy file name to clipboardExpand all lines: javascript/ql/test/query-tests/AlertSuppression/AlertSuppression.expected +56Lines changed: 56 additions & 0 deletions Large diffs are not rendered by default. Collapse file Copy file name to clipboardExpand all lines: python/ql/src/AlertSuppression.ql +11-1Lines changed: 11 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 8 | 8 | private import codeql.suppression.AlertSuppression as AS | 9 | 9 | private import semmle.python.Comment as P | 10 | 10 |
| | 11 | +class AstNode instanceof P::AstNode { | | 12 | + predicate hasLocationInfo( | | 13 | + string filepath, int startline, int startcolumn, int endline, int endcolumn | | 14 | + ) { | | 15 | + super.getLocation().hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn) | | 16 | + } | | 17 | + | | 18 | + string toString() { result = super.toString() } | | 19 | +} | | 20 | + | 11 | 21 | class SingleLineComment instanceof P::Comment { | 12 | 22 | predicate hasLocationInfo( | 13 | 23 | string filepath, int startline, int startcolumn, int endline, int endcolumn | @@ -20,7 +30,7 @@ class SingleLineComment instanceof P::Comment { | 20 | 30 | string toString() { result = super.toString() } | 21 | 31 | } | 22 | 32 |
| 23 | | -import AS::Make<SingleLineComment> | | 33 | +import AS::Make<AstNode, SingleLineComment> | 24 | 34 |
| 25 | 35 | /** | 26 | 36 | * A noqa suppression comment. Both pylint and pyflakes respect this, so lgtm ought to too. | |
|