Skip to content

Commit f3d096c

Browse files
author
Stephan Brandauer
committed
update DollarAtString class to use hasLocationInfo instead of getURL
1 parent 79f2bec commit f3d096c

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed
Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
11
/**
22
* A helper class to represent a string value that can be returned by a query using $@ notation.
33
*
4-
* It extends `string`, but adds a mock `getURL` method that returns the string itself as a data URL.
4+
* It extends `string`, but adds a mock `hasLocationInfo` method that returns the string itself as the file name.
55
*
66
* Use this, when you want to return a string value from a query using $@ notation — the string value
77
* will be included in the sarif file.
88
*
9-
* Note that the string should be URL-encoded, or the resulting URL will be invalid (this may be OK in your use case).
109
*
11-
* Background information:
12-
* - data URLs: https://developer.mozilla.org/en-US/docs/web/http/basics_of_http/data_urls
13-
* - `getURL`:
14-
* https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/#providing-urls
10+
* Background information on `hasLocationInfo`:
11+
* https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/#providing-location-information
1512
*/
1613
class DollarAtString extends string {
1714
bindingset[this]
1815
DollarAtString() { any() }
1916

2017
bindingset[this]
21-
string getURL() { result = "data:text/plain," + this }
18+
predicate hasLocationInfo(string path, int sl, int sc, int el, int ec) {
19+
path = this and sl = 1 and sc = 1 and el = 1 and ec = 1
20+
}
2221
}

0 commit comments

Comments
 (0)