summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md2
-rw-r--r--ale_linters/go/golangci_lint.vim56
-rw-r--r--ale_linters/go/langserver.vim28
-rw-r--r--ale_linters/perl/perl.vim4
-rw-r--r--autoload/ale/completion.vim4
-rw-r--r--autoload/ale/go.vim27
-rw-r--r--autoload/ale/job.vim5
-rw-r--r--autoload/ale/ruby.vim2
-rw-r--r--autoload/ale/socket.vim11
-rw-r--r--doc/ale-go.txt55
-rw-r--r--doc/ale.txt4
-rw-r--r--test/command_callback/go_paths/go1/prj1/file.go0
-rw-r--r--test/command_callback/go_paths/go2/prj2/file.go0
-rw-r--r--test/command_callback/test_golangci_lint_command_callback.vader38
-rw-r--r--test/command_callback/test_golangserver_command_callback.vader67
-rw-r--r--test/command_callback/test_ruby_solargraph.vader7
-rw-r--r--test/completion/test_completion_prefixes.vader20
-rw-r--r--test/handler/test_golangci_lint_handler.vader55
-rw-r--r--test/handler/test_perl_handler.vader5
-rw-r--r--test/ruby_fixtures/valid_ruby_app3/.solargraph.yml0
-rw-r--r--test/ruby_fixtures/valid_ruby_app3/lib/file.rb0
21 files changed, 384 insertions, 6 deletions
diff --git a/README.md b/README.md
index aefd3513..7a4c6cd4 100644
--- a/README.md
+++ b/README.md
@@ -124,7 +124,7 @@ formatting.
| FusionScript | [fusion-lint](https://github.com/RyanSquared/fusionscript) |
| Git Commit Messages | [gitlint](https://github.com/jorisroovers/gitlint) |
| GLSL | [glslang](https://github.com/KhronosGroup/glslang), [glslls](https://github.com/svenstaro/glsl-language-server) |
-| Go | [gofmt](https://golang.org/cmd/gofmt/), [goimports](https://godoc.org/golang.org/x/tools/cmd/goimports), [go vet](https://golang.org/cmd/vet/) !!, [golint](https://godoc.org/github.com/golang/lint), [gotype](https://godoc.org/golang.org/x/tools/cmd/gotype) !!, [gometalinter](https://github.com/alecthomas/gometalinter) !!, [go build](https://golang.org/cmd/go/) !!, [gosimple](https://github.com/dominikh/go-tools/tree/master/cmd/gosimple) !!, [staticcheck](https://github.com/dominikh/go-tools/tree/master/cmd/staticcheck) !! |
+| Go | [gofmt](https://golang.org/cmd/gofmt/), [goimports](https://godoc.org/golang.org/x/tools/cmd/goimports), [go vet](https://golang.org/cmd/vet/) !!, [golint](https://godoc.org/github.com/golang/lint), [gotype](https://godoc.org/golang.org/x/tools/cmd/gotype) !!, [gometalinter](https://github.com/alecthomas/gometalinter) !!, [go build](https://golang.org/cmd/go/) !!, [gosimple](https://github.com/dominikh/go-tools/tree/master/cmd/gosimple) !!, [staticcheck](https://github.com/dominikh/go-tools/tree/master/cmd/staticcheck) !!, [golangserver](https://github.com/sourcegraph/go-langserver), [golangci-lint](https://github.com/golangci/golangci-lint) !! |
| GraphQL | [eslint](http://eslint.org/), [gqlint](https://github.com/happylinks/gqlint), [prettier](https://github.com/prettier/prettier) |
| Hack | [hack](http://hacklang.org/), [hackfmt](https://github.com/facebook/hhvm/tree/master/hphp/hack/hackfmt), [hhast](https://github.com/hhvm/hhast) (disabled by default; see `:help ale-integration-hack`) |
| Haml | [haml-lint](https://github.com/brigade/haml-lint) |
diff --git a/ale_linters/go/golangci_lint.vim b/ale_linters/go/golangci_lint.vim
new file mode 100644
index 00000000..b44a6239
--- /dev/null
+++ b/ale_linters/go/golangci_lint.vim
@@ -0,0 +1,56 @@
+" Author: Sascha Grunert <mail@saschagrunert.de>
+" Description: Adds support of golangci-lint
+
+call ale#Set('go_golangci_lint_options', '--enable-all')
+call ale#Set('go_golangci_lint_executable', 'golangci-lint')
+call ale#Set('go_golangci_lint_package', 0)
+
+function! ale_linters#go#golangci_lint#GetCommand(buffer) abort
+ let l:filename = expand('#' . a:buffer . ':t')
+ let l:options = ale#Var(a:buffer, 'go_golangci_lint_options')
+ let l:lint_package = ale#Var(a:buffer, 'go_golangci_lint_package')
+
+ if l:lint_package
+ return ale#path#BufferCdString(a:buffer)
+ \ . '%e run '
+ \ . l:options
+ endif
+
+ return ale#path#BufferCdString(a:buffer)
+ \ . '%e run '
+ \ . ale#util#EscapePCRE(l:filename)
+ \ . ' ' . l:options
+endfunction
+
+function! ale_linters#go#golangci_lint#GetMatches(lines) abort
+ let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):?(\d+)?:?:?:?\s\*?(.+)$'
+
+ return ale#util#GetMatches(a:lines, l:pattern)
+endfunction
+
+function! ale_linters#go#golangci_lint#Handler(buffer, lines) abort
+ let l:dir = expand('#' . a:buffer . ':p:h')
+ let l:output = []
+
+ for l:match in ale_linters#go#golangci_lint#GetMatches(a:lines)
+ " l:match[1] will already be an absolute path, output from
+ " golangci_lint
+ call add(l:output, {
+ \ 'filename': ale#path#GetAbsPath(l:dir, l:match[1]),
+ \ 'lnum': l:match[2] + 0,
+ \ 'col': l:match[3] + 0,
+ \ 'type': 'E',
+ \ 'text': l:match[4],
+ \})
+ endfor
+
+ return l:output
+endfunction
+
+call ale#linter#Define('go', {
+\ 'name': 'golangci-lint',
+\ 'executable_callback': ale#VarFunc('go_golangci_lint_executable'),
+\ 'command_callback': 'ale_linters#go#golangci_lint#GetCommand',
+\ 'callback': 'ale_linters#go#golangci_lint#Handler',
+\ 'lint_file': 1,
+\})
diff --git a/ale_linters/go/langserver.vim b/ale_linters/go/langserver.vim
new file mode 100644
index 00000000..df956483
--- /dev/null
+++ b/ale_linters/go/langserver.vim
@@ -0,0 +1,28 @@
+" Author: Horacio Sanson <https://github.com/hsanson>
+" Description: Support for go-langserver https://github.com/sourcegraph/go-langserver
+
+call ale#Set('go_langserver_executable', 'go-langserver')
+call ale#Set('go_langserver_options', '')
+
+function! ale_linters#go#langserver#GetCommand(buffer) abort
+ let l:executable = [ale#Escape(ale#Var(a:buffer, 'go_langserver_executable'))]
+ let l:options = ale#Var(a:buffer, 'go_langserver_options')
+ let l:options = substitute(l:options, '-gocodecompletion', '', 'g')
+ let l:options = filter(split(l:options, ' '), 'empty(v:val) != 1')
+
+ if(ale#Var(a:buffer, 'completion_enabled') == 1)
+ call add(l:options, '-gocodecompletion')
+ endif
+
+ let l:options = uniq(sort(l:options))
+
+ return join(extend(l:executable, l:options), ' ')
+endfunction
+
+call ale#linter#Define('go', {
+\ 'name': 'golangserver',
+\ 'lsp': 'stdio',
+\ 'executable_callback': ale#VarFunc('go_langserver_executable'),
+\ 'command_callback': 'ale_linters#go#langserver#GetCommand',
+\ 'project_root_callback': 'ale#go#FindProjectRoot',
+\})
diff --git a/ale_linters/perl/perl.vim b/ale_linters/perl/perl.vim
index 03de77a5..1cb20fa7 100644
--- a/ale_linters/perl/perl.vim
+++ b/ale_linters/perl/perl.vim
@@ -14,6 +14,10 @@ let s:begin_failed_skip_pattern = '\v' . join([
\], '|')
function! ale_linters#perl#perl#Handle(buffer, lines) abort
+ if empty(a:lines)
+ return []
+ endif
+
let l:pattern = '\(.\+\) at \(.\+\) line \(\d\+\)'
let l:output = []
let l:basename = expand('#' . a:buffer . ':t')
diff --git a/autoload/ale/completion.vim b/autoload/ale/completion.vim
index c1736678..bded12b1 100644
--- a/autoload/ale/completion.vim
+++ b/autoload/ale/completion.vim
@@ -39,10 +39,14 @@ let s:LSP_COMPLETION_COLOR_KIND = 16
let s:LSP_COMPLETION_FILE_KIND = 17
let s:LSP_COMPLETION_REFERENCE_KIND = 18
+let s:lisp_regex = '\v[a-zA-Z_\-][a-zA-Z_\-0-9]*$'
+
" Regular expressions for checking the characters in the line before where
" the insert cursor is. If one of these matches, we'll check for completions.
let s:should_complete_map = {
\ '<default>': '\v[a-zA-Z$_][a-zA-Z$_0-9]*$|\.$',
+\ 'clojure': s:lisp_regex,
+\ 'lisp': s:lisp_regex,
\ 'typescript': '\v[a-zA-Z$_][a-zA-Z$_0-9]*$|\.$|''$|"$',
\ 'rust': '\v[a-zA-Z$_][a-zA-Z$_0-9]*$|\.$|::$',
\}
diff --git a/autoload/ale/go.vim b/autoload/ale/go.vim
new file mode 100644
index 00000000..a166480a
--- /dev/null
+++ b/autoload/ale/go.vim
@@ -0,0 +1,27 @@
+" Author: Horacio Sanson https://github.com/hsanson
+" Description: Functions for integrating with Go tools
+
+" Find the nearest dir listed in GOPATH and assume it the root of the go
+" project.
+function! ale#go#FindProjectRoot(buffer) abort
+ let l:sep = has('win32') ? ';' : ':'
+
+ let l:filename = ale#path#Simplify(expand('#' . a:buffer . ':p'))
+
+ for l:name in split($GOPATH, l:sep)
+ let l:path_dir = ale#path#Simplify(l:name)
+
+ " Use the directory from GOPATH if the current filename starts with it.
+ if l:filename[: len(l:path_dir) - 1] is? l:path_dir
+ return l:path_dir
+ endif
+ endfor
+
+ let l:default_go_path = ale#path#Simplify(expand('~/go'))
+
+ if isdirectory(l:default_go_path)
+ return l:default_go_path
+ endif
+
+ return ''
+endfunction
diff --git a/autoload/ale/job.vim b/autoload/ale/job.vim
index 1fe470f8..0117c7dd 100644
--- a/autoload/ale/job.vim
+++ b/autoload/ale/job.vim
@@ -249,6 +249,11 @@ function! ale#job#Start(command, options) abort
let l:job_options.exit_cb = function('s:VimExitCallback')
endif
+ " Use non-blocking writes for Vim versions that support the option.
+ if has('patch-8.1.350')
+ let l:job_options.noblock = 1
+ endif
+
" Vim 8 will read the stdin from the file's buffer.
let l:job_info.job = job_start(a:command, l:job_options)
let l:job_id = ale#job#ParseVim8ProcessID(string(l:job_info.job))
diff --git a/autoload/ale/ruby.vim b/autoload/ale/ruby.vim
index f0d84296..5f0aa50d 100644
--- a/autoload/ale/ruby.vim
+++ b/autoload/ale/ruby.vim
@@ -29,7 +29,7 @@ function! ale#ruby#FindProjectRoot(buffer) abort
return l:dir
endif
- for l:name in ['Rakefile', 'Gemfile']
+ for l:name in ['.solargraph.yml', 'Rakefile', 'Gemfile']
let l:dir = fnamemodify(
\ ale#path#FindNearestFile(a:buffer, l:name),
\ ':h'
diff --git a/autoload/ale/socket.vim b/autoload/ale/socket.vim
index 5ea49c7b..7e069fb5 100644
--- a/autoload/ale/socket.vim
+++ b/autoload/ale/socket.vim
@@ -55,11 +55,18 @@ function! ale#socket#Open(address, options) abort
if !has('nvim')
" Vim
- let l:channel_info.channel = ch_open(a:address, {
+ let l:channel_options = {
\ 'mode': l:mode,
\ 'waittime': 0,
\ 'callback': function('s:VimOutputCallback'),
- \})
+ \}
+
+ " Use non-blocking writes for Vim versions that support the option.
+ if has('patch-8.1.350')
+ let l:channel_options.noblock = 1
+ endif
+
+ let l:channel_info.channel = ch_open(a:address, l:channel_options)
let l:vim_info = ch_info(l:channel_info.channel)
let l:channel_id = !empty(l:vim_info) ? l:vim_info.id : -1
elseif exists('*chansend') && exists('*sockconnect')
diff --git a/doc/ale-go.txt b/doc/ale-go.txt
index baf403b7..1d55763e 100644
--- a/doc/ale-go.txt
+++ b/doc/ale-go.txt
@@ -7,7 +7,7 @@ Integration Information
The `gometalinter` linter is disabled by default. ALE enables `gofmt`,
`golint` and `go vet` by default. It also supports `staticcheck`, `go
-build` and `gosimple`.
+build`, `gosimple`, and `golangserver`.
To enable `gometalinter`, update |g:ale_linters| as appropriate:
>
@@ -115,4 +115,57 @@ g:ale_go_staticcheck_lint_package *g:ale_go_staticcheck_lint_package*
===============================================================================
+golangserver *ale-go-golangserver*
+
+g:ale_go_langserver_executable *g:ale_go_langserver_executable*
+ *b:ale_go_langserver_executable*
+ Type: |String|
+ Default: `'go-langserver'`
+
+ Location of the go-langserver binary file.
+
+g:ale_go_langserver_options *g:ale_go_langserver_options*
+ *b:ale_go_langserver_options*
+ Type: |String|
+ Default: `''`
+
+ Additional options passed to the go-langserver command. Note that the
+ `-gocodecompletion` option is ignored because it is handled automatically
+ by the |g:ale_completion_enabled| variable.
+
+
+===============================================================================
+golangci-lint *ale-go-golangci-lint*
+
+`golangci-lint` is a `lint_file` linter, which only lints files that are
+written to disk. This differs from the default behavior of linting the buffer.
+See: |ale-lint-file|
+
+g:ale_go_golangci_lint_executable *g:ale_go_golangci_lint_executable*
+ *b:ale_go_golangci_lint_executable*
+ Type: |String|
+ Default: `'golangci-lint'`
+
+ The executable that will be run for golangci-lint.
+
+
+g:ale_go_golangci_lint_options *g:ale_go_golangci_lint_options*
+ *b:ale_go_golangci_lint_options*
+ Type: |String|
+ Default: `'--enable-all'`
+
+ This variable can be changed to alter the command-line arguments to the
+ golangci-lint invocation.
+
+
+g:ale_go_golangci_lint_package *g:ale_go_golangci_lint_package*
+ *b:ale_go_golangci_lint_package*
+ Type: |Number|
+ Default: `0`
+
+ When set to `1`, the whole Go package will be checked instead of only the
+ current file.
+
+
+===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
diff --git a/doc/ale.txt b/doc/ale.txt
index 1f326bf1..983fa462 100644
--- a/doc/ale.txt
+++ b/doc/ale.txt
@@ -100,6 +100,8 @@ CONTENTS *ale-contents*
govet...............................|ale-go-govet|
gometalinter........................|ale-go-gometalinter|
staticcheck.........................|ale-go-staticcheck|
+ golangserver........................|ale-go-golangserver|
+ golangci-lint.......................|ale-go-golangci-lint|
graphql...............................|ale-graphql-options|
eslint..............................|ale-graphql-eslint|
gqlint..............................|ale-graphql-gqlint|
@@ -396,7 +398,7 @@ Notes:
* FusionScript: `fusion-lint`
* Git Commit Messages: `gitlint`
* GLSL: glslang, `glslls`
-* Go: `gofmt`, `goimports`, `go vet`!!, `golint`, `gotype`!!, `gometalinter`!!, `go build`!!, `gosimple`!!, `staticcheck`!!
+* Go: `gofmt`, `goimports`, `go vet`!!, `golint`, `gotype`!!, `gometalinter`!!, `go build`!!, `gosimple`!!, `staticcheck`!!, `golangserver`, `golangci-lint`!!
* GraphQL: `eslint`, `gqlint`, `prettier`
* Hack: `hack`, `hackfmt`, `hhast`
* Haml: `haml-lint`
diff --git a/test/command_callback/go_paths/go1/prj1/file.go b/test/command_callback/go_paths/go1/prj1/file.go
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/command_callback/go_paths/go1/prj1/file.go
diff --git a/test/command_callback/go_paths/go2/prj2/file.go b/test/command_callback/go_paths/go2/prj2/file.go
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/command_callback/go_paths/go2/prj2/file.go
diff --git a/test/command_callback/test_golangci_lint_command_callback.vader b/test/command_callback/test_golangci_lint_command_callback.vader
new file mode 100644
index 00000000..6cb73246
--- /dev/null
+++ b/test/command_callback/test_golangci_lint_command_callback.vader
@@ -0,0 +1,38 @@
+Before:
+ call ale#assert#SetUpLinterTest('go', 'golangci_lint')
+ call ale#test#SetFilename('test.go')
+
+After:
+ call ale#assert#TearDownLinterTest()
+
+Execute(The golangci-lint defaults should be correct):
+ AssertLinter 'golangci-lint',
+ \ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
+ \ . ale#Escape('golangci-lint')
+ \ . ' run ' . ale#util#EscapePCRE(expand('%' . ':t'))
+ \ . ' --enable-all'
+
+Execute(The golangci-lint callback should use a configured executable):
+ let b:ale_go_golangci_lint_executable = 'something else'
+
+ AssertLinter 'something else',
+ \ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
+ \ . ale#Escape('something else')
+ \ . ' run ' . ale#util#EscapePCRE(expand('%' . ':t'))
+ \ . ' --enable-all'
+
+Execute(The golangci-lint callback should use configured options):
+ let b:ale_go_golangci_lint_options = '--foobar'
+
+ AssertLinter 'golangci-lint',
+ \ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
+ \ . ale#Escape('golangci-lint')
+ \ . ' run ' . ale#util#EscapePCRE(expand('%' . ':t'))
+ \ . ' --foobar'
+
+Execute(The golangci-lint `lint_package` option should use the correct command):
+ let b:ale_go_golangci_lint_package = 1
+
+ AssertLinter 'golangci-lint',
+ \ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
+ \ . ale#Escape('golangci-lint') . ' run --enable-all'
diff --git a/test/command_callback/test_golangserver_command_callback.vader b/test/command_callback/test_golangserver_command_callback.vader
new file mode 100644
index 00000000..ee88e1a4
--- /dev/null
+++ b/test/command_callback/test_golangserver_command_callback.vader
@@ -0,0 +1,67 @@
+Before:
+ Save $GOPATH
+ Save g:ale_completion_enabled
+
+ let g:ale_completion_enabled = 0
+ let g:sep = has('win32') ? ';' : ':'
+
+ call ale#assert#SetUpLinterTest('go', 'langserver')
+ let $GOPATH = ale#path#Simplify(g:dir . '/go_paths/go1')
+ \ . g:sep
+ \ . ale#path#Simplify(g:dir . '/go_paths/go2')
+
+After:
+ Restore
+
+ unlet! b:ale_completion_enabled
+ unlet! g:sep
+
+ call ale#assert#TearDownLinterTest()
+
+Execute(should set correct defaults):
+ AssertLinter 'go-langserver', ale#Escape('go-langserver')
+
+Execute(should configure go-langserver callback executable):
+ let b:ale_go_langserver_executable = 'boo'
+
+ AssertLinter 'boo', ale#Escape('boo')
+
+Execute(should set go-langserver options):
+ call ale#test#SetFilename('go_paths/go1/prj1/file.go')
+ let b:ale_completion_enabled = 1
+ let b:ale_go_langserver_options = ''
+
+ AssertLinter 'go-langserver',
+ \ ale#Escape('go-langserver') . ' -gocodecompletion'
+
+ let b:ale_go_langserver_options = '-trace'
+
+ AssertLinter 'go-langserver',
+ \ ale#Escape('go-langserver') . ' -gocodecompletion -trace'
+
+Execute(should ignore go-langserver -gocodecompletion option):
+ call ale#test#SetFilename('go_paths/go1/prj1/file.go')
+
+ let b:ale_go_langserver_options = '-trace -gocodecompletion'
+ let b:ale_completion_enabled = 1
+
+ AssertLinter 'go-langserver',
+ \ ale#Escape('go-langserver') . ' -gocodecompletion -trace'
+
+ let b:ale_completion_enabled = 0
+
+ AssertLinter 'go-langserver', ale#Escape('go-langserver') . ' -trace'
+
+Execute(should set go-langserver for go app1):
+ call ale#test#SetFilename('go_paths/go1/prj1/file.go')
+
+ AssertLSPLanguage 'go'
+ AssertLSPOptions {}
+ AssertLSPProject ale#path#Simplify(g:dir . '/go_paths/go1')
+
+Execute(should set go-langserver for go app2):
+ call ale#test#SetFilename('go_paths/go2/prj1/file.go')
+
+ AssertLSPLanguage 'go'
+ AssertLSPOptions {}
+ AssertLSPProject ale#path#Simplify(g:dir . '/go_paths/go2')
diff --git a/test/command_callback/test_ruby_solargraph.vader b/test/command_callback/test_ruby_solargraph.vader
index a27cb62d..b9dd46d8 100644
--- a/test/command_callback/test_ruby_solargraph.vader
+++ b/test/command_callback/test_ruby_solargraph.vader
@@ -27,3 +27,10 @@ Execute(should set solargraph for ruby app2):
AssertLSPOptions {}
AssertLSPProject ale#path#Simplify(g:dir . 'command_callback/../ruby_fixtures/valid_ruby_app2')
AssertLSPAddress '127.0.0.1:7658'
+
+Execute(should set solargraph for ruby app3):
+ call ale#test#SetFilename('../ruby_fixtures/valid_ruby_app3/lib/file.rb')
+ AssertLSPLanguage 'ruby'
+ AssertLSPOptions {}
+ AssertLSPProject ale#path#Simplify(g:dir . 'command_callback/../ruby_fixtures/valid_ruby_app3')
+ AssertLSPAddress '127.0.0.1:7658'
diff --git a/test/completion/test_completion_prefixes.vader b/test/completion/test_completion_prefixes.vader
index 0b2cfeaf..3f2cab15 100644
--- a/test/completion/test_completion_prefixes.vader
+++ b/test/completion/test_completion_prefixes.vader
@@ -43,3 +43,23 @@ Execute(Completion should be done after words in parens in Rust):
Execute(Completion should not be done after parens in Rust):
AssertEqual '', ale#completion#GetPrefix(&filetype, 3, 15)
+
+Given lisp():
+ (minus-name
+ (full-name)
+
+Execute(Completion should be done for function names with minuses in Lisp):
+ AssertEqual 'minus-name', ale#completion#GetPrefix(&filetype, 1, 12)
+
+Execute(Completion should not be done after parens in Lisp):
+ AssertEqual '', ale#completion#GetPrefix(&filetype, 2, 12)
+
+Given clojure():
+ (minus-name
+ (full-name)
+
+Execute(Completion should be done for function names with minuses in Clojure):
+ AssertEqual 'minus-name', ale#completion#GetPrefix(&filetype, 1, 12)
+
+Execute(Completion should not be done after parens in Clojure):
+ AssertEqual '', ale#completion#GetPrefix(&filetype, 2, 12)
diff --git a/test/handler/test_golangci_lint_handler.vader b/test/handler/test_golangci_lint_handler.vader
new file mode 100644
index 00000000..fb6841f4
--- /dev/null
+++ b/test/handler/test_golangci_lint_handler.vader
@@ -0,0 +1,55 @@
+Before:
+ runtime ale_linters/go/golangci_lint.vim
+
+After:
+ call ale#linter#Reset()
+
+Execute (The golangci-lint handler should handle names with spaces):
+ " We can't test Windows paths with the path resovling on Linux, but we can
+ " test the regex.
+ AssertEqual
+ \ [
+ \ [
+ \ 'C:\something\file with spaces.go',
+ \ '12',
+ \ '3',
+ \ 'expected ''package'', found ''IDENT'' gibberish (staticcheck)',
+ \ ],
+ \ [
+ \ 'C:\something\file with spaces.go',
+ \ '37',
+ \ '5',
+ \ 'expected ''package'', found ''IDENT'' gibberish (golint)',
+ \ ],
+ \ ],
+ \ map(ale_linters#go#golangci_lint#GetMatches([
+ \ 'C:\something\file with spaces.go:12:3: expected ''package'', found ''IDENT'' gibberish (staticcheck)',
+ \ 'C:\something\file with spaces.go:37:5: expected ''package'', found ''IDENT'' gibberish (golint)',
+ \ ]), 'v:val[1:4]')
+
+Execute (The golangci-lint handler should handle paths correctly):
+ call ale#test#SetFilename('app/test.go')
+
+ let file = ale#path#GetAbsPath(expand('%:p:h'), 'test.go')
+
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 12,
+ \ 'col': 3,
+ \ 'text': 'expected ''package'', found ''IDENT'' gibberish (staticcheck)',
+ \ 'type': 'E',
+ \ 'filename': ale#path#Simplify(expand('%:p:h') . '/test.go'),
+ \ },
+ \ {
+ \ 'lnum': 37,
+ \ 'col': 5,
+ \ 'text': 'expected ''package'', found ''IDENT'' gibberish (golint)',
+ \ 'type': 'E',
+ \ 'filename': ale#path#Simplify(expand('%:p:h') . '/test.go'),
+ \ },
+ \ ],
+ \ ale_linters#go#golangci_lint#Handler(bufnr(''), [
+ \ file . ':12:3: expected ''package'', found ''IDENT'' gibberish (staticcheck)',
+ \ file . ':37:5: expected ''package'', found ''IDENT'' gibberish (golint)',
+ \ ])
diff --git a/test/handler/test_perl_handler.vader b/test/handler/test_perl_handler.vader
index c5791d76..e769550c 100644
--- a/test/handler/test_perl_handler.vader
+++ b/test/handler/test_perl_handler.vader
@@ -7,6 +7,11 @@ After:
call ale#test#RestoreDirectory()
call ale#linter#Reset()
+Execute(The Perl linter should handle empty output):
+ call ale#test#SetFilename('bar.pl')
+
+ AssertEqual [], ale_linters#perl#perl#Handle(bufnr(''), [])
+
Execute(The Perl linter should ignore errors from other files):
call ale#test#SetFilename('bar.pl')
diff --git a/test/ruby_fixtures/valid_ruby_app3/.solargraph.yml b/test/ruby_fixtures/valid_ruby_app3/.solargraph.yml
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/ruby_fixtures/valid_ruby_app3/.solargraph.yml
diff --git a/test/ruby_fixtures/valid_ruby_app3/lib/file.rb b/test/ruby_fixtures/valid_ruby_app3/lib/file.rb
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/ruby_fixtures/valid_ruby_app3/lib/file.rb