From XennisWiki
Jump to: navigation, search

Python style guide checker


Use pip to install it

pip install pycodestyle

Configuration file

Create a configuration file setup.cfg, for example

# Ignore error codes
#   E501 line too long
#   W503 line break before binary operator
#   W605 invalid escape sequence
ignore = E501,W503,W605

max-line-length = 120


Run the checker

Call the checker on all *.py files

pycodestyle *.py

Run the checker on several modules

pycodestyle my_module/ another_module/

Disable a warning

Add a comment with the name of the warning, that should be disabled. For example

# nopep8: E101 (indentation contains tabs)

See also

External links