Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Bartek thindil Jasicki
2020-07-24 10:38:29 +02:00
25 changed files with 315 additions and 39 deletions

View File

@@ -52,7 +52,7 @@ endfunction
function! ale_linters#java#checkstyle#GetCommand(buffer) abort function! ale_linters#java#checkstyle#GetCommand(buffer) abort
let l:options = ale#Var(a:buffer, 'java_checkstyle_options') let l:options = ale#Var(a:buffer, 'java_checkstyle_options')
let l:config_option = ale#Var(a:buffer, 'java_checkstyle_config') let l:config_option = ale#Var(a:buffer, 'java_checkstyle_config')
let l:config = l:options !~# '\v(^| )-c' && !empty(l:config_option) let l:config = l:options !~# '\v(^| )-c ' && !empty(l:config_option)
\ ? s:GetConfig(a:buffer, l:config_option) \ ? s:GetConfig(a:buffer, l:config_option)
\ : '' \ : ''

View File

@@ -20,25 +20,32 @@ endfunction
function! ale_linters#java#eclipselsp#JarPath(buffer) abort function! ale_linters#java#eclipselsp#JarPath(buffer) abort
let l:path = ale_linters#java#eclipselsp#TargetPath(a:buffer) let l:path = ale_linters#java#eclipselsp#TargetPath(a:buffer)
" Search jar file within repository path when manually built using mvn if has('win32')
let l:repo_path = l:path . '/org.eclipse.jdt.ls.product/target/repository' let l:platform = 'win32'
let l:files = globpath(l:repo_path, '**/plugins/org.eclipse.equinox.launcher_\d\.\d\.\d\d\d\.*\.jar', 1, 1) elseif has('macunix')
let l:platform = 'macosx'
else
let l:platform = 'linux'
endif
if len(l:files) == 1 " Search jar file within repository path when manually built using mvn
let l:files = globpath(l:path, '**/'.l:platform.'/**/plugins/org.eclipse.equinox.launcher_\d\.\d\.\d\d\d\.*\.jar', 1, 1)
if len(l:files) > 1
return l:files[0] return l:files[0]
endif endif
" Search jar file within VSCode extensions folder. " Search jar file within VSCode extensions folder.
let l:files = globpath(l:path, '**/plugins/org.eclipse.equinox.launcher_\d\.\d\.\d\d\d\.*\.jar', 1, 1) let l:files = globpath(l:path, '**/'.l:platform.'/plugins/org.eclipse.equinox.launcher_\d\.\d\.\d\d\d\.*\.jar', 1, 1)
if len(l:files) == 1 if len(l:files) > 1
return l:files[0] return l:files[0]
endif endif
" Search jar file within system package path " Search jar file within system package path
let l:files = globpath('/usr/share/java/jdtls/plugins', 'org.eclipse.equinox.launcher_\d\.\d\.\d\d\d\.*\.jar', 1, 1) let l:files = globpath('/usr/share/java/jdtls/plugins', 'org.eclipse.equinox.launcher_\d\.\d\.\d\d\d\.*\.jar', 1, 1)
if len(l:files) == 1 if len(l:files) > 1
return l:files[0] return l:files[0]
endif endif
@@ -166,7 +173,8 @@ function! ale_linters#java#eclipselsp#RunWithVersionCheck(buffer) abort
return ale#command#Run( return ale#command#Run(
\ a:buffer, \ a:buffer,
\ l:command, \ l:command,
\ function('ale_linters#java#eclipselsp#CommandWithVersion') \ function('ale_linters#java#eclipselsp#CommandWithVersion'),
\ { 'output_stream': 'both' }
\) \)
endfunction endfunction

View File

@@ -6,5 +6,5 @@ call ale#linter#Define('kotlin', {
\ 'executable': 'ktlint', \ 'executable': 'ktlint',
\ 'command': function('ale#handlers#ktlint#GetCommand'), \ 'command': function('ale#handlers#ktlint#GetCommand'),
\ 'callback': 'ale#handlers#ktlint#Handle', \ 'callback': 'ale#handlers#ktlint#Handle',
\ 'lint_file': 1 \ 'output_stream': 'stderr'
\}) \})

View File

@@ -8,13 +8,15 @@ function! ale_linters#puppet#puppet#Handle(buffer, lines) abort
" Error: Could not parse for environment production: Syntax error at ':' at /root/puppetcode/modules/nginx/manifests/init.pp:43:12 " Error: Could not parse for environment production: Syntax error at ':' at /root/puppetcode/modules/nginx/manifests/init.pp:43:12
" Error: Could not parse for environment production: Syntax error at '='; expected '}' at /root/puppetcode/modules/pancakes/manifests/init.pp:5" " Error: Could not parse for environment production: Syntax error at '='; expected '}' at /root/puppetcode/modules/pancakes/manifests/init.pp:5"
" Error: Could not parse for environment production: Syntax error at 'parameter1' (file: /tmp/modules/mariadb/manifests/slave.pp, line: 4, column: 5) " Error: Could not parse for environment production: Syntax error at 'parameter1' (file: /tmp/modules/mariadb/manifests/slave.pp, line: 4, column: 5)
let l:pattern = '^Error: .*: \(.\+\) \((file:\|at\) .\+\.pp\(, line: \|:\)\(\d\+\)\(, column: \|:\)\=\(\d*\)' " Error: Illegal attempt to assign to 'a Name'. Not an assignable reference (file: /tmp/modules/waffles/manifests/syrup.pp, line: 5, column: 11)
" Error: Could not parse for environment production: Syntax error at end of input (file: /tmp/modules/bob/manifests/init.pp)
let l:pattern = '^Error:\%(.*:\)\? \(.\+\) \((file:\|at\) .\+\.pp\(\(, line: \|:\)\(\d\+\)\(, column: \|:\)\=\(\d*\)\|)$\)'
let l:output = [] let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:pattern) for l:match in ale#util#GetMatches(a:lines, l:pattern)
call add(l:output, { call add(l:output, {
\ 'lnum': l:match[4] + 0, \ 'lnum': l:match[5] + 0,
\ 'col': l:match[6] + 0, \ 'col': l:match[7] + 0,
\ 'text': l:match[1], \ 'text': l:match[1],
\}) \})
endfor endfor

View File

@@ -0,0 +1,43 @@
" Author: hsanson <hsanson@gmail.com>
" Description: Lints sh files using bashate
" URL: https://github.com/openstack/bashate
call ale#Set('sh_bashate_executable', 'bashate')
call ale#Set('sh_bashate_options', '')
function! ale_linters#sh#bashate#GetExecutable(buffer) abort
return ale#Var(a:buffer, 'sh_bashate_executable')
endfunction
function! ale_linters#sh#bashate#GetCommand(buffer) abort
let l:options = ale#Var(a:buffer, 'sh_bashate_options')
let l:executable = ale_linters#sh#bashate#GetExecutable(a:buffer)
return ale#Escape(l:executable) . ' ' . l:options . ' ' . '%t'
endfunction
function! ale_linters#sh#bashate#Handle(buffer, lines) abort
" Matches patterns line the following:
"
" /path/to/script/file:694:1: E003 Indent not multiple of 4
let l:pattern = ':\(\d\+\):\(\d\+\): \(.*\)$'
let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:pattern)
call add(l:output, {
\ 'lnum': str2nr(l:match[1]),
\ 'col': str2nr(l:match[2]),
\ 'text': l:match[3],
\})
endfor
return l:output
endfunction
call ale#linter#Define('sh', {
\ 'name': 'bashate',
\ 'output_stream': 'stdout',
\ 'executable': function('ale_linters#sh#bashate#GetExecutable'),
\ 'command': function('ale_linters#sh#bashate#GetCommand'),
\ 'callback': 'ale_linters#sh#bashate#Handle',
\})

20
ale_linters/zig/zls.vim Normal file
View File

@@ -0,0 +1,20 @@
" Author: CherryMan <skipper308@hotmail.ca>
" Description: A language server for Zig
call ale#Set('zig_zls_executable', 'zls')
call ale#Set('zig_zls_config', {})
function! ale_linters#zig#zls#GetProjectRoot(buffer) abort
let l:build_rs = ale#path#FindNearestFile(a:buffer, 'build.zig')
return !empty(l:build_rs) ? fnamemodify(l:build_rs, ':h') : ''
endfunction
call ale#linter#Define('zig', {
\ 'name': 'zls',
\ 'lsp': 'stdio',
\ 'lsp_config': {b -> ale#Var(b, 'zig_zls_config')},
\ 'executable': {b -> ale#Var(b, 'zig_zls_executable')},
\ 'command': '%e',
\ 'project_root': function('ale_linters#zig#zls#GetProjectRoot'),
\})

View File

@@ -3,7 +3,6 @@
function! ale#fixers#ktlint#Fix(buffer) abort function! ale#fixers#ktlint#Fix(buffer) abort
return { return {
\ 'command': ale#handlers#ktlint#GetCommand(a:buffer) . ' --format', \ 'command': ale#handlers#ktlint#GetCommand(a:buffer) . ' --format'
\ 'read_temporary_file': 1,
\} \}
endfunction endfunction

View File

@@ -1,6 +1,11 @@
" 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:executables = [
\ 'node_modules/.bin/eslint_d',
\ 'node_modules/eslint/bin/eslint.js',
\ 'node_modules/.bin/eslint',
\]
let s:sep = has('win32') ? '\' : '/' let s:sep = has('win32') ? '\' : '/'
call ale#Set('javascript_eslint_options', '') call ale#Set('javascript_eslint_options', '')
@@ -30,11 +35,7 @@ function! ale#handlers#eslint#FindConfig(buffer) abort
endfunction endfunction
function! ale#handlers#eslint#GetExecutable(buffer) abort function! ale#handlers#eslint#GetExecutable(buffer) abort
return ale#node#FindExecutable(a:buffer, 'javascript_eslint', [ return ale#node#FindExecutable(a:buffer, 'javascript_eslint', s:executables)
\ 'node_modules/.bin/eslint_d',
\ 'node_modules/eslint/bin/eslint.js',
\ 'node_modules/.bin/eslint',
\])
endfunction endfunction
" Given a buffer, return a command prefix string which changes directory " Given a buffer, return a command prefix string which changes directory
@@ -44,10 +45,19 @@ function! ale#handlers#eslint#GetCdString(buffer) abort
" By default, the project root is simply the CWD of the running process. " By default, the project root is simply the CWD of the running process.
" https://github.com/eslint/rfcs/blob/master/designs/2018-simplified-package-loading/README.md " https://github.com/eslint/rfcs/blob/master/designs/2018-simplified-package-loading/README.md
" https://github.com/dense-analysis/ale/issues/2787 " https://github.com/dense-analysis/ale/issues/2787
" Identify project root from presence of node_modules dir. "
" If eslint is installed in a directory which contains the buffer, assume
" it is the ESLint project root. Otherwise, use nearest node_modules.
" Note: If node_modules not present yet, can't load local deps anyway. " Note: If node_modules not present yet, can't load local deps anyway.
let l:modules_dir = ale#path#FindNearestDirectory(a:buffer, 'node_modules') let l:executable = ale#node#FindNearestExecutable(a:buffer, s:executables)
let l:project_dir = !empty(l:modules_dir) ? fnamemodify(l:modules_dir, ':h:h') : ''
if !empty(l:executable)
let l:nmi = strridx(l:executable, 'node_modules')
let l:project_dir = l:executable[0:l:nmi - 2]
else
let l:modules_dir = ale#path#FindNearestDirectory(a:buffer, 'node_modules')
let l:project_dir = !empty(l:modules_dir) ? fnamemodify(l:modules_dir, ':h:h') : ''
endif
return !empty(l:project_dir) ? ale#path#CdString(l:project_dir) : '' return !empty(l:project_dir) ? ale#path#CdString(l:project_dir) : ''
endfunction endfunction

View File

@@ -13,7 +13,7 @@ function! ale#handlers#ktlint#GetCommand(buffer) abort
return ale#Escape(l:executable) return ale#Escape(l:executable)
\ . (empty(l:options) ? '' : ' ' . l:options) \ . (empty(l:options) ? '' : ' ' . l:options)
\ . (empty(l:rulesets) ? '' : ' ' . l:rulesets) \ . (empty(l:rulesets) ? '' : ' ' . l:rulesets)
\ . ' %t' \ . ' --stdin'
endfunction endfunction
function! ale#handlers#ktlint#GetRulesets(buffer) abort function! ale#handlers#ktlint#GetRulesets(buffer) abort

View File

@@ -12,6 +12,18 @@ function! ale#node#FindExecutable(buffer, base_var_name, path_list) abort
return ale#Var(a:buffer, a:base_var_name . '_executable') return ale#Var(a:buffer, a:base_var_name . '_executable')
endif endif
let l:nearest = ale#node#FindNearestExecutable(a:buffer, a:path_list)
if !empty(l:nearest)
return l:nearest
endif
return ale#Var(a:buffer, a:base_var_name . '_executable')
endfunction
" Given a buffer number, a base variable name, and a list of paths to search
" for in ancestor directories, detect the executable path for a Node program.
function! ale#node#FindNearestExecutable(buffer, path_list) abort
for l:path in a:path_list for l:path in a:path_list
let l:executable = ale#path#FindNearestFile(a:buffer, l:path) let l:executable = ale#path#FindNearestFile(a:buffer, l:path)
@@ -20,7 +32,7 @@ function! ale#node#FindExecutable(buffer, base_var_name, path_list) abort
endif endif
endfor endfor
return ale#Var(a:buffer, a:base_var_name . '_executable') return ''
endfunction endfunction
" Create a executable string which executes a Node.js script command with a " Create a executable string which executes a Node.js script command with a

View File

@@ -131,18 +131,26 @@ javalsp *ale-java-javalsp*
To enable Java LSP linter you need to download and build the vscode-javac To enable Java LSP linter you need to download and build the vscode-javac
language server from https://github.com/georgewfraser/java-language-server. language server from https://github.com/georgewfraser/java-language-server.
Simply download the source code and then build a distribution:
scripts/link_mac.sh Before building the language server you need to install pre-requisites: npm,
maven, and protobuf. You also need to have Java 13 and JAVA_HOME properly
set.
or After downloading the source code and installing all pre-requisites you can
build the language server with the included build.sh script:
scripts/link_windows.sh scripts/build.sh
This generates a dist/mac or dist/windows directory that contains the This will create launch scripts for Linux, Mac, and Windows in the dist folder
language server. To let ALE use this language server you need to set the within the repo:
- lang_server_linux.sh
- lang_server_mac.sh
- lang_server_windows.sh
To let ALE use this language server you need to set the
g:ale_java_javalsp_executable variable to the absolute path of the launcher g:ale_java_javalsp_executable variable to the absolute path of the launcher
executable in this directory. executable for your platform.
g:ale_java_javalsp_executable *g:ale_java_javalsp_executable* g:ale_java_javalsp_executable *g:ale_java_javalsp_executable*
*b:ale_java_javalsp_executable* *b:ale_java_javalsp_executable*
@@ -152,7 +160,7 @@ g:ale_java_javalsp_executable *g:ale_java_javalsp_executable*
This variable must be set to the absolute path of the language server launcher This variable must be set to the absolute path of the language server launcher
executable. For example: executable. For example:
> >
let g:ale_java_javalsp_executable=/java-language-server/dist/mac/bin/launcher let g:ale_java_javalsp_executable=/java-language-server/dist/lang_server_linux.sh
< <
g:ale_java_javalsp_config *g:ale_java_javalsp_config* g:ale_java_javalsp_config *g:ale_java_javalsp_config*

View File

@@ -2,6 +2,29 @@
ALE Shell Integration *ale-sh-options* ALE Shell Integration *ale-sh-options*
===============================================================================
bashate *ale-sh-bashate*
g:ale_sh_bashate_executable *g:ale_sh_bashate_executable*
*b:ale_sh_bashate_executable*
Type: |String|
Default: `'bashate'`
This variable sets executable used for bashate.
g:ale_sh_bashate_options *g:ale_sh_bashate_options*
*b:ale_sh_bashate_options*
Type: |String|
Default: `''`
With this variable we are able to pass extra arguments for bashate. For
example to ignore the indentation rule:
>
let g:ale_sh_shellcheck_options = '-i E003'
<
=============================================================================== ===============================================================================
sh-language-server *ale-sh-language-server* sh-language-server *ale-sh-language-server*

View File

@@ -32,6 +32,7 @@ Notes:
* Awk * Awk
* `gawk` * `gawk`
* Bash * Bash
* `bashate`
* `language-server` * `language-server`
* `shell` (-n flag) * `shell` (-n flag)
* `shellcheck` * `shellcheck`
@@ -511,3 +512,5 @@ Notes:
* `yamllint` * `yamllint`
* YANG * YANG
* `yang-lsp` * `yang-lsp`
* Zig
* `zls`

33
doc/ale-zig.txt Normal file
View File

@@ -0,0 +1,33 @@
===============================================================================
ALE Zig Integration *ale-zig-options*
*ale-integration-zig*
===============================================================================
Integration Information
Currently, the only supported linter for zig is zls.
===============================================================================
zls *ale-zig-zls*
g:ale_zig_zls_executable *g:ale_zig_zls_executable*
*b:ale_zig_zls_executable*
Type: |String|
Default: `'zls'`
This variable can be modified to change the executable path for `zls`.
g:ale_zig_zls_config *g:ale_zig_zls_config*
*b:ale_zig_zls_config*
Type: |Dictionary|
Default: `{}`
WARNING: As of writing, zls does not support receiving configuration
from the client. This variable is a PLACEHOLDER until it does.
Dictionary with configuration settings for zls.
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View File

@@ -2601,6 +2601,7 @@ documented in additional help files.
sasslint..............................|ale-scss-sasslint| sasslint..............................|ale-scss-sasslint|
stylelint.............................|ale-scss-stylelint| stylelint.............................|ale-scss-stylelint|
sh......................................|ale-sh-options| sh......................................|ale-sh-options|
bashate...............................|ale-sh-bashate|
sh-language-server....................|ale-sh-language-server| sh-language-server....................|ale-sh-language-server|
shell.................................|ale-sh-shell| shell.................................|ale-sh-shell|
shellcheck............................|ale-sh-shellcheck| shellcheck............................|ale-sh-shellcheck|
@@ -2677,6 +2678,8 @@ documented in additional help files.
yamllint..............................|ale-yaml-yamllint| yamllint..............................|ale-yaml-yamllint|
yang....................................|ale-yang-options| yang....................................|ale-yang-options|
yang-lsp..............................|ale-yang-lsp| yang-lsp..............................|ale-yang-lsp|
zig.....................................|ale-zig-options|
zls...................................|ale-zig-zls|
=============================================================================== ===============================================================================

View File

@@ -41,6 +41,7 @@ formatting.
* Awk * Awk
* [gawk](https://www.gnu.org/software/gawk/) * [gawk](https://www.gnu.org/software/gawk/)
* Bash * Bash
* [bashate](https://github.com/openstack/bashate)
* [language-server](https://github.com/mads-hartmann/bash-language-server) * [language-server](https://github.com/mads-hartmann/bash-language-server)
* shell [-n flag](https://www.gnu.org/software/bash/manual/bash.html#index-set) * shell [-n flag](https://www.gnu.org/software/bash/manual/bash.html#index-set)
* [shellcheck](https://www.shellcheck.net/) * [shellcheck](https://www.shellcheck.net/)
@@ -520,3 +521,5 @@ formatting.
* [yamllint](https://yamllint.readthedocs.io/) * [yamllint](https://yamllint.readthedocs.io/)
* YANG * YANG
* [yang-lsp](https://github.com/theia-ide/yang-lsp) * [yang-lsp](https://github.com/theia-ide/yang-lsp)
* Zig
* [zls](https://github.com/zigtools/zls)

View 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'

View File

@@ -20,11 +20,11 @@ Execute(The checkstyle executable should be configurable):
\ . ' %s' \ . ' %s'
Execute(Custom options should be supported): 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', AssertLinter 'checkstyle',
\ ale#Escape('checkstyle') \ ale#Escape('checkstyle')
\ . ' --foobar' \ . ' --foobar -cp -classpath /path/to/checkstyle-8.7-all.jar'
\ . ' -c ' . ale#Escape('/google_checks.xml') \ . ' -c ' . ale#Escape('/google_checks.xml')
\ . ' %s' \ . ' %s'

View 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')

View File

@@ -21,9 +21,8 @@ Execute(The ktlint callback should return the correct default values):
AssertEqual AssertEqual
\ { \ {
\ 'command': ale#Escape('xxxinvalid') \ 'command': ale#Escape('xxxinvalid')
\ . ' %t' \ . ' --stdin'
\ . ' --format', \ . ' --format',
\ 'read_temporary_file': 1,
\ }, \ },
\ ale#fixers#ktlint#Fix(bufnr('')) \ ale#fixers#ktlint#Fix(bufnr(''))
@@ -37,8 +36,7 @@ Execute(The ktlint callback should include custom ktlint options):
\ 'command': ale#Escape('xxxinvalid') \ 'command': ale#Escape('xxxinvalid')
\ . ' ' . g:ale_kotlin_ktlint_options \ . ' ' . g:ale_kotlin_ktlint_options
\ . ' --ruleset /path/to/custom/ruleset.jar' \ . ' --ruleset /path/to/custom/ruleset.jar'
\ . ' %t' \ . ' --stdin'
\ . ' --format', \ . ' --format',
\ 'read_temporary_file': 1,
\ }, \ },
\ ale#fixers#ktlint#Fix(bufnr('')) \ ale#fixers#ktlint#Fix(bufnr(''))

View 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',
\ ])

View File

@@ -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 ':' 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)", \ "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)",
\ ])

View File

@@ -70,6 +70,25 @@ Execute(eslint.js executables should be run with node on Windows):
\ ale#handlers#eslint#GetCommand(bufnr('')) \ ale#handlers#eslint#GetCommand(bufnr(''))
endif 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): Execute(eslint.js executables can be run outside project dir):
" Set filename above eslint-test-files (which contains node_modules) " Set filename above eslint-test-files (which contains node_modules)
call ale#test#SetFilename('testfile.js') call ale#test#SetFilename('testfile.js')