MartinThoma / flake8-simplify

❄ A flake8 plugin that helps you to simplify code
MIT License
186 stars 19 forks source link

[Adjust rule] SIM222 #142

Open xqt opened 2 years ago

xqt commented 2 years ago

Desired change

Example

'foo' or True gives 'foo' but not True, 1 or Truegives 1 but not True. '0' or Truegives '0' but not True whereas '' or True gives True 0 or True gives True

In general: x or True can be calculated as x if bool(x) else True

tolomea commented 2 years ago

There's similar removing case to bool problems with some of the other rules, see my comment on https://github.com/MartinThoma/flake8-simplify/issues/3

MartinThoma commented 2 years ago

Just a short heads up: I'm recently spending most of my free time on PyPDF2. I do see those issues, but it might be a while until I work on them.

PRs have a better chance to get merged soon.