mirror of
https://github.com/github/codeql.git
synced 2026-05-01 03:35:13 +02:00
C#: Remove getUrl() predicate
This commit is contained in:
@@ -62,33 +62,22 @@ predicate alwaysDefaultToString(ValueOrRefType t) {
|
||||
)
|
||||
}
|
||||
|
||||
newtype TDefaultToStringType = TDefaultToStringType0(ValueOrRefType t) { alwaysDefaultToString(t) }
|
||||
|
||||
class DefaultToStringType extends TDefaultToStringType {
|
||||
ValueOrRefType t;
|
||||
|
||||
DefaultToStringType() { this = TDefaultToStringType0(t) }
|
||||
|
||||
ValueOrRefType getType() { result = t }
|
||||
|
||||
string toString() { result = t.toString() }
|
||||
class DefaultToStringType extends ValueOrRefType {
|
||||
DefaultToStringType() { alwaysDefaultToString(this) }
|
||||
|
||||
// A workaround for generating empty URLs for non-source locations, because qltest
|
||||
// does not support non-source locations
|
||||
string getURL() {
|
||||
exists(Location l | l = t.getLocation() |
|
||||
if l instanceof SourceLocation
|
||||
then
|
||||
exists(string path, int a, int b, int c, int d | l.hasLocationInfo(path, a, b, c, d) |
|
||||
toUrl(path, a, b, c, d, result)
|
||||
)
|
||||
else result = ""
|
||||
)
|
||||
override Location getLocation() {
|
||||
result = super.getLocation() and
|
||||
result instanceof SourceLocation
|
||||
or
|
||||
not super.getLocation() instanceof SourceLocation and
|
||||
result.hasLocationInfo("", 0, 0, 0, 0)
|
||||
}
|
||||
}
|
||||
|
||||
from Expr e, DefaultToStringType t
|
||||
where invokesToString(e, t.getType())
|
||||
where invokesToString(e, t)
|
||||
select e,
|
||||
"Default 'ToString()': $@ inherits 'ToString()' from 'Object', and so is not suitable for printing.",
|
||||
t, t.getType().getName()
|
||||
t, t.getName()
|
||||
|
||||
@@ -24,9 +24,6 @@ class Element extends DotNet::Element, @element {
|
||||
*/
|
||||
override Location getLocation() { result = ExprOrStmtParentCached::bestLocation(this) }
|
||||
|
||||
/** Gets the URL of this element. */
|
||||
string getURL() { result = ExprOrStmtParentCached::getURL(this) }
|
||||
|
||||
/** Gets a location of this element, including sources and assemblies. */
|
||||
override Location getALocation() { none() }
|
||||
|
||||
|
||||
@@ -370,17 +370,9 @@ module ExprOrStmtParentCached {
|
||||
or
|
||||
hasNoSourceLocation(e) and
|
||||
result = min(Location l | l = e.getALocation() | l order by l.getFile().toString())
|
||||
}
|
||||
|
||||
cached
|
||||
string getURL(Element e) {
|
||||
exists(Location l, string path, int a, int b, int c, int d | l = bestLocation(e) |
|
||||
l.hasLocationInfo(path, a, b, c, d) and
|
||||
toUrl(path, a, b, c, d, result)
|
||||
)
|
||||
or
|
||||
not exists(bestLocation(e)) and
|
||||
result = ""
|
||||
not exists(e.getALocation()) and
|
||||
result.hasLocationInfo("", 0, 0, 0, 0)
|
||||
}
|
||||
}
|
||||
private import ExprOrStmtParentCached
|
||||
|
||||
@@ -149,7 +149,8 @@ class InvalidFormatString extends StringLiteral {
|
||||
result = this.getValue().regexpFind(getValidFormatRegex(), 0, 0).length()
|
||||
}
|
||||
|
||||
override string getURL() {
|
||||
/** Gets the URL of this element. */
|
||||
string getURL() {
|
||||
exists(
|
||||
string filepath, int startline, int startcolumn, int endline, int endcolumn,
|
||||
int oldstartcolumn, int padding
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
| async.cs:11:29:11:32 | Main | | private |
|
||||
| async.cs:11:29:11:32 | Main | | static |
|
||||
| async.cs:22:35:22:57 | PrintContentLengthAsync | | async |
|
||||
| async.cs:22:35:22:57 | PrintContentLengthAsync | | private |
|
||||
| async.cs:22:35:22:57 | PrintContentLengthAsync | | static |
|
||||
| async.cs:28:40:28:57 | ContentLengthAsync | | async |
|
||||
| async.cs:28:40:28:57 | ContentLengthAsync | | private |
|
||||
| async.cs:28:40:28:57 | ContentLengthAsync | | static |
|
||||
| async.cs:38:35:38:47 | AsyncIterator | | async |
|
||||
| async.cs:38:35:38:47 | AsyncIterator | | private |
|
||||
| async.cs:38:35:38:47 | AsyncIterator | | static |
|
||||
| async.cs:50:49:50:57 | OpenAsync | | async |
|
||||
| async.cs:50:49:50:57 | OpenAsync | | private |
|
||||
| async.cs:50:49:50:57 | OpenAsync | | static |
|
||||
| async.cs:11:29:11:32 | Main | file://:0:0:0:0 | private |
|
||||
| async.cs:11:29:11:32 | Main | file://:0:0:0:0 | static |
|
||||
| async.cs:22:35:22:57 | PrintContentLengthAsync | file://:0:0:0:0 | async |
|
||||
| async.cs:22:35:22:57 | PrintContentLengthAsync | file://:0:0:0:0 | private |
|
||||
| async.cs:22:35:22:57 | PrintContentLengthAsync | file://:0:0:0:0 | static |
|
||||
| async.cs:28:40:28:57 | ContentLengthAsync | file://:0:0:0:0 | async |
|
||||
| async.cs:28:40:28:57 | ContentLengthAsync | file://:0:0:0:0 | private |
|
||||
| async.cs:28:40:28:57 | ContentLengthAsync | file://:0:0:0:0 | static |
|
||||
| async.cs:38:35:38:47 | AsyncIterator | file://:0:0:0:0 | async |
|
||||
| async.cs:38:35:38:47 | AsyncIterator | file://:0:0:0:0 | private |
|
||||
| async.cs:38:35:38:47 | AsyncIterator | file://:0:0:0:0 | static |
|
||||
| async.cs:50:49:50:57 | OpenAsync | file://:0:0:0:0 | async |
|
||||
| async.cs:50:49:50:57 | OpenAsync | file://:0:0:0:0 | private |
|
||||
| async.cs:50:49:50:57 | OpenAsync | file://:0:0:0:0 | static |
|
||||
|
||||
@@ -1,46 +1,46 @@
|
||||
| Modifiers.cs:4:18:4:18 | C | | internal |
|
||||
| Modifiers.cs:4:18:4:18 | C | | unsafe |
|
||||
| Modifiers.cs:7:9:7:9 | C | | private |
|
||||
| Modifiers.cs:9:16:9:16 | C | | public |
|
||||
| Modifiers.cs:12:14:12:15 | M1 | | private |
|
||||
| Modifiers.cs:14:22:14:23 | M2 | | private |
|
||||
| Modifiers.cs:16:24:16:25 | M3 | | protected |
|
||||
| Modifiers.cs:18:35:18:36 | M4 | | extern |
|
||||
| Modifiers.cs:18:35:18:36 | M4 | | public |
|
||||
| Modifiers.cs:18:35:18:36 | M4 | | static |
|
||||
| Modifiers.cs:21:20:21:21 | M5 | | async |
|
||||
| Modifiers.cs:21:20:21:21 | M5 | | private |
|
||||
| Modifiers.cs:24:22:24:23 | C1 | | private |
|
||||
| Modifiers.cs:24:22:24:23 | C1 | | sealed |
|
||||
| Modifiers.cs:26:20:26:21 | C1 | | public |
|
||||
| Modifiers.cs:29:34:29:35 | C2 | | abstract |
|
||||
| Modifiers.cs:29:34:29:35 | C2 | | protected |
|
||||
| Modifiers.cs:31:23:31:24 | C2 | | protected |
|
||||
| Modifiers.cs:33:22:33:23 | M2 | | new |
|
||||
| Modifiers.cs:33:22:33:23 | M2 | | private |
|
||||
| Modifiers.cs:35:34:35:35 | M6 | | abstract |
|
||||
| Modifiers.cs:35:34:35:35 | M6 | | public |
|
||||
| Modifiers.cs:38:32:38:33 | C3 | | internal |
|
||||
| Modifiers.cs:38:32:38:33 | C3 | | partial |
|
||||
| Modifiers.cs:41:20:41:21 | F1 | | private |
|
||||
| Modifiers.cs:41:20:41:21 | F1 | | static |
|
||||
| Modifiers.cs:43:26:43:27 | F2 | | const |
|
||||
| Modifiers.cs:43:26:43:27 | F2 | | public |
|
||||
| Modifiers.cs:43:26:43:27 | F2 | | static |
|
||||
| Modifiers.cs:45:41:45:42 | F3 | | internal |
|
||||
| Modifiers.cs:45:41:45:42 | F3 | | protected |
|
||||
| Modifiers.cs:45:41:45:42 | F3 | | readonly |
|
||||
| Modifiers.cs:47:30:47:31 | F4 | | private |
|
||||
| Modifiers.cs:47:30:47:31 | F4 | | volatile |
|
||||
| Modifiers.cs:50:24:50:24 | I | | internal |
|
||||
| Modifiers.cs:52:19:52:19 | S | | public |
|
||||
| Modifiers.cs:52:19:52:19 | S | | sealed |
|
||||
| Modifiers.cs:54:20:54:21 | P1 | | public |
|
||||
| Modifiers.cs:54:36:54:38 | get_P1 | | public |
|
||||
| Modifiers.cs:54:52:54:54 | set_P1 | | public |
|
||||
| Modifiers.cs:55:20:55:21 | P2 | | public |
|
||||
| Modifiers.cs:55:36:55:38 | get_P2 | | public |
|
||||
| Modifiers.cs:55:49:55:51 | set_P2 | | private |
|
||||
| Modifiers.cs:57:13:57:14 | P3 | | private |
|
||||
| Modifiers.cs:57:30:57:32 | get_P3 | | private |
|
||||
| Modifiers.cs:57:47:57:49 | set_P3 | | private |
|
||||
| Modifiers.cs:4:18:4:18 | C | file://:0:0:0:0 | internal |
|
||||
| Modifiers.cs:4:18:4:18 | C | file://:0:0:0:0 | unsafe |
|
||||
| Modifiers.cs:7:9:7:9 | C | file://:0:0:0:0 | private |
|
||||
| Modifiers.cs:9:16:9:16 | C | file://:0:0:0:0 | public |
|
||||
| Modifiers.cs:12:14:12:15 | M1 | file://:0:0:0:0 | private |
|
||||
| Modifiers.cs:14:22:14:23 | M2 | file://:0:0:0:0 | private |
|
||||
| Modifiers.cs:16:24:16:25 | M3 | file://:0:0:0:0 | protected |
|
||||
| Modifiers.cs:18:35:18:36 | M4 | file://:0:0:0:0 | extern |
|
||||
| Modifiers.cs:18:35:18:36 | M4 | file://:0:0:0:0 | public |
|
||||
| Modifiers.cs:18:35:18:36 | M4 | file://:0:0:0:0 | static |
|
||||
| Modifiers.cs:21:20:21:21 | M5 | file://:0:0:0:0 | async |
|
||||
| Modifiers.cs:21:20:21:21 | M5 | file://:0:0:0:0 | private |
|
||||
| Modifiers.cs:24:22:24:23 | C1 | file://:0:0:0:0 | private |
|
||||
| Modifiers.cs:24:22:24:23 | C1 | file://:0:0:0:0 | sealed |
|
||||
| Modifiers.cs:26:20:26:21 | C1 | file://:0:0:0:0 | public |
|
||||
| Modifiers.cs:29:34:29:35 | C2 | file://:0:0:0:0 | abstract |
|
||||
| Modifiers.cs:29:34:29:35 | C2 | file://:0:0:0:0 | protected |
|
||||
| Modifiers.cs:31:23:31:24 | C2 | file://:0:0:0:0 | protected |
|
||||
| Modifiers.cs:33:22:33:23 | M2 | file://:0:0:0:0 | new |
|
||||
| Modifiers.cs:33:22:33:23 | M2 | file://:0:0:0:0 | private |
|
||||
| Modifiers.cs:35:34:35:35 | M6 | file://:0:0:0:0 | abstract |
|
||||
| Modifiers.cs:35:34:35:35 | M6 | file://:0:0:0:0 | public |
|
||||
| Modifiers.cs:38:32:38:33 | C3 | file://:0:0:0:0 | internal |
|
||||
| Modifiers.cs:38:32:38:33 | C3 | file://:0:0:0:0 | partial |
|
||||
| Modifiers.cs:41:20:41:21 | F1 | file://:0:0:0:0 | private |
|
||||
| Modifiers.cs:41:20:41:21 | F1 | file://:0:0:0:0 | static |
|
||||
| Modifiers.cs:43:26:43:27 | F2 | file://:0:0:0:0 | const |
|
||||
| Modifiers.cs:43:26:43:27 | F2 | file://:0:0:0:0 | public |
|
||||
| Modifiers.cs:43:26:43:27 | F2 | file://:0:0:0:0 | static |
|
||||
| Modifiers.cs:45:41:45:42 | F3 | file://:0:0:0:0 | internal |
|
||||
| Modifiers.cs:45:41:45:42 | F3 | file://:0:0:0:0 | protected |
|
||||
| Modifiers.cs:45:41:45:42 | F3 | file://:0:0:0:0 | readonly |
|
||||
| Modifiers.cs:47:30:47:31 | F4 | file://:0:0:0:0 | private |
|
||||
| Modifiers.cs:47:30:47:31 | F4 | file://:0:0:0:0 | volatile |
|
||||
| Modifiers.cs:50:24:50:24 | I | file://:0:0:0:0 | internal |
|
||||
| Modifiers.cs:52:19:52:19 | S | file://:0:0:0:0 | public |
|
||||
| Modifiers.cs:52:19:52:19 | S | file://:0:0:0:0 | sealed |
|
||||
| Modifiers.cs:54:20:54:21 | P1 | file://:0:0:0:0 | public |
|
||||
| Modifiers.cs:54:36:54:38 | get_P1 | file://:0:0:0:0 | public |
|
||||
| Modifiers.cs:54:52:54:54 | set_P1 | file://:0:0:0:0 | public |
|
||||
| Modifiers.cs:55:20:55:21 | P2 | file://:0:0:0:0 | public |
|
||||
| Modifiers.cs:55:36:55:38 | get_P2 | file://:0:0:0:0 | public |
|
||||
| Modifiers.cs:55:49:55:51 | set_P2 | file://:0:0:0:0 | private |
|
||||
| Modifiers.cs:57:13:57:14 | P3 | file://:0:0:0:0 | private |
|
||||
| Modifiers.cs:57:30:57:32 | get_P3 | file://:0:0:0:0 | private |
|
||||
| Modifiers.cs:57:47:57:49 | set_P3 | file://:0:0:0:0 | private |
|
||||
|
||||
@@ -1 +1 @@
|
||||
| | Q1 | namespaces.cs:50:11:50:15 | Q1.Q2 |
|
||||
| file://:0:0:0:0 | Q1 | namespaces.cs:50:11:50:15 | Q1.Q2 |
|
||||
|
||||
@@ -1 +1 @@
|
||||
| | null |
|
||||
| file://:0:0:0:0 | null |
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
| DefaultToString.cs:9:27:9:27 | access to local variable d | Default 'ToString()': $@ inherits 'ToString()' from 'Object', and so is not suitable for printing. | DefaultToString.cs:4:14:4:28 | DefaultToString | DefaultToString |
|
||||
| DefaultToString.cs:10:28:10:28 | access to local variable d | Default 'ToString()': $@ inherits 'ToString()' from 'Object', and so is not suitable for printing. | DefaultToString.cs:4:14:4:28 | DefaultToString | DefaultToString |
|
||||
| DefaultToString.cs:16:27:16:30 | access to local variable ints | Default 'ToString()': $@ inherits 'ToString()' from 'Object', and so is not suitable for printing. | | Int32[] | Int32[] |
|
||||
| DefaultToString.cs:19:24:19:27 | access to local variable ints | Default 'ToString()': $@ inherits 'ToString()' from 'Object', and so is not suitable for printing. | | Int32[] | Int32[] |
|
||||
| DefaultToString.cs:16:27:16:30 | access to local variable ints | Default 'ToString()': $@ inherits 'ToString()' from 'Object', and so is not suitable for printing. | file://:0:0:0:0 | Int32[] | Int32[] |
|
||||
| DefaultToString.cs:19:24:19:27 | access to local variable ints | Default 'ToString()': $@ inherits 'ToString()' from 'Object', and so is not suitable for printing. | file://:0:0:0:0 | Int32[] | Int32[] |
|
||||
| DefaultToString.cs:34:27:34:27 | access to local variable f | Default 'ToString()': $@ inherits 'ToString()' from 'Object', and so is not suitable for printing. | DefaultToString.cs:62:23:62:30 | IPrivate | IPrivate |
|
||||
| DefaultToStringBad.cs:8:35:8:35 | access to local variable p | Default 'ToString()': $@ inherits 'ToString()' from 'Object', and so is not suitable for printing. | DefaultToStringBad.cs:14:11:14:16 | Person | Person |
|
||||
| DefaultToStringBad.cs:11:38:11:41 | access to local variable ints | Default 'ToString()': $@ inherits 'ToString()' from 'Object', and so is not suitable for printing. | | Int32[] | Int32[] |
|
||||
| WriteLineArray.cs:7:23:7:26 | access to parameter args | Default 'ToString()': $@ inherits 'ToString()' from 'Object', and so is not suitable for printing. | | String[] | String[] |
|
||||
| WriteLineArray.cs:8:27:8:30 | access to parameter args | Default 'ToString()': $@ inherits 'ToString()' from 'Object', and so is not suitable for printing. | | String[] | String[] |
|
||||
| WriteLineArray.cs:10:36:10:39 | access to parameter args | Default 'ToString()': $@ inherits 'ToString()' from 'Object', and so is not suitable for printing. | | String[] | String[] |
|
||||
| WriteLineArray.cs:11:40:11:43 | access to parameter args | Default 'ToString()': $@ inherits 'ToString()' from 'Object', and so is not suitable for printing. | | String[] | String[] |
|
||||
| DefaultToStringBad.cs:11:38:11:41 | access to local variable ints | Default 'ToString()': $@ inherits 'ToString()' from 'Object', and so is not suitable for printing. | file://:0:0:0:0 | Int32[] | Int32[] |
|
||||
| WriteLineArray.cs:7:23:7:26 | access to parameter args | Default 'ToString()': $@ inherits 'ToString()' from 'Object', and so is not suitable for printing. | file://:0:0:0:0 | String[] | String[] |
|
||||
| WriteLineArray.cs:8:27:8:30 | access to parameter args | Default 'ToString()': $@ inherits 'ToString()' from 'Object', and so is not suitable for printing. | file://:0:0:0:0 | String[] | String[] |
|
||||
| WriteLineArray.cs:10:36:10:39 | access to parameter args | Default 'ToString()': $@ inherits 'ToString()' from 'Object', and so is not suitable for printing. | file://:0:0:0:0 | String[] | String[] |
|
||||
| WriteLineArray.cs:11:40:11:43 | access to parameter args | Default 'ToString()': $@ inherits 'ToString()' from 'Object', and so is not suitable for printing. | file://:0:0:0:0 | String[] | String[] |
|
||||
|
||||
Reference in New Issue
Block a user