diff options
author | w0rp <devw0rp@gmail.com> | 2020-01-02 14:19:21 +0000 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2020-01-02 14:19:21 +0000 |
commit | 8c4c8dfd97b6a7d24b490f8645d7c54461c45d52 (patch) | |
tree | d442d9cec77f8e4db90d19103c399dc0d77d8043 /ale_linters/python/mypy.vim | |
parent | 0cb432cb825e80c5a6f6dc9bc9c52a38f9b45319 (diff) | |
download | ale-8c4c8dfd97b6a7d24b490f8645d7c54461c45d52.zip |
Fix #2704 - Show mypy notes; can be disabled
Diffstat (limited to 'ale_linters/python/mypy.vim')
-rw-r--r-- | ale_linters/python/mypy.vim | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/ale_linters/python/mypy.vim b/ale_linters/python/mypy.vim index dc4044e6..d4778e40 100644 --- a/ale_linters/python/mypy.vim +++ b/ale_linters/python/mypy.vim @@ -3,6 +3,7 @@ call ale#Set('python_mypy_executable', 'mypy') call ale#Set('python_mypy_ignore_invalid_syntax', 0) +call ale#Set('python_mypy_show_notes', 1) call ale#Set('python_mypy_options', '') call ale#Set('python_mypy_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('python_mypy_auto_pipenv', 0) @@ -51,7 +52,16 @@ function! ale_linters#python#mypy#Handle(buffer, lines) abort " Lines like these should be ignored below: " " file.py:4: note: (Stub files are from https://github.com/python/typeshed) - let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):?(\d+)?: (error|warning): (.+)$' + + let l:types = 'error|warning' + + if ale#Var(a:buffer, 'python_mypy_show_notes') + let l:types = 'error|warning|note' + endif + + let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):?(\d+)?: (' + \ . l:types + \ . '): (.+)$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) @@ -65,7 +75,7 @@ function! ale_linters#python#mypy#Handle(buffer, lines) abort \ 'filename': ale#path#GetAbsPath(l:dir, l:match[1]), \ 'lnum': l:match[2] + 0, \ 'col': l:match[3] + 0, - \ 'type': l:match[4] is# 'error' ? 'E' : 'W', + \ 'type': l:match[4] is# 'error' ? 'E' : (l:match[4] is# 'note' ? 'I': 'W'), \ 'text': l:match[5], \}) endfor |