summaryrefslogtreecommitdiff
path: root/ale_linters/python
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2018-01-11 16:43:10 +0000
committerw0rp <devw0rp@gmail.com>2018-01-11 16:43:10 +0000
commitadba2bd919d5463e16c586a90698588cca9725b6 (patch)
treec033331680cbb79ae94af677642ac76a0b0a5b1b /ale_linters/python
parentf1747901cc00abb7becb64c02bfccad46b66ed21 (diff)
downloadale-adba2bd919d5463e16c586a90698588cca9725b6.zip
Allow syntax errors for mypy to be ignored
Diffstat (limited to 'ale_linters/python')
-rw-r--r--ale_linters/python/mypy.vim14
1 files changed, 10 insertions, 4 deletions
diff --git a/ale_linters/python/mypy.vim b/ale_linters/python/mypy.vim
index 6884a9ac..c1c91742 100644
--- a/ale_linters/python/mypy.vim
+++ b/ale_linters/python/mypy.vim
@@ -1,10 +1,10 @@
" Author: Keith Smiley <k@keith.so>, w0rp <devw0rp@gmail.com>
" Description: mypy support for optional python typechecking
-let g:ale_python_mypy_executable =
-\ get(g:, 'ale_python_mypy_executable', 'mypy')
-let g:ale_python_mypy_options = get(g:, 'ale_python_mypy_options', '')
-let g:ale_python_mypy_use_global = get(g:, 'ale_python_mypy_use_global', 0)
+call ale#Set('python_mypy_executable', 'mypy')
+call ale#Set('python_mypy_ignore_invalid_syntax', 0)
+call ale#Set('python_mypy_options', '')
+call ale#Set('python_mypy_use_global', 0)
function! ale_linters#python#mypy#GetExecutable(buffer) abort
return ale#python#FindExecutable(a:buffer, 'python_mypy', ['mypy'])
@@ -45,6 +45,12 @@ function! ale_linters#python#mypy#Handle(buffer, lines) abort
let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:pattern)
+ " Skip invalid syntax errors if the option is on.
+ if l:match[5] is# 'invalid syntax'
+ \&& ale#Var(a:buffer, 'python_mypy_ignore_invalid_syntax')
+ continue
+ endif
+
call add(l:output, {
\ 'filename': ale#path#GetAbsPath(l:dir, l:match[1]),
\ 'lnum': l:match[2] + 0,