wemake-services / wemake-python-styleguide

The strictest and most opinionated python linter ever!
https://wemake-python-styleguide.rtfd.io
MIT License
2.5k stars 381 forks source link

Overused expression should not count primitives #1152

Closed sobolevn closed 4 years ago

sobolevn commented 4 years ago

Bug report

What's wrong

Currently, this is an error in our linter:

  359:8    WPS204 Found overused expression: []; used 8 times
  print(*[], **{'@': 1})  # noqa: WPS517, WPS445

But, how can one remove this violation? Impossible. We should ignore single node collections and named variables.

sobolevn commented 4 years ago

The same is applied to set(), list(), factory() and other simple callables.

memery-rbx commented 4 years ago

Thanks for doing this. I was about to post the exact same issue!

memery-rbx commented 4 years ago

Just sent over $10 as a token of my appreciation. Keep up the great work!

sobolevn commented 4 years ago

@memery-imb thank you! That's awesome!

I feel so good from knowing that people actually use and benefit from this project! 👍

pawelarybak commented 3 years ago

Should it count minus unary operator (-)? In my code i often use negative value of a named variable and such usage breaks this rule.

Example:

my_value = 5
position = (0, -my_value)
sobolevn commented 3 years ago

@pawelarybak yes, it should not. Please, create a new issue.