Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e1947f0

Browse files
author
Esben Sparre Andreasen
committed
JS: change alert location for js/incomplete-object-initialization
1 parent 1a5585c commit e1947f0

4 files changed

Lines changed: 23 additions & 13 deletions

File tree

change-notes/1.18/analysis-javascript.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
| Uncontrolled command line | More true-positive results | This rule now recognizes indirect command injection through `sh -c` and similar. |
4848
| Unused variable | Fewer results | This rule no longer flags class expressions that could be made anonymous. While technically true, these results are not interesting. |
4949
| Unused variable | Renamed | This rule has been renamed to "Unused variable, import, function or class" to reflect the fact that it flags different kinds of unused program elements. |
50+
| Use of incompletely initialized object| Fewer results | This rule now flags the constructor instead its errorneous `this` or `super` expressions. |
5051

5152
## Changes to QL libraries
5253

javascript/ql/src/LanguageFeatures/ThisBeforeSuper.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,4 @@ where needsGuard(e, kind) and unguarded(e, ctor) and
5959
sc.getBinder() = ctor and
6060
sc.getEnclosingFunction() != ctor
6161
)
62-
select e, "The super constructor must be called before using '" + kind + "'."
62+
select ctor, "The super constructor must be called before using '$@'.", e, kind
Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
| invalid.js:5:40:5:43 | this | The super constructor must be called before using 'this'. |
2-
| invalid.js:6:40:6:43 | this | The super constructor must be called before using 'this'. |
3-
| invalid.js:7:40:7:46 | super.c | The super constructor must be called before using 'super'. |
4-
| invalid.js:8:40:8:43 | this | The super constructor must be called before using 'this'. |
5-
| invalid.js:9:40:9:43 | this | The super constructor must be called before using 'this'. |
6-
| invalid.js:10:40:10:46 | super.c | The super constructor must be called before using 'super'. |
7-
| invalid.js:11:46:11:49 | this | The super constructor must be called before using 'this'. |
8-
| invalid.js:12:46:12:49 | this | The super constructor must be called before using 'this'. |
9-
| invalid.js:13:46:13:52 | super.c | The super constructor must be called before using 'super'. |
10-
| invalid.js:14:99:14:102 | this | The super constructor must be called before using 'this'. |
11-
| invalid.js:15:76:15:79 | this | The super constructor must be called before using 'this'. |
12-
| invalid.js:16:56:16:59 | this | The super constructor must be called before using 'this'. |
1+
| invalid.js:5:35:5:52 | () { this.c = 0; } | The super constructor must be called before using '$@'. | invalid.js:5:40:5:43 | this | this |
2+
| invalid.js:6:35:6:50 | () { this.c(); } | The super constructor must be called before using '$@'. | invalid.js:6:40:6:43 | this | this |
3+
| invalid.js:7:35:7:51 | () { super.c(); } | The super constructor must be called before using '$@'. | invalid.js:7:40:7:46 | super.c | super |
4+
| invalid.js:8:35:8:61 | () { th ... er(); } | The super constructor must be called before using '$@'. | invalid.js:8:40:8:43 | this | this |
5+
| invalid.js:9:35:9:59 | () { th ... er(); } | The super constructor must be called before using '$@'. | invalid.js:9:40:9:43 | this | this |
6+
| invalid.js:10:35:10:60 | () { su ... er(); } | The super constructor must be called before using '$@'. | invalid.js:10:40:10:46 | super.c | super |
7+
| invalid.js:11:35:11:55 | () { su ... s.c); } | The super constructor must be called before using '$@'. | invalid.js:11:46:11:49 | this | this |
8+
| invalid.js:12:35:12:57 | () { su ... c()); } | The super constructor must be called before using '$@'. | invalid.js:12:46:12:49 | this | this |
9+
| invalid.js:13:35:13:58 | () { su ... c()); } | The super constructor must be called before using '$@'. | invalid.js:13:46:13:52 | super.c | super |
10+
| invalid.js:14:35:14:118 | () { cl ... er(); } | The super constructor must be called before using '$@'. | invalid.js:14:99:14:102 | this | this |
11+
| invalid.js:15:71:15:95 | () { th ... er(); } | The super constructor must be called before using '$@'. | invalid.js:15:76:15:79 | this | this |
12+
| invalid.js:16:35:16:66 | () { if ... .a(); } | The super constructor must be called before using '$@'. | invalid.js:16:56:16:59 | this | this |
13+
| invalid.js:26:16:29:5 | () {\\n ... ;\\n } | The super constructor must be called before using '$@'. | invalid.js:27:9:27:12 | this | this |
14+
| invalid.js:26:16:29:5 | () {\\n ... ;\\n } | The super constructor must be called before using '$@'. | invalid.js:28:9:28:12 | this | this |

javascript/ql/test/query-tests/LanguageFeatures/ThisBeforeSuper/invalid.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,10 @@ class A41 extends B1 { constructor() { if (a) super(); this.a(); } }
2121
class B2 { constructor() { throw ""; } }
2222
class A42 extends B2 { constructor() { try { super(); } finally { this.a; } } }
2323
class A43 extends B2 { constructor() { try { super(); } catch (err) { } this.a; } }
24+
25+
class A44 extends B1 {
26+
constructor() {
27+
this.p1 = 0;
28+
this.p2 = 0;
29+
}
30+
}

0 commit comments

Comments
 (0)