dart-code-metrics
dart-code-metrics copied to clipboard
[Rule change] long-parameter-list must take into account only required and positional parameters
In Flutter can be 5-10 optional parameters. Check out all .copyWith
methods, constructors. This rule make sense only for positional and required parameters.
The idea of this anti-pattern is to keep the amount of parameters small and it won't achieve its goal if only positional and required parameters will be taken into account. So, I think we won't change it that way. But we definitely should take into consideration ignoring .copyWith
.
@incendial not only copyWith. Check out SDK component constructors. In most cases they have many params, but only 1..3 is required.
I agree, I think the current lint is barely helpful
Fixed in Teams version 1.2.0, it's now a rule https://dcm.dev/docs/rules/common/avoid-long-parameter-list/