Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flake8 ignoring -ignore flag setting #60

Open
Integralist opened this issue Jul 4, 2016 · 3 comments
Open

Flake8 ignoring -ignore flag setting #60

Integralist opened this issue Jul 4, 2016 · 3 comments

Comments

@Integralist
Copy link

Integralist commented Jul 4, 2016

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

@Integralist Integralist changed the title :Flake8 command not available Flake8 ignoring -ignore flag setting Jul 4, 2016
@ardentTech
Copy link

ardentTech commented Nov 23, 2016

@Integralist Did you ever get this sorted out? The Vim-Flake8 changelog for 1.6 indicates that Vim Flake8 configuration has been deprecated in favor of config files. The [Flake8] (http://flake8.pycqa.org/en/latest/user/configuration.html#user-configuration) documentation provides instructions on how to set up a config file, and then you can simply add the lines

[flake8]
ignore = F821,E302,E501

to it and reload Vim to see the changes take effect.

@Integralist
Copy link
Author

@ardentTech have a look at my vimrc in my dotfile repo. It all works fine now after some required changes

@ardentTech
Copy link

@Integralist cool cool. My config file syntax was off, so I edited my comment above to correct that.

zx1986 added a commit to zx1986/xVim that referenced this issue Oct 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants