mirror of
https://github.com/github/codeql.git
synced 2026-04-26 17:25:19 +02:00
Python: Actually get rid of points-to
Also adds `quality` to the list of tags for the query.
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
* @kind problem
|
||||
* @tags reliability
|
||||
* correctness
|
||||
* quality
|
||||
* @problem.severity error
|
||||
* @sub-severity low
|
||||
* @precision high
|
||||
@@ -188,29 +189,27 @@ predicate isLikelyPlaceholderFunction(Function f) {
|
||||
}
|
||||
|
||||
from
|
||||
PythonFunctionValue f, string message, string sizes, boolean show_counts, string name,
|
||||
ClassValue owner, boolean show_unused_defaults
|
||||
Function f, string message, string sizes, boolean show_counts, string name, Class owner,
|
||||
boolean show_unused_defaults
|
||||
where
|
||||
owner.getScope().getAMethod() = f.getScope() and
|
||||
f.getScope().getName() = name and
|
||||
owner.getAMethod() = f and
|
||||
f.getName() = name and
|
||||
(
|
||||
incorrect_special_method_defn(f.getScope(), message, show_counts, name, show_unused_defaults)
|
||||
incorrect_special_method_defn(f, message, show_counts, name, show_unused_defaults)
|
||||
or
|
||||
incorrect_pow(f.getScope(), message, show_counts, show_unused_defaults) and name = "__pow__"
|
||||
incorrect_pow(f, message, show_counts, show_unused_defaults) and name = "__pow__"
|
||||
or
|
||||
incorrect_get(f.getScope(), message, show_counts, show_unused_defaults) and name = "__get__"
|
||||
incorrect_get(f, message, show_counts, show_unused_defaults) and name = "__get__"
|
||||
or
|
||||
incorrect_round(f.getScope(), message, show_counts, show_unused_defaults) and
|
||||
incorrect_round(f, message, show_counts, show_unused_defaults) and
|
||||
name = "__round__"
|
||||
) and
|
||||
not isLikelyPlaceholderFunction(f.getScope()) and
|
||||
not isLikelyPlaceholderFunction(f) and
|
||||
show_unused_defaults = false and
|
||||
(
|
||||
show_counts = false and sizes = ""
|
||||
or
|
||||
show_counts = true and
|
||||
sizes =
|
||||
", which has " + has_parameters(f.getScope()) + ", but should have " +
|
||||
should_have_parameters(name)
|
||||
sizes = ", which has " + has_parameters(f) + ", but should have " + should_have_parameters(name)
|
||||
)
|
||||
select f, message + " for special method " + name + sizes + ", in class $@.", owner, owner.getName()
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
| om_test.py:59:5:59:28 | Function WrongSpecials.__div__ | Too many parameters for special method __div__, which has 3 parameters, but should have 2, in class $@. | om_test.py:57:1:57:28 | class WrongSpecials | WrongSpecials |
|
||||
| om_test.py:62:5:62:22 | Function WrongSpecials.__mul__ | Too few parameters for special method __mul__, which has 1 parameter, but should have 2, in class $@. | om_test.py:57:1:57:28 | class WrongSpecials | WrongSpecials |
|
||||
| om_test.py:65:5:65:29 | Function WrongSpecials.__neg__ | Too many parameters for special method __neg__, which has 2 parameters, but should have 1, in class $@. | om_test.py:57:1:57:28 | class WrongSpecials | WrongSpecials |
|
||||
| om_test.py:68:5:68:35 | Function WrongSpecials.__exit__ | Too few parameters for special method __exit__, which has 3 parameters, but should have 4, in class $@. | om_test.py:57:1:57:28 | class WrongSpecials | WrongSpecials |
|
||||
| om_test.py:71:5:71:19 | Function WrongSpecials.__repr__ | Too few parameters for special method __repr__, which has no parameters, but should have 1, in class $@. | om_test.py:57:1:57:28 | class WrongSpecials | WrongSpecials |
|
||||
| om_test.py:83:5:83:18 | Function OKSpecials.__del__ | Too few parameters for special method __del__, which has no parameters, but should have 1, in class $@. | om_test.py:81:1:81:25 | class OKSpecials | OKSpecials |
|
||||
| om_test.py:59:5:59:28 | Function __div__ | Too many parameters for special method __div__, which has 3 parameters, but should have 2, in class $@. | om_test.py:57:1:57:28 | Class WrongSpecials | WrongSpecials |
|
||||
| om_test.py:62:5:62:22 | Function __mul__ | Too few parameters for special method __mul__, which has 1 parameter, but should have 2, in class $@. | om_test.py:57:1:57:28 | Class WrongSpecials | WrongSpecials |
|
||||
| om_test.py:65:5:65:29 | Function __neg__ | Too many parameters for special method __neg__, which has 2 parameters, but should have 1, in class $@. | om_test.py:57:1:57:28 | Class WrongSpecials | WrongSpecials |
|
||||
| om_test.py:68:5:68:35 | Function __exit__ | Too few parameters for special method __exit__, which has 3 parameters, but should have 4, in class $@. | om_test.py:57:1:57:28 | Class WrongSpecials | WrongSpecials |
|
||||
| om_test.py:71:5:71:19 | Function __repr__ | Too few parameters for special method __repr__, which has no parameters, but should have 1, in class $@. | om_test.py:57:1:57:28 | Class WrongSpecials | WrongSpecials |
|
||||
| om_test.py:83:5:83:18 | Function __del__ | Too few parameters for special method __del__, which has no parameters, but should have 1, in class $@. | om_test.py:81:1:81:25 | Class OKSpecials | OKSpecials |
|
||||
|
||||
Reference in New Issue
Block a user