diff options
author | w0rp <devw0rp@gmail.com> | 2018-08-03 00:56:49 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2018-08-03 00:56:49 +0100 |
commit | 73d8c3b80aa466034cdcb084181eb9eeb6008b5b (patch) | |
tree | 87c938aceca93b7409f0c6903d2cb565eb424778 /ale_linters/vim/ale_custom_linting_rules.vim | |
parent | 65880fec780b2daa01f62cd8a665ecc8df0c9aca (diff) | |
download | ale-73d8c3b80aa466034cdcb084181eb9eeb6008b5b.zip |
Only run the custom ALE linting script if it's in runtimepath
Diffstat (limited to 'ale_linters/vim/ale_custom_linting_rules.vim')
-rw-r--r-- | ale_linters/vim/ale_custom_linting_rules.vim | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/ale_linters/vim/ale_custom_linting_rules.vim b/ale_linters/vim/ale_custom_linting_rules.vim index 9981c54f..f4e111ee 100644 --- a/ale_linters/vim/ale_custom_linting_rules.vim +++ b/ale_linters/vim/ale_custom_linting_rules.vim @@ -2,8 +2,18 @@ " Description: A linter for checking ALE project code itself. function! ale_linters#vim#ale_custom_linting_rules#GetExecutable(buffer) abort - " Look for the custom-linting-rules script. - return ale#path#FindNearestFile(a:buffer, 'test/script/custom-linting-rules') + let l:filename = expand('#' . a:buffer . ':p') + let l:dir_list = [] + + for l:dir in split(&runtimepath, ',') + if l:filename[:len(l:dir) - 1] is# l:dir + call add(l:dir_list, l:dir) + endif + endfor + + return !empty(l:dir_list) + \ ? findfile('test/script/custom-linting-rules', join(l:dir_list, ',')) + \ : '' endfunction function! s:GetALEProjectDir(buffer) abort |