1
0
Fork 0
mirror of synced 2024-11-30 04:35:35 -05:00
ultimate-vim/sources_non_forked/swift.vim/syntax_checkers/swift/swiftlint.vim
2017-11-27 13:43:13 +08:00

45 lines
1.1 KiB
VimL

if exists('g:loaded_syntastic_swift_swiftlint_checker')
finish
endif
let g:loaded_syntastic_swift_swiftlint_checker = 1
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_swift_swiftlint_IsAvailable() dict
if !executable(self.getExec())
return 0
endif
return get(g:, 'syntastic_swift_swiftlint_use_defaults', 0)
\ || filereadable('.swiftlint.yml')
endfunction
function! SyntaxCheckers_swift_swiftlint_GetLocList() dict
let makeprg = self.makeprgBuild({
\ 'args': 'lint --use-script-input-files',
\ 'fname': '' })
let errorformat =
\ '%f:%l:%c: %trror: %m,' .
\ '%f:%l:%c: %tarning: %m,' .
\ '%f:%l: %trror: %m,' .
\ '%f:%l: %tarning: %m'
let env = {
\ 'SCRIPT_INPUT_FILE_COUNT': 1,
\ 'SCRIPT_INPUT_FILE_0': expand('%:p'),
\ }
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'env': env })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'swift',
\ 'name': 'swiftlint' })
let &cpo = s:save_cpo
unlet s:save_cpo