Skip to content

Commit b9cce57

Browse files
committed
JS: Fix mistake.
1 parent 882adc8 commit b9cce57

File tree

1 file changed

+20
-61
lines changed

1 file changed

+20
-61
lines changed

javascript/ql/lib/semmle/javascript/frameworks/LodashUnderscore.qll

Lines changed: 20 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,15 @@ module LodashUnderscore {
101101
exists(DataFlow::CallNode call, string name |
102102
// Members ending with By, With, or While indicate that they are a variant of
103103
// another function that takes a callback.
104-
name.matches(["%By", "%With", "%While"]) or
104+
name.matches(["%By", "%With", "%While"])
105+
or
105106
// Other members that don't fit the above pattern.
106-
name = ["each", "eachRight", "every", "filter", "find", "findLast", "flatMap", "flatMapDeep", "flatMapDepth", "forEach", "forEachRight", "partition", "reduce", "reduceRight", "replace", "some", "transform"]
107+
name =
108+
[
109+
"each", "eachRight", "every", "filter", "find", "findLast", "flatMap", "flatMapDeep",
110+
"flatMapDepth", "forEach", "forEachRight", "partition", "reduce", "reduceRight",
111+
"replace", "some", "transform"
112+
]
107113
|
108114
call = member(name).getACall() and
109115
pred = call.getAnArgument().(DataFlow::FunctionNode).getExceptionalReturn() and
@@ -181,77 +187,30 @@ private class LodashCallbackAsPartialInvoke extends DataFlow::PartialInvokeNode:
181187
this = LodashUnderscore::member(name).getACall() and
182188
getNumArgument() = argumentCount
183189
|
184-
(
185-
name = ["bind", "callback", "iteratee"]
186-
) and
190+
name = ["bind", "callback", "iteratee"] and
187191
callbackIndex = 0 and
188192
contextIndex = 1 and
189193
argumentCount = 2
190194
or
191-
(
192-
name = [
193-
"all",
194-
"any",
195-
"collect",
196-
"countBy",
197-
"detect",
198-
"dropRightWhile",
199-
"dropWhile",
200-
"each",
201-
"eachRight",
202-
"every",
203-
"filter",
204-
"find",
205-
"findIndex",
206-
"findKey",
207-
"findLast",
208-
"findLastIndex",
209-
"findLastKey",
210-
"forEach",
211-
"forEachRight",
212-
"forIn",
213-
"forInRight",
214-
"groupBy",
215-
"indexBy",
216-
"map",
217-
"mapKeys",
218-
"mapValues",
219-
"max",
220-
"min",
221-
"omit",
222-
"partition",
223-
"pick",
224-
"reject",
225-
"remove",
226-
"select",
227-
"some",
228-
"sortBy",
229-
"sum",
230-
"takeRightWhile",
231-
"takeWhile",
232-
"tap",
233-
"thru",
234-
"times",
235-
"unzipWith",
236-
"zipWith"]
237-
) and
195+
name =
196+
[
197+
"all", "any", "collect", "countBy", "detect", "dropRightWhile", "dropWhile", "each",
198+
"eachRight", "every", "filter", "find", "findIndex", "findKey", "findLast",
199+
"findLastIndex", "findLastKey", "forEach", "forEachRight", "forIn", "forInRight",
200+
"groupBy", "indexBy", "map", "mapKeys", "mapValues", "max", "min", "omit", "partition",
201+
"pick", "reject", "remove", "select", "some", "sortBy", "sum", "takeRightWhile",
202+
"takeWhile", "tap", "thru", "times", "unzipWith", "zipWith"
203+
] and
238204
callbackIndex = 1 and
239205
contextIndex = 2 and
240206
argumentCount = 3
241207
or
242-
(
243-
name = ["foldl", "foldr", "inject", "reduce", "reduceRight", "transform"]
244-
) and
208+
name = ["foldl", "foldr", "inject", "reduce", "reduceRight", "transform"] and
245209
callbackIndex = 1 and
246210
contextIndex = 3 and
247211
argumentCount = 4
248212
or
249-
(
250-
name = ["sortedlastIndex", "assign", "eq", "extend", "merge"]
251-
or
252-
name = "sortedIndex" and
253-
name = "uniq"
254-
) and
213+
name = ["sortedlastIndex", "assign", "eq", "extend", "merge", "sortedIndex", "uniq"] and
255214
callbackIndex = 2 and
256215
contextIndex = 3 and
257216
argumentCount = 4

0 commit comments

Comments
 (0)