Fix #518 Fix handling of spaces in filenames for various linters

This commit is contained in:
w0rp
2017-04-29 17:33:18 +01:00
parent cbb01e32b9
commit 0b4acd6453
10 changed files with 200 additions and 48 deletions

View File

@@ -40,6 +40,20 @@ Execute (HandlePEP8Format should handle the correct lines of output):
\ "test.yml:35: [EANSIBLE0002] Trailing whitespace",
\ ])
Execute (HandlePEP8Format should handle names with spaces):
AssertEqual
\ [
\ {
\ 'lnum': 6,
\ 'col': 6,
\ 'type': 'E',
\ 'text': 'E111: indentation is not a multiple of four',
\ },
\ ],
\ ale#handlers#python#HandlePEP8Format(42, [
\ 'C:\something\with spaces.py:6:6: E111 indentation is not a multiple of four',
\ ])
Execute (HandleGCCFormat should handle the correct lines of output):
AssertEqual
\ [
@@ -122,6 +136,20 @@ Execute (HandleUnixFormatAsError should handle lines with no space after the col
\ 'some_file.xyz:53:10:bar',
\ ])
Execute (HandleUnixFormatAsError should handle names with spaces):
AssertEqual
\ [
\ {
\ 'lnum': 13,
\ 'col': 90,
\ 'type': 'E',
\ 'text': 'leonard.exclamation.30ppm More than 30 ppm of exclamations. Keep them under control.',
\ },
\ ],
\ ale#handlers#unix#HandleAsError(42, [
\ '/Users/rrj/Notes/Astro/Taurus December SM.txt:13:90: leonard.exclamation.30ppm More than 30 ppm of exclamations. Keep them under control.',
\ ])
Execute (HandleUnixFormatAsWarning should handle some example lines of output):
AssertEqual
\ [

View File

@@ -0,0 +1,44 @@
Before:
runtime ale_linters/go/gobuild.vim
After:
call ale#linter#Reset()
Execute (The gobuild 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',
\ '27',
\ '',
\ 'missing argument for Printf("%s"): format reads arg 2, have only 1 args',
\ ],
\ [
\ 'C:\something\file with spaces.go',
\ '5',
\ '2',
\ 'expected declaration, found ''STRING'' "log"',
\ ],
\ ],
\ map(ale_linters#go#gobuild#GetMatches([
\ 'C:\something\file with spaces.go:27: missing argument for Printf("%s"): format reads arg 2, have only 1 args',
\ 'C:\something\file with spaces.go:5:2: expected declaration, found ''STRING'' "log"',
\ ]), 'v:val[1:4]')
Execute (The gobuild handler should handle relative paths correctly):
:file! /foo/bar/baz.go
AssertEqual
\ [
\ {
\ 'lnum': 27,
\ 'col': 0,
\ 'text': 'missing argument for Printf("%s"): format reads arg 2, have only 1 args',
\ 'type': 'E',
\ },
\ ],
\ ale_linters#go#gobuild#Handler(42, [
\ 'baz.go:27: missing argument for Printf("%s"): format reads arg 2, have only 1 args',
\ ])

View File

@@ -0,0 +1,53 @@
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):
: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(42, [
\ 'baz.go:12:3:warning: expected ''package'', found ''IDENT'' gibberish (staticcheck)',
\ 'baz.go:37:5:error: expected ''package'', found ''IDENT'' gibberish (golint)',
\ ])

View File

@@ -1,6 +1,10 @@
Execute(The mypy handler should parse lines correctly):
Before:
runtime ale_linters/python/mypy.vim
After:
call ale#linter#Reset()
Execute(The mypy handler should parse lines correctly):
AssertEqual
\ [
\ {
@@ -22,5 +26,16 @@ Execute(The mypy handler should parse lines correctly):
\ "file.py:40:5: error: Some other problem",
\ ])
After:
call ale#linter#Reset()
Execute(The mypy handler should handle Windows names with spaces):
AssertEqual
\ [
\ {
\ 'lnum': 4,
\ 'col': 0,
\ 'text': "No library stub file for module 'django.db'",
\ 'type': 'E',
\ },
\ ],
\ ale_linters#python#mypy#Handle(347, [
\ "C:\something\with spaces.py:4: error: No library stub file for module 'django.db'",
\ ])