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 aWritten well:
python
def make_order(spec):
return specRelated patterns
The other patterns in Code longer than it needs to be:
- Brute-force idioms: lessloc catches it as
simpler, built in for Python, JS/TS, Go, Rust, Java and C#. ruff (in every hook) and clippy (inci) go deeper. - Hand-built counters and flag loops: lessloc catches it as
simpler. - A catch that only rethrows: lessloc catches it as
simpler. - A promise wrapped in new Promise: lessloc catches it as
simpler. - Annotating types the compiler infers: lessloc catches it as
simpler. - A React Effect that only sets state from other values: lessloc catches it as
simpler. - Deep nesting: lessloc catches it as
deep-nesting. - Long functions: lessloc catches it as
long-function. - If-chains on literal values: lessloc catches it as
if-chain. - A file that keeps growing: lessloc catches it as
swollen-file. - Reformatting lines the task did not change: lessloc gives every session a rule against it and catches it as
churn. - Net growth past a budget: lessloc catches it as
net-growth. - Golfed code: lessloc catches it as
cleveranddense-lines.

