Skip to content

Commit a6e8b00

Browse files
authored
Merge pull request github#13138 from kaspersv/kaspersv/js-implicit-this-warnings
JS: Enable implicit this receiver warnings
2 parents f7924bd + 7dd9906 commit a6e8b00

File tree

8 files changed

+17
-14
lines changed

8 files changed

+17
-14
lines changed

javascript/ql/lib/qlpack.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ dependencies:
1212
codeql/yaml: ${workspace}
1313
dataExtensions:
1414
- semmle/javascript/frameworks/**/model.yml
15+
warnOnImplicitThis: true

javascript/ql/lib/semmle/javascript/frameworks/AngularJS/AngularJSCore.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ class DirectiveTargetName extends string {
507507
* `:` and `_` count as component delimiters.
508508
*/
509509
string getRawComponent(int i) {
510-
result = toLowerCase().regexpFind("(?<=^|[-:_])[a-zA-Z0-9]+(?=$|[-:_])", i, _)
510+
result = this.toLowerCase().regexpFind("(?<=^|[-:_])[a-zA-Z0-9]+(?=$|[-:_])", i, _)
511511
}
512512

513513
/**

javascript/ql/src/qlpack.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ dependencies:
1111
codeql/suite-helpers: ${workspace}
1212
codeql/typos: ${workspace}
1313
codeql/util: ${workspace}
14+
warnOnImplicitThis: true

javascript/ql/test/qlpack.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ extractor: javascript
77
tests: .
88
dataExtensions:
99
- library-tests/DataExtensions/*.model.yml
10+
warnOnImplicitThis: true

javascript/ql/test/tutorials/Validating RAML-based APIs/query1.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import javascript
22

33
/** A RAML specification. */
44
class RamlSpec extends YamlDocument, YamlMapping {
5-
RamlSpec() { getLocation().getFile().getExtension() = "raml" }
5+
RamlSpec() { this.getLocation().getFile().getExtension() = "raml" }
66
}
77

88
from RamlSpec s

javascript/ql/test/tutorials/Validating RAML-based APIs/query2.ql

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ string httpVerb() { result = ["get", "put", "post", "delete"] }
44

55
/** A RAML specification. */
66
class RamlSpec extends YamlDocument, YamlMapping {
7-
RamlSpec() { getLocation().getFile().getExtension() = "raml" }
7+
RamlSpec() { this.getLocation().getFile().getExtension() = "raml" }
88
}
99

1010
/** A RAML resource specification. */
1111
class RamlResource extends YamlMapping {
1212
RamlResource() {
13-
getDocument() instanceof RamlSpec and
13+
this.getDocument() instanceof RamlSpec and
1414
exists(YamlMapping m, string name |
1515
this = m.lookup(name) and
1616
name.matches("/%")
@@ -30,14 +30,14 @@ class RamlResource extends YamlMapping {
3030
/** Get the method for this resource with the given verb. */
3131
RamlMethod getMethod(string verb) {
3232
verb = httpVerb() and
33-
result = lookup(verb)
33+
result = this.lookup(verb)
3434
}
3535
}
3636

3737
/** A RAML method specification. */
3838
class RamlMethod extends YamlValue {
3939
RamlMethod() {
40-
getDocument() instanceof RamlSpec and
40+
this.getDocument() instanceof RamlSpec and
4141
exists(YamlMapping obj | this = obj.lookup(httpVerb()))
4242
}
4343

javascript/ql/test/tutorials/Validating RAML-based APIs/query3.ql

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ string httpVerb() { result = ["get", "put", "post", "delete"] }
44

55
/** A RAML specification. */
66
class RamlSpec extends YamlDocument, YamlMapping {
7-
RamlSpec() { getLocation().getFile().getExtension() = "raml" }
7+
RamlSpec() { this.getLocation().getFile().getExtension() = "raml" }
88
}
99

1010
/** A RAML resource specification. */
1111
class RamlResource extends YamlMapping {
1212
RamlResource() {
13-
getDocument() instanceof RamlSpec and
13+
this.getDocument() instanceof RamlSpec and
1414
exists(YamlMapping m, string name |
1515
this = m.lookup(name) and
1616
name.matches("/%")
@@ -30,13 +30,13 @@ class RamlResource extends YamlMapping {
3030
/** Get the method for this resource with the given verb. */
3131
RamlMethod getMethod(string verb) {
3232
verb = httpVerb() and
33-
result = lookup(verb)
33+
result = this.lookup(verb)
3434
}
3535
}
3636

3737
class RamlMethod extends YamlValue {
3838
RamlMethod() {
39-
getDocument() instanceof RamlSpec and
39+
this.getDocument() instanceof RamlSpec and
4040
exists(YamlMapping obj | this = obj.lookup(httpVerb()))
4141
}
4242
}

javascript/ql/test/tutorials/Validating RAML-based APIs/query4.ql

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ string httpVerb() { result = ["get", "put", "post", "delete"] }
44

55
/** A RAML specification. */
66
class RamlSpec extends YamlDocument, YamlMapping {
7-
RamlSpec() { getLocation().getFile().getExtension() = "raml" }
7+
RamlSpec() { this.getLocation().getFile().getExtension() = "raml" }
88
}
99

1010
/** A RAML resource specification. */
1111
class RamlResource extends YamlMapping {
1212
RamlResource() {
13-
getDocument() instanceof RamlSpec and
13+
this.getDocument() instanceof RamlSpec and
1414
exists(YamlMapping m, string name |
1515
this = m.lookup(name) and
1616
name.matches("/%")
@@ -30,14 +30,14 @@ class RamlResource extends YamlMapping {
3030
/** Get the method for this resource with the given verb. */
3131
RamlMethod getMethod(string verb) {
3232
verb = httpVerb() and
33-
result = lookup(verb)
33+
result = this.lookup(verb)
3434
}
3535
}
3636

3737
/** A RAML method specification. */
3838
class RamlMethod extends YamlValue {
3939
RamlMethod() {
40-
getDocument() instanceof RamlSpec and
40+
this.getDocument() instanceof RamlSpec and
4141
exists(YamlMapping obj | this = obj.lookup(httpVerb()))
4242
}
4343

0 commit comments

Comments
 (0)