ale/test/handler/test_gometalinter_handler.vader
Sander van Harmelen 455793dfd9 Improve performance when using gometalinter (#566)
* Improve performance when using gometalinter

Before this change when I opened a big project that had 6000+ warnings/errors it took ages to get the actual warnings/errors and it caused my CPU to be busy for quite some time. The call to gometalinter alone took about 24 seconds, but after that vim was struggling as well.

After this change the gometalinter call just takes 2 seconds and nothing noticable happens with the CPU and/or vim.

* Removed obsolete test

This logic is no longer done by the `ale` plugin, but by `gometalinter` itself.
2017-05-20 11:43:28 +01:00

54 lines
1.6 KiB
Plaintext

Before:
runtime ale_linters/go/gometalinter.vim
After:
call ale#linter#Reset()
Execute (The gometalinter 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',
\ 'warning',
\ 'expected ''package'', found ''IDENT'' gibberish (staticcheck)',
\ ],
\ [
\ 'C:\something\file with spaces.go',
\ '37',
\ '5',
\ 'error',
\ 'expected ''package'', found ''IDENT'' gibberish (golint)',
\ ],
\ ],
\ map(ale_linters#go#gometalinter#GetMatches([
\ 'C:\something\file with spaces.go:12:3:warning: expected ''package'', found ''IDENT'' gibberish (staticcheck)',
\ 'C:\something\file with spaces.go:37:5:error: expected ''package'', found ''IDENT'' gibberish (golint)',
\ ]), 'v:val[1:5]')
Execute (The gometalinter handler should handle relative paths correctly):
silent file /foo/bar/baz.go
AssertEqual
\ [
\ {
\ 'lnum': 12,
\ 'col': 3,
\ 'text': 'expected ''package'', found ''IDENT'' gibberish (staticcheck)',
\ 'type': 'W',
\ },
\ {
\ 'lnum': 37,
\ 'col': 5,
\ 'text': 'expected ''package'', found ''IDENT'' gibberish (golint)',
\ 'type': 'E',
\ },
\ ],
\ ale_linters#go#gometalinter#Handler(bufnr(''), [
\ 'baz.go:12:3:warning: expected ''package'', found ''IDENT'' gibberish (staticcheck)',
\ 'baz.go:37:5:error: expected ''package'', found ''IDENT'' gibberish (golint)',
\ ])