mirror of
https://github.com/github/codeql.git
synced 2026-04-29 10:45:15 +02:00
Python: Avoid multiple results for toString
This commit is contained in:
@@ -121,12 +121,6 @@ deprecated string mode_from_mode_object(Value obj) {
|
||||
abstract class RegexString extends Expr {
|
||||
RegexString() { (this instanceof Bytes or this instanceof Unicode) }
|
||||
|
||||
override string toString() {
|
||||
result = this.(Bytes).getText()
|
||||
or
|
||||
result = this.(Unicode).getText()
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper predicate for `char_set_start(int start, int end)`.
|
||||
*
|
||||
|
||||
@@ -13,7 +13,7 @@ class CharacterSetTest extends InlineExpectationsTest {
|
||||
exists(Regex re, int start, int end |
|
||||
re.charSet(start, end) and
|
||||
location = re.getLocation() and
|
||||
element = re.toString().substring(start, end) and
|
||||
element = re.getText().substring(start, end) and
|
||||
value = start + ":" + end and
|
||||
tag = "charSet"
|
||||
)
|
||||
@@ -31,7 +31,7 @@ class CharacterRangeTest extends InlineExpectationsTest {
|
||||
exists(Regex re, int start, int lower_end, int upper_start, int end |
|
||||
re.charRange(_, start, lower_end, upper_start, end) and
|
||||
location = re.getLocation() and
|
||||
element = re.toString().substring(start, end) and
|
||||
element = re.getText().substring(start, end) and
|
||||
value = start + ":" + lower_end + "-" + upper_start + ":" + end and
|
||||
tag = "charRange"
|
||||
)
|
||||
@@ -49,7 +49,7 @@ class EscapeTest extends InlineExpectationsTest {
|
||||
exists(Regex re, int start, int end |
|
||||
re.escapedCharacter(start, end) and
|
||||
location = re.getLocation() and
|
||||
element = re.toString().substring(start, end) and
|
||||
element = re.getText().substring(start, end) and
|
||||
value = start + ":" + end and
|
||||
tag = "escapedCharacter"
|
||||
)
|
||||
@@ -67,7 +67,7 @@ class GroupTest extends InlineExpectationsTest {
|
||||
exists(Regex re, int start, int end |
|
||||
re.group(start, end) and
|
||||
location = re.getLocation() and
|
||||
element = re.toString().substring(start, end) and
|
||||
element = re.getText().substring(start, end) and
|
||||
value = start + ":" + end and
|
||||
tag = "group"
|
||||
)
|
||||
|
||||
@@ -1,4 +1,2 @@
|
||||
| test.py:17:12:17:22 | Str | Backspace escape in regular expression at offset 1. |
|
||||
| test.py:17:12:17:22 | [\\b\\t ] | Backspace escape in regular expression at offset 1. |
|
||||
| test.py:19:12:19:28 | E\\d+\\b[ \\b\\t] | Backspace escape in regular expression at offset 8. |
|
||||
| test.py:19:12:19:28 | Str | Backspace escape in regular expression at offset 8. |
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
| test.py:46:12:46:18 | Str | This regular expression includes duplicate character 'A' in a set of characters. |
|
||||
| test.py:46:12:46:18 | [AA] | This regular expression includes duplicate character 'A' in a set of characters. |
|
||||
| test.py:47:12:47:19 | Str | This regular expression includes duplicate character '0' in a set of characters. |
|
||||
| test.py:47:12:47:19 | [000] | This regular expression includes duplicate character '0' in a set of characters. |
|
||||
| test.py:48:12:48:21 | Str | This regular expression includes duplicate character '-' in a set of characters. |
|
||||
| test.py:48:12:48:21 | [-0-9-] | This regular expression includes duplicate character '-' in a set of characters. |
|
||||
|
||||
@@ -1,4 +1,2 @@
|
||||
| test.py:22:12:22:29 | (P<name>[\\w]+) | Regular expression is missing '?' in named group. |
|
||||
| test.py:22:12:22:29 | Str | Regular expression is missing '?' in named group. |
|
||||
| test.py:23:12:23:33 | (_(P<name>[\\w]+)\|) | Regular expression is missing '?' in named group. |
|
||||
| test.py:23:12:23:33 | Str | Regular expression is missing '?' in named group. |
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
| test.py:4:12:4:19 | ^abc | This regular expression includes an unmatchable caret at offset 1. |
|
||||
| test.py:4:12:4:19 | Str | This regular expression includes an unmatchable caret at offset 1. |
|
||||
| test.py:5:12:5:23 | (?s) ^abc | This regular expression includes an unmatchable caret at offset 5. |
|
||||
| test.py:5:12:5:23 | Str | This regular expression includes an unmatchable caret at offset 5. |
|
||||
| test.py:6:12:6:21 | Str | This regular expression includes an unmatchable caret at offset 2. |
|
||||
| test.py:6:12:6:21 | \\[^123] | This regular expression includes an unmatchable caret at offset 2. |
|
||||
| test.py:79:12:79:27 | (?<=foo)^\\w+ | This regular expression includes an unmatchable caret at offset 8. |
|
||||
| test.py:79:12:79:27 | Str | This regular expression includes an unmatchable caret at offset 8. |
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
| test.py:29:12:29:19 | Str | This regular expression includes an unmatchable dollar at offset 3. |
|
||||
| test.py:29:12:29:19 | abc$ | This regular expression includes an unmatchable dollar at offset 3. |
|
||||
| test.py:30:12:30:23 | Str | This regular expression includes an unmatchable dollar at offset 3. |
|
||||
| test.py:30:12:30:23 | abc$ (?s) | This regular expression includes an unmatchable dollar at offset 3. |
|
||||
| test.py:31:12:31:20 | Str | This regular expression includes an unmatchable dollar at offset 2. |
|
||||
| test.py:31:12:31:20 | \\[$] | This regular expression includes an unmatchable dollar at offset 2. |
|
||||
| test.py:80:12:80:26 | Str | This regular expression includes an unmatchable dollar at offset 3. |
|
||||
| test.py:80:12:80:26 | \\w+$(?=foo) | This regular expression includes an unmatchable dollar at offset 3. |
|
||||
|
||||
@@ -1,2 +1 @@
|
||||
| hosttest.py:6:27:6:51 | (www\|beta).example.com/ | This regular expression has an unescaped '.' before 'example.com', so it might match more hosts than expected. |
|
||||
| hosttest.py:6:27:6:51 | Str | This regular expression has an unescaped '.' before 'example.com', so it might match more hosts than expected. |
|
||||
|
||||
Reference in New Issue
Block a user