Skip to content

Flake8 ignoring -ignore flag setting #60

@Integralist

Description

@Integralist

Hello,

Problem

I call Flake8 whenever I write to a Buffer:

autocmd BufWritePost *.py :call Flake8()

But it shows a list of errors which I've already configured to be ignored:

foo.py|28 col 80| E501 line too long (88 > 79 characters)
foo.py|36 col 1| E302 expected 2 blank lines, found 1

Here are the relevant lines from my vimrc:

execute pathogen#infect()
filetype plugin indent on

set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_python_checkers = ['flake8', 'pylint']

let g:syntastic_python_pylint_args="-d C0103,C0111,R0201"
let g:syntastic_python_flake8_args='--ignore=F821,E302,E501'

Software

I'm using terminal NeoVim (NVIM 0.1.5-dev) on latest Mac OS X release (10.11.5)

Note: I have the same issue with standard OS X install of terminal Vim (7.3)

Notes

The Flake8 plugin appears to work as I can see it's being loaded as part of Syntastic:

Syntastic version: 3.7.0-157 (Vim 704, Darwin)                                                                    
Info for filetype: python                                                                                         
Global mode: active                                                                                               
Filetype python is active                                                                                         
The current file will be checked automatically                                                                    
Available checkers: flake8 pep8 pycodestyle pyflakes pylint python                                                
Currently enabled checkers: flake8 pylint

I've looked at :scriptnames and I can see the flake8 plugin is being loaded:

~/.vim/bundle/vim-flake8/ftplugin/python_flake8.vim
~/.vim/bundle/syntastic/syntax_checkers/python/flake8.vim

If I was to remove the following line from my vimrc:

let g:syntastic_python_flake8_args='--ignore=F821,E302,E501'

...then close Vim and re-open the relevant python file in Vim, I would see those errors appear in a quickfix window and that would be expected behaviour.

If I then put back that line into my vimrc, close Vim and re-open the relevant python file in Vim I'll see the errors are ignored. Again, expected behaviour.

The problem occurs only when calling Flake8 when writing to the current buffer. The errors re-appear, when they should be ignored.

Interestingly I noticed, when removing the flake8_args setting, that after opening the file and the quicklist window immediately appeared, that if I then wrote to the buffer I would get another quickfix window with the same errors. But the first quickfix window shows the command used as:

:flake8 "foo.py"

I think the problem is that when I use call Flake8 that I'm using the shell directly, maybe? This would explain why it's side-stepping my Syntastic ignore flag setting

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions