inaka / elvis_core

The core of an Erlang linter
Other
61 stars 56 forks source link

Max Function Arity #286

Closed elbrujohalcon closed 1 year ago

elbrujohalcon commented 1 year ago

Max Function Arity

Brief Description

Warn if a function has too many arguments.

Should be on by default?

YES

Options

Note: I picked 5 as the default basically randomly. If the implementor can do a proper analysis of some public Erlang codebases to determine what a reasonable default should be, much better.

Reasoning

Quoting from Credo docs:

A function can take as many parameters as needed, but even in a functional language, there can be too many parameters.

Origin (#281)

Inspired by the Refactor.FunctionArity rule from Credo

maco commented 1 year ago

Credo's default is 8. I don't really see why not have the same default.

paulo-ferraz-oliveira commented 1 year ago

8 sounds reasonable as a default. In a team I used to work in we had 7 as a "rule of thumb" 👍 Then you had to use maps or records, or otherwise work around it :) Most of the initial cases it was just people adding options as new arguments :)

elbrujohalcon commented 1 year ago

8 is a great number, yes!