Syntastic error and warning symbols #391

Closed
jjimenezlopez opened this Issue Oct 25, 2012 · 4 comments

Comments

Projects
None yet
2 participants
Contributor

jjimenezlopez commented Oct 25, 2012

I have syntastic plugin running correctly in vim/gvim. I just want to customize it a little more, I am trying to set the properties 'syntastic_warning_symbol' and 'syntastic_error_symbol' to differentiate them.

In my .vimrc I have:

let g:syntastic_warning_symbol = 'WW'
let g:syntastic_error_symbol = 'EE'

But when I open vim, I see 'EE' even in the Warning lines.

Am I doing anything wrong?

Thanks.

EDIT: I am using it with Python and flake8.

Collaborator

scrooloose commented Oct 25, 2012

Hmmm, i copied those lines into my vimrc and it worked as expected :-/

What do you see when you open up the location list with :Errors? Are you definitely getting warnings? You should see "warning" in the output e.g.

/tmp/foo.html|1 col 1 >>>warning<<<| missing <!DOCTYPE> declaration

Contributor

jjimenezlopez commented Oct 26, 2012

Thanks for your response scrooloose.

I have tried with a html file, and it works. It shows the correct label (with the correct color), and in the :Errors list they are shown as warnings instead of errors.

But with Python and C, it does not work. With Python for example, I see all warnings as errors (even in the :Errors list), but if I run the command flake8 with the same file in a terminal, it shows me the warnings correctly.

You can see a short C example here: http://goo.gl/eknhU

Tell me if you need more details.

Collaborator

scrooloose commented Oct 26, 2012

The problem is in the python syntax checker itself - in syntastic/syntax_checkers/python/flake8.vim.

If you look in there you can see that the errorformat doesnt specify any format to match warnings. It just treats all output messages as errors. There is some explanation here in the commit message here: b4e85a8

Im not a python dev, but maybe the output of flake8 has changed since this commit? is it now possible to determine what messages from flake8 are warnings vs errors? If so, then we can update the flake8 errorformat accordingly :)

Contributor

jjimenezlopez commented Oct 26, 2012

Yes, is possible to determine what messages from flake8 are warnings and what others are errors, for example:

views.py:8: W402 'csrf' imported but unused
views.py:181:64: E712 comparison to True should be 'if cond is True:' or 'if cond:'

You can see that the error code is starting with 'W' or 'E'.

I have been looking the flake8.vim file. I don't understand so well the code (I am starting to use vim plugins, and the regular expressions always have been a mistery for me :) but I have changed the code that appears in the commit you have linked in the comment before, and now it is working for me as expected.

I am going to do a pull request now. Maybe if anyone could give a try to confirm it is working fine...

Thanks for the support scrooloose!

@scrooloose scrooloose closed this Nov 14, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment