How to write a pep8 configuration (pep8.rc) file?

后端 未结 3 1463
别那么骄傲
别那么骄傲 2021-02-01 05:05

I found the documentation for pep8 but wasn\'t able to understand how to write these. I couldn\'t even find any examples with options other than setting max-line-length and igno

3条回答
  •  清酒与你
    2021-02-01 05:32

    The preferred way is to use a setup.cfg in the top-level of the project (.cfg has the same syntax as a .ini file), which should contain a [pep8] section. For example:

    [pep8]
    ignore = E226,E302,E41
    max-line-length = 160
    

    Note: the error codes are defined in the pep8 docs.


    • autopep8 find this same [pep8] section as pep8.
    • flake8 needs a [flake8] section in setup.cfg.
    • yapf looks for a [yapf] section in setup.cfg.

提交回复
热议问题