52 lines
2.2 KiB
Plaintext
52 lines
2.2 KiB
Plaintext
=== on 29 Apr 2015, 08:02:51 Ann Campbell wrote:
|
|
See JSC_WRONG_ARGUMENT_COUNT at \https://developers.google.com/closure/compiler/docs/error-ref
|
|
|
|
=== on 29 Apr 2015, 08:54:10 Linda Martin wrote:
|
|
\[~ann.campbell.2] I would say "[...] doing so *could* lead to unexpected results.", because it could be expected that not all arguments will be given because some are optionals and the body function will check it.
|
|
|
|
|
|
Also what do you think about adding an exception when ``++arguments++`` is used in the body of the function ?
|
|
|
|
E.g
|
|
|
|
----
|
|
function f(a, b, c, d) {
|
|
for (var i = 0; i < arguments.length; i++) {
|
|
doSomethingWith(arguments[i]);
|
|
}
|
|
}
|
|
----
|
|
|
|
|
|
=== on 29 Apr 2015, 12:43:03 Ann Campbell wrote:
|
|
I've changed the wording from 'will' to 'could', but I'm against your proposed exception: it requires the author of the call to examine the code of the method being called, which is just not something you should have to do.
|
|
|
|
=== on 20 May 2015, 07:09:36 Linda Martin wrote:
|
|
\[~ann.campbell.2] not necessarily, documentation exists exactly for this kind of cases.
|
|
|
|
=== on 20 May 2015, 17:40:29 Ann Campbell wrote:
|
|
So can we narrow the exception, [~linda.martin] to: function is documented (there's a comment immediately before it) AND arguments is used in the body?
|
|
|
|
=== on 2 Jun 2015, 14:29:00 Stas Vilchik wrote:
|
|
What to do with optional parameters? Just check the several first functions from http://underscorejs.org/[underscore.js].
|
|
|
|
=== on 2 Jun 2015, 15:27:09 Ann Campbell wrote:
|
|
Per discussion with [~elena.vilchik], the too few args case is ignored by this rule.
|
|
|
|
=== on 2 Jun 2015, 15:58:04 Linda Martin wrote:
|
|
\[~ann.campbell.2] So no explicit mention of the "exception" in the rule description ?
|
|
|
|
=== on 2 Jun 2015, 16:32:47 Elena Vilchik wrote:
|
|
\[~ann.campbell.2] I've updated description. Assigned to you for validation. CC [~linda.martin]
|
|
|
|
=== on 3 Jun 2015, 14:39:11 Ann Campbell wrote:
|
|
IMO [~linda.martin] no explicit mention needed of ignoring too few args since specialized title narrows the scope.
|
|
|
|
=== on 4 Jun 2015, 07:47:09 Linda Martin wrote:
|
|
OK!
|
|
|
|
=== on 8 Jun 2015, 11:18:27 Elena Vilchik wrote:
|
|
We need to activate this subtask by default (\http://jira.sonarsource.com/browse/RULEAPI-243). Implementation already updated.
|
|
|
|
include::../comments-and-links.adoc[]
|