mirror of
https://github.com/github/codeql.git
synced 2026-04-30 03:05:15 +02:00
JS: Autoformat everything
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
import javascript
|
||||
|
||||
from RegExpCharEscape rece
|
||||
where rece.toString() = "\\b"
|
||||
and rece.isPartOfRegExpLiteral()
|
||||
where
|
||||
rece.toString() = "\\b" and
|
||||
rece.isPartOfRegExpLiteral()
|
||||
select rece, "Backspace escape in regular expression."
|
||||
|
||||
@@ -18,7 +18,8 @@ import javascript
|
||||
* Indexing is 1-based.
|
||||
*/
|
||||
predicate constantInCharacterClass(RegExpCharacterClass recc, int i, RegExpConstant cc, string val) {
|
||||
cc = rank[i](RegExpConstant cc2, int j |
|
||||
cc =
|
||||
rank[i](RegExpConstant cc2, int j |
|
||||
cc2 = recc.getChild(j) and cc2.isCharacter() and cc2.getValue() = val
|
||||
|
|
||||
cc2 order by j
|
||||
|
||||
@@ -58,7 +58,8 @@ predicate regExpMatchesString(RegExpTerm t, string s) {
|
||||
or
|
||||
// sequences match the concatenation of their elements
|
||||
exists(RegExpSequence seq | seq = t |
|
||||
s = concat(int i, RegExpTerm child |
|
||||
s =
|
||||
concat(int i, RegExpTerm child |
|
||||
child = seq.getChild(i)
|
||||
|
|
||||
any(string subs | regExpMatchesString(child, subs)) order by i
|
||||
|
||||
@@ -73,13 +73,9 @@ abstract class RegExpQuery extends DataFlow::CallNode {
|
||||
class RegExpTestCall extends DataFlow::MethodCallNode, RegExpQuery {
|
||||
DataFlow::RegExpCreationNode regexp;
|
||||
|
||||
RegExpTestCall() {
|
||||
this = regexp.getAReference().getAMethodCall("test")
|
||||
}
|
||||
RegExpTestCall() { this = regexp.getAReference().getAMethodCall("test") }
|
||||
|
||||
override RegExpTerm getRegExp() {
|
||||
result = regexp.getRoot()
|
||||
}
|
||||
override RegExpTerm getRegExp() { result = regexp.getRoot() }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -93,9 +89,7 @@ class RegExpSearchCall extends DataFlow::MethodCallNode, RegExpQuery {
|
||||
regexp.getAReference().flowsTo(getArgument(0))
|
||||
}
|
||||
|
||||
override RegExpTerm getRegExp() {
|
||||
result = regexp.getRoot()
|
||||
}
|
||||
override RegExpTerm getRegExp() { result = regexp.getRoot() }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -116,10 +110,12 @@ where
|
||||
(
|
||||
call instanceof RegExpTestCall and
|
||||
not isPossiblyAnchoredOnBothEnds(term) and
|
||||
message = "This regular expression always matches when used in a test $@, as it can match an empty substring."
|
||||
message =
|
||||
"This regular expression always matches when used in a test $@, as it can match an empty substring."
|
||||
or
|
||||
call instanceof RegExpSearchCall and
|
||||
not term.getAChild*() instanceof RegExpDollar and
|
||||
message = "This regular expression always the matches at index 0 when used $@, as it matches the empty substring."
|
||||
message =
|
||||
"This regular expression always the matches at index 0 when used $@, as it matches the empty substring."
|
||||
)
|
||||
select term, message, call, "here"
|
||||
|
||||
Reference in New Issue
Block a user