summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorBjorn Neergaard <bjorn@neersighted.com>2016-10-20 09:23:23 -0500
committerBjorn Neergaard <bjorn@neersighted.com>2016-10-20 09:23:23 -0500
commitc34664120b53e48ae6719a11fbd0a46f233a4ac9 (patch)
tree22a1eae8b8bc5e37b50d467edc4756ccccc540a3 /autoload
parenta34fb0a6a7f920cd4d9a3e50facf51f8d5defea2 (diff)
downloadale-c34664120b53e48ae6719a11fbd0a46f233a4ac9.zip
Add ansible-lint support and factor out PEP8 handler
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale/handlers.vim37
1 files changed, 37 insertions, 0 deletions
diff --git a/autoload/ale/handlers.vim b/autoload/ale/handlers.vim
index 5322bfb2..a8d2572f 100644
--- a/autoload/ale/handlers.vim
+++ b/autoload/ale/handlers.vim
@@ -103,6 +103,43 @@ function! ale#handlers#HandleCppCheckFormat(buffer, lines) abort
endfunction
+function! ale#handlers#HandlePEP8Format(buffer, lines)
+ " Matches patterns line the following:
+ "
+ " Matches patterns line the following:
+ "
+ " stdin:6:6: E111 indentation is not a multiple of four
+ " test.yml:35: [EANSIBLE0002] Trailing whitespace
+ let l:pattern = '^' . s:path_pattern . ':\(\d\+\):\?\(\d\+\)\?: \[\?\(\([[:alpha:]]\)[[:alnum:]]\+\)\]\? \(.*\)$'
+ let l:output = []
+
+ for l:line in a:lines
+ let l:match = matchlist(l:line, l:pattern)
+
+ if len(l:match) == 0
+ continue
+ endif
+
+ let l:code = l:match[3]
+ if (l:code ==# 'W291' || l:code ==# 'W293' || l:code ==# 'EANSIBLE002')
+ \ && !g:ale_warn_about_trailing_whitespace
+ " Skip warnings for trailing whitespace if the option is off.
+ continue
+ endif
+
+ call add(l:output, {
+ \ 'bufnr': a:buffer,
+ \ 'lnum': l:match[1] + 0,
+ \ 'vcol': 0,
+ \ 'col': l:match[2] + 0,
+ \ 'text': l:code . ': ' . l:match[5],
+ \ 'type': l:match[4] ==# 'E' ? 'E' : 'W',
+ \ 'nr': -1,
+ \})
+ endfor
+
+ return l:output
+endfunction
function! ale#handlers#HandleCSSLintFormat(buffer, lines) abort
" Matches patterns line the following: