ale/test/test_phpcs_executable_detection.vader
Eric Stern ab534c2995 Support project's local phpcs installation (#666)
* Use locally-installed PHPCS if available

* Add author

* Add configuration options

* Escape executable

* Add tests
2017-06-21 21:35:40 +01:00

46 lines
1.0 KiB
Plaintext

Before:
let g:ale_php_phpcs_executable = 'phpcs_test'
silent! cd /testplugin/test
let g:dir = getcwd()
runtime ale_linters/php/phpcs.vim
After:
let g:ale_php_phpcs_executable = 'phpcs'
let g:ale_php_phpcs_use_global = 0
silent execute 'cd ' . g:dir
unlet! g:dir
call ale#linter#Reset()
Execute(project with phpcs should use local by default):
silent noautocmd new phpcs-test-files/project-with-phpcs/vendor/bin/phpcs
AssertEqual
\ g:dir . '/phpcs-test-files/project-with-phpcs/vendor/bin/phpcs',
\ ale_linters#php#phpcs#GetExecutable(bufnr(''))
:q
Execute(use-global should override local detection):
let g:ale_php_phpcs_use_global = 1
silent noautocmd new phpcs-test-files/project-with-phpcs/vendor/bin/phpcs
AssertEqual
\ 'phpcs_test',
\ ale_linters#php#phpcs#GetExecutable(bufnr(''))
:q
Execute(project without phpcs should use global):
silent noautocmd new phpcs-test-files/project-without-phpcs/vendor/bin/phpcs
AssertEqual
\ 'phpcs_test',
\ ale_linters#php#phpcs#GetExecutable(bufnr(''))
:q