Python: Enable implicit this warnings

This commit is contained in:
Kasper Svendsen
2023-05-04 07:54:30 +02:00
parent 0b2f5609d6
commit d9f29a85d6
6 changed files with 7 additions and 4 deletions

View File

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

View File

@@ -9,3 +9,4 @@ dependencies:
suites: codeql-suites
extractor: python
defaultSuiteFile: codeql-suites/python-code-scanning.qls
warnOnImplicitThis: true

View File

@@ -297,7 +297,7 @@ class HttpServerHttpResponseTest extends InlineExpectationsTest {
location.getFile() = file and
exists(file.getRelativePath()) and
// we need to do this step since we expect subclasses could override getARelevantTag
tag = getARelevantTag() and
tag = this.getARelevantTag() and
(
exists(Http::Server::HttpResponse response |
location = response.getLocation() and

View File

@@ -13,12 +13,12 @@ class ApiUseTest extends InlineExpectationsTest {
}
override predicate hasActualResult(Location location, string element, string tag, string value) {
exists(DataFlow::Node n | relevant_node(_, n, location) |
exists(DataFlow::Node n | this.relevant_node(_, n, location) |
tag = "use" and
// Only report the longest path on this line:
value =
max(API::Node a2, Location l2 |
relevant_node(a2, _, l2) and
this.relevant_node(a2, _, l2) and
l2.getFile() = location.getFile() and
l2.getStartLine() = location.getStartLine()
|

View File

@@ -5,3 +5,4 @@ dependencies:
codeql/python-queries: ${workspace}
extractor: python
tests: .
warnOnImplicitThis: true

View File

@@ -14,7 +14,7 @@ class ModificationOfParameterWithDefaultTest extends InlineExpectationsTest {
}
override predicate hasActualResult(Location location, string element, string tag, string value) {
exists(DataFlow::Node n | relevant_node(n) |
exists(DataFlow::Node n | this.relevant_node(n) |
n.getLocation() = location and
tag = "modification" and
value = prettyNode(n) and