Compare commits
4 commits
Author | SHA1 | Date | |
---|---|---|---|
|
97b410bbba | ||
|
78b05d30a5 | ||
|
6f6c156995 | ||
|
62a45f8ae4 |
7 changed files with 163 additions and 3 deletions
1
.gitattributes
vendored
1
.gitattributes
vendored
|
@ -5,3 +5,4 @@
|
||||||
/README.md export-ignore
|
/README.md export-ignore
|
||||||
/img export-ignore
|
/img export-ignore
|
||||||
/test export-ignore
|
/test export-ignore
|
||||||
|
/custom-checks export-ignore
|
||||||
|
|
|
@ -12,7 +12,7 @@ function! ale_linters#fortran#gcc#Handle(buffer, lines) abort
|
||||||
"
|
"
|
||||||
" :21.34:
|
" :21.34:
|
||||||
" Error: Expected comma in I/O list at (1)
|
" Error: Expected comma in I/O list at (1)
|
||||||
let l:line_marker_pattern = '^:\(\d\+\)\.\(\d\+\):$'
|
let l:line_marker_pattern = ':\(\d\+\)[.:]\=\(\d\+\)\=:\=$'
|
||||||
let l:message_pattern = '^\(Error\|Warning\): \(.\+\)$'
|
let l:message_pattern = '^\(Error\|Warning\): \(.\+\)$'
|
||||||
let l:looking_for_message = 0
|
let l:looking_for_message = 0
|
||||||
let l:last_loclist_obj = {}
|
let l:last_loclist_obj = {}
|
||||||
|
|
|
@ -7,7 +7,7 @@ function! ale_linters#typescript#typecheck#Handle(buffer, lines) abort
|
||||||
" hello.ts[7, 41]: Property 'a' does not exist on type 'A'
|
" hello.ts[7, 41]: Property 'a' does not exist on type 'A'
|
||||||
" hello.ts[16, 7]: Type 'A' is not assignable to type 'B'
|
" hello.ts[16, 7]: Type 'A' is not assignable to type 'B'
|
||||||
"
|
"
|
||||||
let l:pattern = '.\+.ts\[\(\d\+\), \(\d\+\)\]: \(.\+\)'
|
let l:pattern = '.\+\.ts\[\(\d\+\), \(\d\+\)\]: \(.\+\)'
|
||||||
let l:output = []
|
let l:output = []
|
||||||
|
|
||||||
for l:line in a:lines
|
for l:line in a:lines
|
||||||
|
|
|
@ -12,7 +12,7 @@ function! s:HandleUnixFormat(buffer, lines, type) abort
|
||||||
" file.go:27: missing argument for Printf("%s"): format reads arg 2, have only 1 args
|
" file.go:27: missing argument for Printf("%s"): format reads arg 2, have only 1 args
|
||||||
" file.go:53:10: if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary)
|
" file.go:53:10: if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary)
|
||||||
" file.go:5:2: expected declaration, found 'STRING' "log"
|
" file.go:5:2: expected declaration, found 'STRING' "log"
|
||||||
let l:pattern = '^' . s:path_pattern . ':\(\d\+\):\?\(\d\+\)\?: \(.\+\)$'
|
let l:pattern = '^' . s:path_pattern . ':\(\d\+\):\?\(\d\+\)\?:\? \(.\+\)$'
|
||||||
let l:output = []
|
let l:output = []
|
||||||
|
|
||||||
for l:line in a:lines
|
for l:line in a:lines
|
||||||
|
|
|
@ -86,6 +86,7 @@ Execute (Run HandleUnixFormatAsError):
|
||||||
let g:loclist = ale#handlers#HandleUnixFormatAsError(42, [
|
let g:loclist = ale#handlers#HandleUnixFormatAsError(42, [
|
||||||
\ 'file.go:27: missing argument for Printf("%s"): format reads arg 2, have only 1 args',
|
\ 'file.go:27: missing argument for Printf("%s"): format reads arg 2, have only 1 args',
|
||||||
\ 'file.go:53:10: if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary)',
|
\ 'file.go:53:10: if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary)',
|
||||||
|
\ 'test.pug:1:1 ".b" is not a valid class name. Class names must begin with "-", "_" or a letter and can only contain "_", "-", a-z and 0-9.',
|
||||||
\])
|
\])
|
||||||
|
|
||||||
Then (The loclist should be correct):
|
Then (The loclist should be correct):
|
||||||
|
@ -108,6 +109,15 @@ Then (The loclist should be correct):
|
||||||
\ 'type': 'E',
|
\ 'type': 'E',
|
||||||
\ 'text': 'if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary)',
|
\ 'text': 'if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary)',
|
||||||
\ },
|
\ },
|
||||||
|
\ {
|
||||||
|
\ 'bufnr': 42,
|
||||||
|
\ 'vcol': 0,
|
||||||
|
\ 'nr': -1,
|
||||||
|
\ 'lnum': 1,
|
||||||
|
\ 'col': 1,
|
||||||
|
\ 'type': 'E',
|
||||||
|
\ 'text': '".b" is not a valid class name. Class names must begin with "-", "_" or a letter and can only contain "_", "-", a-z and 0-9.',
|
||||||
|
\ },
|
||||||
\], g:loclist
|
\], g:loclist
|
||||||
|
|
||||||
Execute (Run HandleUnixFormatAsWarning):
|
Execute (Run HandleUnixFormatAsWarning):
|
||||||
|
|
118
test/test_fortran_handler.vader
Normal file
118
test/test_fortran_handler.vader
Normal file
|
@ -0,0 +1,118 @@
|
||||||
|
Execute(The fortran handler should parse lines from GCC 4.1.2 correctly):
|
||||||
|
runtime ale_linters/fortran/gcc.vim
|
||||||
|
|
||||||
|
AssertEqual
|
||||||
|
\ [
|
||||||
|
\ {
|
||||||
|
\ 'bufnr': 357,
|
||||||
|
\ 'lnum': 4,
|
||||||
|
\ 'vcol': 0,
|
||||||
|
\ 'col': 0,
|
||||||
|
\ 'text': "Symbol ‘b’ at (1) has no IMPLICIT type",
|
||||||
|
\ 'type': 'E',
|
||||||
|
\ 'nr': -1,
|
||||||
|
\ },
|
||||||
|
\ {
|
||||||
|
\ 'bufnr': 357,
|
||||||
|
\ 'lnum': 3,
|
||||||
|
\ 'vcol': 0,
|
||||||
|
\ 'col': 0,
|
||||||
|
\ 'text': "Symbol ‘a’ at (1) has no IMPLICIT type",
|
||||||
|
\ 'type': 'E',
|
||||||
|
\ 'nr': -1,
|
||||||
|
\ },
|
||||||
|
\ ],
|
||||||
|
\ ale_linters#fortran#gcc#Handle(357, [
|
||||||
|
\ " In file :4",
|
||||||
|
\ "",
|
||||||
|
\ "write(*,*) b",
|
||||||
|
\ " 1",
|
||||||
|
\ "Error: Symbol ‘b’ at (1) has no IMPLICIT type",
|
||||||
|
\ " In file :3",
|
||||||
|
\ "",
|
||||||
|
\ "write(*,*) a",
|
||||||
|
\ " 1",
|
||||||
|
\ "Error: Symbol ‘a’ at (1) has no IMPLICIT type",
|
||||||
|
\ ])
|
||||||
|
|
||||||
|
After:
|
||||||
|
call ale#linter#Reset()
|
||||||
|
|
||||||
|
|
||||||
|
Execute(The fortran handler should parse lines from GCC 4.9.3 correctly):
|
||||||
|
runtime ale_linters/fortran/gcc.vim
|
||||||
|
|
||||||
|
AssertEqual
|
||||||
|
\ [
|
||||||
|
\ {
|
||||||
|
\ 'bufnr': 357,
|
||||||
|
\ 'lnum': 3,
|
||||||
|
\ 'vcol': 0,
|
||||||
|
\ 'col': 12,
|
||||||
|
\ 'text': "Symbol ‘a’ at (1) has no IMPLICIT type",
|
||||||
|
\ 'type': 'E',
|
||||||
|
\ 'nr': -1,
|
||||||
|
\ },
|
||||||
|
\ {
|
||||||
|
\ 'bufnr': 357,
|
||||||
|
\ 'lnum': 4,
|
||||||
|
\ 'vcol': 0,
|
||||||
|
\ 'col': 12,
|
||||||
|
\ 'text': "Symbol ‘b’ at (1) has no IMPLICIT type",
|
||||||
|
\ 'type': 'E',
|
||||||
|
\ 'nr': -1,
|
||||||
|
\ },
|
||||||
|
\ ],
|
||||||
|
\ ale_linters#fortran#gcc#Handle(357, [
|
||||||
|
\ ":3.12:",
|
||||||
|
\ "",
|
||||||
|
\ "write(*,*) a",
|
||||||
|
\ " 1",
|
||||||
|
\ "Error: Symbol ‘a’ at (1) has no IMPLICIT type",
|
||||||
|
\ ":4.12:",
|
||||||
|
\ "",
|
||||||
|
\ "write(*,*) b",
|
||||||
|
\ " 1",
|
||||||
|
\ "Error: Symbol ‘b’ at (1) has no IMPLICIT type",
|
||||||
|
\ ])
|
||||||
|
|
||||||
|
After:
|
||||||
|
call ale#linter#Reset()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Execute(The fortran handler should parse lines from GCC 6.3.1 correctly):
|
||||||
|
runtime ale_linters/fortran/gcc.vim
|
||||||
|
|
||||||
|
AssertEqual
|
||||||
|
\ [
|
||||||
|
\ {
|
||||||
|
\ 'bufnr': 337,
|
||||||
|
\ 'lnum': 3,
|
||||||
|
\ 'vcol': 0,
|
||||||
|
\ 'col': 12,
|
||||||
|
\ 'text': "Symbol ‘a’ at (1) has no IMPLICIT type",
|
||||||
|
\ 'type': 'E',
|
||||||
|
\ 'nr': -1,
|
||||||
|
\ },
|
||||||
|
\ {
|
||||||
|
\ 'bufnr': 337,
|
||||||
|
\ 'lnum': 4,
|
||||||
|
\ 'vcol': 0,
|
||||||
|
\ 'col': 12,
|
||||||
|
\ 'text': "Symbol ‘b’ at (1) has no IMPLICIT type",
|
||||||
|
\ 'type': 'E',
|
||||||
|
\ 'nr': -1,
|
||||||
|
\ },
|
||||||
|
\ ],
|
||||||
|
\ ale_linters#fortran#gcc#Handle(337, [
|
||||||
|
\ "<stdin>:3:12:",
|
||||||
|
\ "",
|
||||||
|
\ "Error: Symbol ‘a’ at (1) has no IMPLICIT type",
|
||||||
|
\ "<stdin>:4:12:",
|
||||||
|
\ "",
|
||||||
|
\ "Error: Symbol ‘b’ at (1) has no IMPLICIT type",
|
||||||
|
\ ])
|
||||||
|
|
||||||
|
After:
|
||||||
|
call ale#linter#Reset()
|
31
test/test_typecheck_handler.vader
Normal file
31
test/test_typecheck_handler.vader
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
Execute(The typecheck handler should parse lines correctly):
|
||||||
|
runtime ale_linters/typescript/typecheck.vim
|
||||||
|
|
||||||
|
AssertEqual
|
||||||
|
\ [
|
||||||
|
\ {
|
||||||
|
\ 'bufnr': 347,
|
||||||
|
\ 'lnum': 16,
|
||||||
|
\ 'vcol': 0,
|
||||||
|
\ 'col': 7,
|
||||||
|
\ 'text': "Type 'A' is not assignable to type 'B'",
|
||||||
|
\ 'type': 'E',
|
||||||
|
\ 'nr': -1,
|
||||||
|
\ },
|
||||||
|
\ {
|
||||||
|
\ 'bufnr': 347,
|
||||||
|
\ 'lnum': 7,
|
||||||
|
\ 'vcol': 0,
|
||||||
|
\ 'col': 41,
|
||||||
|
\ 'text': "Property 'a' does not exist on type 'A'",
|
||||||
|
\ 'type': 'E',
|
||||||
|
\ 'nr': -1,
|
||||||
|
\ },
|
||||||
|
\ ],
|
||||||
|
\ ale_linters#typescript#typecheck#Handle(347, [
|
||||||
|
\ "somets.ts[16, 7]: Type 'A' is not assignable to type 'B'",
|
||||||
|
\ "somets.ts[7, 41]: Property 'a' does not exist on type 'A'",
|
||||||
|
\ ])
|
||||||
|
|
||||||
|
After:
|
||||||
|
call ale#linter#Reset()
|
Reference in a new issue