11

Anytime there is an inline assertion rule to be verified against a bool statement, using the python black formatter in VSCode will break the line causing flake8 to warn about rule W503

line break before binary operatorflake8(W503)

assert (
      ...
      != ...
)

Is there any fix for this rather than ignoring that rule?

anthony sottile
  • 61,815
  • 15
  • 148
  • 207
Antonio Santoro
  • 827
  • 1
  • 11
  • 29

1 Answers1

32

you have set ignore = in your configuration -- you should use extend-ignore =

W504 and W503 conflict with each other (and are both disabled by default) -- by setting ignore you've re-enabled them. extend-ignore does not have this problem as it augments the default set of ignored codes

note that when working with black you'll want to use black's recommended settings: https://github.com/psf/black/blob/06ccb88bf2bd35a4dc5d591bb296b5b299d07323/docs/guides/using_black_with_other_tools.md#flake8

max-line-length = 88
extend-ignore = E203

disclaimer: I'm the current flake8 maintainer

anthony sottile
  • 61,815
  • 15
  • 148
  • 207