Get fixer tests to work on Windows
This commit is contained in:
parent
638ca42082
commit
5091e2de45
@ -12,7 +12,7 @@ function! ale#fixers#autopep8#Fix(buffer) abort
|
|||||||
\ ['autopep8'],
|
\ ['autopep8'],
|
||||||
\)
|
\)
|
||||||
|
|
||||||
if !executable(l:executable)
|
if !ale#python#IsExecutable(l:executable)
|
||||||
return 0
|
return 0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ function! ale#fixers#isort#Fix(buffer) abort
|
|||||||
\ ['isort'],
|
\ ['isort'],
|
||||||
\)
|
\)
|
||||||
|
|
||||||
if !executable(l:executable)
|
if !ale#python#IsExecutable(l:executable)
|
||||||
return 0
|
return 0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
" Author: Sumner Evans <sumner.evans98@gmail.com>
|
" Author: Sumner Evans <sumner.evans98@gmail.com>
|
||||||
" Description: Fixing files with Standard.
|
" Description: Fixing files with Standard.
|
||||||
|
|
||||||
|
call ale#Set('javascript_standard_executable', 'standard')
|
||||||
|
call ale#Set('javascript_standard_use_global', 0)
|
||||||
|
call ale#Set('javascript_standard_options', '')
|
||||||
|
|
||||||
function! ale#fixers#standard#GetExecutable(buffer) abort
|
function! ale#fixers#standard#GetExecutable(buffer) abort
|
||||||
return ale#node#FindExecutable(a:buffer, 'javascript_standard', [
|
return ale#node#FindExecutable(a:buffer, 'javascript_standard', [
|
||||||
\ 'node_modules/standard/bin/cmd.js',
|
\ 'node_modules/standard/bin/cmd.js',
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
" Author: w0rp <devw0rp@gmail.com>
|
" Author: w0rp <devw0rp@gmail.com>
|
||||||
" Description: Functions for working with eslint, for checking or fixing files.
|
" Description: Functions for working with eslint, for checking or fixing files.
|
||||||
|
|
||||||
|
let s:sep = has('win32') ? '\' : '/'
|
||||||
|
|
||||||
call ale#Set('javascript_eslint_options', '')
|
call ale#Set('javascript_eslint_options', '')
|
||||||
call ale#Set('javascript_eslint_executable', 'eslint')
|
call ale#Set('javascript_eslint_executable', 'eslint')
|
||||||
call ale#Set('javascript_eslint_use_global', 0)
|
call ale#Set('javascript_eslint_use_global', 0)
|
||||||
@ -15,7 +17,7 @@ function! ale#handlers#eslint#FindConfig(buffer) abort
|
|||||||
\ '.eslintrc.json',
|
\ '.eslintrc.json',
|
||||||
\ '.eslintrc',
|
\ '.eslintrc',
|
||||||
\]
|
\]
|
||||||
let l:config = ale#path#Simplify(l:path . '/' . l:basename)
|
let l:config = ale#path#Simplify(join([l:path, l:basename], s:sep))
|
||||||
|
|
||||||
if filereadable(l:config)
|
if filereadable(l:config)
|
||||||
return l:config
|
return l:config
|
||||||
|
@ -11,9 +11,13 @@ Before:
|
|||||||
silent cd command_callback
|
silent cd command_callback
|
||||||
let g:dir = getcwd()
|
let g:dir = getcwd()
|
||||||
|
|
||||||
|
let b:bin_dir = has('win32') ? 'Scripts' : 'bin'
|
||||||
|
|
||||||
After:
|
After:
|
||||||
Restore
|
Restore
|
||||||
|
|
||||||
|
unlet! b:bin_dir
|
||||||
|
|
||||||
call ale#test#RestoreDirectory()
|
call ale#test#RestoreDirectory()
|
||||||
|
|
||||||
Execute(The autopep8 callback should return the correct default values):
|
Execute(The autopep8 callback should return the correct default values):
|
||||||
@ -23,7 +27,7 @@ Execute(The autopep8 callback should return the correct default values):
|
|||||||
|
|
||||||
silent execute 'file ' . fnameescape(g:dir . '/python_paths/with_virtualenv/subdir/foo/bar.py')
|
silent execute 'file ' . fnameescape(g:dir . '/python_paths/with_virtualenv/subdir/foo/bar.py')
|
||||||
AssertEqual
|
AssertEqual
|
||||||
\ {'command': "'" . g:dir . "/python_paths/with_virtualenv/env/bin/autopep8' -" },
|
\ {'command': ale#Escape(ale#path#Winify(g:dir . '/python_paths/with_virtualenv/env/' . b:bin_dir . '/autopep8')) . ' -'},
|
||||||
\ ale#fixers#autopep8#Fix(bufnr(''))
|
\ ale#fixers#autopep8#Fix(bufnr(''))
|
||||||
|
|
||||||
Execute(The autopep8 callback should include options):
|
Execute(The autopep8 callback should include options):
|
||||||
@ -31,5 +35,5 @@ Execute(The autopep8 callback should include options):
|
|||||||
|
|
||||||
silent execute 'file ' . fnameescape(g:dir . '/python_paths/with_virtualenv/subdir/foo/bar.py')
|
silent execute 'file ' . fnameescape(g:dir . '/python_paths/with_virtualenv/subdir/foo/bar.py')
|
||||||
AssertEqual
|
AssertEqual
|
||||||
\ {'command': "'" . g:dir . "/python_paths/with_virtualenv/env/bin/autopep8' --some-option -" },
|
\ {'command': ale#Escape(ale#path#Winify(g:dir . '/python_paths/with_virtualenv/env/' . b:bin_dir . '/autopep8')) . ' --some-option -' },
|
||||||
\ ale#fixers#autopep8#Fix(bufnr(''))
|
\ ale#fixers#autopep8#Fix(bufnr(''))
|
||||||
|
@ -15,7 +15,7 @@ Execute(The elm-format command should have default params):
|
|||||||
\ {
|
\ {
|
||||||
\ 'read_temporary_file': 1,
|
\ 'read_temporary_file': 1,
|
||||||
\ 'command':
|
\ 'command':
|
||||||
\ ale#Escape(simplify(g:dir . '/../elm-test-files/node_modules/.bin/elm-format'))
|
\ ale#Escape(ale#path#Winify(g:dir . '/../elm-test-files/node_modules/.bin/elm-format'))
|
||||||
\ . ' %t --yes',
|
\ . ' %t --yes',
|
||||||
\ },
|
\ },
|
||||||
\ ale#fixers#format#Fix(bufnr(''))
|
\ ale#fixers#format#Fix(bufnr(''))
|
||||||
@ -55,7 +55,7 @@ Execute(The elm-format command should manage empty options):
|
|||||||
\ {
|
\ {
|
||||||
\ 'read_temporary_file': 1,
|
\ 'read_temporary_file': 1,
|
||||||
\ 'command':
|
\ 'command':
|
||||||
\ ale#Escape(simplify(g:dir . '/../elm-test-files/node_modules/.bin/elm-format'))
|
\ ale#Escape(ale#path#Winify(g:dir . '/../elm-test-files/node_modules/.bin/elm-format'))
|
||||||
\ . ' %t',
|
\ . ' %t',
|
||||||
\ },
|
\ },
|
||||||
\ ale#fixers#format#Fix(bufnr(''))
|
\ ale#fixers#format#Fix(bufnr(''))
|
||||||
@ -68,8 +68,7 @@ Execute(The elm-format command should manage custom options):
|
|||||||
\ {
|
\ {
|
||||||
\ 'read_temporary_file': 1,
|
\ 'read_temporary_file': 1,
|
||||||
\ 'command':
|
\ 'command':
|
||||||
\ ale#Escape(simplify(g:dir . '/../elm-test-files/node_modules/.bin/elm-format'))
|
\ ale#Escape(ale#path#Winify(g:dir . '/../elm-test-files/node_modules/.bin/elm-format'))
|
||||||
\ . ' %t --param1 --param2',
|
\ . ' %t --param1 --param2',
|
||||||
\ },
|
\ },
|
||||||
\ ale#fixers#format#Fix(bufnr(''))
|
\ ale#fixers#format#Fix(bufnr(''))
|
||||||
|
|
||||||
|
@ -2,18 +2,17 @@ Before:
|
|||||||
call ale#test#SetDirectory('/testplugin/test/fixers')
|
call ale#test#SetDirectory('/testplugin/test/fixers')
|
||||||
|
|
||||||
After:
|
After:
|
||||||
let g:ale_has_override = {}
|
|
||||||
call ale#test#RestoreDirectory()
|
call ale#test#RestoreDirectory()
|
||||||
|
|
||||||
Execute(The path to eslint.js should be run on Unix):
|
Execute(The executable path should be correct):
|
||||||
call ale#test#SetFilename('../eslint-test-files/react-app/subdir/testfile.js')
|
call ale#test#SetFilename('../eslint-test-files/react-app/subdir/testfile.js')
|
||||||
|
|
||||||
AssertEqual
|
AssertEqual
|
||||||
\ {
|
\ {
|
||||||
\ 'read_temporary_file': 1,
|
\ 'read_temporary_file': 1,
|
||||||
\ 'command':
|
\ 'command': (has('win32') ? 'node.exe ' : '')
|
||||||
\ ale#Escape(simplify(g:dir . '/../eslint-test-files/react-app/node_modules/eslint/bin/eslint.js'))
|
\ . ale#Escape(ale#path#Winify(g:dir . '/../eslint-test-files/react-app/node_modules/eslint/bin/eslint.js'))
|
||||||
\ . ' -c ' . ale#Escape(simplify(g:dir . '/../eslint-test-files/react-app/.eslintrc.js'))
|
\ . ' -c ' . ale#Escape(ale#path#Winify(g:dir . '/../eslint-test-files/react-app/.eslintrc.js'))
|
||||||
\ . ' --fix %t',
|
\ . ' --fix %t',
|
||||||
\ },
|
\ },
|
||||||
\ ale#fixers#eslint#Fix(bufnr(''))
|
\ ale#fixers#eslint#Fix(bufnr(''))
|
||||||
@ -24,9 +23,9 @@ Execute(The lower priority configuration file in a nested directory should be pr
|
|||||||
AssertEqual
|
AssertEqual
|
||||||
\ {
|
\ {
|
||||||
\ 'read_temporary_file': 1,
|
\ 'read_temporary_file': 1,
|
||||||
\ 'command':
|
\ 'command': (has('win32') ? 'node.exe ' : '')
|
||||||
\ ale#Escape(simplify(g:dir . '/../eslint-test-files/react-app/node_modules/eslint/bin/eslint.js'))
|
\ . ale#Escape(ale#path#Winify(g:dir . '/../eslint-test-files/react-app/node_modules/eslint/bin/eslint.js'))
|
||||||
\ . ' -c ' . ale#Escape(simplify(g:dir . '/../eslint-test-files/react-app/subdir-with-config/.eslintrc'))
|
\ . ' -c ' . ale#Escape(ale#path#Winify(g:dir . '/../eslint-test-files/react-app/subdir-with-config/.eslintrc'))
|
||||||
\ . ' --fix %t',
|
\ . ' --fix %t',
|
||||||
\ },
|
\ },
|
||||||
\ ale#fixers#eslint#Fix(bufnr(''))
|
\ ale#fixers#eslint#Fix(bufnr(''))
|
||||||
@ -37,9 +36,9 @@ Execute(package.json should be used as a last resort):
|
|||||||
AssertEqual
|
AssertEqual
|
||||||
\ {
|
\ {
|
||||||
\ 'read_temporary_file': 1,
|
\ 'read_temporary_file': 1,
|
||||||
\ 'command':
|
\ 'command': (has('win32') ? 'node.exe ' : '')
|
||||||
\ ale#Escape(simplify(g:dir . '/../eslint-test-files/react-app/node_modules/eslint/bin/eslint.js'))
|
\ . ale#Escape(ale#path#Winify(g:dir . '/../eslint-test-files/react-app/node_modules/eslint/bin/eslint.js'))
|
||||||
\ . ' -c ' . ale#Escape(simplify(g:dir . '/../eslint-test-files/react-app/.eslintrc.js'))
|
\ . ' -c ' . ale#Escape(ale#path#Winify(g:dir . '/../eslint-test-files/react-app/.eslintrc.js'))
|
||||||
\ . ' --fix %t',
|
\ . ' --fix %t',
|
||||||
\ },
|
\ },
|
||||||
\ ale#fixers#eslint#Fix(bufnr(''))
|
\ ale#fixers#eslint#Fix(bufnr(''))
|
||||||
@ -50,8 +49,8 @@ Execute(package.json should be used as a last resort):
|
|||||||
\ {
|
\ {
|
||||||
\ 'read_temporary_file': 1,
|
\ 'read_temporary_file': 1,
|
||||||
\ 'command':
|
\ 'command':
|
||||||
\ ale#Escape(simplify(g:dir . '/../eslint-test-files/node_modules/.bin/eslint'))
|
\ ale#Escape(ale#path#Winify(g:dir . '/../eslint-test-files/node_modules/.bin/eslint'))
|
||||||
\ . ' -c ' . ale#Escape(simplify(g:dir . '/../eslint-test-files/package.json'))
|
\ . ' -c ' . ale#Escape(ale#path#Winify(g:dir . '/../eslint-test-files/package.json'))
|
||||||
\ . ' --fix %t',
|
\ . ' --fix %t',
|
||||||
\ },
|
\ },
|
||||||
\ ale#fixers#eslint#Fix(bufnr(''))
|
\ ale#fixers#eslint#Fix(bufnr(''))
|
||||||
|
@ -9,9 +9,13 @@ Before:
|
|||||||
silent cd command_callback
|
silent cd command_callback
|
||||||
let g:dir = getcwd()
|
let g:dir = getcwd()
|
||||||
|
|
||||||
|
let b:bin_dir = has('win32') ? 'Scripts' : 'bin'
|
||||||
|
|
||||||
After:
|
After:
|
||||||
Restore
|
Restore
|
||||||
|
|
||||||
|
unlet! b:bin_dir
|
||||||
|
|
||||||
call ale#test#RestoreDirectory()
|
call ale#test#RestoreDirectory()
|
||||||
|
|
||||||
Execute(The isort callback should return the correct default values):
|
Execute(The isort callback should return the correct default values):
|
||||||
@ -21,5 +25,5 @@ Execute(The isort callback should return the correct default values):
|
|||||||
|
|
||||||
silent execute 'file ' . fnameescape(g:dir . '/python_paths/with_virtualenv/subdir/foo/bar.py')
|
silent execute 'file ' . fnameescape(g:dir . '/python_paths/with_virtualenv/subdir/foo/bar.py')
|
||||||
AssertEqual
|
AssertEqual
|
||||||
\ {'command': "'" . g:dir . "/python_paths/with_virtualenv/env/bin/isort' -" },
|
\ {'command': ale#Escape(ale#path#Winify(g:dir . '/python_paths/with_virtualenv/env/' . b:bin_dir . '/isort')) . ' -' },
|
||||||
\ ale#fixers#isort#Fix(bufnr(''))
|
\ ale#fixers#isort#Fix(bufnr(''))
|
||||||
|
@ -21,7 +21,7 @@ Execute(project with phpcbf should use local by default):
|
|||||||
call ale#test#SetFilename('php_paths/project-with-phpcbf/foo/test.php')
|
call ale#test#SetFilename('php_paths/project-with-phpcbf/foo/test.php')
|
||||||
|
|
||||||
AssertEqual
|
AssertEqual
|
||||||
\ g:dir . '/php_paths/project-with-phpcbf/vendor/bin/phpcbf',
|
\ ale#path#Winify(g:dir . '/php_paths/project-with-phpcbf/vendor/bin/phpcbf'),
|
||||||
\ ale#fixers#phpcbf#GetExecutable(bufnr(''))
|
\ ale#fixers#phpcbf#GetExecutable(bufnr(''))
|
||||||
|
|
||||||
Execute(use-global should override local detection):
|
Execute(use-global should override local detection):
|
||||||
@ -43,7 +43,7 @@ Execute(The phpcbf callback should return the correct default values):
|
|||||||
call ale#test#SetFilename('php_paths/project-with-phpcbf/foo/test.php')
|
call ale#test#SetFilename('php_paths/project-with-phpcbf/foo/test.php')
|
||||||
|
|
||||||
AssertEqual
|
AssertEqual
|
||||||
\ {'command': ale#Escape(g:dir . '/php_paths/project-with-phpcbf/vendor/bin/phpcbf') . ' --stdin-path=%s ' },
|
\ {'command': ale#Escape(ale#path#Winify(g:dir . '/php_paths/project-with-phpcbf/vendor/bin/phpcbf')) . ' --stdin-path=%s ' },
|
||||||
\ ale#fixers#phpcbf#Fix(bufnr(''))
|
\ ale#fixers#phpcbf#Fix(bufnr(''))
|
||||||
|
|
||||||
Execute(The phpcbf callback should include the phpcbf_standard option):
|
Execute(The phpcbf callback should include the phpcbf_standard option):
|
||||||
@ -51,6 +51,62 @@ Execute(The phpcbf callback should include the phpcbf_standard option):
|
|||||||
call ale#test#SetFilename('php_paths/project-with-phpcbf/foo/test.php')
|
call ale#test#SetFilename('php_paths/project-with-phpcbf/foo/test.php')
|
||||||
|
|
||||||
AssertEqual
|
AssertEqual
|
||||||
\ {'command': ale#Escape(g:dir . '/php_paths/project-with-phpcbf/vendor/bin/phpcbf') . ' --stdin-path=%s ' . '--standard=phpcbf_ruleset.xml'},
|
\ {'command': ale#Escape(ale#path#Winify(g:dir . '/php_paths/project-with-phpcbf/vendor/bin/phpcbf')) . ' --stdin-path=%s ' . '--standard=phpcbf_ruleset.xml'},
|
||||||
|
\ ale#fixers#phpcbf#Fix(bufnr(''))
|
||||||
|
|
||||||
|
Before:
|
||||||
|
Save g:ale_php_phpcbf_executable
|
||||||
|
Save g:ale_php_phpcbf_standard
|
||||||
|
Save g:ale_php_phpcbf_use_global
|
||||||
|
|
||||||
|
let g:ale_php_phpcbf_executable = 'phpcbf_test'
|
||||||
|
let g:ale_php_phpcbf_standard = ''
|
||||||
|
let g:ale_php_phpcbf_use_global = 0
|
||||||
|
|
||||||
|
call ale#test#SetDirectory('/testplugin/test/fixers')
|
||||||
|
silent cd ..
|
||||||
|
silent cd command_callback
|
||||||
|
let g:dir = getcwd()
|
||||||
|
|
||||||
|
After:
|
||||||
|
Restore
|
||||||
|
|
||||||
|
call ale#test#RestoreDirectory()
|
||||||
|
|
||||||
|
Execute(project with phpcbf should use local by default):
|
||||||
|
call ale#test#SetFilename('php_paths/project-with-phpcbf/foo/test.php')
|
||||||
|
|
||||||
|
AssertEqual
|
||||||
|
\ ale#path#Winify(g:dir . '/php_paths/project-with-phpcbf/vendor/bin/phpcbf'),
|
||||||
|
\ ale#fixers#phpcbf#GetExecutable(bufnr(''))
|
||||||
|
|
||||||
|
Execute(use-global should override local detection):
|
||||||
|
let g:ale_php_phpcbf_use_global = 1
|
||||||
|
call ale#test#SetFilename('php_paths/project-with-phpcbf/foo/test.php')
|
||||||
|
|
||||||
|
AssertEqual
|
||||||
|
\ 'phpcbf_test',
|
||||||
|
\ ale#fixers#phpcbf#GetExecutable(bufnr(''))
|
||||||
|
|
||||||
|
Execute(project without phpcbf should use global):
|
||||||
|
call ale#test#SetFilename('php_paths/project-without-phpcbf/foo/test.php')
|
||||||
|
|
||||||
|
AssertEqual
|
||||||
|
\ 'phpcbf_test',
|
||||||
|
\ ale#fixers#phpcbf#GetExecutable(bufnr(''))
|
||||||
|
|
||||||
|
Execute(The phpcbf callback should return the correct default values):
|
||||||
|
call ale#test#SetFilename('php_paths/project-with-phpcbf/foo/test.php')
|
||||||
|
|
||||||
|
AssertEqual
|
||||||
|
\ {'command': ale#Escape(ale#path#Winify(g:dir . '/php_paths/project-with-phpcbf/vendor/bin/phpcbf')) . ' --stdin-path=%s ' },
|
||||||
|
\ ale#fixers#phpcbf#Fix(bufnr(''))
|
||||||
|
|
||||||
|
Execute(The phpcbf callback should include the phpcbf_standard option):
|
||||||
|
let g:ale_php_phpcbf_standard = 'phpcbf_ruleset.xml'
|
||||||
|
call ale#test#SetFilename('php_paths/project-with-phpcbf/foo/test.php')
|
||||||
|
|
||||||
|
AssertEqual
|
||||||
|
\ {'command': ale#Escape(ale#path#Winify(g:dir . '/php_paths/project-with-phpcbf/vendor/bin/phpcbf')) . ' --stdin-path=%s ' . '--standard=phpcbf_ruleset.xml'},
|
||||||
\ ale#fixers#phpcbf#Fix(bufnr(''))
|
\ ale#fixers#phpcbf#Fix(bufnr(''))
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ Execute(Configuration files should be detected):
|
|||||||
\ 'command':
|
\ 'command':
|
||||||
\ ale#Escape('prettier-eslint')
|
\ ale#Escape('prettier-eslint')
|
||||||
\ . ' %t'
|
\ . ' %t'
|
||||||
\ . ' --eslint-config-path ' . ale#Escape(g:dir . '/eslint-test-files/react-app/.eslintrc.js')
|
\ . ' --eslint-config-path ' . ale#Escape(ale#path#Winify(g:dir . '/eslint-test-files/react-app/.eslintrc.js'))
|
||||||
\ . ' --write'
|
\ . ' --write'
|
||||||
\ },
|
\ },
|
||||||
\ ale#fixers#prettier_eslint#Fix(bufnr(''))
|
\ ale#fixers#prettier_eslint#Fix(bufnr(''))
|
||||||
|
@ -39,7 +39,7 @@ Execute(The prettier callback should include configuration files when the option
|
|||||||
\ 'command': ale#Escape(g:ale_javascript_prettier_executable)
|
\ 'command': ale#Escape(g:ale_javascript_prettier_executable)
|
||||||
\ . ' %t'
|
\ . ' %t'
|
||||||
\ . ' --parser babylon'
|
\ . ' --parser babylon'
|
||||||
\ . ' --config ' . ale#Escape(simplify(g:dir . '/../prettier-test-files/with_config/.prettierrc'))
|
\ . ' --config ' . ale#Escape(ale#path#Winify(g:dir . '/../prettier-test-files/with_config/.prettierrc'))
|
||||||
\ . ' --write',
|
\ . ' --write',
|
||||||
\ },
|
\ },
|
||||||
\ ale#fixers#prettier#Fix(bufnr(''))
|
\ ale#fixers#prettier#Fix(bufnr(''))
|
||||||
@ -54,7 +54,7 @@ Execute(The prettier callback should include custom prettier options):
|
|||||||
\ 'command': ale#Escape(g:ale_javascript_prettier_executable)
|
\ 'command': ale#Escape(g:ale_javascript_prettier_executable)
|
||||||
\ . ' %t'
|
\ . ' %t'
|
||||||
\ . ' --no-semi --parser babylon'
|
\ . ' --no-semi --parser babylon'
|
||||||
\ . ' --config ' . ale#Escape(simplify(g:dir . '/../prettier-test-files/with_config/.prettierrc'))
|
\ . ' --config ' . ale#Escape(ale#path#Winify(g:dir . '/../prettier-test-files/with_config/.prettierrc'))
|
||||||
\ . ' --write',
|
\ . ' --write',
|
||||||
\ },
|
\ },
|
||||||
\ ale#fixers#prettier#Fix(bufnr(''))
|
\ ale#fixers#prettier#Fix(bufnr(''))
|
||||||
|
@ -21,7 +21,7 @@ Execute(The puppetlint callback should return the correct default values):
|
|||||||
|
|
||||||
AssertEqual
|
AssertEqual
|
||||||
\ {'read_temporary_file': 1,
|
\ {'read_temporary_file': 1,
|
||||||
\ 'command': "'" . g:ale_puppet_puppetlint_executable . "'"
|
\ 'command': ale#Escape(g:ale_puppet_puppetlint_executable)
|
||||||
\ . ' ' . g:ale_puppet_puppetlint_options
|
\ . ' ' . g:ale_puppet_puppetlint_options
|
||||||
\ . ' --fix %t' },
|
\ . ' --fix %t' },
|
||||||
\ ale#fixers#puppetlint#Fix(bufnr(''))
|
\ ale#fixers#puppetlint#Fix(bufnr(''))
|
||||||
|
@ -34,7 +34,7 @@ Execute(The rubocop callback should include configuration files):
|
|||||||
\ {
|
\ {
|
||||||
\ 'read_temporary_file': 1,
|
\ 'read_temporary_file': 1,
|
||||||
\ 'command': ale#Escape(g:ale_ruby_rubocop_executable)
|
\ 'command': ale#Escape(g:ale_ruby_rubocop_executable)
|
||||||
\ . ' --config ' . ale#Escape(g:dir . '/ruby_paths/with_config/.rubocop.yml')
|
\ . ' --config ' . ale#Escape(ale#path#Winify(g:dir . '/ruby_paths/with_config/.rubocop.yml'))
|
||||||
\ . ' --auto-correct %t',
|
\ . ' --auto-correct %t',
|
||||||
\ },
|
\ },
|
||||||
\ ale#fixers#rubocop#Fix(bufnr(''))
|
\ ale#fixers#rubocop#Fix(bufnr(''))
|
||||||
@ -47,7 +47,7 @@ Execute(The rubocop callback should include custom rubocop options):
|
|||||||
\ {
|
\ {
|
||||||
\ 'read_temporary_file': 1,
|
\ 'read_temporary_file': 1,
|
||||||
\ 'command': ale#Escape(g:ale_ruby_rubocop_executable)
|
\ 'command': ale#Escape(g:ale_ruby_rubocop_executable)
|
||||||
\ . ' --config ' . ale#Escape(g:dir . '/ruby_paths/with_config/.rubocop.yml')
|
\ . ' --config ' . ale#Escape(ale#path#Winify(g:dir . '/ruby_paths/with_config/.rubocop.yml'))
|
||||||
\ . ' --except Lint/Debugger'
|
\ . ' --except Lint/Debugger'
|
||||||
\ . ' --auto-correct %t',
|
\ . ' --auto-correct %t',
|
||||||
\ },
|
\ },
|
||||||
|
@ -2,31 +2,16 @@ Before:
|
|||||||
call ale#test#SetDirectory('/testplugin/test/fixers')
|
call ale#test#SetDirectory('/testplugin/test/fixers')
|
||||||
|
|
||||||
After:
|
After:
|
||||||
let g:ale_has_override = {}
|
|
||||||
call ale#test#RestoreDirectory()
|
call ale#test#RestoreDirectory()
|
||||||
|
|
||||||
Execute(The path to standard.js should be run on Unix):
|
Execute(The executable path should be correct):
|
||||||
call ale#test#SetFilename('../eslint-test-files/react-app/subdir/testfile.js')
|
call ale#test#SetFilename('../eslint-test-files/react-app/subdir/testfile.js')
|
||||||
|
|
||||||
AssertEqual
|
AssertEqual
|
||||||
\ {
|
\ {
|
||||||
\ 'read_temporary_file': 1,
|
\ 'read_temporary_file': 1,
|
||||||
\ 'command':
|
\ 'command': (has('win32') ? 'node.exe ' : '')
|
||||||
\ ale#Escape(simplify(g:dir . '/../eslint-test-files/react-app/node_modules/standard/bin/cmd.js'))
|
\ . ale#Escape(ale#path#Winify(g:dir . '/../eslint-test-files/react-app/node_modules/standard/bin/cmd.js'))
|
||||||
\ . ' --fix %t',
|
|
||||||
\ },
|
|
||||||
\ ale#fixers#standard#Fix(bufnr(''))
|
|
||||||
|
|
||||||
Execute(The standard fixer with standard.js should be run with node on Windows):
|
|
||||||
call ale#test#SetFilename('../eslint-test-files/react-app/subdir/testfile.js')
|
|
||||||
let g:ale_has_override['win32'] = 1
|
|
||||||
|
|
||||||
" We have to execute the file with node.
|
|
||||||
AssertEqual
|
|
||||||
\ {
|
|
||||||
\ 'read_temporary_file': 1,
|
|
||||||
\ 'command': ale#Escape('node.exe') . ' '
|
|
||||||
\ . ale#Escape(simplify(g:dir . '/../eslint-test-files/react-app/node_modules/standard/bin/cmd.js'))
|
|
||||||
\ . ' --fix %t',
|
\ . ' --fix %t',
|
||||||
\ },
|
\ },
|
||||||
\ ale#fixers#standard#Fix(bufnr(''))
|
\ ale#fixers#standard#Fix(bufnr(''))
|
||||||
|
@ -2,31 +2,16 @@ Before:
|
|||||||
call ale#test#SetDirectory('/testplugin/test/fixers')
|
call ale#test#SetDirectory('/testplugin/test/fixers')
|
||||||
|
|
||||||
After:
|
After:
|
||||||
let g:ale_has_override = {}
|
|
||||||
call ale#test#RestoreDirectory()
|
call ale#test#RestoreDirectory()
|
||||||
|
|
||||||
Execute(The path to stylelint.js should be run on Unix):
|
Execute(The executable path should be correct):
|
||||||
call ale#test#SetFilename('../eslint-test-files/react-app/subdir/testfile.css')
|
call ale#test#SetFilename('../eslint-test-files/react-app/subdir/testfile.css')
|
||||||
|
|
||||||
AssertEqual
|
AssertEqual
|
||||||
\ {
|
\ {
|
||||||
\ 'read_temporary_file': 1,
|
\ 'read_temporary_file': 1,
|
||||||
\ 'command':
|
\ 'command': (has('win32') ? 'node.exe ' : '')
|
||||||
\ ale#Escape(simplify(g:dir . '/../eslint-test-files/react-app/node_modules/stylelint/bin/stylelint.js'))
|
\ . ale#Escape(ale#path#Winify(g:dir . '/../eslint-test-files/react-app/node_modules/stylelint/bin/stylelint.js'))
|
||||||
\ . ' --fix %t',
|
|
||||||
\ },
|
|
||||||
\ ale#fixers#stylelint#Fix(bufnr(''))
|
|
||||||
|
|
||||||
Execute(The stylelint fixer with stylelint.js should be run with node on Windows):
|
|
||||||
call ale#test#SetFilename('../eslint-test-files/react-app/subdir/testfile.css')
|
|
||||||
let g:ale_has_override['win32'] = 1
|
|
||||||
|
|
||||||
" We have to execute the file with node.
|
|
||||||
AssertEqual
|
|
||||||
\ {
|
|
||||||
\ 'read_temporary_file': 1,
|
|
||||||
\ 'command': ale#Escape('node.exe') . ' '
|
|
||||||
\ . ale#Escape(simplify(g:dir . '/../eslint-test-files/react-app/node_modules/stylelint/bin/stylelint.js'))
|
|
||||||
\ . ' --fix %t',
|
\ . ' --fix %t',
|
||||||
\ },
|
\ },
|
||||||
\ ale#fixers#stylelint#Fix(bufnr(''))
|
\ ale#fixers#stylelint#Fix(bufnr(''))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user