From d9f29a85d618e18afee39a519527b2e9025dfe58 Mon Sep 17 00:00:00 2001 From: Kasper Svendsen Date: Thu, 4 May 2023 07:54:30 +0200 Subject: [PATCH] Python: Enable implicit this warnings --- python/ql/lib/qlpack.yml | 1 + python/ql/src/qlpack.yml | 1 + python/ql/test/experimental/meta/ConceptsTest.qll | 2 +- python/ql/test/library-tests/ApiGraphs/py2/use.ql | 4 ++-- python/ql/test/qlpack.yml | 1 + .../Functions/ModificationOfParameterWithDefault/test.ql | 2 +- 6 files changed, 7 insertions(+), 4 deletions(-) diff --git a/python/ql/lib/qlpack.yml b/python/ql/lib/qlpack.yml index 3b9cd5960cb2..9948ffa5d7fd 100644 --- a/python/ql/lib/qlpack.yml +++ b/python/ql/lib/qlpack.yml @@ -12,3 +12,4 @@ dependencies: codeql/yaml: ${workspace} dataExtensions: - semmle/python/frameworks/**/model.yml +warnOnImplicitThis: true diff --git a/python/ql/src/qlpack.yml b/python/ql/src/qlpack.yml index 341109d6fa3c..0d2839ec410a 100644 --- a/python/ql/src/qlpack.yml +++ b/python/ql/src/qlpack.yml @@ -9,3 +9,4 @@ dependencies: suites: codeql-suites extractor: python defaultSuiteFile: codeql-suites/python-code-scanning.qls +warnOnImplicitThis: true diff --git a/python/ql/test/experimental/meta/ConceptsTest.qll b/python/ql/test/experimental/meta/ConceptsTest.qll index 9690b7b1497d..3f76315e8b10 100644 --- a/python/ql/test/experimental/meta/ConceptsTest.qll +++ b/python/ql/test/experimental/meta/ConceptsTest.qll @@ -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 diff --git a/python/ql/test/library-tests/ApiGraphs/py2/use.ql b/python/ql/test/library-tests/ApiGraphs/py2/use.ql index cad950524e11..7a4301a14fb1 100644 --- a/python/ql/test/library-tests/ApiGraphs/py2/use.ql +++ b/python/ql/test/library-tests/ApiGraphs/py2/use.ql @@ -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() | diff --git a/python/ql/test/qlpack.yml b/python/ql/test/qlpack.yml index 17f3d2cc551a..66c1cf16a8ae 100644 --- a/python/ql/test/qlpack.yml +++ b/python/ql/test/qlpack.yml @@ -5,3 +5,4 @@ dependencies: codeql/python-queries: ${workspace} extractor: python tests: . +warnOnImplicitThis: true diff --git a/python/ql/test/query-tests/Functions/ModificationOfParameterWithDefault/test.ql b/python/ql/test/query-tests/Functions/ModificationOfParameterWithDefault/test.ql index de516c7ec9ba..3e4853b7b205 100644 --- a/python/ql/test/query-tests/Functions/ModificationOfParameterWithDefault/test.ql +++ b/python/ql/test/query-tests/Functions/ModificationOfParameterWithDefault/test.ql @@ -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