Function has too many parameters (6 or more)

ID

c.maintainability.max_params

Severity

low

Remediation Complexity

medium

Remediation Risk

low

Remediation Effort

medium

Resource

Complexity

Language

C / C++

Description

This function declares 6 or more parameters (fixed threshold: 6). Long parameter lists are hard to call correctly and often signal that the function does too much or that related arguments should be grouped into a struct. Consider grouping related parameters into a struct or splitting the function.

Rationale

This function declares 6 or more parameters (fixed threshold: 6). Long parameter lists are hard to call correctly and often signal that the function does too much or that related arguments should be grouped into a struct. Consider grouping related parameters into a struct or splitting the function.

The following code illustrates the pattern detected by this rule:

#include <stddef.h>

// FLAGGED: Function has too many parameters (6 or more)
int six(int a, int b, int c, int d, int e, int f) {
    return a + b + c + d + e + f;
}

Remediation

Follow secure coding practices and review the references below for detailed remediation guidance.

Configuration

This detector does not need any configuration.