Taus
bf688b88a9
Python: Add missing special methods
2025-03-14 16:29:54 +00:00
Taus
f3353dc3fb
Python: Ignore special methods with placeholder bodies
...
Instances of this include
- Bodies that contain just a docstring (common in Zope interfaces)
- Bodies that do nothing but raise an exception.
2025-03-13 12:18:43 +00:00
Taus
862b89207d
Python: Disable "usused default" logic
...
Adds a new boolean parameter `is_unused_default` that indicates whether
the given result is one where a parameter to a special method has a
default value (which will never be used when invoked in the normal way).
These results are somewhat less useful (because the special method
_might_ be invoked directly, in which case the default value would still
be relevant), but it seemed like a shame to simply remove the code, so
instead I opted to disable it in this way.
2025-03-13 12:18:43 +00:00
Taus
24b2eb24c1
Python: Refactor special method query
...
Moves a bunch of `owner.declaredAttribute(name) = f` instances to the
top level, in the process greatly cleaning up the code. The behaviour
should be the unchanged.
Having done this, there's only one place where we depend on points-to,
and that's in the remaining `declaredAttribute` call. This should
greatly simplify the move away from points to.
2025-03-13 12:18:43 +00:00
Joe Farebrother
f46a2a1773
Exclude some decorators
2025-02-12 09:40:45 +00:00
Joe Farebrother
61d5a692fb
Refactor metaclass logic a bit, ensure lambdas are excluded
2025-02-07 21:46:30 +00:00
Joe Farebrother
287cf0121d
Fix docs
2025-02-04 15:28:13 +00:00
Joe Farebrother
3802a73f47
Update docs
2025-02-04 14:46:02 +00:00
Joe Farebrother
e8adef18a3
Update to inline expectations + fixes
2025-02-04 14:45:59 +00:00
Joe Farebrother
0bf8d4ec4b
Exclude 'methods' used in initialisation, and allow self for metaclass methods
2025-02-04 14:45:52 +00:00
Joe Farebrother
fa76bf3c9f
Fix formatting and rewrite redundant exists
2025-02-04 14:45:48 +00:00
Joe Farebrother
526e235fc1
Update NonSelf and NonCls queries
2025-02-04 14:45:44 +00:00
Rasmus Wriedt Larsen
ce6335866b
Python: Move ModificationOfParameterWithDefault to new dataflow API
2023-08-28 16:19:47 +02:00
erik-krogh
944ca4a0da
fix some more style-guide violations in the alert-messages
2022-10-07 11:23:34 +02:00
erik-krogh
0de0325c8e
change the alert-message for py/modification-of-default-value
2022-09-05 13:30:56 +02:00
erik-krogh
089ce5a8a4
change alert messages of path queries to use the same template
2022-09-02 14:45:40 +02:00
Erik Krogh Kristensen
a3c55c2aec
use set literal instead of big disjunction of literals
2021-10-26 12:55:25 +02:00
Surya Prakash Sahu
2871bdb206
Python SignatureOverriddenMethod: Rmv duplicate condition
2021-10-17 18:04:20 +05:30
Mathias Vorreiter Pedersen
bdc54bcda7
Python: Replace 'if p() then q() else none()' with a conjunction.
2021-10-13 12:13:55 +01:00
Rasmus Lerchedahl Petersen
e865a290de
Python: straight port of query
...
The old query uses `pointsTo` to limit the sinks
to methods on lists and dictionaries.
That constraint is omitted here which could hurt performance.
2021-08-24 16:35:11 +02:00
Ian Lynagh
f0bec74ce3
python: Correct the ReturnValueIgnored.qhelp docs
2021-05-26 17:40:57 +01:00
Chris Smowton
455b840712
Fix all dead qhelp links
...
For those documents with no obvious new home I've pointed the links to the Internet Archive.
2021-04-23 15:20:21 +01:00
Rasmus Wriedt Larsen
3fe715abb6
Python: Fix query names that inclde __ (dunder)
...
Without backticks, the text UNDERSCORE UNDERSCORE eq UNDERSCORE UNDERSCORE would
be considered to make things bold in our markdown output, making the query info
look strange.
Example https://codeql.github.com/codeql-query-help/python/py-slots-in-old-style-class/
2021-02-04 15:49:37 +01:00
Taus Brock-Nannestad
f07a7bf8cf
Python: Autoformat everything using qlformat.
...
Will need subsequent PRs fixing up test failures (due to deprecated
methods moving around), but other than that everything should be
straight-forward.
2020-07-07 15:43:52 +02:00
Rasmus Wriedt Larsen
d5895c16c8
Python: Changing signature in overriden method is not an error
...
Rather, fulfiling the Liskov substitution principle is an opinionated
recommendation. Looking at `py/inheritance/incorrect-overridden-signature` and
`py/mixed-tuple-returns`, it seems very appropriate that this should have
`@severity recommendation`, and `@sub-severity high`.
2020-06-22 16:58:52 +02:00
Rasmus Lerchedahl Petersen
1817d2af2b
Make test for wrong bool type pass
2020-05-14 15:56:57 +02:00
Rasmus Lerchedahl Petersen
d9d86e1f56
Make test pass
2020-05-13 12:16:11 +02:00
Rasmus Wriedt Larsen
4da5222255
Python: More safe methods for py/modification-of-default-value
...
Fixes https://github.com/github/codeql/issues/3397
2020-05-05 11:09:05 +02:00
Rebecca Valentine
9cd2171fb8
Merge branch 'master' into python-objectapi-to-valueapi-incorrectlyoverridenmethod
2020-04-22 09:40:33 -07:00
Taus
8402e6a2e1
Merge pull request #3243 from BekaValentine/python-objectapi-to-valueapi-incorrectlyspecifiedoverriddenmethod
...
Python: ObjectAPI to ValueAPI: IncorrectlySpecifiedOverriddenMethod
2020-04-14 18:55:42 +02:00
Taus
3e46604fa5
Merge pull request #3223 from BekaValentine/python-objectapi-to-valueapi-iterreturnsnoniterator
...
Python: ObjectAPI to ValueAPI: IterReturnsNonIterator
2020-04-14 12:55:21 +02:00
Rebecca Valentine
336e48c5c6
Python: ObjectAPI to ValueAPI: IncorrectlySpecifiedOverriddenMethod: Adds preliminary modernization
2020-04-09 14:50:26 -07:00
Rebecca Valentine
be00d71b99
Python: ObjectAPI to ValueAPI: IncorrectlyOverriddenMethod: Adds preliminary modernization
2020-04-09 14:41:22 -07:00
Rebecca Valentine
7a586c97a4
Python: ObjectAPI to ValueAPI: IterReturnsNonIterature: Replaces custom return_type predicate with call to getAnInferredReturnType
2020-04-09 14:30:40 -07:00
Rebecca Valentine
c2443f2342
Python: ObjectAPI to ValueAPI: OverlyComplexDelMethod: Adds preliminary modernization
2020-04-07 21:31:35 -07:00
Rebecca Valentine
0d65db148f
Python: ObjectAPI to ValueAPI: IterReturnsNonIterator: Adds preliminary modernization
2020-04-07 21:14:25 -07:00
Rebecca Valentine
712fb8badc
Python: ObjectAPI to ValueAPI: IterReturnsNonSelf: Autoformats
2020-04-02 09:19:41 -07:00
Rebecca Valentine
cdda80623d
Merge branch 'master' into python-objectapi-to-valueapi-iterreturnsnonself
2020-04-02 09:16:23 -07:00
Taus
d540bf6ce5
Merge pull request #3039 from BekaValentine/python-objectapi-to-valueapi-returnvalueignored
...
Python: ObjectAPI to ValueAPI: ReturnValueIgnored
2020-04-02 11:42:01 +02:00
Rebecca Valentine
cc53b15a5d
Python: ObjectAPI to ValueAPI: ReturnValueIgnored: Reorganizes predicates
2020-04-01 14:41:49 -07:00
Rebecca Valentine
09349f1957
Python: ObjectAPI to ValueAPI: ReturnValueIgnored: Autoformats
2020-04-01 12:54:42 -07:00
Rebecca Valentine
28319ee0f7
Python: ObjectAPI to ValueAPI: SignatureOverriddenMethod: Autoformats
2020-04-01 12:32:21 -07:00
Rebecca Valentine
838e37ca98
Python: ObjectAPI to ValueAPI: ReturnValueIgnore: Moves getAnInferredType to CallableObjectInternal
2020-04-01 08:45:27 -07:00
Rebecca Valentine
97b4077162
Merge branch 'master' into python-objectapi-to-valueapi-signatureoverriddenmethod
2020-04-01 07:42:10 -07:00
Rebecca Valentine
12377badf9
Merge branch 'master' into python-objectapi-to-valueapi-returnvalueignored
2020-04-01 07:37:17 -07:00
Rebecca Valentine
eb4a567a34
Merge branch 'master' into python-objectapi-to-valueapi-signatureoverriddenmethod
2020-03-31 23:36:15 -07:00
Rebecca Valentine
42388b0d97
Python: ObjectAPI to ValueAPI: ReturnValueIgnored: Adds prototype version of getAnInferredReturnType
2020-03-31 22:11:58 -07:00
Taus Brock-Nannestad
87a9f51c78
Python: Autoformat all .ql files.
2020-03-30 11:59:10 +02:00
Rebecca Valentine
160f6cbc15
Python: Adds preliminary modernization
2020-03-10 08:51:20 -07:00
Rebecca Valentine
b36214ae47
Python: Modernizes query and updates expecteds
2020-03-10 08:33:29 -07:00