Skip to content

Commit ef9b229

Browse files
committed
Python: Actually get rid of points-to
Also adds `quality` to the list of tags for the query.
1 parent c9e9deb commit ef9b229

File tree

2 files changed

+17
-18
lines changed

2 files changed

+17
-18
lines changed

python/ql/src/Functions/SignatureSpecialMethods.ql

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* @kind problem
55
* @tags reliability
66
* correctness
7+
* quality
78
* @problem.severity error
89
* @sub-severity low
910
* @precision high
@@ -188,29 +189,27 @@ predicate isLikelyPlaceholderFunction(Function f) {
188189
}
189190

190191
from
191-
PythonFunctionValue f, string message, string sizes, boolean show_counts, string name,
192-
ClassValue owner, boolean show_unused_defaults
192+
Function f, string message, string sizes, boolean show_counts, string name, Class owner,
193+
boolean show_unused_defaults
193194
where
194-
owner.getScope().getAMethod() = f.getScope() and
195-
f.getScope().getName() = name and
195+
owner.getAMethod() = f and
196+
f.getName() = name and
196197
(
197-
incorrect_special_method_defn(f.getScope(), message, show_counts, name, show_unused_defaults)
198+
incorrect_special_method_defn(f, message, show_counts, name, show_unused_defaults)
198199
or
199-
incorrect_pow(f.getScope(), message, show_counts, show_unused_defaults) and name = "__pow__"
200+
incorrect_pow(f, message, show_counts, show_unused_defaults) and name = "__pow__"
200201
or
201-
incorrect_get(f.getScope(), message, show_counts, show_unused_defaults) and name = "__get__"
202+
incorrect_get(f, message, show_counts, show_unused_defaults) and name = "__get__"
202203
or
203-
incorrect_round(f.getScope(), message, show_counts, show_unused_defaults) and
204+
incorrect_round(f, message, show_counts, show_unused_defaults) and
204205
name = "__round__"
205206
) and
206-
not isLikelyPlaceholderFunction(f.getScope()) and
207+
not isLikelyPlaceholderFunction(f) and
207208
show_unused_defaults = false and
208209
(
209210
show_counts = false and sizes = ""
210211
or
211212
show_counts = true and
212-
sizes =
213-
", which has " + has_parameters(f.getScope()) + ", but should have " +
214-
should_have_parameters(name)
213+
sizes = ", which has " + has_parameters(f) + ", but should have " + should_have_parameters(name)
215214
)
216215
select f, message + " for special method " + name + sizes + ", in class $@.", owner, owner.getName()
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
| 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 |
2-
| 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 |
3-
| 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 |
4-
| 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 |
5-
| 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 |
6-
| 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 |
1+
| 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 |
2+
| 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 |
3+
| 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 |
4+
| 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 |
5+
| 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 |
6+
| 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 |

0 commit comments

Comments
 (0)