blob: 72b7af0b86c29cd4c9382594bd6aea1b421a8286 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
Before:
Save g:ale_php_phpcs_executable
Save g:ale_php_phpcs_use_global
let g:ale_php_phpcs_executable = 'phpcs_test'
let g:ale_php_phpcs_use_global = 0
silent! cd /testplugin/test
let g:dir = getcwd()
runtime ale_linters/php/phpcs.vim
After:
Restore
silent execute 'cd ' . fnameescape(g:dir)
unlet! g:dir
call ale#linter#Reset()
Execute(project with phpcs should use local by default):
call ale#test#SetFilename('phpcs-test-files/project-with-phpcs/foo/test.php')
AssertEqual
\ g:dir . '/phpcs-test-files/project-with-phpcs/vendor/bin/phpcs',
\ ale_linters#php#phpcs#GetExecutable(bufnr(''))
Execute(use-global should override local detection):
let g:ale_php_phpcs_use_global = 1
call ale#test#SetFilename('phpcs-test-files/project-with-phpcs/foo/test.php')
AssertEqual
\ 'phpcs_test',
\ ale_linters#php#phpcs#GetExecutable(bufnr(''))
Execute(project without phpcs should use global):
call ale#test#SetFilename('phpcs-test-files/project-without-phpcs/foo/test.php')
AssertEqual
\ 'phpcs_test',
\ ale_linters#php#phpcs#GetExecutable(bufnr(''))
|