Skip to content

Instantly share code, notes, and snippets.

@y56
Created November 26, 2019 01:51
Show Gist options
  • Save y56/a14082a24f36ef326d73725155cbd92e to your computer and use it in GitHub Desktop.
Save y56/a14082a24f36ef326d73725155cbd92e to your computer and use it in GitHub Desktop.
pycodestyle
That being said, conforming your Python code to PEP 8 is generally a good idea and helps make code more consistent when working on projects with other developers. There is a command-line program, pycodestyle (previously known as pep8), that can check your code for conformance. Install it by running the following command in your terminal:
$ pip install pycodestyle
Then run it on a file or series of files to get a report of any violations.
$ pycodestyle optparse.py
optparse.py:69:11: E401 multiple imports on one line
optparse.py:77:1: E302 expected 2 blank lines, found 1
optparse.py:88:5: E301 expected 1 blank line, found 0
optparse.py:222:34: W602 deprecated form of raising exception
optparse.py:347:31: E211 whitespace before '('
optparse.py:357:17: E201 whitespace after '{'
optparse.py:472:29: E221 multiple spaces before operator
optparse.py:544:21: W601 .has_key() is deprecated, use 'in'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment