GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — codeql/swift/ql/src/AlertSuppression.ql at codeql-cli/v2.24.0 · github/codeql

Expand file tree

/

AlertSuppression.ql

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
45 lines (38 loc) · 1.45 KB
/

AlertSuppression.ql

Copy path

File metadata and controls

45 lines (38 loc) · 1.45 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/**
* @name Alert suppression
* @description Generates information about alert suppressions.
* @kind alert-suppression
* @id swift/alert-suppression
*/
private import codeql.util.suppression.AlertSuppression as AS
private import codeql.swift.elements.Locatable as L
private import codeql.swift.elements.Comments as C
class AstNode extends L::Locatable {
predicate hasLocationInfo(string path, int startLine, int startColumn, int endLine, int endColumn) {
this.getLocation().hasLocationInfo(path, startLine, startColumn, endLine, endColumn)
}
}
class SingleLineComment extends AstNode instanceof C::Comment {
private string text;
SingleLineComment() {
this instanceof C::SingleLineComment and
text = super.getText().regexpCapture("//([^\\r\\n]*)[\\r\\n]?", 1)
or
this instanceof C::MultiLineComment and
// suppression comments must be single-line
text = super.getText().regexpCapture("/\\*([^\\r\\n]*)\\*/", 1)
}
override predicate hasLocationInfo(
string path, int startLine, int startColumn, int endLine, int endColumn
) {
this.(C::SingleLineComment).getLocation().hasLocationInfo(path, startLine, startColumn, _, _) and
endLine = startLine and
endColumn = startColumn + text.length() + 1
or
this.(C::MultiLineComment)
.getLocation()
.hasLocationInfo(path, startLine, startColumn, endLine, endColumn + 1)
}
string getText() { result = text }
}
import AS::Make<AstNode, SingleLineComment>
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.