Skip to content

Functions with many parameters (8 or more) ​

Code longer than it needs to be: one of the ways AI coding agents bloat software, from lessloc's pattern catalog. lessloc catches it as long-params.

What makes functions with many parameters (8 or more) a bad practice? ​

The standards that call it a bad practice: CWE-1064 (ISO/IEC 5055 maintainability); Sonar S107; Clean Code F1 Too Many Arguments.

What does lessloc do about functions with many parameters (8 or more)? ​

lessloc catches it as long-params.

  • long-params (tier 2): A new function with 8 or more parameters.

Examples ​

Caught as long-params:

python
def make_order(a, b, c, d, e, f, g, h):
    return a

Written well:

python
def make_order(spec):
    return spec

The other patterns in Code longer than it needs to be:

Released under the Apache-2.0 license. · llms.txt