summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ale_linters/python/flake8.vim11
-rw-r--r--ale_linters/python/pycodestyle.vim4
-rw-r--r--test/handler/test_flake8_handler.vader30
-rw-r--r--test/handler/test_pycodestyle_handler.vader15
4 files changed, 55 insertions, 5 deletions
diff --git a/ale_linters/python/flake8.vim b/ale_linters/python/flake8.vim
index 400e60f0..e7bbcfb1 100644
--- a/ale_linters/python/flake8.vim
+++ b/ale_linters/python/flake8.vim
@@ -105,11 +105,16 @@ function! ale_linters#python#flake8#Handle(buffer, lines) abort
\ 'type': 'W',
\}
- if l:code[:0] is# 'F' || l:code is# 'E999'
- let l:item.type = 'E'
+ if l:code[:0] is# 'F'
+ if l:code isnot# 'F401'
+ let l:item.type = 'E'
+ endif
elseif l:code[:0] is# 'E'
let l:item.type = 'E'
- let l:item.sub_type = 'style'
+
+ if l:code isnot# 'E999' && l:code isnot# 'E112'
+ let l:item.sub_type = 'style'
+ endif
elseif l:code[:0] is# 'W'
let l:item.sub_type = 'style'
endif
diff --git a/ale_linters/python/pycodestyle.vim b/ale_linters/python/pycodestyle.vim
index bbecdf03..19f05a53 100644
--- a/ale_linters/python/pycodestyle.vim
+++ b/ale_linters/python/pycodestyle.vim
@@ -44,8 +44,8 @@ function! ale_linters#python#pycodestyle#Handle(buffer, lines) abort
\ 'code': l:match[4],
\}
- " E999 is not a style error, it's a syntax error.
- if l:match[4] is# 'E999'
+ " E999 and E112 are syntax errors.
+ if l:match[4] is# 'E999' || l:match[4] is# 'E112'
unlet l:item.sub_type
endif
diff --git a/test/handler/test_flake8_handler.vader b/test/handler/test_flake8_handler.vader
index 492941c9..efacdfb2 100644
--- a/test/handler/test_flake8_handler.vader
+++ b/test/handler/test_flake8_handler.vader
@@ -214,3 +214,33 @@ Execute(Disabling trailing blank line warnings should work):
\ ale_linters#python#flake8#Handle(bufnr(''), [
\ 'foo.py:6:1: W391 blank line at end of file',
\ ])
+
+Execute(F401 should be a warning):
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 6,
+ \ 'col': 1,
+ \ 'code': 'F401',
+ \ 'type': 'W',
+ \ 'text': 'module imported but unused',
+ \ },
+ \ ],
+ \ ale_linters#python#flake8#Handle(bufnr(''), [
+ \ 'foo.py:6:1: F401 module imported but unused',
+ \ ])
+
+Execute(E112 should be a syntax error):
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 6,
+ \ 'col': 1,
+ \ 'code': 'E112',
+ \ 'type': 'E',
+ \ 'text': 'expected an indented block',
+ \ },
+ \ ],
+ \ ale_linters#python#flake8#Handle(bufnr(''), [
+ \ 'foo.py:6:1: E112 expected an indented block',
+ \ ])
diff --git a/test/handler/test_pycodestyle_handler.vader b/test/handler/test_pycodestyle_handler.vader
index 0fd885d6..3664455e 100644
--- a/test/handler/test_pycodestyle_handler.vader
+++ b/test/handler/test_pycodestyle_handler.vader
@@ -137,3 +137,18 @@ Execute(Disabling trailing blank line warnings should work):
\ ale_linters#python#pycodestyle#Handle(bufnr(''), [
\ 'foo.py:6:1: W391 blank line at end of file',
\ ])
+
+Execute(E112 should be a syntax error):
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 6,
+ \ 'col': 1,
+ \ 'code': 'E112',
+ \ 'type': 'E',
+ \ 'text': 'expected an indented block',
+ \ },
+ \ ],
+ \ ale_linters#python#pycodestyle#Handle(bufnr(''), [
+ \ 'foo.py:6:1: E112 expected an indented block',
+ \ ])