summaryrefslogtreecommitdiff
path: root/ale_linters/python/mypy.vim
diff options
context:
space:
mode:
Diffstat (limited to 'ale_linters/python/mypy.vim')
-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,