@@ -154,17 +154,21 @@ predicate too_few_args(Call call, Value callable, int limit) {
154154 not exists ( call .getKwargs ( ) ) and
155155 arg_count ( call ) < limit and
156156 exists ( FunctionValue func | func = get_function_or_initializer ( callable ) |
157- call = func .getAFunctionCall ( ) .getNode ( ) and limit = func .minParameters ( ) and
158- /* The combination of misuse of `mox.Mox().StubOutWithMock()`
159- * and a bug in mox's implementation of methods results in having to
160- * pass 1 too few arguments to the mocked function.
161- */
162- not ( useOfMoxInModule ( call .getEnclosingModule ( ) ) and func .isNormalMethod ( ) )
163- or
164- call = func .getAMethodCall ( ) .getNode ( ) and limit = func .minParameters ( ) - 1
165- or
166- callable instanceof ClassValue and
167- call .getAFlowNode ( ) = get_a_call ( callable ) and limit = func .minParameters ( ) - 1
157+ call = func .getAFunctionCall ( ) .getNode ( ) and
158+ limit = func .minParameters ( ) and
159+ /*
160+ * The combination of misuse of `mox.Mox().StubOutWithMock()`
161+ * and a bug in mox's implementation of methods results in having to
162+ * pass 1 too few arguments to the mocked function.
163+ */
164+
165+ not ( useOfMoxInModule ( call .getEnclosingModule ( ) ) and func .isNormalMethod ( ) )
166+ or
167+ call = func .getAMethodCall ( ) .getNode ( ) and limit = func .minParameters ( ) - 1
168+ or
169+ callable instanceof ClassValue and
170+ call .getAFlowNode ( ) = get_a_call ( callable ) and
171+ limit = func .minParameters ( ) - 1
168172 )
169173}
170174
@@ -192,14 +196,15 @@ predicate too_many_args_objectapi(Call call, Object callable, int limit) {
192196predicate too_many_args ( Call call , Value callable , int limit ) {
193197 // Exclude cases where an incorrect name is used as that is covered by 'Wrong name for an argument in a call'
194198 not illegally_named_parameter ( call , callable , _) and
195- exists ( FunctionValue func |
196- func = get_function_or_initializer ( callable ) and
197- not func .getScope ( ) .hasVarArg ( ) and limit >= 0
198- |
199+ exists ( FunctionValue func |
200+ func = get_function_or_initializer ( callable ) and
201+ not func .getScope ( ) .hasVarArg ( ) and
202+ limit >= 0
203+ |
199204 call = func .getAFunctionCall ( ) .getNode ( ) and limit = func .maxParameters ( )
200- or
205+ or
201206 call = func .getAMethodCall ( ) .getNode ( ) and limit = func .maxParameters ( ) - 1
202- or
207+ or
203208 callable instanceof ClassValue and
204209 call .getAFlowNode ( ) = get_a_call ( callable ) and
205210 limit = func .maxParameters ( ) - 1
0 commit comments