Skip to content

Commit 2c32a85

Browse files
committed
Swaps illegally_named_parameter globally
1 parent 4857a94 commit 2c32a85

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

python/ql/src/Classes/WrongNameForArgumentInClassInstantiation.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import Expressions.CallArgs
2020

2121
from Call call, ClassObject cls, string name, FunctionObject init
2222
where
23-
illegally_named_parameter(call, cls, name)
23+
illegally_named_parameter_objectapi(call, cls, name)
2424
and init = get_function_or_initializer_objectapi(cls)
2525
select
2626
call, "Keyword argument '" + name + "' is not a supported parameter name of $@.", init, init.getQualifiedName()

python/ql/src/Expressions/CallArgs.qll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ FunctionObject get_function_or_initializer_objectapi(Object func_or_cls) {
6060

6161

6262
/**Whether there is an illegally named parameter called `name` in the `call` to `func` */
63-
predicate illegally_named_parameter(Call call, Object func, string name) {
63+
predicate illegally_named_parameter_objectapi(Call call, Object func, string name) {
6464
not func.isC() and
6565
name = call.getANamedArgumentName() and
6666
call.getAFlowNode() = get_a_call_objectapi(func) and
@@ -70,7 +70,7 @@ predicate illegally_named_parameter(Call call, Object func, string name) {
7070
/**Whether there are too few arguments in the `call` to `callable` where `limit` is the lowest number of legal arguments */
7171
predicate too_few_args(Call call, Object callable, int limit) {
7272
// Exclude cases where an incorrect name is used as that is covered by 'Wrong name for an argument in a call'
73-
not illegally_named_parameter(call, callable, _) and
73+
not illegally_named_parameter_objectapi(call, callable, _) and
7474
not exists(call.getStarargs()) and not exists(call.getKwargs()) and
7575
arg_count_objectapi(call) < limit and
7676
exists(FunctionObject func | func = get_function_or_initializer_objectapi(callable) |
@@ -91,7 +91,7 @@ predicate too_few_args(Call call, Object callable, int limit) {
9191
/**Whether there are too many arguments in the `call` to `func` where `limit` is the highest number of legal arguments */
9292
predicate too_many_args(Call call, Object callable, int limit) {
9393
// Exclude cases where an incorrect name is used as that is covered by 'Wrong name for an argument in a call'
94-
not illegally_named_parameter(call, callable, _) and
94+
not illegally_named_parameter_objectapi(call, callable, _) and
9595
exists(FunctionObject func |
9696
func = get_function_or_initializer_objectapi(callable) and
9797
not func.getFunction().hasVarArg() and limit >= 0

python/ql/src/Expressions/WrongNameForArgumentInCall.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import Expressions.CallArgs
1919

2020
from Call call, FunctionObject func, string name
2121
where
22-
illegally_named_parameter(call, func, name) and
22+
illegally_named_parameter_objectapi(call, func, name) and
2323
not func.isAbstract() and
2424
not exists(FunctionObject overridden | func.overrides(overridden) and overridden.getFunction().getAnArg().(Name).getId() = name)
2525
select

python/ql/src/Functions/IncorrectlyOverriddenMethod.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ func.overrides(overridden) and (
1818
wrong_args(call, func, _, problem) and correct_args_if_called_as_method(call, overridden)
1919
or
2020
exists(string name |
21-
illegally_named_parameter(call, func, name) and problem = "an argument named '" + name + "'" and
21+
illegally_named_parameter_objectapi(call, func, name) and problem = "an argument named '" + name + "'" and
2222
overridden.getFunction().getAnArg().(Name).getId() = name
2323
)
2424
)

0 commit comments

Comments
 (0)