mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-07 13:14:29 +08:00
Support project's local phpcs installation (#666)
* Use locally-installed PHPCS if available * Add author * Add configuration options * Escape executable * Add tests
This commit is contained in:
45
test/test_phpcs_executable_detection.vader
Normal file
45
test/test_phpcs_executable_detection.vader
Normal file
@@ -0,0 +1,45 @@
|
||||
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
|
||||
Reference in New Issue
Block a user