#!/usr/bin/env python # coding: utf-8 # # Syntax Checkers # # [back to overview page](index.ipynb) # # There are several tools out there, this is just a random selection: # ## pylint # # Website: http://www.pylint.org/ # # Docs: http://docs.pylint.org/ # # Tutorial: http://docs.pylint.org/tutorial.html # # All message codes: http://pylint-messages.wikidot.com/all-codes # # Google coding style: http://google-styleguide.googlecode.com/svn/trunk/pyguide.html?showone=Lint#Lint # # To show how it works, let's check the file [bad_syntax.py](files/bad_syntax.py): # In[5]: get_ipython().system('pylint --reports=no bad_syntax.py') # TODO: on Debian, enable Python3 support # # If a file named `pylintrc` is available in the current directory, it is used a configuration file. # To create a default configuration file, use: # # ```bash # pylint --generate-rcfile > pylintrc # ``` # # TODO: disabling selected messages # ## pep8 # # http://pypi.python.org/pypi/pep8 # # Checks for style conventions specified in [PEP 8](http://www.python.org/dev/peps/pep-0008/). # # `pep8` shows a few things that `pylint` doesn't (and the other way round). # # Again, let's look at the file [bad_syntax.py](files/bad_syntax.py): # In[2]: get_ipython().system('pep8 --repeat --show-source --show-pep8 bad_syntax.py') # TODO: disabling selected messages # # Text Editor Support # # Many text editors have plugins to automatically do syntax checks in the background. # # Here a few links for Vim-users: # # https://github.com/klen/python-mode # # https://github.com/scrooloose/syntastic # # http://www.vim.org/scripts/script.php?script_id=891 #

# # CC0 # #
# To the extent possible under law, # the person who associated CC0 # with this work has waived all copyright and related or neighboring # rights to this work. #