-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Limit number of method/closure parameters rule #415
Comments
Interesting idea. Do you think this should or shouldn't count parameters with default values? |
@scottrhoyt that's a good question indeed 👍
|
Without thinking about it too much, I think I would vote for option number 2 since it is simpler and clearer. Ultimately I think it is more important for this rule to protect potential callers as opposed to the function writer. |
Time to time I raise this issue with colleagues: there is no proven number to stick, but IMHO anything with 5 or more parameters should be considered as suspicious (might be a good place to use "Introduce Parameter object" refactoring).
I see it as an AST rule that raises warning for methods/functions/closures with 5 or more arguments (configurable).
Edit: probably it should ignore
init
methods though (value objects usually have tons of parameters)The text was updated successfully, but these errors were encountered: