Adds preliminary modernization

This will overlapp with/depend on changes to CallArgs and ObjectAPI that are already in the WrongNamedArgumentInCall PR
This commit is contained in:
Rebecca Valentine
2020-02-26 21:42:52 -08:00
parent 85f5ad2231
commit 84875d70ff

View File

@@ -14,15 +14,15 @@
import python
import CallArgs
from Call call, FunctionObject func, string too, string should, int limit
from Call call, FunctionValue func, string too, string should, int limit
where
(
too_many_args_objectapi(call, func, limit) and too = "too many arguments" and should = "no more than "
too_many_args(call, func, limit) and too = "too many arguments" and should = "no more than "
or
too_few_args_objectapi(call, func, limit) and too = "too few arguments" and should = "no fewer than "
too_few_args(call, func, limit) and too = "too few arguments" and should = "no fewer than "
) and
not func.isAbstract() and
not exists(FunctionObject overridden | func.overrides(overridden) and correct_args_if_called_as_method_objectapi(call, overridden))
not exists(FunctionValue overridden | func.overrides(overridden) and correct_args_if_called_as_method(call, overridden))
/* The semantics of `__new__` can be a bit subtle, so we simply exclude `__new__` methods */
and not func.getName() = "__new__"