summaryrefslogtreecommitdiff
path: root/ale_linters
diff options
context:
space:
mode:
authorDaisuke Shimamoto <diskshima@gmail.com>2021-11-15 21:17:18 +0900
committerGitHub <noreply@github.com>2021-11-15 21:17:18 +0900
commit31dc6a61a07839ea906f6f0b80be713fb8cad1c7 (patch)
tree55a29590a736bf799a5df2ea5e6ec13aff4e9c51 /ale_linters
parent01fdd8d66b9ee949747ce53ad37bc65b5df4e084 (diff)
downloadale-31dc6a61a07839ea906f6f0b80be713fb8cad1c7.zip
Find composer.json when searching for psalm (#3979)
* Look for nearest composer.json before .git * Add test for projects with composer.json
Diffstat (limited to 'ale_linters')
-rw-r--r--ale_linters/php/psalm.vim6
1 files changed, 6 insertions, 0 deletions
diff --git a/ale_linters/php/psalm.vim b/ale_linters/php/psalm.vim
index dbbe9453..f1280057 100644
--- a/ale_linters/php/psalm.vim
+++ b/ale_linters/php/psalm.vim
@@ -6,6 +6,12 @@ call ale#Set('php_psalm_options', '')
call ale#Set('php_psalm_use_global', get(g:, 'ale_use_global_executables', 0))
function! ale_linters#php#psalm#GetProjectRoot(buffer) abort
+ let l:composer_path = ale#path#FindNearestFile(a:buffer, 'composer.json')
+
+ if (!empty(l:composer_path))
+ return fnamemodify(l:composer_path, ':h')
+ endif
+
let l:git_path = ale#path#FindNearestDirectory(a:buffer, '.git')
return !empty(l:git_path) ? fnamemodify(l:git_path, ':h:h') : ''