mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-30 08:04:31 +08:00
Make every test set filenames and switch directories in the same way, and fix some missing escaping for the rubocop linter
This commit is contained in:
@@ -5,15 +5,12 @@ Before:
|
||||
|
||||
let g:ale_ruby_brakeman_options = ''
|
||||
|
||||
silent! cd /testplugin/test/command_callback
|
||||
let g:dir = getcwd()
|
||||
call ale#test#SetDirectory('/testplugin/test/command_callback')
|
||||
|
||||
After:
|
||||
Restore
|
||||
|
||||
silent execute 'cd ' . fnameescape(g:dir)
|
||||
unlet! g:dir
|
||||
|
||||
call ale#test#RestoreDirectory()
|
||||
call ale#linter#Reset()
|
||||
|
||||
Execute(The brakeman command callback should detect absence of a valid Rails app):
|
||||
|
||||
@@ -1,15 +1,9 @@
|
||||
Before:
|
||||
runtime ale_linters/python/flake8.vim
|
||||
silent! execute 'cd /testplugin/test/command_callback'
|
||||
let g:dir = getcwd()
|
||||
call ale#test#SetDirectory('/testplugin/test/command_callback')
|
||||
|
||||
After:
|
||||
silent execute 'cd ' . fnameescape(g:dir)
|
||||
" Set the file to something else,
|
||||
" or we'll cause issues when running other tests
|
||||
silent file 'dummy.py'
|
||||
unlet! g:dir
|
||||
|
||||
call ale#test#RestoreDirectory()
|
||||
call ale#linter#Reset()
|
||||
let g:ale_python_flake8_executable = 'flake8'
|
||||
let g:ale_python_flake8_options = ''
|
||||
|
||||
@@ -7,17 +7,13 @@ Before:
|
||||
|
||||
runtime ale_linters/go/gometalinter.vim
|
||||
|
||||
silent! cd /testplugin/test/command_callback
|
||||
let g:dir = getcwd()
|
||||
|
||||
call ale#test#SetDirectory('/testplugin/test/command_callback')
|
||||
call ale#test#SetFilename('test.go')
|
||||
|
||||
After:
|
||||
Restore
|
||||
|
||||
silent execute 'cd ' . fnameescape(g:dir)
|
||||
unlet! g:dir
|
||||
|
||||
call ale#test#RestoreDirectory()
|
||||
call ale#linter#Reset()
|
||||
|
||||
Execute(The gometalinter callback should return the right defaults):
|
||||
|
||||
@@ -1,15 +1,9 @@
|
||||
Before:
|
||||
runtime ale_linters/python/mypy.vim
|
||||
silent! execute 'cd /testplugin/test/command_callback'
|
||||
let g:dir = getcwd()
|
||||
call ale#test#SetDirectory('/testplugin/test/command_callback')
|
||||
|
||||
After:
|
||||
silent execute 'cd ' . fnameescape(g:dir)
|
||||
" Set the file to something else,
|
||||
" or we'll cause issues when running other tests
|
||||
silent file 'dummy.py'
|
||||
unlet! g:dir
|
||||
|
||||
call ale#test#RestoreDirectory()
|
||||
call ale#linter#Reset()
|
||||
let g:ale_python_mypy_executable = 'mypy'
|
||||
let g:ale_python_mypy_options = ''
|
||||
|
||||
@@ -7,17 +7,14 @@ Before:
|
||||
let g:ale_pug_puglint_executable = 'pug-lint'
|
||||
let g:ale_pug_puglint_use_global = 0
|
||||
|
||||
silent! cd /testplugin/test/command_callback
|
||||
let g:dir = getcwd()
|
||||
call ale#test#SetDirectory('/testplugin/test/command_callback')
|
||||
|
||||
runtime ale_linters/pug/puglint.vim
|
||||
|
||||
After:
|
||||
Restore
|
||||
|
||||
silent execute 'cd ' . fnameescape(g:dir)
|
||||
unlet! g:dir
|
||||
|
||||
call ale#test#RestoreDirectory()
|
||||
call ale#linter#Reset()
|
||||
|
||||
Execute(puglint should detect local executables and package.json):
|
||||
|
||||
@@ -1,16 +1,11 @@
|
||||
Before:
|
||||
runtime ale_linters/python/pylint.vim
|
||||
silent! execute 'cd /testplugin/test/command_callback'
|
||||
let g:dir = getcwd()
|
||||
call ale#test#SetDirectory('/testplugin/test/command_callback')
|
||||
|
||||
let b:command_tail = ' --output-format text --msg-template="{path}:{line}:{column}: {msg_id} ({symbol}) {msg}" --reports n %s'
|
||||
|
||||
After:
|
||||
silent execute 'cd ' . fnameescape(g:dir)
|
||||
" Set the file to something else,
|
||||
" or we'll cause issues when running other tests
|
||||
silent file 'dummy.py'
|
||||
unlet! g:dir
|
||||
|
||||
call ale#test#RestoreDirectory()
|
||||
call ale#linter#Reset()
|
||||
let g:ale_python_pylint_executable = 'pylint'
|
||||
let g:ale_python_pylint_options = ''
|
||||
|
||||
@@ -1,19 +1,33 @@
|
||||
Before:
|
||||
Save g:ale_ruby_rubocop_executable
|
||||
|
||||
let g:ale_ruby_rubocop_executable = 'rubocop'
|
||||
|
||||
runtime ale_linters/ruby/rubocop.vim
|
||||
call ale#test#SetDirectory('/testplugin/test/command_callback')
|
||||
call ale#test#SetFilename('dummy.rb')
|
||||
|
||||
After:
|
||||
Restore
|
||||
|
||||
call ale#test#RestoreDirectory()
|
||||
|
||||
Execute(Executable should default to rubocop):
|
||||
AssertEqual
|
||||
\ '''rubocop'' --format json --force-exclusion --stdin ''dummy.py''',
|
||||
\ '''rubocop'' --format json --force-exclusion --stdin '
|
||||
\ . ale#Escape(g:dir . '/dummy.rb'),
|
||||
\ ale_linters#ruby#rubocop#GetCommand(bufnr(''))
|
||||
|
||||
Execute(Should be able to set a custom executable):
|
||||
let g:ale_ruby_rubocop_executable = 'bin/rubocop'
|
||||
AssertEqual
|
||||
\ '''bin/rubocop'' --format json --force-exclusion --stdin ''dummy.py''',
|
||||
\ '''bin/rubocop'' --format json --force-exclusion --stdin '
|
||||
\ . ale#Escape(g:dir . '/dummy.rb'),
|
||||
\ ale_linters#ruby#rubocop#GetCommand(bufnr(''))
|
||||
|
||||
Execute(Setting bundle appends 'exec rubocop'):
|
||||
let g:ale_ruby_rubocop_executable = 'path to/bundle'
|
||||
AssertEqual
|
||||
\ '''path to/bundle'' exec rubocop --format json --force-exclusion --stdin ''dummy.py''',
|
||||
\ '''path to/bundle'' exec rubocop --format json --force-exclusion --stdin '
|
||||
\ . ale#Escape(g:dir . '/dummy.rb'),
|
||||
\ ale_linters#ruby#rubocop#GetCommand(bufnr(''))
|
||||
|
||||
Reference in New Issue
Block a user