Configuration setting for Vim PEP-8 plugin to ignore errors and warnings?

baijum picture baijum · Mar 15, 2012 · Viewed 8.1k times · Source

I am using this plugin to detect PEP-8 errors and warnings in Vim: http://www.vim.org/scripts/script.php?script_id=3430

I want to ignore few errors and warnings like E501 & W601 given in the backend pep8 tool: http://pypi.python.org/pypi/pep8

When I looked at the plugin code, I can see it has support for this:

from pep8checker import Pep8Checker

args = vim.eval('string(g:pep8_args)')
select = vim.eval('string(g:pep8_select)')
ignore = vim.eval('string(g:pep8_ignore)')

if select:
    args = args + ' --select=%s' % select

if ignore:
    args = args + ' --ignore=%s' % ignore

pep8_checker = Pep8Checker(cmd, args)

But how do I use it ?

Answer

robbrit picture robbrit · Jun 25, 2013

For those folks that stumble across this question and the above answer doesn't work, here's some solutions for other Vim Python plugins:

For Syntastic:

let g:syntastic_python_checker="flake8"
let g:syntastic_python_checker_args="--ignore=E501,W601"

UPDATE: newer versions of Syntastic use this instead:

let g:syntastic_python_checkers=["flake8"]

For python-mode:

let g:pymode_lint_ignore="E501,W601"

Ensure that these are set before Pathogen or Vundle are triggered.