From 73d8c3b80aa466034cdcb084181eb9eeb6008b5b Mon Sep 17 00:00:00 2001 From: w0rp Date: Fri, 3 Aug 2018 00:56:49 +0100 Subject: Only run the custom ALE linting script if it's in runtimepath --- ale_linters/vim/ale_custom_linting_rules.vim | 14 ++++++++++++-- 1 file 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 -- cgit v1.2.3