Expand Minimize

Consider refactoring, too many parameters in function definition, maximum 3

Either use a monadic pattern to only ever use a single object, or refactor the method to reduce parameters, to a maximum of 3 in order to ease readability, and reduce code complexity.

CheckId SPC218902
TypeName LimitMaximumNumberParameters
Severity Information
Type JavaScriptFile

Bad Practice

function fooTotal(a, b, c, d, e, f, g) {
  return a + b + c + d + e + f + g;

Good Practice
function fooTotal(values) {
  if(Object.prototype.toString.call(values) !== '[object Array]') {
      return false;
  var len = values.length,
      total = 0;
  while(len--) {
      total += values[len];  }
  return total;}

Disclaimer: The views and opinions expressed in this documentation and in SPCAF do not necessarily reflect the opinions and recommendations of Microsoft or any member of Microsoft. SPCAF and RENCORE are registered trademarks of Rencore. All other trademarks, service marks, collective marks, copyrights, registered names, and marks used or cited by this documentation are the property of their respective owners.