Luacheck: cleanup.
This commit is contained in:
parent
d2c454963d
commit
30257ef239
@ -14,19 +14,27 @@ if exists("g:loaded_syntastic_lua_luacheck_checker")
|
|||||||
endif
|
endif
|
||||||
let g:loaded_syntastic_lua_luacheck_checker = 1
|
let g:loaded_syntastic_lua_luacheck_checker = 1
|
||||||
|
|
||||||
if !exists('g:syntastic_lua_luacheck_sort')
|
|
||||||
let g:syntastic_lua_luacheck_sort = 1
|
|
||||||
endif
|
|
||||||
|
|
||||||
let s:save_cpo = &cpo
|
let s:save_cpo = &cpo
|
||||||
set cpo&vim
|
set cpo&vim
|
||||||
|
|
||||||
function! SyntaxCheckers_lua_luacheck_GetHighlightRegex(item)
|
function! SyntaxCheckers_lua_luacheck_GetHighlightRegex(item)
|
||||||
let term = matchstr(a:item['text'], '''\zs.*\ze''') " matches the substring wrapped in single quotes
|
let term = matchstr(a:item['text'], '\m\(accessing undefined\|setting non-standard global\|' .
|
||||||
if term != ''
|
\ 'setting non-module global\|unused global\) variable \zs\S\+')
|
||||||
let term = '\V\<' . escape(term, '\') . '\>'
|
if term == ''
|
||||||
|
let term = matchstr(a:item['text'], '\mvariable \zs\S\+\ze was previously defined')
|
||||||
endif
|
endif
|
||||||
return term
|
if term == ''
|
||||||
|
let term = matchstr(a:item['text'], '\munused \(variable\|argument\|loop variable\) \zs\S\+')
|
||||||
|
endif
|
||||||
|
if term == ''
|
||||||
|
let term = matchstr(a:item['text'], '\m\(value assigned to variable\|value of argument\|' .
|
||||||
|
\ 'value of loop variable\) \zs\S\+')
|
||||||
|
endif
|
||||||
|
if term == ''
|
||||||
|
let term = matchstr(a:item['text'], '\mvariable \zs\S\+\ze is never set')
|
||||||
|
endif
|
||||||
|
|
||||||
|
return term != '' ? '\V\<' . escape(term, '\') . '\>' : ''
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! SyntaxCheckers_lua_luacheck_GetLocList() dict
|
function! SyntaxCheckers_lua_luacheck_GetLocList() dict
|
||||||
@ -36,12 +44,17 @@ function! SyntaxCheckers_lua_luacheck_GetLocList() dict
|
|||||||
\ '%f:%l:%c: %m,'.
|
\ '%f:%l:%c: %m,'.
|
||||||
\ '%-G%.%#'
|
\ '%-G%.%#'
|
||||||
|
|
||||||
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
return SyntasticMake({
|
||||||
|
\ 'makeprg': makeprg,
|
||||||
|
\ 'errorformat': errorformat,
|
||||||
|
\ 'subtype': 'Style',
|
||||||
|
\ 'defaults': { 'type': 'W' },
|
||||||
|
\ 'returns': [0, 1, 2] })
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||||
\ 'filetype': 'lua',
|
\ 'filetype': 'lua',
|
||||||
\ 'name': 'luacheck' })
|
\ 'name': 'luacheck' })
|
||||||
|
|
||||||
let &cpo = s:save_cpo
|
let &cpo = s:save_cpo
|
||||||
unlet s:save_cpo
|
unlet s:save_cpo
|
||||||
|
Loading…
x
Reference in New Issue
Block a user