flake8-simplify icon indicating copy to clipboard operation
flake8-simplify copied to clipboard

[Adjust rule] SIM222

Open xqt opened this issue 3 years ago • 2 comments

Desired change

  • Rule(s): SIM222
  • Adjustment: The rule Use 'True' instead of '... or True' is wrong

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

xqt avatar Jun 03 '22 18:06 xqt

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

tolomea avatar Jul 05 '22 16:07 tolomea

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.

MartinThoma avatar Jul 05 '22 19:07 MartinThoma