Make the Erlang linter code match the style used in the rest of the codebase. Make the options match the new standard.
This commit is contained in:
parent
cae153b3ac
commit
e4a4fcd26b
@ -1,6 +1,12 @@
|
||||
" Author: Magnus Ottenklinger - https://github.com/evnu
|
||||
|
||||
function! ale_linters#erlang#erlc#Handle(buffer, lines)
|
||||
let g:ale_erlang_erlc_options = get(g:, 'ale_erlang_erlc_options', '')
|
||||
|
||||
function! ale_linters#erlang#erlc#GetCommand(buffer) abort
|
||||
return g:ale#util#stdin_wrapper . ' .erl erlc ' . g:ale_erlang_erlc_options
|
||||
endfunction
|
||||
|
||||
function! ale_linters#erlang#erlc#Handle(buffer, lines) abort
|
||||
" Matches patterns like the following:
|
||||
"
|
||||
" error.erl:4: variable 'B' is unbound
|
||||
@ -28,7 +34,6 @@ function! ale_linters#erlang#erlc#Handle(buffer, lines)
|
||||
"
|
||||
" If none of the patterns above match, the line can be ignored
|
||||
if len(l:match) == 0 " not a 'normal' warning or error
|
||||
|
||||
let l:match_parse_transform = matchlist(l:line, l:pattern_parse_transform)
|
||||
|
||||
if len(l:match_parse_transform) == 0 " also not a parse_transform error
|
||||
@ -44,6 +49,7 @@ function! ale_linters#erlang#erlc#Handle(buffer, lines)
|
||||
\ 'text': l:match_parse_transform[0],
|
||||
\ 'nr': -1,
|
||||
\})
|
||||
|
||||
continue
|
||||
endif
|
||||
|
||||
@ -54,9 +60,10 @@ function! ale_linters#erlang#erlc#Handle(buffer, lines)
|
||||
" If this file is a header .hrl, ignore the following expected messages:
|
||||
" - 'no module definition'
|
||||
" - 'X is unused'
|
||||
if l:is_hrl &&
|
||||
\ (match(l:text, l:pattern_no_module_definition) != -1 ||
|
||||
\ match(l:text, l:pattern_unused) != -1)
|
||||
if l:is_hrl && (
|
||||
\ match(l:text, l:pattern_no_module_definition) != -1
|
||||
\ || match(l:text, l:pattern_unused) != -1
|
||||
\)
|
||||
continue
|
||||
endif
|
||||
|
||||
@ -84,6 +91,6 @@ endfunction
|
||||
call ale#linter#Define('erlang', {
|
||||
\ 'name': 'erlc',
|
||||
\ 'executable': 'erlc',
|
||||
\ 'command': g:ale#util#stdin_wrapper . ' .erl erlc '
|
||||
\ . get(g:, 'ale_erlang_erlc_flags', ''),
|
||||
\ 'callback': 'ale_linters#erlang#erlc#Handle' })
|
||||
\ 'command_callback': 'ale_linters#erlang#erlc#GetCommand',
|
||||
\ 'callback': 'ale_linters#erlang#erlc#Handle',
|
||||
\})
|
||||
|
@ -832,7 +832,7 @@ g:ale_python_pylint_options *g:ale_python_pylint_options*
|
||||
------------------------------------------------------------------------------
|
||||
4.25. erlang *ale-linter-options-erlang*
|
||||
|
||||
g:ale_erlang_erlc_flags *g:ale_erlang_erlc_flags*
|
||||
g:ale_erlang_erlc_options *g:ale_erlang_erlc_options*
|
||||
|
||||
Type: |String|
|
||||
Default: '`''`'
|
||||
|
Loading…
Reference in New Issue
Block a user