Skip to content

Commit 96748ca

Browse files
committed
JS: sharpen js/duplicate-parameter-name
1 parent 5718fbd commit 96748ca

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed

change-notes/1.24/analysis-javascript.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
| **Query** | **Expected impact** | **Change** |
2222
|--------------------------------|------------------------------|---------------------------------------------------------------------------|
2323
| Clear-text logging of sensitive information (`js/clear-text-logging`) | More results | More results involving `process.env` and indirect calls to logging methods are recognized. |
24+
| Duplicate parameter names (`js/duplicate-parameter-name`) | Fewer results | This query now recognizes additional parameters that reasonably can have duplicated names. |
2425
| Incomplete string escaping or encoding (`js/incomplete-sanitization`) | Fewer false positive results | This query now recognizes additional cases where a single replacement is likely to be intentional. |
2526
| Unbound event handler receiver (`js/unbound-event-handler-receiver`) | Fewer false positive results | This query now recognizes additional ways event handler receivers can be bound. |
2627

javascript/ql/src/Declarations/UniqueParameterNames.ql

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ where
3636
i < j and
3737
j = max(int k | parmBinds(f, k, _, name) | k) and
3838
not isDummy(p) and
39+
// ignore functions without bodies or empty bodies
40+
f.hasBody() and
41+
exists(f.getABodyStmt()) and
3942
// duplicate parameters in strict mode functions are flagged by the 'Syntax error' rule
4043
not f.isStrict()
4144
select p, "This parameter has the same name as $@ of the same function.", q, "another parameter"
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
| tst.js:2:1:2:1 | x | This parameter has the same name as $@ of the same function. | tst.js:4:1:4:6 | \\u0078 | another parameter |
22
| tst.js:3:1:3:1 | x | This parameter has the same name as $@ of the same function. | tst.js:4:1:4:6 | \\u0078 | another parameter |
3-
| tst.js:17:1:17:1 | x | This parameter has the same name as $@ of the same function. | tst.js:18:1:18:1 | x | another parameter |

0 commit comments

Comments
 (0)