Skip to content

Commit b73c0ba

Browse files
committed
Only enable swiftlint checker with config file
This means that if you just have swiftlint installed, it won't be enabled automatically. You either need a `.swiftlint.yml` or you need to set `g:syntastic_swift_swiftlint_use_defaults` to 1 in your vimrc.
1 parent 3cd476d commit b73c0ba

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

syntax_checkers/swift/swiftlint.vim

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,15 @@ let g:loaded_syntastic_swift_swiftlint_checker = 1
66
let s:save_cpo = &cpo
77
set cpo&vim
88

9+
function! SyntaxCheckers_swift_swiftlint_IsAvailable() dict
10+
if !executable(self.getExec())
11+
return 0
12+
endif
13+
14+
return get(g:, 'syntastic_swift_swiftlint_use_defaults', 0)
15+
\ || filereadable('.swiftlint.yml')
16+
endfunction
17+
918
function! SyntaxCheckers_swift_swiftlint_GetLocList() dict
1019
let env_vars = 'SCRIPT_INPUT_FILE_COUNT=1 SCRIPT_INPUT_FILE_0=' . syntastic#util#shexpand('%:p')
1120
let makeprg = self.makeprgBuild({

0 commit comments

Comments
 (0)