Commit Graph

9349 Commits

Author SHA1 Message Date
Joe Farebrother
7a7db0efe8 Update unsupported format character documentaion, fix outdated reference link 2025-07-15 10:42:25 +01:00
Joe Farebrother
df5f76872f Update docs for duplicate-key-in-dict-literal to relate. to python 3 2025-07-15 10:18:29 +01:00
Taus
c6c6a857df Python: Add tests
Also fixes an issue with the return type annotations that caused these
to not work properly.

Currently, annotated assignments don't work properly, due to the fact
that our flow relation doesn't consider flow going to the "type" part of
an annotated assignment. This means that in `x : Foo`, we do correctly
note that `x` is annotated with `Foo`, but we have no idea what `Foo`
is, since it has no incoming flow.

To fix this we should probably just extend the flow relation, but this
may need to be done with some care, so I have left it as future work.
2025-07-11 12:03:14 +00:00
Taus
2c45550a9f Python: Add change note
Co-authored-by: Napalys Klicius <napalys@github.com>
2025-07-11 12:03:14 +00:00
Taus
d1cf7f0624 Python: Support type annotations in call graph
Adds support for tracking instances via type annotations. Also adds a
convenience method to the newly added `Annotation` class,
`getAnnotatedExpression`, that returns the expression that is annotated
with the given type. For return annotations this is any value returned
from the annotated function in question.

Co-authored-by: Napalys Klicius <napalys@github.com>
2025-07-11 12:03:14 +00:00
Jonas Jensen
5a1246a586 Merge remote-tracking branch 'upstream/main' into approximate-related-location 2025-07-09 10:10:20 +02:00
github-actions[bot]
24a0ac1223 Post-release preparation for codeql-cli-2.22.2 2025-07-07 18:15:04 +00:00
github-actions[bot]
f12daefabe Release preparation for version 2.22.2 2025-07-07 14:00:26 +00:00
Asger F
4a2d795076 Shared: Make approximate location filtering the default behaviour 2025-07-02 14:41:02 +02:00
Asger F
a46b5f9529 Python: enable diff-informedness for poly redos using approximate related locations 2025-07-02 14:39:42 +02:00
Michael Nebel
233b54c7fa Merge pull request #19891 from michaelnebel/michaelnebel/freezemoresuites
Go/Ruby/Python: Freeze quality queries in `security-and-quality`.
2025-07-01 09:04:19 +02:00
Taus
184dd5bf10 Merge pull request #19895 from github/tausbn/python-fix-match-as-identifier
Python: Allow use of `match` as an identifier
2025-06-30 16:24:23 +02:00
Kasper Svendsen
da1b99b921 Merge pull request #19779 from github/kaspersv/overlay-java-annotations
Overlay: Add overlay annotations to Java & shared libraries
2025-06-27 08:26:33 +02:00
Joe Farebrother
4cbaeb10e9 Merge pull request #19641 from joefarebrother/python-qual-file-not-closed
Python: Improve performance of FileNotClosed query by using basic block reachability
2025-06-26 23:35:38 +01:00
Taus
cd0e46314c Python: Add change note 2025-06-26 15:36:02 +00:00
Taus
ad53518644 Python: Regenerate parser files 2025-06-26 15:34:44 +00:00
Taus
e04821e9e3 Python: Allow use of match as an identifier
This previously only worked in certain circumstances. In particular,
assignments such as `match[1] = ...` or even just `match[1]` would fail
to parse correctly.

Fixing this turned out to be less trivial than anticipated. Consider the
fact that
```
match [1]: case (...)
```
can either look the start of a `match` statement, or it could be a type
ascription, ascribing the value of `case(...)` (a call) to the item at
index 1 of `match`.

To fix this, then, we give `match` the identifier and `match` the
statement the same precendence in the grammar, and additionally also
mark a conflict between `match_statement` and `primary_expression`. This
causes the conflict to be resolved dynamically, and seems to do the
right thing in all cases.
2025-06-26 15:33:00 +00:00
Michael Nebel
37b3ca036a Python: Freeze the quality queries in the security-and-quality suite. 2025-06-26 14:45:05 +02:00
Kasper Svendsen
9d2dd782d9 Merge remote-tracking branch 'github/main' into kaspersv/overlay-java-annotations 2025-06-26 13:18:25 +02:00
github-actions[bot]
6972c7a872 Post-release preparation for codeql-cli-2.22.1 2025-06-24 12:55:14 +00:00
github-actions[bot]
3e074b2425 Release preparation for version 2.22.1 2025-06-24 08:55:31 +00:00
Kasper Svendsen
2da8d61984 Run config/sync-files.py 2025-06-24 10:25:06 +02:00
Joe Farebrother
f457453647 Update redundant assignment to be a correctness issue for cross language consistency 2025-06-19 14:22:12 +01:00
Joe Farebrother
e67f057b85 Update integration test output 2025-06-19 14:09:55 +01:00
Joe Farebrother
63d7eac127 Ensure exactly one subcategory is used 2025-06-19 14:09:07 +01:00
Joe Farebrother
c8c92a7139 Update tags for mixed-tuple-returns to include exactly 1 subcategory 2025-06-19 14:09:00 +01:00
Joe Farebrother
c3f7b18055 Review suggestions - update some tags 2025-06-19 14:08:51 +01:00
Joe Farebrother
09516a47d3 Fix integration test output 2025-06-19 14:08:42 +01:00
Joe Farebrother
d28a19c961 Update integration test output & add changenote 2025-06-19 14:08:30 +01:00
Joe Farebrother
fa5b2ef794 Tag remaining high precision quality queries
Excluded queries that are python 2 specific; as well as the cyclic import queries
2025-06-19 14:08:07 +01:00
Joe Farebrother
02f8ec33f2 Tag 'type-checking'-like quality queries 2025-06-19 14:07:55 +01:00
Joe Farebrother
4b1d31c976 Tag 'linter-like' quality queries that don't use pointsto 2025-06-19 14:07:42 +01:00
Joe Farebrother
869e33e38c Tag 'linter-like' quality queries that use pointto
Excluded for now: unnecassary-delete; since the pattern is often intentional to break reference cycles, which the query doesn't account for; so uncertain about its claim of high precision
2025-06-19 14:07:15 +01:00
Joe Farebrother
5c4548df45 Tag more quality queries.
Excluded for now for uncertainty: incomplete ordering, import deprecated module
2025-06-19 14:06:57 +01:00
Joe Farebrother
049c0705a9 Tag quality queries that are high precision and dont use pointsto 2025-06-19 14:06:46 +01:00
Jeroen Ketema
dd1c09769f Python: Fix integration test 2025-06-19 13:36:57 +02:00
Nora Dimitrijević
438b92b995 Merge pull request #19797 from d10c/d10c/python/diff-informed-2
Python: mass enable diff-informed data flow `none()` location overrides
2025-06-19 10:55:07 +02:00
Joe Farebrother
4ae72dbad6 Merge pull request #19709 from joefarebrother/python-qual-init-call-subclass
Python: Modernize the init-calls-subclass query
2025-06-18 14:21:25 +01:00
Tamas Vajk
e6a9ff08a3 Adjust query-suite integration test expected files 2025-06-18 13:10:34 +02:00
Tamas Vajk
40274dcd69 Add code-quality-extended query suites 2025-06-18 13:10:34 +02:00
Nora Dimitrijević
b79ce6d30b Python: mass enable diff-informed data flow none() location overrides
An auto-generated patch that enables diff-informed data flow in the obvious cases.

Builds on github#18346 and github/codeql-patch#88
2025-06-17 15:36:52 +02:00
Joe Farebrother
d1bd7228c3 Fix typos 2025-06-17 13:58:30 +01:00
Joe Farebrother
547c03cee6 Update tests 2025-06-17 13:58:27 +01:00
Joe Farebrother
2c8896848f Update integration test output 2025-06-17 13:58:22 +01:00
Joe Farebrother
22a6fa3ebf Remove case for being last in initialisation. This pattern can still be a problem if the subclass overrides initialisation. 2025-06-17 13:57:36 +01:00
Joe Farebrother
95153c172c Add some more details to the documentation 2025-06-17 13:57:30 +01:00
Joe Farebrother
90bf45a3ba Fix docs 2025-06-17 13:57:23 +01:00
Joe Farebrother
75bb743ce3 Update documentation 2025-06-17 13:57:18 +01:00
Joe Farebrother
a04fbc59f5 Update tests 2025-06-17 13:57:10 +01:00
Joe Farebrother
f3ce57840d Filter out some results; for if the overridden method doesn't use self, or the call is last in the initialisation. 2025-06-17 13:57:04 +01:00