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 ?
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.
You need to set the variable g:pep8_ignore
; you should put this in your vimrc.
let g:pep8_ignore="E501,W601"
After trying all of robbrit's solutions and finding that none of them worked for me, I read some of the documentation for Syntastic. To pass args to a checker, you need to know several things. The following is the command syntax:
let g:syntastic_python_checkers=["<checker_type>"]
let g:syntastic_<filetype>_<checker_name>_args="--ignore=E501,W601,..."
This means that if you use flake8, you would write:
let g:syntastic_python_checkers=["flake8"]
let g:syntastic_python_flake8_args="--ignore=E501,W601"
Hope this helps someone avoid spending ages trying to figure this out like I did.
If you use python-mode
you need to use list now:
let g:pymode_lint_ignore=["E501", "W601"]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With