mirror of
https://github.com/github/codeql.git
synced 2026-04-24 08:15:14 +02:00
move Regex into a ParseRegExp file, and rename the class to RegExp
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
import python
|
||||
import semmle.python.regex
|
||||
|
||||
from Regex r, int offset
|
||||
from RegExp r, int offset
|
||||
where
|
||||
r.escapingChar(offset) and
|
||||
r.getChar(offset + 1) = "b" and
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
import python
|
||||
import semmle.python.regex
|
||||
|
||||
predicate duplicate_char_in_class(Regex r, string char) {
|
||||
predicate duplicate_char_in_class(RegExp r, string char) {
|
||||
exists(int i, int j, int x, int y, int start, int end |
|
||||
i != x and
|
||||
j != y and
|
||||
@@ -36,7 +36,7 @@ predicate duplicate_char_in_class(Regex r, string char) {
|
||||
)
|
||||
}
|
||||
|
||||
from Regex r, string char
|
||||
from RegExp r, string char
|
||||
where duplicate_char_in_class(r, char)
|
||||
select r,
|
||||
"This regular expression includes duplicate character '" + char + "' in a set of characters."
|
||||
|
||||
@@ -13,6 +13,6 @@
|
||||
import python
|
||||
import semmle.python.regex
|
||||
|
||||
from Regex r, string missing, string part
|
||||
from RegExp r, string missing, string part
|
||||
where r.getText().regexpMatch(".*\\(P<\\w+>.*") and missing = "?" and part = "named group"
|
||||
select r, "Regular expression is missing '" + missing + "' in " + part + "."
|
||||
|
||||
@@ -13,14 +13,14 @@
|
||||
import python
|
||||
import semmle.python.regex
|
||||
|
||||
predicate unmatchable_caret(Regex r, int start) {
|
||||
predicate unmatchable_caret(RegExp r, int start) {
|
||||
not r.getAMode() = "MULTILINE" and
|
||||
not r.getAMode() = "VERBOSE" and
|
||||
r.specialCharacter(start, start + 1, "^") and
|
||||
not r.firstItem(start, start + 1)
|
||||
}
|
||||
|
||||
from Regex r, int offset
|
||||
from RegExp r, int offset
|
||||
where unmatchable_caret(r, offset)
|
||||
select r,
|
||||
"This regular expression includes an unmatchable caret at offset " + offset.toString() + "."
|
||||
|
||||
@@ -13,14 +13,14 @@
|
||||
import python
|
||||
import semmle.python.regex
|
||||
|
||||
predicate unmatchable_dollar(Regex r, int start) {
|
||||
predicate unmatchable_dollar(RegExp r, int start) {
|
||||
not r.getAMode() = "MULTILINE" and
|
||||
not r.getAMode() = "VERBOSE" and
|
||||
r.specialCharacter(start, start + 1, "$") and
|
||||
not r.lastItem(start, start + 1)
|
||||
}
|
||||
|
||||
from Regex r, int offset
|
||||
from RegExp r, int offset
|
||||
where unmatchable_dollar(r, offset)
|
||||
select r,
|
||||
"This regular expression includes an unmatchable dollar at offset " + offset.toString() + "."
|
||||
|
||||
Reference in New Issue
Block a user