Use explicit scope in all ale_linters
vint -s is now clean
This commit is contained in:
parent
ca4badfb3a
commit
fb4b797dd2
@ -14,34 +14,34 @@ function! ale_linters#coffee#coffeelint#Handle(buffer, lines)
|
|||||||
" stdin,14,,error,Throwing strings is forbidden
|
" stdin,14,,error,Throwing strings is forbidden
|
||||||
"
|
"
|
||||||
" Note that we currently ignore lineNumberEnd for multiline errors
|
" Note that we currently ignore lineNumberEnd for multiline errors
|
||||||
let pattern = 'stdin,\(\d\+\),\(\d*\),\(.\+\),\(.\+\)'
|
let l:pattern = 'stdin,\(\d\+\),\(\d*\),\(.\+\),\(.\+\)'
|
||||||
let output = []
|
let l:output = []
|
||||||
|
|
||||||
for line in a:lines
|
for l:line in a:lines
|
||||||
let l:match = matchlist(line, pattern)
|
let l:match = matchlist(l:line, l:pattern)
|
||||||
|
|
||||||
if len(l:match) == 0
|
if len(l:match) == 0
|
||||||
continue
|
continue
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let line = l:match[1] + 0
|
let l:line = l:match[1] + 0
|
||||||
let column = 1
|
let l:column = 1
|
||||||
let type = l:match[3] ==# 'error' ? 'E' : 'W'
|
let l:type = l:match[3] ==# 'error' ? 'E' : 'W'
|
||||||
let text = l:match[4]
|
let l:text = l:match[4]
|
||||||
|
|
||||||
" vcol is needed to indicate that the column is a character
|
" vcol is needed to indicate that the column is a character
|
||||||
call add(output, {
|
call add(l:output, {
|
||||||
\ 'bufnr': a:buffer,
|
\ 'bufnr': a:buffer,
|
||||||
\ 'lnum': line,
|
\ 'lnum': l:line,
|
||||||
\ 'vcol': 0,
|
\ 'vcol': 0,
|
||||||
\ 'col': column,
|
\ 'col': l:column,
|
||||||
\ 'text': text,
|
\ 'text': l:text,
|
||||||
\ 'type': type,
|
\ 'type': l:type,
|
||||||
\ 'nr': -1,
|
\ 'nr': -1,
|
||||||
\})
|
\})
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
return output
|
return l:output
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
call ale#linter#Define('coffee', {
|
call ale#linter#Define('coffee', {
|
||||||
|
@ -9,56 +9,56 @@ let g:loaded_ale_linters_d_dmd = 1
|
|||||||
|
|
||||||
" A function for finding the dmd-wrapper script in the Vim runtime paths
|
" A function for finding the dmd-wrapper script in the Vim runtime paths
|
||||||
function! s:FindWrapperScript()
|
function! s:FindWrapperScript()
|
||||||
for parent in split(&runtimepath, ',')
|
for l:parent in split(&runtimepath, ',')
|
||||||
" Expand the path to deal with ~ issues.
|
" Expand the path to deal with ~ issues.
|
||||||
let path = expand(parent . '/' . 'dmd-wrapper')
|
let l:path = expand(l:parent . '/' . 'dmd-wrapper')
|
||||||
|
|
||||||
if filereadable(path)
|
if filereadable(l:path)
|
||||||
return path
|
return l:path
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! ale_linters#d#dmd#GetCommand(buffer)
|
function! ale_linters#d#dmd#GetCommand(buffer)
|
||||||
let wrapper_script = s:FindWrapperScript()
|
let l:wrapper_script = s:FindWrapperScript()
|
||||||
|
|
||||||
let command = wrapper_script . ' -o- -vcolumns -c'
|
let l:command = l:wrapper_script . ' -o- -vcolumns -c'
|
||||||
|
|
||||||
return command
|
return l:command
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! ale_linters#d#dmd#Handle(buffer, lines)
|
function! ale_linters#d#dmd#Handle(buffer, lines)
|
||||||
" Matches patterns lines like the following:
|
" Matches patterns lines like the following:
|
||||||
"
|
"
|
||||||
" /tmp/tmp.G1L5xIizvB.d(8,8): Error: module weak_reference is in file 'dstruct/weak_reference.d' which cannot be read
|
" /tmp/tmp.G1L5xIizvB.d(8,8): Error: module weak_reference is in file 'dstruct/weak_reference.d' which cannot be read
|
||||||
let pattern = '^[^(]\+(\([0-9]\+\),\([0-9]\+\)): \([^:]\+\): \(.\+\)'
|
let l:pattern = '^[^(]\+(\([0-9]\+\),\([0-9]\+\)): \([^:]\+\): \(.\+\)'
|
||||||
let output = []
|
let l:output = []
|
||||||
|
|
||||||
for line in a:lines
|
for l:line in a:lines
|
||||||
let l:match = matchlist(line, pattern)
|
let l:match = matchlist(l:line, l:pattern)
|
||||||
|
|
||||||
if len(l:match) == 0
|
if len(l:match) == 0
|
||||||
break
|
break
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let line = l:match[1] + 0
|
let l:line = l:match[1] + 0
|
||||||
let column = l:match[2] + 0
|
let l:column = l:match[2] + 0
|
||||||
let type = l:match[3]
|
let l:type = l:match[3]
|
||||||
let text = l:match[4]
|
let l:text = l:match[4]
|
||||||
|
|
||||||
" vcol is Needed to indicate that the column is a character.
|
" vcol is Needed to indicate that the column is a character.
|
||||||
call add(output, {
|
call add(l:output, {
|
||||||
\ 'bufnr': bufnr('%'),
|
\ 'bufnr': bufnr('%'),
|
||||||
\ 'lnum': line,
|
\ 'lnum': l:line,
|
||||||
\ 'vcol': 0,
|
\ 'vcol': 0,
|
||||||
\ 'col': column,
|
\ 'col': l:column,
|
||||||
\ 'text': text,
|
\ 'text': l:text,
|
||||||
\ 'type': type ==# 'Warning' ? 'W' : 'E',
|
\ 'type': l:type ==# 'Warning' ? 'W' : 'E',
|
||||||
\ 'nr': -1,
|
\ 'nr': -1,
|
||||||
\})
|
\})
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
return output
|
return l:output
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
call ale#linter#Define('d', {
|
call ale#linter#Define('d', {
|
||||||
|
@ -18,33 +18,33 @@ function! ale_linters#fortran#gcc#Handle(buffer, lines)
|
|||||||
"
|
"
|
||||||
" :21.34:
|
" :21.34:
|
||||||
" Error: Expected comma in I/O list at (1)
|
" Error: Expected comma in I/O list at (1)
|
||||||
let line_marker_pattern = '^:\(\d\+\)\.\(\d\+\):$'
|
let l:line_marker_pattern = '^:\(\d\+\)\.\(\d\+\):$'
|
||||||
let message_pattern = '^\(Error\|Warning\): \(.\+\)$'
|
let l:message_pattern = '^\(Error\|Warning\): \(.\+\)$'
|
||||||
let looking_for_message = 0
|
let l:looking_for_message = 0
|
||||||
let last_loclist_obj = {}
|
let l:last_loclist_obj = {}
|
||||||
|
|
||||||
let output = []
|
let l:output = []
|
||||||
|
|
||||||
for line in a:lines
|
for l:line in a:lines
|
||||||
if looking_for_message
|
if l:looking_for_message
|
||||||
let l:match = matchlist(line, message_pattern)
|
let l:match = matchlist(l:line, l:message_pattern)
|
||||||
else
|
else
|
||||||
let l:match = matchlist(line, line_marker_pattern)
|
let l:match = matchlist(l:line, l:line_marker_pattern)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if len(l:match) == 0
|
if len(l:match) == 0
|
||||||
continue
|
continue
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if looking_for_message
|
if l:looking_for_message
|
||||||
let looking_for_message = 0
|
let l:looking_for_message = 0
|
||||||
|
|
||||||
" Now we have the text, we can set it and add the error.
|
" Now we have the text, we can set it and add the error.
|
||||||
let last_loclist_obj.text = l:match[2]
|
let l:last_loclist_obj.text = l:match[2]
|
||||||
let last_loclist_obj.type = l:match[1] ==# 'Warning' ? 'W' : 'E'
|
let l:last_loclist_obj.type = l:match[1] ==# 'Warning' ? 'W' : 'E'
|
||||||
call add(output, last_loclist_obj)
|
call add(l:output, l:last_loclist_obj)
|
||||||
else
|
else
|
||||||
let last_loclist_obj = {
|
let l:last_loclist_obj = {
|
||||||
\ 'bufnr': a:buffer,
|
\ 'bufnr': a:buffer,
|
||||||
\ 'lnum': l:match[1] + 0,
|
\ 'lnum': l:match[1] + 0,
|
||||||
\ 'vcol': 0,
|
\ 'vcol': 0,
|
||||||
@ -53,11 +53,11 @@ function! ale_linters#fortran#gcc#Handle(buffer, lines)
|
|||||||
\}
|
\}
|
||||||
|
|
||||||
" Start looking for the message and error type.
|
" Start looking for the message and error type.
|
||||||
let looking_for_message = 1
|
let l:looking_for_message = 1
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
return output
|
return l:output
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
call ale#linter#Define('fortran', {
|
call ale#linter#Define('fortran', {
|
||||||
|
@ -11,40 +11,40 @@ function! ale_linters#haskell#ghc#Handle(buffer, lines)
|
|||||||
" Look for lines like the following.
|
" Look for lines like the following.
|
||||||
"
|
"
|
||||||
" /dev/stdin:28:26: Not in scope: `>>>>>'
|
" /dev/stdin:28:26: Not in scope: `>>>>>'
|
||||||
let pattern = '^[^:]\+:\(\d\+\):\(\d\+\): \(.\+\)$'
|
let l:pattern = '^[^:]\+:\(\d\+\):\(\d\+\): \(.\+\)$'
|
||||||
let output = []
|
let l:output = []
|
||||||
|
|
||||||
" For some reason the output coming out of the GHC through the wrapper
|
" For some reason the output coming out of the GHC through the wrapper
|
||||||
" script breaks the lines up in strange ways. So we have to join some
|
" script breaks the lines up in strange ways. So we have to join some
|
||||||
" lines back together again.
|
" lines back together again.
|
||||||
let corrected_lines = []
|
let l:corrected_lines = []
|
||||||
|
|
||||||
for line in a:lines
|
for l:line in a:lines
|
||||||
if len(matchlist(line, pattern)) > 0
|
if len(matchlist(l:line, l:pattern)) > 0
|
||||||
call add(corrected_lines, line)
|
call add(l:corrected_lines, l:line)
|
||||||
if line !~# ': error:$'
|
if l:line !~# ': error:$'
|
||||||
call add(corrected_lines, '')
|
call add(l:corrected_lines, '')
|
||||||
endif
|
endif
|
||||||
elseif line ==# ''
|
elseif l:line ==# ''
|
||||||
call add(corrected_lines, line)
|
call add(l:corrected_lines, l:line)
|
||||||
else
|
else
|
||||||
if len(corrected_lines) > 0
|
if len(l:corrected_lines) > 0
|
||||||
if corrected_lines[-1] =~# ': error:$'
|
if l:corrected_lines[-1] =~# ': error:$'
|
||||||
let line = substitute(line, '\v^\s+', ' ', '')
|
let l:line = substitute(l:line, '\v^\s+', ' ', '')
|
||||||
endif
|
endif
|
||||||
let corrected_lines[-1] .= line
|
let l:corrected_lines[-1] .= l:line
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
for line in corrected_lines
|
for l:line in l:corrected_lines
|
||||||
let l:match = matchlist(line, pattern)
|
let l:match = matchlist(l:line, l:pattern)
|
||||||
|
|
||||||
if len(l:match) == 0
|
if len(l:match) == 0
|
||||||
continue
|
continue
|
||||||
endif
|
endif
|
||||||
|
|
||||||
call add(output, {
|
call add(l:output, {
|
||||||
\ 'bufnr': a:buffer,
|
\ 'bufnr': a:buffer,
|
||||||
\ 'lnum': l:match[1] + 0,
|
\ 'lnum': l:match[1] + 0,
|
||||||
\ 'vcol': 0,
|
\ 'vcol': 0,
|
||||||
@ -55,7 +55,7 @@ function! ale_linters#haskell#ghc#Handle(buffer, lines)
|
|||||||
\})
|
\})
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
return output
|
return l:output
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
call ale#linter#Define('haskell', {
|
call ale#linter#Define('haskell', {
|
||||||
|
@ -11,33 +11,33 @@ function! ale_linters#html#htmlhint#Handle(buffer, lines) abort
|
|||||||
" Matches patterns lines like the following:
|
" Matches patterns lines like the following:
|
||||||
"stdin:7:10: <title></title> must not be empty. [error/title-require]
|
"stdin:7:10: <title></title> must not be empty. [error/title-require]
|
||||||
|
|
||||||
let pattern = '^stdin:\(\d\+\):\(\d\+\): \(.\+\)$'
|
let l:pattern = '^stdin:\(\d\+\):\(\d\+\): \(.\+\)$'
|
||||||
let output = []
|
let l:output = []
|
||||||
|
|
||||||
for line in a:lines
|
for l:line in a:lines
|
||||||
let match = matchlist(line, pattern)
|
let l:match = matchlist(l:line, l:pattern)
|
||||||
|
|
||||||
if len(match) == 0
|
if len(l:match) == 0
|
||||||
continue
|
continue
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let line = match[1] + 0
|
let l:line = l:match[1] + 0
|
||||||
let col = match[2] + 0
|
let l:col = l:match[2] + 0
|
||||||
let text = match[3]
|
let l:text = l:match[3]
|
||||||
|
|
||||||
" vcol is Needed to indicate that the column is a character.
|
" vcol is Needed to indicate that the column is a character.
|
||||||
call add(output, {
|
call add(l:output, {
|
||||||
\ 'bufnr': a:buffer,
|
\ 'bufnr': a:buffer,
|
||||||
\ 'lnum': line,
|
\ 'lnum': l:line,
|
||||||
\ 'vcol': 0,
|
\ 'vcol': 0,
|
||||||
\ 'col': col,
|
\ 'col': l:col,
|
||||||
\ 'text': text,
|
\ 'text': l:text,
|
||||||
\ 'type': 'E',
|
\ 'type': 'E',
|
||||||
\ 'nr': -1,
|
\ 'nr': -1,
|
||||||
\})
|
\})
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
return output
|
return l:output
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
call ale#linter#Define('html', {
|
call ale#linter#Define('html', {
|
||||||
|
@ -12,10 +12,9 @@ let g:ale_html_tidy_executable = get(g:, 'ale_html_tidy_executable', 'tidy')
|
|||||||
let g:ale_html_tidy_args = get(g:, 'ale_html_tidy_args', '-q -e -language en')
|
let g:ale_html_tidy_args = get(g:, 'ale_html_tidy_args', '-q -e -language en')
|
||||||
|
|
||||||
function! ale_linters#html#tidy#GetCommand(buffer) abort
|
function! ale_linters#html#tidy#GetCommand(buffer) abort
|
||||||
|
|
||||||
" Specify file encoding in options
|
" Specify file encoding in options
|
||||||
" (Idea taken from https://github.com/scrooloose/syntastic/blob/master/syntax_checkers/html/tidy.vim)
|
" (Idea taken from https://github.com/scrooloose/syntastic/blob/master/syntax_checkers/html/tidy.vim)
|
||||||
let file_encoding = get({
|
let l:file_encoding = get({
|
||||||
\ 'ascii': '-ascii',
|
\ 'ascii': '-ascii',
|
||||||
\ 'big5': '-big5',
|
\ 'big5': '-big5',
|
||||||
\ 'cp1252': '-win1252',
|
\ 'cp1252': '-win1252',
|
||||||
@ -33,7 +32,7 @@ function! ale_linters#html#tidy#GetCommand(buffer) abort
|
|||||||
return printf('%s %s %s -',
|
return printf('%s %s %s -',
|
||||||
\ g:ale_html_tidy_executable,
|
\ g:ale_html_tidy_executable,
|
||||||
\ g:ale_html_tidy_args,
|
\ g:ale_html_tidy_args,
|
||||||
\ file_encoding
|
\ l:file_encoding
|
||||||
\ )
|
\ )
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@ -41,34 +40,34 @@ function! ale_linters#html#tidy#Handle(buffer, lines) abort
|
|||||||
" Matches patterns lines like the following:
|
" Matches patterns lines like the following:
|
||||||
" line 7 column 5 - Warning: missing </title> before </head>
|
" line 7 column 5 - Warning: missing </title> before </head>
|
||||||
|
|
||||||
let pattern = '^line \(\d\+\) column \(\d\+\) - \(Warning\|Error\): \(.\+\)$'
|
let l:pattern = '^line \(\d\+\) column \(\d\+\) - \(Warning\|Error\): \(.\+\)$'
|
||||||
let output = []
|
let l:output = []
|
||||||
|
|
||||||
for line in a:lines
|
for l:line in a:lines
|
||||||
let match = matchlist(line, pattern)
|
let l:match = matchlist(l:line, l:pattern)
|
||||||
|
|
||||||
if len(match) == 0
|
if len(l:match) == 0
|
||||||
continue
|
continue
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let line = match[1] + 0
|
let l:line = l:match[1] + 0
|
||||||
let col = match[2] + 0
|
let l:col = l:match[2] + 0
|
||||||
let type = match[3] ==# 'Error' ? 'E' : 'W'
|
let l:type = l:match[3] ==# 'Error' ? 'E' : 'W'
|
||||||
let text = match[4]
|
let l:text = l:match[4]
|
||||||
|
|
||||||
" vcol is Needed to indicate that the column is a character.
|
" vcol is Needed to indicate that the column is a character.
|
||||||
call add(output, {
|
call add(l:output, {
|
||||||
\ 'bufnr': a:buffer,
|
\ 'bufnr': a:buffer,
|
||||||
\ 'lnum': line,
|
\ 'lnum': l:line,
|
||||||
\ 'vcol': 0,
|
\ 'vcol': 0,
|
||||||
\ 'col': col,
|
\ 'col': l:col,
|
||||||
\ 'text': text,
|
\ 'text': l:text,
|
||||||
\ 'type': type,
|
\ 'type': l:type,
|
||||||
\ 'nr': -1,
|
\ 'nr': -1,
|
||||||
\})
|
\})
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
return output
|
return l:output
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
call ale#linter#Define('html', {
|
call ale#linter#Define('html', {
|
||||||
|
@ -15,38 +15,38 @@ function! ale_linters#javascript#eslint#Handle(buffer, lines)
|
|||||||
"
|
"
|
||||||
" /path/to/some-filename.js:47:14: Missing trailing comma. [Warning/comma-dangle]
|
" /path/to/some-filename.js:47:14: Missing trailing comma. [Warning/comma-dangle]
|
||||||
" /path/to/some-filename.js:56:41: Missing semicolon. [Error/semi]
|
" /path/to/some-filename.js:56:41: Missing semicolon. [Error/semi]
|
||||||
let pattern = '^.*:\(\d\+\):\(\d\+\): \(.\+\) \[\(.\+\)\]$'
|
let l:pattern = '^.*:\(\d\+\):\(\d\+\): \(.\+\) \[\(.\+\)\]$'
|
||||||
let output = []
|
let l:output = []
|
||||||
|
|
||||||
for line in a:lines
|
for l:line in a:lines
|
||||||
let l:match = matchlist(line, pattern)
|
let l:match = matchlist(l:line, l:pattern)
|
||||||
|
|
||||||
if len(l:match) == 0
|
if len(l:match) == 0
|
||||||
continue
|
continue
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let text = l:match[3]
|
let l:text = l:match[3]
|
||||||
let marker = l:match[4]
|
let l:marker = l:match[4]
|
||||||
let marker_parts = split(marker, '/')
|
let l:marker_parts = split(l:marker, '/')
|
||||||
let type = marker_parts[0]
|
let l:type = l:marker_parts[0]
|
||||||
|
|
||||||
if len(marker_parts) == 2
|
if len(l:marker_parts) == 2
|
||||||
let text = text . ' (' . marker_parts[1] . ')'
|
let l:text = l:text . ' (' . l:marker_parts[1] . ')'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" vcol is Needed to indicate that the column is a character.
|
" vcol is Needed to indicate that the column is a character.
|
||||||
call add(output, {
|
call add(l:output, {
|
||||||
\ 'bufnr': a:buffer,
|
\ 'bufnr': a:buffer,
|
||||||
\ 'lnum': l:match[1] + 0,
|
\ 'lnum': l:match[1] + 0,
|
||||||
\ 'vcol': 0,
|
\ 'vcol': 0,
|
||||||
\ 'col': l:match[2] + 0,
|
\ 'col': l:match[2] + 0,
|
||||||
\ 'text': text,
|
\ 'text': l:text,
|
||||||
\ 'type': type ==# 'Warning' ? 'W' : 'E',
|
\ 'type': l:type ==# 'Warning' ? 'W' : 'E',
|
||||||
\ 'nr': -1,
|
\ 'nr': -1,
|
||||||
\})
|
\})
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
return output
|
return l:output
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
call ale#linter#Define('javascript', {
|
call ale#linter#Define('javascript', {
|
||||||
|
@ -11,36 +11,36 @@ function! ale_linters#javascript#jscs#Handle(buffer, lines)
|
|||||||
" Matches patterns line the following:
|
" Matches patterns line the following:
|
||||||
"
|
"
|
||||||
" input:57:8: Unexpected token (57:8)
|
" input:57:8: Unexpected token (57:8)
|
||||||
let pattern = '^.\+:\(\d\+\):\(\d\+\): \(.\+\)'
|
let l:pattern = '^.\+:\(\d\+\):\(\d\+\): \(.\+\)'
|
||||||
let output = []
|
let l:output = []
|
||||||
|
|
||||||
for line in a:lines
|
for l:line in a:lines
|
||||||
let l:match = matchlist(line, pattern)
|
let l:match = matchlist(l:line, l:pattern)
|
||||||
|
|
||||||
if len(l:match) == 0
|
if len(l:match) == 0
|
||||||
continue
|
continue
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let text = l:match[3]
|
let l:text = l:match[3]
|
||||||
let marker_parts = l:match[4]
|
let l:marker_parts = l:match[4]
|
||||||
|
|
||||||
if len(marker_parts) == 2
|
if len(l:marker_parts) == 2
|
||||||
let text = text . ' (' . marker_parts[1] . ')'
|
let l:text = l:text . ' (' . l:marker_parts[1] . ')'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" vcol is Needed to indicate that the column is a character.
|
" vcol is Needed to indicate that the column is a character.
|
||||||
call add(output, {
|
call add(l:output, {
|
||||||
\ 'bufnr': a:buffer,
|
\ 'bufnr': a:buffer,
|
||||||
\ 'lnum': l:match[1] + 0,
|
\ 'lnum': l:match[1] + 0,
|
||||||
\ 'vcol': 0,
|
\ 'vcol': 0,
|
||||||
\ 'col': l:match[2] + 0,
|
\ 'col': l:match[2] + 0,
|
||||||
\ 'text': text,
|
\ 'text': l:text,
|
||||||
\ 'type': 'E',
|
\ 'type': 'E',
|
||||||
\ 'nr': -1,
|
\ 'nr': -1,
|
||||||
\})
|
\})
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
return output
|
return l:output
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
call ale#linter#Define('javascript', {
|
call ale#linter#Define('javascript', {
|
||||||
|
@ -14,21 +14,21 @@ function! ale_linters#javascript#jshint#GetCommand(buffer)
|
|||||||
" Set this to the location of the jshint configuration file to
|
" Set this to the location of the jshint configuration file to
|
||||||
" use a fixed location for .jshintrc
|
" use a fixed location for .jshintrc
|
||||||
if exists('g:ale_jshint_config_loc')
|
if exists('g:ale_jshint_config_loc')
|
||||||
let jshint_config = g:ale_jshint_config_loc
|
let l:jshint_config = g:ale_jshint_config_loc
|
||||||
else
|
else
|
||||||
" Look for the JSHint config in parent directories.
|
" Look for the JSHint config in parent directories.
|
||||||
let jshint_config = ale#util#FindNearestFile(a:buffer, '.jshintrc')
|
let l:jshint_config = ale#util#FindNearestFile(a:buffer, '.jshintrc')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let command = g:ale_javascript_jshint_executable . ' --reporter unix'
|
let l:command = g:ale_javascript_jshint_executable . ' --reporter unix'
|
||||||
|
|
||||||
if !empty(jshint_config)
|
if !empty(l:jshint_config)
|
||||||
let command .= ' --config ' . fnameescape(jshint_config)
|
let l:command .= ' --config ' . fnameescape(l:jshint_config)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let command .= ' -'
|
let l:command .= ' -'
|
||||||
|
|
||||||
return command
|
return l:command
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! ale_linters#javascript#jshint#Handle(buffer, lines)
|
function! ale_linters#javascript#jshint#Handle(buffer, lines)
|
||||||
@ -38,36 +38,36 @@ function! ale_linters#javascript#jshint#Handle(buffer, lines)
|
|||||||
" stdin:60:5: Attempting to override 'test2' which is a constant.
|
" stdin:60:5: Attempting to override 'test2' which is a constant.
|
||||||
" stdin:57:10: 'test' is defined but never used.
|
" stdin:57:10: 'test' is defined but never used.
|
||||||
" stdin:57:1: 'function' is defined but never used.
|
" stdin:57:1: 'function' is defined but never used.
|
||||||
let pattern = '^.\+:\(\d\+\):\(\d\+\): \(.\+\)'
|
let l:pattern = '^.\+:\(\d\+\):\(\d\+\): \(.\+\)'
|
||||||
let output = []
|
let l:output = []
|
||||||
|
|
||||||
for line in a:lines
|
for l:line in a:lines
|
||||||
let l:match = matchlist(line, pattern)
|
let l:match = matchlist(l:line, l:pattern)
|
||||||
|
|
||||||
if len(l:match) == 0
|
if len(l:match) == 0
|
||||||
continue
|
continue
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let text = l:match[3]
|
let l:text = l:match[3]
|
||||||
let marker_parts = l:match[4]
|
let l:marker_parts = l:match[4]
|
||||||
|
|
||||||
if len(marker_parts) == 2
|
if len(l:marker_parts) == 2
|
||||||
let text = text . ' (' . marker_parts[1] . ')'
|
let l:text = l:text . ' (' . l:marker_parts[1] . ')'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" vcol is Needed to indicate that the column is a character.
|
" vcol is Needed to indicate that the column is a character.
|
||||||
call add(output, {
|
call add(l:output, {
|
||||||
\ 'bufnr': a:buffer,
|
\ 'bufnr': a:buffer,
|
||||||
\ 'lnum': l:match[1] + 0,
|
\ 'lnum': l:match[1] + 0,
|
||||||
\ 'vcol': 0,
|
\ 'vcol': 0,
|
||||||
\ 'col': l:match[2] + 0,
|
\ 'col': l:match[2] + 0,
|
||||||
\ 'text': text,
|
\ 'text': l:text,
|
||||||
\ 'type': 'E',
|
\ 'type': 'E',
|
||||||
\ 'nr': -1,
|
\ 'nr': -1,
|
||||||
\})
|
\})
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
return output
|
return l:output
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
call ale#linter#Define('javascript', {
|
call ale#linter#Define('javascript', {
|
||||||
|
@ -10,29 +10,29 @@ function! ale_linters#json#jsonlint#Handle(buffer, lines)
|
|||||||
" Matches patterns like the following:
|
" Matches patterns like the following:
|
||||||
" line 2, col 15, found: 'STRING' - expected: 'EOF', '}', ',', ']'.
|
" line 2, col 15, found: 'STRING' - expected: 'EOF', '}', ',', ']'.
|
||||||
|
|
||||||
let pattern = '^line \(\d\+\), col \(\d*\), \(.\+\)$'
|
let l:pattern = '^line \(\d\+\), col \(\d*\), \(.\+\)$'
|
||||||
let output = []
|
let l:output = []
|
||||||
|
|
||||||
for line in a:lines
|
for l:line in a:lines
|
||||||
let match = matchlist(line, pattern)
|
let l:match = matchlist(l:line, l:pattern)
|
||||||
|
|
||||||
if len(l:match) == 0
|
if len(l:match) == 0
|
||||||
continue
|
continue
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" vcol is needed to indicate that the column is a character
|
" vcol is needed to indicate that the column is a character
|
||||||
call add(output, {
|
call add(l:output, {
|
||||||
\ 'bufnr': a:buffer,
|
\ 'bufnr': a:buffer,
|
||||||
\ 'lnum': match[1] + 0,
|
\ 'lnum': l:match[1] + 0,
|
||||||
\ 'vcol': 0,
|
\ 'vcol': 0,
|
||||||
\ 'col': match[2] + 0,
|
\ 'col': l:match[2] + 0,
|
||||||
\ 'text': match[3],
|
\ 'text': l:match[3],
|
||||||
\ 'type': 'E',
|
\ 'type': 'E',
|
||||||
\ 'nr': -1,
|
\ 'nr': -1,
|
||||||
\})
|
\})
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
return output
|
return l:output
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
call ale#linter#Define('json', {
|
call ale#linter#Define('json', {
|
||||||
|
@ -7,34 +7,34 @@ endif
|
|||||||
|
|
||||||
let g:loaded_ale_linters_perl_perl = 1
|
let g:loaded_ale_linters_perl_perl = 1
|
||||||
function! ale_linters#perl#perl#Handle(buffer, lines)
|
function! ale_linters#perl#perl#Handle(buffer, lines)
|
||||||
let pattern = '\(.\+\) at \(.\+\) line \(\d\+\)'
|
let l:pattern = '\(.\+\) at \(.\+\) line \(\d\+\)'
|
||||||
let output = []
|
let l:output = []
|
||||||
|
|
||||||
for line in a:lines
|
for l:line in a:lines
|
||||||
let l:match = matchlist(line, pattern)
|
let l:match = matchlist(l:line, l:pattern)
|
||||||
|
|
||||||
if len(l:match) == 0
|
if len(l:match) == 0
|
||||||
continue
|
continue
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let line = l:match[3]
|
let l:line = l:match[3]
|
||||||
let column = 1
|
let l:column = 1
|
||||||
let text = l:match[1]
|
let l:text = l:match[1]
|
||||||
let type = 'E'
|
let l:type = 'E'
|
||||||
|
|
||||||
" vcol is Needed to indicate that the column is a character.
|
" vcol is Needed to indicate that the column is a character.
|
||||||
call add(output, {
|
call add(l:output, {
|
||||||
\ 'bufnr': a:buffer,
|
\ 'bufnr': a:buffer,
|
||||||
\ 'lnum': line,
|
\ 'lnum': l:line,
|
||||||
\ 'vcol': 0,
|
\ 'vcol': 0,
|
||||||
\ 'col': column,
|
\ 'col': l:column,
|
||||||
\ 'text': text,
|
\ 'text': l:text,
|
||||||
\ 'type': type,
|
\ 'type': l:type,
|
||||||
\ 'nr': -1,
|
\ 'nr': -1,
|
||||||
\})
|
\})
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
return output
|
return l:output
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
call ale#linter#Define('perl', {
|
call ale#linter#Define('perl', {
|
||||||
|
@ -7,34 +7,34 @@ endif
|
|||||||
|
|
||||||
let g:loaded_ale_linters_perl_perlcritic = 1
|
let g:loaded_ale_linters_perl_perlcritic = 1
|
||||||
function! ale_linters#perl#perlcritic#Handle(buffer, lines)
|
function! ale_linters#perl#perlcritic#Handle(buffer, lines)
|
||||||
let pattern = '\(.\+\) at \(.\+\) line \(\d\+\)'
|
let l:pattern = '\(.\+\) at \(.\+\) line \(\d\+\)'
|
||||||
let output = []
|
let l:output = []
|
||||||
|
|
||||||
for line in a:lines
|
for l:line in a:lines
|
||||||
let l:match = matchlist(line, pattern)
|
let l:match = matchlist(l:line, l:pattern)
|
||||||
|
|
||||||
if len(l:match) == 0
|
if len(l:match) == 0
|
||||||
continue
|
continue
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let line = l:match[3]
|
let l:line = l:match[3]
|
||||||
let column = 1
|
let l:column = 1
|
||||||
let text = l:match[1]
|
let l:text = l:match[1]
|
||||||
let type = 'E'
|
let l:type = 'E'
|
||||||
|
|
||||||
" vcol is Needed to indicate that the column is a character.
|
" vcol is Needed to indicate that the column is a character.
|
||||||
call add(output, {
|
call add(l:output, {
|
||||||
\ 'bufnr': a:buffer,
|
\ 'bufnr': a:buffer,
|
||||||
\ 'lnum': line,
|
\ 'lnum': l:line,
|
||||||
\ 'vcol': 0,
|
\ 'vcol': 0,
|
||||||
\ 'col': column,
|
\ 'col': l:column,
|
||||||
\ 'text': text,
|
\ 'text': l:text,
|
||||||
\ 'type': type,
|
\ 'type': l:type,
|
||||||
\ 'nr': -1,
|
\ 'nr': -1,
|
||||||
\})
|
\})
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
return output
|
return l:output
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
call ale#linter#Define('perl', {
|
call ale#linter#Define('perl', {
|
||||||
|
@ -11,18 +11,18 @@ function! ale_linters#php#php#Handle(buffer, lines)
|
|||||||
" Matches patterns like the following:
|
" Matches patterns like the following:
|
||||||
"
|
"
|
||||||
" Parse error: parse error in - on line 7
|
" Parse error: parse error in - on line 7
|
||||||
let pattern = 'Parse error:\s\+\(.\+\) on line \(\d\+\)'
|
let l:pattern = 'Parse error:\s\+\(.\+\) on line \(\d\+\)'
|
||||||
let output = []
|
let l:output = []
|
||||||
|
|
||||||
for line in a:lines
|
for l:line in a:lines
|
||||||
let l:match = matchlist(line, pattern)
|
let l:match = matchlist(l:line, l:pattern)
|
||||||
|
|
||||||
if len(l:match) == 0
|
if len(l:match) == 0
|
||||||
continue
|
continue
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" vcol is needed to indicate that the column is a character.
|
" vcol is needed to indicate that the column is a character.
|
||||||
call add(output, {
|
call add(l:output, {
|
||||||
\ 'bufnr': a:buffer,
|
\ 'bufnr': a:buffer,
|
||||||
\ 'lnum': l:match[2] + 0,
|
\ 'lnum': l:match[2] + 0,
|
||||||
\ 'vcol': 0,
|
\ 'vcol': 0,
|
||||||
@ -33,7 +33,7 @@ function! ale_linters#php#php#Handle(buffer, lines)
|
|||||||
\})
|
\})
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
return output
|
return l:output
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
call ale#linter#Define('php', {
|
call ale#linter#Define('php', {
|
||||||
|
@ -8,46 +8,46 @@ endif
|
|||||||
let g:loaded_ale_linters_php_phpcs = 1
|
let g:loaded_ale_linters_php_phpcs = 1
|
||||||
|
|
||||||
function! ale_linters#php#phpcs#GetCommand(buffer)
|
function! ale_linters#php#phpcs#GetCommand(buffer)
|
||||||
let command = 'phpcs -s --report=emacs --stdin-path=%s'
|
let l:command = 'phpcs -s --report=emacs --stdin-path=%s'
|
||||||
|
|
||||||
" This option can be set to change the standard used by phpcs
|
" This option can be set to change the standard used by phpcs
|
||||||
if exists('g:ale_php_phpcs_standard')
|
if exists('g:ale_php_phpcs_standard')
|
||||||
let command .= ' --standard=' . g:ale_php_phpcs_standard
|
let l:command .= ' --standard=' . g:ale_php_phpcs_standard
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return command
|
return l:command
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! ale_linters#php#phpcs#Handle(buffer, lines)
|
function! ale_linters#php#phpcs#Handle(buffer, lines)
|
||||||
" Matches against lines like the following:
|
" Matches against lines like the following:
|
||||||
"
|
"
|
||||||
" /path/to/some-filename.php:18:3: error - Line indented incorrectly; expected 4 spaces, found 2 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
|
" /path/to/some-filename.php:18:3: error - Line indented incorrectly; expected 4 spaces, found 2 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
|
||||||
let pattern = '^.*:\(\d\+\):\(\d\+\): \(.\+\) - \(.\+\) \(\(.\+\)\)$'
|
let l:pattern = '^.*:\(\d\+\):\(\d\+\): \(.\+\) - \(.\+\) \(\(.\+\)\)$'
|
||||||
let output = []
|
let l:output = []
|
||||||
|
|
||||||
for line in a:lines
|
for l:line in a:lines
|
||||||
let l:match = matchlist(line, pattern)
|
let l:match = matchlist(l:line, l:pattern)
|
||||||
|
|
||||||
if len(l:match) == 0
|
if len(l:match) == 0
|
||||||
continue
|
continue
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let text = l:match[4]
|
let l:text = l:match[4]
|
||||||
let type = l:match[3]
|
let l:type = l:match[3]
|
||||||
|
|
||||||
" vcol is Needed to indicate that the column is a character.
|
" vcol is Needed to indicate that the column is a character.
|
||||||
call add(output, {
|
call add(l:output, {
|
||||||
\ 'bufnr': a:buffer,
|
\ 'bufnr': a:buffer,
|
||||||
\ 'lnum': l:match[1] + 0,
|
\ 'lnum': l:match[1] + 0,
|
||||||
\ 'vcol': 0,
|
\ 'vcol': 0,
|
||||||
\ 'col': l:match[2] + 0,
|
\ 'col': l:match[2] + 0,
|
||||||
\ 'text': text,
|
\ 'text': l:text,
|
||||||
\ 'type': type ==# 'warning' ? 'W' : 'E',
|
\ 'type': l:type ==# 'warning' ? 'W' : 'E',
|
||||||
\ 'nr': -1,
|
\ 'nr': -1,
|
||||||
\})
|
\})
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
return output
|
return l:output
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
call ale#linter#Define('php', {
|
call ale#linter#Define('php', {
|
||||||
|
@ -11,17 +11,17 @@ function! ale_linters#pug#puglint#Handle(buffer, lines)
|
|||||||
" Matches patterns like the following:
|
" Matches patterns like the following:
|
||||||
"
|
"
|
||||||
" temp.jade:6:1 The end of the string reached with no closing bracket ) found.
|
" temp.jade:6:1 The end of the string reached with no closing bracket ) found.
|
||||||
let pattern = '^.\+:\(\d\+\):\(\d\+\) \(.\+\)$'
|
let l:pattern = '^.\+:\(\d\+\):\(\d\+\) \(.\+\)$'
|
||||||
let output = []
|
let l:output = []
|
||||||
|
|
||||||
for line in a:lines
|
for l:line in a:lines
|
||||||
let l:match = matchlist(line, pattern)
|
let l:match = matchlist(l:line, l:pattern)
|
||||||
|
|
||||||
if len(l:match) == 0
|
if len(l:match) == 0
|
||||||
continue
|
continue
|
||||||
endif
|
endif
|
||||||
|
|
||||||
call add(output, {
|
call add(l:output, {
|
||||||
\ 'bufnr': a:buffer,
|
\ 'bufnr': a:buffer,
|
||||||
\ 'lnum': l:match[1] + 0,
|
\ 'lnum': l:match[1] + 0,
|
||||||
\ 'vcol': 0,
|
\ 'vcol': 0,
|
||||||
@ -32,7 +32,7 @@ function! ale_linters#pug#puglint#Handle(buffer, lines)
|
|||||||
\})
|
\})
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
return output
|
return l:output
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
call ale#linter#Define('pug', {
|
call ale#linter#Define('pug', {
|
||||||
|
@ -5,11 +5,11 @@ function! ale_linters#pyrex#cython#Handle(buffer, lines)
|
|||||||
" Matches patterns line the following:
|
" Matches patterns line the following:
|
||||||
"
|
"
|
||||||
" test.pyx:13:25: Expected ':', found 'NEWLINE'
|
" test.pyx:13:25: Expected ':', found 'NEWLINE'
|
||||||
let pattern = '^.\+:\(\d\+\):\(\d\+\): \(.\+\)$'
|
let l:pattern = '^.\+:\(\d\+\):\(\d\+\): \(.\+\)$'
|
||||||
let output = []
|
let l:output = []
|
||||||
|
|
||||||
for line in a:lines
|
for l:line in a:lines
|
||||||
let l:match = matchlist(line, pattern)
|
let l:match = matchlist(l:line, l:pattern)
|
||||||
|
|
||||||
if len(l:match) == 0
|
if len(l:match) == 0
|
||||||
continue
|
continue
|
||||||
@ -20,7 +20,7 @@ function! ale_linters#pyrex#cython#Handle(buffer, lines)
|
|||||||
continue
|
continue
|
||||||
endif
|
endif
|
||||||
|
|
||||||
call add(output, {
|
call add(l:output, {
|
||||||
\ 'bufnr': a:buffer,
|
\ 'bufnr': a:buffer,
|
||||||
\ 'lnum': l:match[1] + 0,
|
\ 'lnum': l:match[1] + 0,
|
||||||
\ 'vcol': 0,
|
\ 'vcol': 0,
|
||||||
@ -31,7 +31,7 @@ function! ale_linters#pyrex#cython#Handle(buffer, lines)
|
|||||||
\})
|
\})
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
return output
|
return l:output
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
call ale#linter#Define('pyrex', {
|
call ale#linter#Define('pyrex', {
|
||||||
|
@ -11,40 +11,40 @@ function! ale_linters#python#flake8#Handle(buffer, lines)
|
|||||||
" Matches patterns line the following:
|
" Matches patterns line the following:
|
||||||
"
|
"
|
||||||
" stdin:6:6: E111 indentation is not a multiple of four
|
" stdin:6:6: E111 indentation is not a multiple of four
|
||||||
let pattern = '^stdin:\(\d\+\):\(\d\+\): \([^ ]\+\) \(.\+\)$'
|
let l:pattern = '^stdin:\(\d\+\):\(\d\+\): \([^ ]\+\) \(.\+\)$'
|
||||||
let output = []
|
let l:output = []
|
||||||
|
|
||||||
for line in a:lines
|
for l:line in a:lines
|
||||||
let l:match = matchlist(line, pattern)
|
let l:match = matchlist(l:line, l:pattern)
|
||||||
|
|
||||||
if len(l:match) == 0
|
if len(l:match) == 0
|
||||||
continue
|
continue
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let line = l:match[1] + 0
|
let l:line = l:match[1] + 0
|
||||||
let column = l:match[2] + 0
|
let l:column = l:match[2] + 0
|
||||||
let code = l:match[3]
|
let l:code = l:match[3]
|
||||||
let text = code . ': ' . l:match[4]
|
let l:text = l:code . ': ' . l:match[4]
|
||||||
let type = code[0] ==# 'E' ? 'E' : 'W'
|
let l:type = l:code[0] ==# 'E' ? 'E' : 'W'
|
||||||
|
|
||||||
if code ==# 'W291' && !g:ale_warn_about_trailing_whitespace
|
if l:code ==# 'W291' && !g:ale_warn_about_trailing_whitespace
|
||||||
" Skip warnings for trailing whitespace if the option is off.
|
" Skip warnings for trailing whitespace if the option is off.
|
||||||
continue
|
continue
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" vcol is Needed to indicate that the column is a character.
|
" vcol is Needed to indicate that the column is a character.
|
||||||
call add(output, {
|
call add(l:output, {
|
||||||
\ 'bufnr': a:buffer,
|
\ 'bufnr': a:buffer,
|
||||||
\ 'lnum': line,
|
\ 'lnum': l:line,
|
||||||
\ 'vcol': 0,
|
\ 'vcol': 0,
|
||||||
\ 'col': column,
|
\ 'col': l:column,
|
||||||
\ 'text': text,
|
\ 'text': l:text,
|
||||||
\ 'type': type,
|
\ 'type': l:type,
|
||||||
\ 'nr': -1,
|
\ 'nr': -1,
|
||||||
\})
|
\})
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
return output
|
return l:output
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
call ale#linter#Define('python', {
|
call ale#linter#Define('python', {
|
||||||
|
@ -12,32 +12,32 @@ function! ale_linters#ruby#rubocop#Handle(buffer, lines)
|
|||||||
"
|
"
|
||||||
" <path>/_:47:14: 83:29: C: Prefer single-quoted strings when you don't
|
" <path>/_:47:14: 83:29: C: Prefer single-quoted strings when you don't
|
||||||
" need string interpolation or special symbols.
|
" need string interpolation or special symbols.
|
||||||
let pattern = '\v_:(\d+):(\d+): (.): (.+)'
|
let l:pattern = '\v_:(\d+):(\d+): (.): (.+)'
|
||||||
let output = []
|
let l:output = []
|
||||||
|
|
||||||
for line in a:lines
|
for l:line in a:lines
|
||||||
let l:match = matchlist(line, pattern)
|
let l:match = matchlist(l:line, l:pattern)
|
||||||
|
|
||||||
if len(l:match) == 0
|
if len(l:match) == 0
|
||||||
continue
|
continue
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let text = l:match[4]
|
let l:text = l:match[4]
|
||||||
let type = l:match[3]
|
let l:type = l:match[3]
|
||||||
|
|
||||||
" vcol is Needed to indicate that the column is a character.
|
" vcol is Needed to indicate that the column is a character.
|
||||||
call add(output, {
|
call add(l:output, {
|
||||||
\ 'bufnr': a:buffer,
|
\ 'bufnr': a:buffer,
|
||||||
\ 'lnum': l:match[1] + 0,
|
\ 'lnum': l:match[1] + 0,
|
||||||
\ 'vcol': 0,
|
\ 'vcol': 0,
|
||||||
\ 'col': l:match[2] + 0,
|
\ 'col': l:match[2] + 0,
|
||||||
\ 'text': text,
|
\ 'text': l:text,
|
||||||
\ 'type': type ==# 'C' ? 'E' : 'W',
|
\ 'type': l:type ==# 'C' ? 'E' : 'W',
|
||||||
\ 'nr': -1,
|
\ 'nr': -1,
|
||||||
\})
|
\})
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
return output
|
return l:output
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
call ale#linter#Define('ruby', {
|
call ale#linter#Define('ruby', {
|
||||||
|
@ -12,41 +12,41 @@ function! ale_linters#scala#scalac#Handle(buffer, lines)
|
|||||||
" Matches patterns line the following:
|
" Matches patterns line the following:
|
||||||
"
|
"
|
||||||
" /var/folders/5q/20rgxx3x1s34g3m14n5bq0x80000gn/T/vv6pSsy/0:26: error: expected class or object definition
|
" /var/folders/5q/20rgxx3x1s34g3m14n5bq0x80000gn/T/vv6pSsy/0:26: error: expected class or object definition
|
||||||
let pattern = '^.\+:\(\d\+\): \(\w\+\): \(.\+\)'
|
let l:pattern = '^.\+:\(\d\+\): \(\w\+\): \(.\+\)'
|
||||||
let output = []
|
let l:output = []
|
||||||
let ln = 0
|
let l:ln = 0
|
||||||
|
|
||||||
for line in a:lines
|
for l:line in a:lines
|
||||||
let ln = ln + 1
|
let l:ln = l:ln + 1
|
||||||
let l:match = matchlist(line, pattern)
|
let l:match = matchlist(l:line, l:pattern)
|
||||||
|
|
||||||
if len(l:match) == 0
|
if len(l:match) == 0
|
||||||
continue
|
continue
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let text = l:match[3]
|
let l:text = l:match[3]
|
||||||
let type = l:match[2] ==# 'error' ? 'E' : 'W'
|
let l:type = l:match[2] ==# 'error' ? 'E' : 'W'
|
||||||
let col = 0
|
let l:col = 0
|
||||||
if ln + 1 < len(a:lines)
|
if l:ln + 1 < len(a:lines)
|
||||||
let col = stridx(a:lines[ln + 1], '^')
|
let l:col = stridx(a:lines[l:ln + 1], '^')
|
||||||
if col == -1
|
if l:col == -1
|
||||||
let col = 0
|
let l:col = 0
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" vcol is Needed to indicate that the column is a character.
|
" vcol is Needed to indicate that the column is a character.
|
||||||
call add(output, {
|
call add(l:output, {
|
||||||
\ 'bufnr': a:buffer,
|
\ 'bufnr': a:buffer,
|
||||||
\ 'lnum': l:match[1] + 0,
|
\ 'lnum': l:match[1] + 0,
|
||||||
\ 'vcol': 0,
|
\ 'vcol': 0,
|
||||||
\ 'col': col + 1,
|
\ 'col': l:col + 1,
|
||||||
\ 'text': text,
|
\ 'text': l:text,
|
||||||
\ 'type': type,
|
\ 'type': l:type,
|
||||||
\ 'nr': -1,
|
\ 'nr': -1,
|
||||||
\})
|
\})
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
return output
|
return l:output
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
call ale#linter#Define('scala', {
|
call ale#linter#Define('scala', {
|
||||||
|
@ -11,11 +11,11 @@ function! ale_linters#scss#scsslint#Handle(buffer, lines)
|
|||||||
" Matches patterns like the following:
|
" Matches patterns like the following:
|
||||||
"
|
"
|
||||||
" test.scss:2:1 [W] Indentation: Line should be indented 2 spaces, but was indented 4 spaces
|
" test.scss:2:1 [W] Indentation: Line should be indented 2 spaces, but was indented 4 spaces
|
||||||
let pattern = '^.*:\(\d\+\):\(\d*\) \[\([^\]]\+\)\] \(.\+\)$'
|
let l:pattern = '^.*:\(\d\+\):\(\d*\) \[\([^\]]\+\)\] \(.\+\)$'
|
||||||
let output = []
|
let l:output = []
|
||||||
|
|
||||||
for line in a:lines
|
for l:line in a:lines
|
||||||
let l:match = matchlist(line, pattern)
|
let l:match = matchlist(l:line, l:pattern)
|
||||||
|
|
||||||
if len(l:match) == 0
|
if len(l:match) == 0
|
||||||
continue
|
continue
|
||||||
@ -27,7 +27,7 @@ function! ale_linters#scss#scsslint#Handle(buffer, lines)
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
" vcol is needed to indicate that the column is a character
|
" vcol is needed to indicate that the column is a character
|
||||||
call add(output, {
|
call add(l:output, {
|
||||||
\ 'bufnr': a:buffer,
|
\ 'bufnr': a:buffer,
|
||||||
\ 'lnum': l:match[1] + 0,
|
\ 'lnum': l:match[1] + 0,
|
||||||
\ 'vcol': 0,
|
\ 'vcol': 0,
|
||||||
@ -38,7 +38,7 @@ function! ale_linters#scss#scsslint#Handle(buffer, lines)
|
|||||||
\})
|
\})
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
return output
|
return l:output
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
call ale#linter#Define('scss', {
|
call ale#linter#Define('scss', {
|
||||||
|
@ -18,16 +18,16 @@ if !exists('g:ale_linters_sh_shell_default_shell')
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
function! ale_linters#sh#shell#GetExecutable(buffer)
|
function! ale_linters#sh#shell#GetExecutable(buffer)
|
||||||
let banglines = getbufline(a:buffer, 1)
|
let l:banglines = getbufline(a:buffer, 1)
|
||||||
|
|
||||||
" Take the shell executable from the hashbang, if we can.
|
" Take the shell executable from the hashbang, if we can.
|
||||||
if len(banglines) == 1 && banglines[0] =~# '^#!'
|
if len(l:banglines) == 1 && l:banglines[0] =~# '^#!'
|
||||||
" Remove options like -e, etc.
|
" Remove options like -e, etc.
|
||||||
let line = substitute(banglines[0], '--\?[a-zA-Z0-9]\+', '', 'g')
|
let l:line = substitute(l:banglines[0], '--\?[a-zA-Z0-9]\+', '', 'g')
|
||||||
|
|
||||||
for possible_shell in ['bash', 'tcsh', 'csh', 'zsh', 'sh']
|
for l:possible_shell in ['bash', 'tcsh', 'csh', 'zsh', 'sh']
|
||||||
if line =~# possible_shell . '\s*$'
|
if l:line =~# l:possible_shell . '\s*$'
|
||||||
return possible_shell
|
return l:possible_shell
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
endif
|
endif
|
||||||
@ -44,34 +44,34 @@ function! ale_linters#sh#shell#Handle(buffer, lines)
|
|||||||
"
|
"
|
||||||
" bash: line 13: syntax error near unexpected token `d'
|
" bash: line 13: syntax error near unexpected token `d'
|
||||||
" sh: 11: Syntax error: "(" unexpected
|
" sh: 11: Syntax error: "(" unexpected
|
||||||
let pattern = '^[^:]\+: \%(\w\+ \|\)\(\d\+\): \(.\+\)'
|
let l:pattern = '^[^:]\+: \%(\w\+ \|\)\(\d\+\): \(.\+\)'
|
||||||
let output = []
|
let l:output = []
|
||||||
|
|
||||||
for line in a:lines
|
for l:line in a:lines
|
||||||
let l:match = matchlist(line, pattern)
|
let l:match = matchlist(l:line, l:pattern)
|
||||||
|
|
||||||
if len(l:match) == 0
|
if len(l:match) == 0
|
||||||
continue
|
continue
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let line = l:match[1] + 0
|
let l:line = l:match[1] + 0
|
||||||
let column = 1
|
let l:column = 1
|
||||||
let text = l:match[2]
|
let l:text = l:match[2]
|
||||||
let type = 'E'
|
let l:type = 'E'
|
||||||
|
|
||||||
" vcol is Needed to indicate that the column is a character.
|
" vcol is Needed to indicate that the column is a character.
|
||||||
call add(output, {
|
call add(l:output, {
|
||||||
\ 'bufnr': a:buffer,
|
\ 'bufnr': a:buffer,
|
||||||
\ 'lnum': line,
|
\ 'lnum': l:line,
|
||||||
\ 'vcol': 0,
|
\ 'vcol': 0,
|
||||||
\ 'col': column,
|
\ 'col': l:column,
|
||||||
\ 'text': text,
|
\ 'text': l:text,
|
||||||
\ 'type': type,
|
\ 'type': l:type,
|
||||||
\ 'nr': -1,
|
\ 'nr': -1,
|
||||||
\})
|
\})
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
return output
|
return l:output
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
call ale#linter#Define('sh', {
|
call ale#linter#Define('sh', {
|
||||||
|
@ -13,34 +13,34 @@ function! ale_linters#typescript#tslint#Handle(buffer, lines)
|
|||||||
" hello.ts[7, 41]: trailing whitespace
|
" hello.ts[7, 41]: trailing whitespace
|
||||||
" hello.ts[5, 1]: Forbidden 'var' keyword, use 'let' or 'const' instead
|
" hello.ts[5, 1]: Forbidden 'var' keyword, use 'let' or 'const' instead
|
||||||
"
|
"
|
||||||
let pattern = '.\+.ts\[\(\d\+\), \(\d\+\)\]: \(.\+\)'
|
let l:pattern = '.\+.ts\[\(\d\+\), \(\d\+\)\]: \(.\+\)'
|
||||||
let output = []
|
let l:output = []
|
||||||
|
|
||||||
for line in a:lines
|
for l:line in a:lines
|
||||||
let l:match = matchlist(line, pattern)
|
let l:match = matchlist(l:line, l:pattern)
|
||||||
|
|
||||||
if len(l:match) == 0
|
if len(l:match) == 0
|
||||||
continue
|
continue
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let line = l:match[1] + 0
|
let l:line = l:match[1] + 0
|
||||||
let column = l:match[2] + 0
|
let l:column = l:match[2] + 0
|
||||||
let type = 'E'
|
let l:type = 'E'
|
||||||
let text = l:match[3]
|
let l:text = l:match[3]
|
||||||
|
|
||||||
" vcol is Needed to indicate that the column is a character.
|
" vcol is Needed to indicate that the column is a character.
|
||||||
call add(output, {
|
call add(l:output, {
|
||||||
\ 'bufnr': a:buffer,
|
\ 'bufnr': a:buffer,
|
||||||
\ 'lnum': line,
|
\ 'lnum': l:line,
|
||||||
\ 'vcol': 0,
|
\ 'vcol': 0,
|
||||||
\ 'col': column,
|
\ 'col': l:column,
|
||||||
\ 'text': text,
|
\ 'text': l:text,
|
||||||
\ 'type': type,
|
\ 'type': l:type,
|
||||||
\ 'nr': -1,
|
\ 'nr': -1,
|
||||||
\})
|
\})
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
return output
|
return l:output
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
call ale#linter#Define('typescript', {
|
call ale#linter#Define('typescript', {
|
||||||
|
@ -14,32 +14,32 @@ function! ale_linters#verilog#iverilog#Handle(buffer, lines)
|
|||||||
" tb_me_top.v:17: syntax error
|
" tb_me_top.v:17: syntax error
|
||||||
" memory_single_port.v:2: syntax error
|
" memory_single_port.v:2: syntax error
|
||||||
" tb_me_top.v:17: error: Invalid module instantiation
|
" tb_me_top.v:17: error: Invalid module instantiation
|
||||||
let pattern = '^[^:]\+:\(\d\+\): \(warning\|error\|syntax error\)\(: \(.\+\)\)\?'
|
let l:pattern = '^[^:]\+:\(\d\+\): \(warning\|error\|syntax error\)\(: \(.\+\)\)\?'
|
||||||
let output = []
|
let l:output = []
|
||||||
|
|
||||||
for line in a:lines
|
for l:line in a:lines
|
||||||
let l:match = matchlist(line, pattern)
|
let l:match = matchlist(l:line, l:pattern)
|
||||||
|
|
||||||
if len(l:match) == 0
|
if len(l:match) == 0
|
||||||
continue
|
continue
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let line = l:match[1] + 0
|
let l:line = l:match[1] + 0
|
||||||
let type = l:match[2] ==# 'warning' ? 'W' : 'E'
|
let l:type = l:match[2] ==# 'warning' ? 'W' : 'E'
|
||||||
let text = l:match[2] ==# 'syntax error' ? 'syntax error' : l:match[4]
|
let l:text = l:match[2] ==# 'syntax error' ? 'syntax error' : l:match[4]
|
||||||
|
|
||||||
call add(output, {
|
call add(l:output, {
|
||||||
\ 'bufnr': a:buffer,
|
\ 'bufnr': a:buffer,
|
||||||
\ 'lnum': line,
|
\ 'lnum': l:line,
|
||||||
\ 'vcol': 0,
|
\ 'vcol': 0,
|
||||||
\ 'col': 1,
|
\ 'col': 1,
|
||||||
\ 'text': text,
|
\ 'text': l:text,
|
||||||
\ 'type': type,
|
\ 'type': l:type,
|
||||||
\ 'nr': -1,
|
\ 'nr': -1,
|
||||||
\})
|
\})
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
return output
|
return l:output
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
call ale#linter#Define('verilog', {
|
call ale#linter#Define('verilog', {
|
||||||
|
@ -16,32 +16,32 @@ function! ale_linters#verilog#verilator#Handle(buffer, lines)
|
|||||||
" %Warning-UNDRIVEN: test.v:3: Signal is not driven: clk
|
" %Warning-UNDRIVEN: test.v:3: Signal is not driven: clk
|
||||||
" %Warning-UNUSED: test.v:4: Signal is not used: dout
|
" %Warning-UNUSED: test.v:4: Signal is not used: dout
|
||||||
" %Warning-BLKSEQ: test.v:10: Blocking assignments (=) in sequential (flop or latch) block; suggest delayed assignments (<=).
|
" %Warning-BLKSEQ: test.v:10: Blocking assignments (=) in sequential (flop or latch) block; suggest delayed assignments (<=).
|
||||||
let pattern = '^%\(Warning\|Error\)[^:]*:[^:]\+:\(\d\+\): \(.\+\)$'
|
let l:pattern = '^%\(Warning\|Error\)[^:]*:[^:]\+:\(\d\+\): \(.\+\)$'
|
||||||
let output = []
|
let l:output = []
|
||||||
|
|
||||||
for line in a:lines
|
for l:line in a:lines
|
||||||
let l:match = matchlist(line, pattern)
|
let l:match = matchlist(l:line, l:pattern)
|
||||||
|
|
||||||
if len(l:match) == 0
|
if len(l:match) == 0
|
||||||
continue
|
continue
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let line = l:match[2] + 0
|
let l:line = l:match[2] + 0
|
||||||
let type = l:match[1] ==# 'Error' ? 'E' : 'W'
|
let l:type = l:match[1] ==# 'Error' ? 'E' : 'W'
|
||||||
let text = l:match[3]
|
let l:text = l:match[3]
|
||||||
|
|
||||||
call add(output, {
|
call add(l:output, {
|
||||||
\ 'bufnr': a:buffer,
|
\ 'bufnr': a:buffer,
|
||||||
\ 'lnum': line,
|
\ 'lnum': l:line,
|
||||||
\ 'vcol': 0,
|
\ 'vcol': 0,
|
||||||
\ 'col': 1,
|
\ 'col': 1,
|
||||||
\ 'text': text,
|
\ 'text': l:text,
|
||||||
\ 'type': type,
|
\ 'type': l:type,
|
||||||
\ 'nr': -1,
|
\ 'nr': -1,
|
||||||
\})
|
\})
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
return output
|
return l:output
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
call ale#linter#Define('verilog', {
|
call ale#linter#Define('verilog', {
|
||||||
|
@ -10,34 +10,34 @@ function! ale_linters#yaml#yamllint#Handle(buffer, lines)
|
|||||||
" Matches patterns line the following:
|
" Matches patterns line the following:
|
||||||
" something.yaml:1:1: [warning] missing document start "---" (document-start)
|
" something.yaml:1:1: [warning] missing document start "---" (document-start)
|
||||||
" something.yml:2:1: [error] syntax error: expected the node content, but found '<stream end>'
|
" something.yml:2:1: [error] syntax error: expected the node content, but found '<stream end>'
|
||||||
let pattern = '^.*:\(\d\+\):\(\d\+\): \[\(error\|warning\)\] \(.\+\)$'
|
let l:pattern = '^.*:\(\d\+\):\(\d\+\): \[\(error\|warning\)\] \(.\+\)$'
|
||||||
let output = []
|
let l:output = []
|
||||||
|
|
||||||
for line in a:lines
|
for l:line in a:lines
|
||||||
let l:match = matchlist(line, pattern)
|
let l:match = matchlist(l:line, l:pattern)
|
||||||
|
|
||||||
if len(l:match) == 0
|
if len(l:match) == 0
|
||||||
continue
|
continue
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let line = match[1] + 0
|
let l:line = l:match[1] + 0
|
||||||
let col = match[2] + 0
|
let l:col = l:match[2] + 0
|
||||||
let type = match[3]
|
let l:type = l:match[3]
|
||||||
let text = match[4]
|
let l:text = l:match[4]
|
||||||
|
|
||||||
" vcol is Needed to indicate that the column is a character.
|
" vcol is Needed to indicate that the column is a character.
|
||||||
call add(output, {
|
call add(l:output, {
|
||||||
\ 'bufnr': a:buffer,
|
\ 'bufnr': a:buffer,
|
||||||
\ 'lnum': line,
|
\ 'lnum': l:line,
|
||||||
\ 'vcol': 0,
|
\ 'vcol': 0,
|
||||||
\ 'col': col,
|
\ 'col': l:col,
|
||||||
\ 'text': text,
|
\ 'text': l:text,
|
||||||
\ 'type': type ==# 'warning' ? 'W' : 'E',
|
\ 'type': l:type ==# 'warning' ? 'W' : 'E',
|
||||||
\ 'nr': -1,
|
\ 'nr': -1,
|
||||||
\})
|
\})
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
return output
|
return l:output
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
call ale#linter#Define('yaml', {
|
call ale#linter#Define('yaml', {
|
||||||
|
Loading…
Reference in New Issue
Block a user