Merge pull request #13138 from kaspersv/kaspersv/js-implicit-this-warnings

JS: Enable implicit this receiver warnings
This commit is contained in:
Kasper Svendsen
2023-05-12 11:23:27 +02:00
committed by GitHub
8 changed files with 17 additions and 14 deletions

View File

@@ -12,3 +12,4 @@ dependencies:
codeql/yaml: ${workspace}
dataExtensions:
- semmle/javascript/frameworks/**/model.yml
warnOnImplicitThis: true

View File

@@ -507,7 +507,7 @@ class DirectiveTargetName extends string {
* `:` and `_` count as component delimiters.
*/
string getRawComponent(int i) {
result = toLowerCase().regexpFind("(?<=^|[-:_])[a-zA-Z0-9]+(?=$|[-:_])", i, _)
result = this.toLowerCase().regexpFind("(?<=^|[-:_])[a-zA-Z0-9]+(?=$|[-:_])", i, _)
}
/**

View File

@@ -11,3 +11,4 @@ dependencies:
codeql/suite-helpers: ${workspace}
codeql/typos: ${workspace}
codeql/util: ${workspace}
warnOnImplicitThis: true

View File

@@ -7,3 +7,4 @@ extractor: javascript
tests: .
dataExtensions:
- library-tests/DataExtensions/*.model.yml
warnOnImplicitThis: true

View File

@@ -2,7 +2,7 @@ import javascript
/** A RAML specification. */
class RamlSpec extends YamlDocument, YamlMapping {
RamlSpec() { getLocation().getFile().getExtension() = "raml" }
RamlSpec() { this.getLocation().getFile().getExtension() = "raml" }
}
from RamlSpec s

View File

@@ -4,13 +4,13 @@ string httpVerb() { result = ["get", "put", "post", "delete"] }
/** A RAML specification. */
class RamlSpec extends YamlDocument, YamlMapping {
RamlSpec() { getLocation().getFile().getExtension() = "raml" }
RamlSpec() { this.getLocation().getFile().getExtension() = "raml" }
}
/** A RAML resource specification. */
class RamlResource extends YamlMapping {
RamlResource() {
getDocument() instanceof RamlSpec and
this.getDocument() instanceof RamlSpec and
exists(YamlMapping m, string name |
this = m.lookup(name) and
name.matches("/%")
@@ -30,14 +30,14 @@ class RamlResource extends YamlMapping {
/** Get the method for this resource with the given verb. */
RamlMethod getMethod(string verb) {
verb = httpVerb() and
result = lookup(verb)
result = this.lookup(verb)
}
}
/** A RAML method specification. */
class RamlMethod extends YamlValue {
RamlMethod() {
getDocument() instanceof RamlSpec and
this.getDocument() instanceof RamlSpec and
exists(YamlMapping obj | this = obj.lookup(httpVerb()))
}

View File

@@ -4,13 +4,13 @@ string httpVerb() { result = ["get", "put", "post", "delete"] }
/** A RAML specification. */
class RamlSpec extends YamlDocument, YamlMapping {
RamlSpec() { getLocation().getFile().getExtension() = "raml" }
RamlSpec() { this.getLocation().getFile().getExtension() = "raml" }
}
/** A RAML resource specification. */
class RamlResource extends YamlMapping {
RamlResource() {
getDocument() instanceof RamlSpec and
this.getDocument() instanceof RamlSpec and
exists(YamlMapping m, string name |
this = m.lookup(name) and
name.matches("/%")
@@ -30,13 +30,13 @@ class RamlResource extends YamlMapping {
/** Get the method for this resource with the given verb. */
RamlMethod getMethod(string verb) {
verb = httpVerb() and
result = lookup(verb)
result = this.lookup(verb)
}
}
class RamlMethod extends YamlValue {
RamlMethod() {
getDocument() instanceof RamlSpec and
this.getDocument() instanceof RamlSpec and
exists(YamlMapping obj | this = obj.lookup(httpVerb()))
}
}

View File

@@ -4,13 +4,13 @@ string httpVerb() { result = ["get", "put", "post", "delete"] }
/** A RAML specification. */
class RamlSpec extends YamlDocument, YamlMapping {
RamlSpec() { getLocation().getFile().getExtension() = "raml" }
RamlSpec() { this.getLocation().getFile().getExtension() = "raml" }
}
/** A RAML resource specification. */
class RamlResource extends YamlMapping {
RamlResource() {
getDocument() instanceof RamlSpec and
this.getDocument() instanceof RamlSpec and
exists(YamlMapping m, string name |
this = m.lookup(name) and
name.matches("/%")
@@ -30,14 +30,14 @@ class RamlResource extends YamlMapping {
/** Get the method for this resource with the given verb. */
RamlMethod getMethod(string verb) {
verb = httpVerb() and
result = lookup(verb)
result = this.lookup(verb)
}
}
/** A RAML method specification. */
class RamlMethod extends YamlValue {
RamlMethod() {
getDocument() instanceof RamlSpec and
this.getDocument() instanceof RamlSpec and
exists(YamlMapping obj | this = obj.lookup(httpVerb()))
}