LoginSignup
0
0

More than 1 year has passed since last update.

W503 line break before binary operator flake8 & black

Last updated at Posted at 2023-02-04

概要

W503 line break before binary operator

なぜかこちらのエラーが出たので調べたことを書いておく

自分のケースにたいする解決策

.flake8ignore = xxxに自分で指定している無視するルールがあったが、defaultでignoreされているもの全部を含んでいなかったためにW503が有効化されてエラーがでていたので、ignoreではなく extend-ignoreに自分の無視するルールを記載した

.flake8
[flake8]
extend-ignore = xxx

結論

  1. W503はflake8のdefaultでignoreに入っているので基本は出ない

    flake8 --help
    ...
      --ignore errors       Comma-separated list of error codes to ignore (or skip). For example,
                        ``--ignore=E4,E51,W234``. (Default: E121,E123,E126,E226,E24,E704,W503,W504)
    
  2. .flake8 で設定している場合は、デフォルト値をそのままにして特定のルールを無視する場合 ignoreではなくextend-ignoreを使う

      --extend-ignore errors
                        Comma-separated list of error codes to add to the list of ignored ones. For example,
                        ``--extend-ignore=E4,E51,W234``.
    
  3. その他 blackとflake8を同時に使う際の注意点は Using Black with other tools

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0