mirror of
https://github.com/dense-analysis/ale.git
synced 2026-02-07 10:21:05 +08:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
15
test/command_callback/test_bashate_command_callback.vader
Normal file
15
test/command_callback/test_bashate_command_callback.vader
Normal file
@@ -0,0 +1,15 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('sh', 'bashate')
|
||||
call ale#test#SetFilename('test.sh')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The default bashate command should be correct):
|
||||
AssertLinter 'bashate', ale#Escape('bashate') . ' %t'
|
||||
|
||||
Execute(The bashate command should accept options):
|
||||
let b:ale_sh_bashate_options = '-i E310 --max-line-length 100'
|
||||
|
||||
AssertLinter 'bashate',
|
||||
\ ale#Escape('bashate') . ' -i E310 --max-line-length 100 %t'
|
||||
@@ -20,11 +20,11 @@ Execute(The checkstyle executable should be configurable):
|
||||
\ . ' %s'
|
||||
|
||||
Execute(Custom options should be supported):
|
||||
let b:ale_java_checkstyle_options = '--foobar'
|
||||
let b:ale_java_checkstyle_options = '--foobar -cp -classpath /path/to/checkstyle-8.7-all.jar'
|
||||
|
||||
AssertLinter 'checkstyle',
|
||||
\ ale#Escape('checkstyle')
|
||||
\ . ' --foobar'
|
||||
\ . ' --foobar -cp -classpath /path/to/checkstyle-8.7-all.jar'
|
||||
\ . ' -c ' . ale#Escape('/google_checks.xml')
|
||||
\ . ' %s'
|
||||
|
||||
|
||||
15
test/command_callback/test_zig_zls_callbacks.vader
Normal file
15
test/command_callback/test_zig_zls_callbacks.vader
Normal file
@@ -0,0 +1,15 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('zig', 'zls')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The default executable path should be correct):
|
||||
AssertLinter 'zls', ale#Escape('zls')
|
||||
|
||||
Execute(The project root should be detected correctly):
|
||||
AssertLSPProject ''
|
||||
|
||||
call ale#test#SetFilename('zig-zls-project/main.zig')
|
||||
|
||||
AssertLSPProject ale#path#Simplify(g:dir . '/zig-zls-project')
|
||||
0
test/command_callback/zig-zls-project/build.zig
Normal file
0
test/command_callback/zig-zls-project/build.zig
Normal file
0
test/eslint-test-files/react-app/subdir-with-package-json/node_modules/.gitkeep
generated
vendored
Normal file
0
test/eslint-test-files/react-app/subdir-with-package-json/node_modules/.gitkeep
generated
vendored
Normal file
@@ -21,9 +21,8 @@ Execute(The ktlint callback should return the correct default values):
|
||||
AssertEqual
|
||||
\ {
|
||||
\ 'command': ale#Escape('xxxinvalid')
|
||||
\ . ' %t'
|
||||
\ . ' --stdin'
|
||||
\ . ' --format',
|
||||
\ 'read_temporary_file': 1,
|
||||
\ },
|
||||
\ ale#fixers#ktlint#Fix(bufnr(''))
|
||||
|
||||
@@ -37,8 +36,7 @@ Execute(The ktlint callback should include custom ktlint options):
|
||||
\ 'command': ale#Escape('xxxinvalid')
|
||||
\ . ' ' . g:ale_kotlin_ktlint_options
|
||||
\ . ' --ruleset /path/to/custom/ruleset.jar'
|
||||
\ . ' %t'
|
||||
\ . ' --stdin'
|
||||
\ . ' --format',
|
||||
\ 'read_temporary_file': 1,
|
||||
\ },
|
||||
\ ale#fixers#ktlint#Fix(bufnr(''))
|
||||
|
||||
36
test/handler/test_bashate_handler.vader
Normal file
36
test/handler/test_bashate_handler.vader
Normal file
@@ -0,0 +1,36 @@
|
||||
Before:
|
||||
runtime ale_linters/sh/bashate.vim
|
||||
|
||||
After:
|
||||
call ale#linter#Reset()
|
||||
|
||||
Execute(The bashate handler should handle basic errors):
|
||||
AssertEqual
|
||||
\ [
|
||||
\ {
|
||||
\ 'lnum': 777,
|
||||
\ 'col': 1,
|
||||
\ 'text': 'E003 Indent not multiple of 4',
|
||||
\ },
|
||||
\ {
|
||||
\ 'lnum': 783,
|
||||
\ 'col': 1,
|
||||
\ 'text': 'E020 Function declaration not in format ^function name {$',
|
||||
\ },
|
||||
\ {
|
||||
\ 'lnum': 786,
|
||||
\ 'col': 1,
|
||||
\ 'text': 'E010 The "do" should be on same line as for',
|
||||
\ },
|
||||
\ {
|
||||
\ 'lnum': 791,
|
||||
\ 'col': 1,
|
||||
\ 'text': 'E006 Line too long',
|
||||
\ },
|
||||
\ ],
|
||||
\ ale_linters#sh#bashate#Handle(bufnr(''), [
|
||||
\ 'run:777:1: E003 Indent not multiple of 4',
|
||||
\ 'run:783:1: E020 Function declaration not in format ^function name {$',
|
||||
\ 'run:786:1: E010 The "do" should be on same line as for',
|
||||
\ 'run:791:1: E006 Line too long',
|
||||
\ ])
|
||||
@@ -49,3 +49,29 @@ Execute(The puppet handler should parse lines and column correctly):
|
||||
\ "Error: Could not parse for environment production: Syntax error at ':' at C:/puppet/modules/nginx/manifests/init.pp:54:9",
|
||||
\ "Error: Could not parse for environment production: Syntax error at 'parameter1' (file: /tmp/modules/mariadb/manifests/slave.pp, line: 45, column: 12)",
|
||||
\ ])
|
||||
|
||||
Execute(The puppet handler should correctly parse errors that are reported before even trying to parse for an environment):
|
||||
" Line Error
|
||||
AssertEqual
|
||||
\ [
|
||||
\ {
|
||||
\ 'lnum': 5,
|
||||
\ 'col': 11,
|
||||
\ 'text': "Illegal attempt to assign to 'a Name'. Not an assignable reference"
|
||||
\ },
|
||||
\ ],
|
||||
\ ale_linters#puppet#puppet#Handle(255, [
|
||||
\ "Error: Illegal attempt to assign to 'a Name'. Not an assignable reference (file: /tmp/modules/waffles/manifests/syrup.pp, line: 5, column: 11)",
|
||||
\ ])
|
||||
Execute(The puppet handler should parse lines when end of input is the location):
|
||||
AssertEqual
|
||||
\ [
|
||||
\ {
|
||||
\ 'lnum': 0,
|
||||
\ 'col': 0,
|
||||
\ 'text': "Syntax error at end of input"
|
||||
\ },
|
||||
\ ],
|
||||
\ ale_linters#puppet#puppet#Handle(255, [
|
||||
\ "Error: Could not parse for environment production: Syntax error at end of input (file: /tmp//modules/test/manifests/init.pp)",
|
||||
\ ])
|
||||
|
||||
@@ -70,6 +70,25 @@ Execute(eslint.js executables should be run with node on Windows):
|
||||
\ ale#handlers#eslint#GetCommand(bufnr(''))
|
||||
endif
|
||||
|
||||
Execute(eslint.js should be run from containing project with eslint):
|
||||
call ale#test#SetFilename('eslint-test-files/react-app/subdir-with-package-json/testfile.js')
|
||||
|
||||
" We have to execute the file with node.
|
||||
if has('win32')
|
||||
AssertEqual
|
||||
\ ale#path#CdString(ale#path#Simplify(g:dir . '/eslint-test-files/react-app'))
|
||||
\ . ale#Escape('node.exe') . ' '
|
||||
\ . ale#Escape(ale#path#Simplify(g:dir . '/eslint-test-files/react-app/node_modules/eslint/bin/eslint.js'))
|
||||
\ . ' -f json --stdin --stdin-filename %s',
|
||||
\ ale#handlers#eslint#GetCommand(bufnr(''))
|
||||
else
|
||||
AssertEqual
|
||||
\ ale#path#CdString(ale#path#Simplify(g:dir . '/eslint-test-files/react-app'))
|
||||
\ . ale#Escape(ale#path#Simplify(g:dir . '/eslint-test-files/react-app/node_modules/eslint/bin/eslint.js'))
|
||||
\ . ' -f json --stdin --stdin-filename %s',
|
||||
\ ale#handlers#eslint#GetCommand(bufnr(''))
|
||||
endif
|
||||
|
||||
Execute(eslint.js executables can be run outside project dir):
|
||||
" Set filename above eslint-test-files (which contains node_modules)
|
||||
call ale#test#SetFilename('testfile.js')
|
||||
|
||||
Reference in New Issue
Block a user