dart-code-metrics icon indicating copy to clipboard operation
dart-code-metrics copied to clipboard

[Rule change] long-parameter-list must take into account only required and positional parameters

Open NaikSoftware opened this issue 3 years ago • 3 comments

In Flutter can be 5-10 optional parameters. Check out all .copyWith methods, constructors. This rule make sense only for positional and required parameters.

NaikSoftware avatar Aug 11 '21 16:08 NaikSoftware

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 avatar Aug 14 '21 17:08 incendial

@incendial not only copyWith. Check out SDK component constructors. In most cases they have many params, but only 1..3 is required.

NaikSoftware avatar Aug 16 '21 11:08 NaikSoftware

I agree, I think the current lint is barely helpful

jangruenwaldt avatar Sep 09 '21 17:09 jangruenwaldt

Fixed in Teams version 1.2.0, it's now a rule https://dcm.dev/docs/rules/common/avoid-long-parameter-list/

incendial avatar Mar 06 '23 15:03 incendial