poetry icon indicating copy to clipboard operation
poetry copied to clipboard

feat: add ARG001 rule

Open ralbertazzi opened this issue 2 years ago • 9 comments

As this affects the whole codebase it would be great to have a quick feedback cycle to avoid lots of painful rebases 🙏

This kind of rules doesn't obviously play well with pytest fixtures, that's why many inline ignores. On the other side, it helped detecting lots of unneeded fixtures.

ralbertazzi avatar May 30 '23 18:05 ralbertazzi

Honestly, I don't like this. The amount of false positives that we have to silence is just too high for my taste. I am all for doing some cleaning, but to keep this rule enabled in the long run, not really.

Secrus avatar May 31 '23 06:05 Secrus

Honestly, I don't like this. The amount of false positives that we have to silence is just too high for my taste. I am all for doing some cleaning, but to keep this rule enabled in the long run, not really.

Maybe a good compromise would be to activate this rule only for the package code, but not for the tests?

finswimmer avatar May 31 '23 06:05 finswimmer

Maybe a good compromise would be to activate this rule only for the package code, but not for the tests?

For me, tests are an integral part of code, so treating them differently would be weird imho.

Disclaimer: I won't block this PR if others think it's a good change. Just sounding out my concerns.

Secrus avatar May 31 '23 06:05 Secrus

I may have missed an obvious thing, but I didn't find a way to disable rules on entire folders on ruff 🤔 If you don't like having the rule enabled, one solution could also be to revert the enabling while still merging the improvements that it brought

ralbertazzi avatar May 31 '23 06:05 ralbertazzi

Honestly, I don't like this. The amount of false positives that we have to silence is just too high for my taste. I am all for doing some cleaning, but to keep this rule enabled in the long run, not really.

That was actually my first thought as well.

one solution could also be to revert the enabling while still merging the improvements that it brought

Sounds good to me.

radoering avatar May 31 '23 14:05 radoering

Maybe a good compromise would be to activate this rule only for the package code, but not for the tests?

Would also be ok for me.

I may have missed an obvious thing, but I didn't find a way to disable rules on entire folders on ruff 🤔

Did you try file patterns with *?

radoering avatar May 31 '23 14:05 radoering

Silly me.. it's actually possible to disable the check on the entire tests folder. To summarize:

  • We keep ARG001 enabled on the main codebase
  • We keep ARG001 disabled on tests, while still merging the cleanup performed while keeping this rule enabled

We now have a total of 2 additional # noqa pragmas in total. Seems small enough to call it not noisy :)

ralbertazzi avatar May 31 '23 16:05 ralbertazzi

I enabled all ARG rules on the main codebase while keeping them disabled on tests. I'm more in favour of radoering's comment on preserving names to keep the Liskov principle valid rather than modifying variable names with _.

If this version doesn't find consensus yet, then I'll probably revert enabling ARG rules everywhere and just propose the improvements.

ralbertazzi avatar Jun 01 '23 08:06 ralbertazzi

@ralbertazzi are you still interested in this? If not, please close.

Secrus avatar Jan 30 '24 11:01 Secrus