Update syntax checking
* Line continuation characters should be on the same lines. * .vim file line indentation should be a multiple of 4.
This commit is contained in:
parent
4d426bf287
commit
3e11cbd18d
44 changed files with 221 additions and 191 deletions
|
@ -11,9 +11,9 @@ endfunction
|
|||
|
||||
function! ale_linters#bib#bibclean#get_type(str) abort
|
||||
if a:str is# '??'
|
||||
return 'E'
|
||||
return 'E'
|
||||
else
|
||||
return 'W'
|
||||
return 'W'
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
@ -36,30 +36,31 @@ function! ale_linters#bib#bibclean#Handle(buffer, lines) abort
|
|||
let l:msg = ''
|
||||
|
||||
for l:line in a:lines
|
||||
if empty(l:msg)
|
||||
let l:mlist = ale_linters#bib#bibclean#match_msg(l:line)
|
||||
if empty(l:msg)
|
||||
let l:mlist = ale_linters#bib#bibclean#match_msg(l:line)
|
||||
|
||||
if !empty(l:mlist)
|
||||
let l:msg = l:mlist[3]
|
||||
let l:type = ale_linters#bib#bibclean#get_type(l:mlist[1])
|
||||
endif
|
||||
else
|
||||
if l:type is# 'E'
|
||||
let l:mlist = ale_linters#bib#bibclean#match_entry(l:line)
|
||||
else
|
||||
let l:mlist = ale_linters#bib#bibclean#match_value(l:line)
|
||||
endif
|
||||
if !empty(l:mlist)
|
||||
let l:msg = l:mlist[3]
|
||||
let l:type = ale_linters#bib#bibclean#get_type(l:mlist[1])
|
||||
endif
|
||||
else
|
||||
if l:type is# 'E'
|
||||
let l:mlist = ale_linters#bib#bibclean#match_entry(l:line)
|
||||
else
|
||||
let l:mlist = ale_linters#bib#bibclean#match_value(l:line)
|
||||
endif
|
||||
|
||||
if !empty(l:mlist)
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:mlist[1],
|
||||
\ 'col': l:mlist[2],
|
||||
\ 'text': l:msg,
|
||||
\ 'type': l:type
|
||||
\})
|
||||
let l:msg = ''
|
||||
endif
|
||||
endif
|
||||
if !empty(l:mlist)
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:mlist[1],
|
||||
\ 'col': l:mlist[2],
|
||||
\ 'text': l:msg,
|
||||
\ 'type': l:type
|
||||
\})
|
||||
|
||||
let l:msg = ''
|
||||
endif
|
||||
endif
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
|
|
|
@ -7,13 +7,13 @@ call ale#Set('c_flawfinder_minlevel', 1)
|
|||
call ale#Set('c_flawfinder_error_severity', 6)
|
||||
|
||||
function! ale_linters#c#flawfinder#GetCommand(buffer) abort
|
||||
" Set the minimum vulnerability level for flawfinder to bother with
|
||||
let l:minlevel = ' --minlevel=' . ale#Var(a:buffer, 'c_flawfinder_minlevel')
|
||||
" Set the minimum vulnerability level for flawfinder to bother with
|
||||
let l:minlevel = ' --minlevel=' . ale#Var(a:buffer, 'c_flawfinder_minlevel')
|
||||
|
||||
return '%e -CDQS'
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'c_flawfinder_options'))
|
||||
\ . l:minlevel
|
||||
\ . ' %t'
|
||||
return '%e -CDQS'
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'c_flawfinder_options'))
|
||||
\ . l:minlevel
|
||||
\ . ' %t'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('c', {
|
||||
|
|
|
@ -11,7 +11,7 @@ function! ale_linters#clojure#joker#HandleJokerFormat(buffer, lines) abort
|
|||
let l:type = 'E'
|
||||
|
||||
if l:match[4] is? 'Parse warning'
|
||||
let l:type = 'W'
|
||||
let l:type = 'W'
|
||||
endif
|
||||
|
||||
call add(l:output, {
|
||||
|
|
|
@ -7,13 +7,13 @@ call ale#Set('cpp_flawfinder_minlevel', 1)
|
|||
call ale#Set('c_flawfinder_error_severity', 6)
|
||||
|
||||
function! ale_linters#cpp#flawfinder#GetCommand(buffer) abort
|
||||
" Set the minimum vulnerability level for flawfinder to bother with
|
||||
let l:minlevel = ' --minlevel=' . ale#Var(a:buffer, 'cpp_flawfinder_minlevel')
|
||||
" Set the minimum vulnerability level for flawfinder to bother with
|
||||
let l:minlevel = ' --minlevel=' . ale#Var(a:buffer, 'cpp_flawfinder_minlevel')
|
||||
|
||||
return '%e -CDQS'
|
||||
\ . ale#Var(a:buffer, 'cpp_flawfinder_options')
|
||||
\ . l:minlevel
|
||||
\ . ' %t'
|
||||
return '%e -CDQS'
|
||||
\ . ale#Var(a:buffer, 'cpp_flawfinder_options')
|
||||
\ . l:minlevel
|
||||
\ . ' %t'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('cpp', {
|
||||
|
|
|
@ -14,7 +14,7 @@ endfunction
|
|||
" Handle output from ameba
|
||||
function! ale_linters#crystal#ameba#HandleAmebaOutput(buffer, lines) abort
|
||||
if len(a:lines) == 0
|
||||
return []
|
||||
return []
|
||||
endif
|
||||
|
||||
let l:errors = ale#util#FuzzyJSONDecode(a:lines[0], {})
|
||||
|
@ -32,7 +32,7 @@ function! ale_linters#crystal#ameba#HandleAmebaOutput(buffer, lines) abort
|
|||
let l:end_col = str2nr(l:error['end_location']['column'])
|
||||
|
||||
if !l:end_col
|
||||
let l:end_col = l:start_col + 1
|
||||
let l:end_col = l:start_col + 1
|
||||
endif
|
||||
|
||||
call add(l:output, {
|
||||
|
|
|
@ -222,10 +222,10 @@ function! ale_linters#elm#make#GetExecutable(buffer) abort
|
|||
|
||||
if l:is_test && l:is_v19
|
||||
return ale#node#FindExecutable(
|
||||
\ a:buffer,
|
||||
\ 'elm_make',
|
||||
\ ['node_modules/.bin/elm-test', 'node_modules/.bin/elm']
|
||||
\ )
|
||||
\ a:buffer,
|
||||
\ 'elm_make',
|
||||
\ ['node_modules/.bin/elm-test', 'node_modules/.bin/elm']
|
||||
\)
|
||||
else
|
||||
return ale#node#FindExecutable(a:buffer, 'elm_make', ['node_modules/.bin/elm'])
|
||||
endif
|
||||
|
|
|
@ -10,8 +10,8 @@ function! ale_linters#go#langserver#GetCommand(buffer) abort
|
|||
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')
|
||||
if ale#Var(a:buffer, 'completion_enabled')
|
||||
call add(l:options, '-gocodecompletion')
|
||||
endif
|
||||
|
||||
let l:options = uniq(sort(l:options))
|
||||
|
|
|
@ -9,7 +9,7 @@ function! ale_linters#hack#hhast#GetProjectRoot(buffer) abort
|
|||
let l:hhconfig = ale#path#FindNearestFile(a:buffer, '.hhconfig')
|
||||
|
||||
if empty(l:hhconfig)
|
||||
return ''
|
||||
return ''
|
||||
endif
|
||||
|
||||
let l:root = fnamemodify(l:hhconfig, ':h')
|
||||
|
|
|
@ -35,7 +35,7 @@ function! ale_linters#haskell#hie#GetCommand(buffer) abort
|
|||
let l:executable = ale#Var(a:buffer, 'haskell_hie_executable')
|
||||
|
||||
return ale#handlers#haskell_stack#EscapeExecutable(l:executable, 'hie')
|
||||
\ . ' --lsp'
|
||||
\ . ' --lsp'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('haskell', {
|
||||
|
|
|
@ -49,11 +49,11 @@ function! ale_linters#idris#idris#Handle(buffer, lines) abort
|
|||
let l:errors = matchlist(l:match[5], '\v([wW]arning|[eE]rror) - ?(.*)')
|
||||
|
||||
if len(l:errors) > 0
|
||||
let l:ghc_type = l:errors[1]
|
||||
let l:text = l:errors[2]
|
||||
let l:ghc_type = l:errors[1]
|
||||
let l:text = l:errors[2]
|
||||
else
|
||||
let l:ghc_type = ''
|
||||
let l:text = l:match[5][:0] is# ' ' ? l:match[5][1:] : l:match[5]
|
||||
let l:ghc_type = ''
|
||||
let l:text = l:match[5][:0] is# ' ' ? l:match[5][1:] : l:match[5]
|
||||
endif
|
||||
|
||||
if l:ghc_type is? 'Warning'
|
||||
|
|
|
@ -20,7 +20,7 @@ function! ale_linters#kotlin#kotlinc#GetImportPaths(buffer) abort
|
|||
|
||||
if !empty(l:pom_path) && executable('mvn')
|
||||
return ale#path#CdString(fnamemodify(l:pom_path, ':h'))
|
||||
\ . 'mvn dependency:build-classpath'
|
||||
\ . 'mvn dependency:build-classpath'
|
||||
endif
|
||||
|
||||
let l:classpath_command = ale#gradle#BuildClasspathCommand(a:buffer)
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
" Description: Adds support for markdownlint
|
||||
|
||||
call ale#linter#Define('markdown', {
|
||||
\ 'name': 'markdownlint',
|
||||
\ 'executable': 'markdownlint',
|
||||
\ 'lint_file': 1,
|
||||
\ 'output_stream': 'both',
|
||||
\ 'command': 'markdownlint %s',
|
||||
\ 'callback': 'ale#handlers#markdownlint#Handle'
|
||||
\ })
|
||||
\ 'name': 'markdownlint',
|
||||
\ 'executable': 'markdownlint',
|
||||
\ 'lint_file': 1,
|
||||
\ 'output_stream': 'both',
|
||||
\ 'command': 'markdownlint %s',
|
||||
\ 'callback': 'ale#handlers#markdownlint#Handle'
|
||||
\})
|
||||
|
|
|
@ -36,8 +36,8 @@ function! ale_linters#perl6#perl6#ExtractError(dict, item, type, buffer) abort
|
|||
endif
|
||||
|
||||
if has_key(a:dict[a:item], 'line') && !empty(a:dict[a:item]['line'])
|
||||
let l:line = a:dict[a:item]['line']
|
||||
let l:counter -= 1
|
||||
let l:line = a:dict[a:item]['line']
|
||||
let l:counter -= 1
|
||||
endif
|
||||
|
||||
if has_key(a:dict[a:item], 'column') && !empty(a:dict[a:item]['column'])
|
||||
|
@ -61,7 +61,7 @@ function! ale_linters#perl6#perl6#ExtractError(dict, item, type, buffer) abort
|
|||
|
||||
" Currently, filenames and line numbers are not always given in the error output
|
||||
if l:counter < 2
|
||||
\&& ( ale#path#IsBufferPath(a:buffer, l:file) || l:file is# '' )
|
||||
\&& ( ale#path#IsBufferPath(a:buffer, l:file) || l:file is# '' )
|
||||
return {
|
||||
\ 'lnum': '' . l:line,
|
||||
\ 'text': l:text,
|
||||
|
@ -83,7 +83,7 @@ function! ale_linters#perl6#perl6#Handle(buffer, lines) abort
|
|||
endif
|
||||
|
||||
if a:lines[0] is# 'Syntax OK'
|
||||
return l:output
|
||||
return l:output
|
||||
endif
|
||||
|
||||
try
|
||||
|
@ -115,7 +115,7 @@ function! ale_linters#perl6#perl6#Handle(buffer, lines) abort
|
|||
\ )
|
||||
|
||||
if l:result isnot# ''
|
||||
call add(l:output, l:result)
|
||||
call add(l:output, l:result)
|
||||
endif
|
||||
endfor
|
||||
endfor
|
||||
|
@ -133,7 +133,7 @@ function! ale_linters#perl6#perl6#Handle(buffer, lines) abort
|
|||
\ )
|
||||
|
||||
if l:result isnot# ''
|
||||
call add(l:output, l:result)
|
||||
call add(l:output, l:result)
|
||||
endif
|
||||
endfor
|
||||
endfor
|
||||
|
@ -147,7 +147,7 @@ function! ale_linters#perl6#perl6#Handle(buffer, lines) abort
|
|||
\ )
|
||||
|
||||
if l:result isnot# ''
|
||||
call add(l:output, l:result)
|
||||
call add(l:output, l:result)
|
||||
endif
|
||||
endif
|
||||
endfor
|
||||
|
|
|
@ -53,7 +53,7 @@ function! ale_linters#python#pylint#Handle(buffer, lines) abort
|
|||
|
||||
if l:code is# 'I0011'
|
||||
" Skip 'Locally disabling' message
|
||||
continue
|
||||
continue
|
||||
endif
|
||||
|
||||
call add(l:output, {
|
||||
|
|
|
@ -11,11 +11,11 @@ function! ale_linters#slim#slimlint#GetCommand(buffer) abort
|
|||
"
|
||||
" See https://github.com/sds/slim-lint/blob/master/lib/slim_lint/linter/README.md#rubocop
|
||||
if !empty(l:rubocop_config)
|
||||
if ale#Has('win32')
|
||||
let l:command = 'set SLIM_LINT_RUBOCOP_CONF=' . ale#Escape(l:rubocop_config) . ' && ' . l:command
|
||||
else
|
||||
let l:command = 'SLIM_LINT_RUBOCOP_CONF=' . ale#Escape(l:rubocop_config) . ' ' . l:command
|
||||
endif
|
||||
if ale#Has('win32')
|
||||
let l:command = 'set SLIM_LINT_RUBOCOP_CONF=' . ale#Escape(l:rubocop_config) . ' && ' . l:command
|
||||
else
|
||||
let l:command = 'SLIM_LINT_RUBOCOP_CONF=' . ale#Escape(l:rubocop_config) . ' ' . l:command
|
||||
endif
|
||||
endif
|
||||
|
||||
return l:command
|
||||
|
|
|
@ -6,10 +6,10 @@ call ale#Set('swift_swiftlint_use_global', get(g:, 'ale_use_global_executables',
|
|||
|
||||
function! ale_linters#swift#swiftlint#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'swift_swiftlint', [
|
||||
\ 'Pods/SwiftLint/swiftlint',
|
||||
\ 'ios/Pods/SwiftLint/swiftlint',
|
||||
\ 'swiftlint',
|
||||
\])
|
||||
\ 'Pods/SwiftLint/swiftlint',
|
||||
\ 'ios/Pods/SwiftLint/swiftlint',
|
||||
\ 'swiftlint',
|
||||
\])
|
||||
endfunction
|
||||
|
||||
function! ale_linters#swift#swiftlint#GetCommand(buffer) abort
|
||||
|
@ -17,7 +17,7 @@ function! ale_linters#swift#swiftlint#GetCommand(buffer) abort
|
|||
let l:args = 'lint --use-stdin'
|
||||
|
||||
return ale#Escape(l:executable)
|
||||
\ . ' ' .l:args
|
||||
\ . ' ' .l:args
|
||||
endfunction
|
||||
|
||||
function! ale_linters#swift#swiftlint#Handle(buffer, lines) abort
|
||||
|
@ -26,10 +26,10 @@ function! ale_linters#swift#swiftlint#Handle(buffer, lines) abort
|
|||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
let l:item = {
|
||||
\ 'lnum': str2nr(l:match[2]),
|
||||
\ 'type': l:match[4] is# 'error' ? 'E' : 'W',
|
||||
\ 'text': l:match[5],
|
||||
\}
|
||||
\ 'lnum': str2nr(l:match[2]),
|
||||
\ 'type': l:match[4] is# 'error' ? 'E' : 'W',
|
||||
\ 'text': l:match[5],
|
||||
\}
|
||||
|
||||
if l:match[4] is# 'error'
|
||||
let l:item.type = 'E'
|
||||
|
|
|
@ -17,11 +17,11 @@ function! ale_linters#verilog#vlog#Handle(buffer, lines) abort
|
|||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'type': l:match[1] is? 'Error' ? 'E' : 'W',
|
||||
\ 'text': l:match[3],
|
||||
\})
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'type': l:match[1] is? 'Error' ? 'E' : 'W',
|
||||
\ 'text': l:match[3],
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
|
|
|
@ -16,11 +16,11 @@ function! ale_linters#verilog#xvlog#Handle(buffer, lines) abort
|
|||
|
||||
" NOTE: `xvlog` only prints 'INFO' and 'ERROR' messages
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'type': 'E',
|
||||
\ 'text': l:match[1],
|
||||
\})
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'type': 'E',
|
||||
\ 'text': l:match[1],
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
|
|
|
@ -6,7 +6,7 @@ call ale#Set('vhdl_ghdl_executable', 'ghdl')
|
|||
call ale#Set('vhdl_ghdl_options', '--std=08')
|
||||
|
||||
function! ale_linters#vhdl#ghdl#GetCommand(buffer) abort
|
||||
return '%e -s ' . ale#Pad(ale#Var(a:buffer, 'vhdl_ghdl_options')) . ' %t'
|
||||
return '%e -s ' . ale#Pad(ale#Var(a:buffer, 'vhdl_ghdl_options')) . ' %t'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#vhdl#ghdl#Handle(buffer, lines) abort
|
||||
|
|
|
@ -19,11 +19,11 @@ function! ale_linters#vhdl#vcom#Handle(buffer, lines) abort
|
|||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'type': l:match[1] is? 'Error' ? 'E' : 'W',
|
||||
\ 'text': l:match[3],
|
||||
\})
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'type': l:match[1] is? 'Error' ? 'E' : 'W',
|
||||
\ 'text': l:match[3],
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
|
|
|
@ -18,11 +18,11 @@ function! ale_linters#vhdl#xvhdl#Handle(buffer, lines) abort
|
|||
|
||||
" NOTE: `xvhdl` only prints 'INFO' and 'ERROR' messages
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'type': 'E',
|
||||
\ 'text': l:match[1],
|
||||
\})
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'type': 'E',
|
||||
\ 'text': l:match[1],
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
|
|
|
@ -29,27 +29,27 @@ function! ale_linters#xml#xmllint#Handle(buffer, lines) abort
|
|||
let l:match_message = matchlist(l:line, l:pattern_message)
|
||||
|
||||
if !empty(l:match_message)
|
||||
let l:line = l:match_message[2] + 0
|
||||
let l:type = l:match_message[4] =~? 'warning' ? 'W' : 'E'
|
||||
let l:text = l:match_message[3]
|
||||
let l:line = l:match_message[2] + 0
|
||||
let l:type = l:match_message[4] =~? 'warning' ? 'W' : 'E'
|
||||
let l:text = l:match_message[3]
|
||||
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:line,
|
||||
\ 'text': l:text,
|
||||
\ 'type': l:type,
|
||||
\})
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:line,
|
||||
\ 'text': l:text,
|
||||
\ 'type': l:type,
|
||||
\})
|
||||
|
||||
continue
|
||||
continue
|
||||
endif
|
||||
|
||||
" Parse column position
|
||||
let l:match_column_token = matchlist(l:line, l:pattern_column_token)
|
||||
|
||||
if !empty(l:output) && !empty(l:match_column_token)
|
||||
let l:previous = l:output[len(l:output) - 1]
|
||||
let l:previous['col'] = len(l:match_column_token[0])
|
||||
let l:previous = l:output[len(l:output) - 1]
|
||||
let l:previous['col'] = len(l:match_column_token[0])
|
||||
|
||||
continue
|
||||
continue
|
||||
endif
|
||||
endfor
|
||||
|
||||
|
|
|
@ -86,8 +86,8 @@ function! ale#c#ParseCFlags(path_prefix, cflag_line) abort
|
|||
let l:next_option_index = l:option_index + 1
|
||||
|
||||
" Join space-separated option
|
||||
while l:next_option_index < len(l:split_lines) &&
|
||||
\ stridx(l:split_lines[l:next_option_index], '-') != 0
|
||||
while l:next_option_index < len(l:split_lines)
|
||||
\&& stridx(l:split_lines[l:next_option_index], '-') != 0
|
||||
let l:next_option_index += 1
|
||||
endwhile
|
||||
|
||||
|
@ -96,9 +96,9 @@ function! ale#c#ParseCFlags(path_prefix, cflag_line) abort
|
|||
call insert(l:split_lines, l:option, l:option_index)
|
||||
|
||||
" Ignore invalid or conflicting options
|
||||
if stridx(l:option, '-') != 0 ||
|
||||
\ stridx(l:option, '-o') == 0 ||
|
||||
\ stridx(l:option, '-c') == 0
|
||||
if stridx(l:option, '-') != 0
|
||||
\|| stridx(l:option, '-o') == 0
|
||||
\|| stridx(l:option, '-c') == 0
|
||||
call remove(l:split_lines, l:option_index)
|
||||
let l:option_index = l:option_index - 1
|
||||
" Fix relative path
|
||||
|
|
|
@ -316,7 +316,7 @@ function! ale#completion#ParseTSServerCompletionEntryDetails(response) abort
|
|||
endfunction
|
||||
|
||||
function! ale#completion#NullFilter(buffer, item) abort
|
||||
return 1
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
function! ale#completion#ParseLSPCompletions(response) abort
|
||||
|
|
|
@ -5,7 +5,7 @@ function! ale#filetypes#LoadExtensionMap() abort
|
|||
" Output includes:
|
||||
" '*.erl setf erlang'
|
||||
redir => l:output
|
||||
silent exec 'autocmd'
|
||||
silent exec 'autocmd'
|
||||
redir end
|
||||
|
||||
let l:map = {}
|
||||
|
|
|
@ -7,16 +7,16 @@ function! ale#fixers#jq#GetExecutable(buffer) abort
|
|||
endfunction
|
||||
|
||||
function! ale#fixers#jq#Fix(buffer) abort
|
||||
let l:options = ale#Var(a:buffer, 'json_jq_options')
|
||||
let l:filters = ale#Var(a:buffer, 'json_jq_filters')
|
||||
let l:options = ale#Var(a:buffer, 'json_jq_options')
|
||||
let l:filters = ale#Var(a:buffer, 'json_jq_filters')
|
||||
|
||||
if empty(l:filters)
|
||||
return 0
|
||||
endif
|
||||
if empty(l:filters)
|
||||
return 0
|
||||
endif
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(ale#fixers#jq#GetExecutable(a:buffer))
|
||||
\ . ' ' . l:filters . ' '
|
||||
\ . l:options,
|
||||
\}
|
||||
return {
|
||||
\ 'command': ale#Escape(ale#fixers#jq#GetExecutable(a:buffer))
|
||||
\ . ' ' . l:filters . ' '
|
||||
\ . l:options,
|
||||
\}
|
||||
endfunction
|
||||
|
|
|
@ -51,9 +51,9 @@ function! ale#fixers#prettier#ApplyFixForVersion(buffer, version_output) abort
|
|||
" filetype (scratch buffer), Prettier needs `parser` set to know how
|
||||
" to process the buffer.
|
||||
if ale#semver#GTE(l:version, [1, 16, 0])
|
||||
let l:parser = 'babel'
|
||||
let l:parser = 'babel'
|
||||
else
|
||||
let l:parser = 'babylon'
|
||||
let l:parser = 'babylon'
|
||||
endif
|
||||
|
||||
let l:prettier_parsers = {
|
||||
|
|
|
@ -5,7 +5,7 @@ function! ale#fixers#qmlfmt#GetExecutable(buffer) abort
|
|||
endfunction
|
||||
|
||||
function! ale#fixers#qmlfmt#Fix(buffer) abort
|
||||
return {
|
||||
\ 'command': ale#Escape(ale#fixers#qmlfmt#GetExecutable(a:buffer)),
|
||||
\}
|
||||
return {
|
||||
\ 'command': ale#Escape(ale#fixers#qmlfmt#GetExecutable(a:buffer)),
|
||||
\}
|
||||
endfunction
|
||||
|
|
|
@ -5,13 +5,12 @@ call ale#Set('stylelint_executable', 'stylelint')
|
|||
call ale#Set('stylelint_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
|
||||
function! ale#fixers#stylelint#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'stylelint', [
|
||||
\ 'node_modules/stylelint/bin/stylelint.js',
|
||||
\ 'node_modules/.bin/stylelint',
|
||||
\])
|
||||
return ale#node#FindExecutable(a:buffer, 'stylelint', [
|
||||
\ 'node_modules/stylelint/bin/stylelint.js',
|
||||
\ 'node_modules/.bin/stylelint',
|
||||
\])
|
||||
endfunction
|
||||
|
||||
|
||||
function! ale#fixers#stylelint#Fix(buffer) abort
|
||||
let l:executable = ale#fixers#stylelint#GetExecutable(a:buffer)
|
||||
|
||||
|
|
|
@ -9,18 +9,18 @@ function! ale#go#FindProjectRoot(buffer) abort
|
|||
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)
|
||||
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
|
||||
" 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
|
||||
return l:default_go_path
|
||||
endif
|
||||
|
||||
return ''
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
scriptencoding utf-8
|
||||
" Author: Christian Gibbons <cgibbons@gmu.edu>
|
||||
" Description: This file defines a handler function that should work for the
|
||||
" flawfinder format with the -CDQS flags.
|
||||
|
@ -30,7 +31,7 @@ function! ale#handlers#flawfinder#HandleFlawfinderFormat(buffer, lines) abort
|
|||
\ 'lnum': str2nr(l:match[2]),
|
||||
\ 'col': str2nr(l:match[3]),
|
||||
\ 'type': (l:severity < ale#Var(a:buffer, 'c_flawfinder_error_severity'))
|
||||
\ ? 'W' : 'E',
|
||||
\ ? 'W' : 'E',
|
||||
\ 'text': s:RemoveUnicodeQuotes(join(split(l:match[4])[1:]) . ': ' . l:match[5]),
|
||||
\}
|
||||
|
||||
|
|
|
@ -66,11 +66,11 @@ function! ale#handlers#haskell#HandleGHCFormat(buffer, lines) abort
|
|||
let l:errors = matchlist(l:match[4], '\v([wW]arning|[eE]rror): ?(.*)')
|
||||
|
||||
if len(l:errors) > 0
|
||||
let l:ghc_type = l:errors[1]
|
||||
let l:text = l:errors[2]
|
||||
let l:ghc_type = l:errors[1]
|
||||
let l:text = l:errors[2]
|
||||
else
|
||||
let l:ghc_type = ''
|
||||
let l:text = l:match[4][:0] is# ' ' ? l:match[4][1:] : l:match[4]
|
||||
let l:ghc_type = ''
|
||||
let l:text = l:match[4][:0] is# ' ' ? l:match[4][1:] : l:match[4]
|
||||
endif
|
||||
|
||||
if l:ghc_type is? 'Warning'
|
||||
|
|
|
@ -7,10 +7,10 @@ function! ale#handlers#markdownlint#Handle(buffer, lines) abort
|
|||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'text': '(' . l:match[2] . l:match[3] . l:match[4] . ')' . l:match[5],
|
||||
\ 'type': 'W',
|
||||
\ })
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'text': '(' . l:match[2] . l:match[3] . l:match[4] . ')' . l:match[5],
|
||||
\ 'type': 'W',
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
|
|
|
@ -64,26 +64,27 @@ function! ale#handlers#sml#Handle(buffer, lines) abort
|
|||
let l:match2 = matchlist(l:line, l:pattern2)
|
||||
|
||||
if len(l:match2) != 0
|
||||
call add(l:out, {
|
||||
\ 'bufnr': a:buffer,
|
||||
\ 'lnum': l:match2[1] + 0,
|
||||
\ 'col' : l:match2[2] - 1,
|
||||
\ 'text': l:match2[3],
|
||||
\ 'type': l:match2[3] =~# '^Warning' ? 'W' : 'E',
|
||||
\})
|
||||
continue
|
||||
call add(l:out, {
|
||||
\ 'bufnr': a:buffer,
|
||||
\ 'lnum': l:match2[1] + 0,
|
||||
\ 'col' : l:match2[2] - 1,
|
||||
\ 'text': l:match2[3],
|
||||
\ 'type': l:match2[3] =~# '^Warning' ? 'W' : 'E',
|
||||
\})
|
||||
|
||||
continue
|
||||
endif
|
||||
|
||||
let l:match = matchlist(l:line, l:pattern)
|
||||
|
||||
if len(l:match) != 0
|
||||
call add(l:out, {
|
||||
\ 'bufnr': a:buffer,
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'text': l:match[2] . ': ' . l:match[3],
|
||||
\ 'type': l:match[2] is# 'error' ? 'E' : 'W',
|
||||
\})
|
||||
continue
|
||||
call add(l:out, {
|
||||
\ 'bufnr': a:buffer,
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'text': l:match[2] . ': ' . l:match[3],
|
||||
\ 'type': l:match[2] is# 'error' ? 'E' : 'W',
|
||||
\})
|
||||
continue
|
||||
endif
|
||||
endfor
|
||||
|
||||
|
|
|
@ -78,8 +78,8 @@ function! ale#hover#HandleLSPResponse(conn_id, response) abort
|
|||
let l:result = l:result.contents
|
||||
|
||||
if type(l:result) is v:t_string
|
||||
" The result can be just a string.
|
||||
let l:result = [l:result]
|
||||
" The result can be just a string.
|
||||
let l:result = [l:result]
|
||||
endif
|
||||
|
||||
if type(l:result) is v:t_dict
|
||||
|
|
|
@ -58,16 +58,20 @@ function! ale#lsp#response#ReadDiagnostics(response) abort
|
|||
if has_key(l:diagnostic, 'relatedInformation')
|
||||
let l:related = deepcopy(l:diagnostic.relatedInformation)
|
||||
call map(l:related, {key, val ->
|
||||
\ ale#path#FromURI(val.location.uri) .
|
||||
\ ':' . (val.location.range.start.line + 1) .
|
||||
\ ':' . (val.location.range.start.character + 1) .
|
||||
\ ":\n\t" . val.message
|
||||
\ })
|
||||
\ ale#path#FromURI(val.location.uri) .
|
||||
\ ':' . (val.location.range.start.line + 1) .
|
||||
\ ':' . (val.location.range.start.character + 1) .
|
||||
\ ":\n\t" . val.message
|
||||
\})
|
||||
let l:loclist_item.detail = l:diagnostic.message . "\n" . join(l:related, "\n")
|
||||
endif
|
||||
|
||||
if has_key(l:diagnostic, 'source')
|
||||
let l:loclist_item.detail = printf('[%s] %s', l:diagnostic.source, l:diagnostic.message)
|
||||
let l:loclist_item.detail = printf(
|
||||
\ '[%s] %s',
|
||||
\ l:diagnostic.source,
|
||||
\ l:diagnostic.message
|
||||
\)
|
||||
endif
|
||||
|
||||
call add(l:loclist, l:loclist_item)
|
||||
|
|
|
@ -52,7 +52,8 @@ function! ale#preview#ShowSelection(item_list, ...) abort
|
|||
let l:filename = l:item.filename
|
||||
|
||||
if get(l:options, 'use_relative_paths')
|
||||
let l:filename = substitute(l:item.filename, '^' . getcwd() . l:sep, '', '') " no-custom-checks
|
||||
let l:cwd = getcwd() " no-custom-checks
|
||||
let l:filename = substitute(l:filename, '^' . l:cwd . l:sep, '', '')
|
||||
endif
|
||||
|
||||
call add(
|
||||
|
|
|
@ -48,7 +48,7 @@ function! ale#python#FindProjectRoot(buffer) abort
|
|||
let l:ini_root = ale#python#FindProjectRootIni(a:buffer)
|
||||
|
||||
if !empty(l:ini_root)
|
||||
return l:ini_root
|
||||
return l:ini_root
|
||||
endif
|
||||
|
||||
for l:path in ale#path#Upwards(expand('#' . a:buffer . ':p:h'))
|
||||
|
|
|
@ -26,7 +26,7 @@ function! ale#ruby#FindProjectRoot(buffer) abort
|
|||
let l:dir = ale#ruby#FindRailsRoot(a:buffer)
|
||||
|
||||
if isdirectory(l:dir)
|
||||
return l:dir
|
||||
return l:dir
|
||||
endif
|
||||
|
||||
for l:name in ['.solargraph.yml', 'Rakefile', 'Gemfile']
|
||||
|
|
|
@ -116,7 +116,7 @@ endfunction
|
|||
" Read sign data for a buffer to a list of lines.
|
||||
function! ale#sign#ReadSigns(buffer) abort
|
||||
redir => l:output
|
||||
silent execute 'sign place buffer=' . a:buffer
|
||||
silent execute 'sign place buffer=' . a:buffer
|
||||
redir end
|
||||
|
||||
return split(l:output, "\n")
|
||||
|
|
|
@ -78,8 +78,10 @@ endfunction
|
|||
function! s:UpdateCacheIfNecessary(buffer) abort
|
||||
" Cache is cold, so manually ask for an update.
|
||||
if !has_key(g:ale_buffer_info[a:buffer], 'count')
|
||||
call ale#statusline#Update(a:buffer,
|
||||
\ g:ale_buffer_info[a:buffer].loclist)
|
||||
call ale#statusline#Update(
|
||||
\ a:buffer,
|
||||
\ g:ale_buffer_info[a:buffer].loclist
|
||||
\)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
|
|
@ -55,9 +55,9 @@ endfunction
|
|||
|
||||
function! s:RemoveModule(results) abort
|
||||
for l:item in a:results
|
||||
if has_key(l:item, 'module')
|
||||
call remove(l:item, 'module')
|
||||
endif
|
||||
if has_key(l:item, 'module')
|
||||
call remove(l:item, 'module')
|
||||
endif
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
|
|
|
@ -258,6 +258,6 @@ augroup ALECleanupGroup
|
|||
autocmd QuitPre * call ale#events#QuitEvent(str2nr(expand('<abuf>')))
|
||||
|
||||
if exists('##VimSuspend')
|
||||
autocmd VimSuspend * if exists('*ale#engine#CleanupEveryBuffer') | call ale#engine#CleanupEveryBuffer() | endif
|
||||
autocmd VimSuspend * if exists('*ale#engine#CleanupEveryBuffer') | call ale#engine#CleanupEveryBuffer() | endif
|
||||
endif
|
||||
augroup END
|
||||
|
|
|
@ -10,7 +10,7 @@ import re
|
|||
|
||||
INDENTATION_RE = re.compile(r'^ *')
|
||||
COMMENT_LINE_RE = re.compile(r'^ *"')
|
||||
COMMAND_RE = re.compile(r'^ *([a-zA-Z]+)')
|
||||
COMMAND_RE = re.compile(r'^ *([a-zA-Z\\]+)')
|
||||
|
||||
START_BLOCKS = set(['if', 'for', 'while', 'try', 'function'])
|
||||
END_BLOCKS = set(['endif', 'endfor', 'endwhile', 'endtry', 'endfunction'])
|
||||
|
@ -21,6 +21,7 @@ WHITESPACE_BEFORE_SET = START_BLOCKS | TERMINATORS
|
|||
WHITESPACE_FORBIDDEN_BEFORE_SET = END_BLOCKS | MIDDLE_BLOCKS
|
||||
WHITESPACE_AFTER_SET = END_BLOCKS
|
||||
WHITESPACE_FORBIDDEN_AFTER_SET = START_BLOCKS | MIDDLE_BLOCKS
|
||||
SAME_INDENTATION_SET = set(['\\'])
|
||||
|
||||
|
||||
def remove_comment_lines(line_iter):
|
||||
|
@ -44,7 +45,7 @@ def check_lines(line_iter):
|
|||
):
|
||||
yield (
|
||||
line_number,
|
||||
'Blank line forbidden after `%s`' % (command,)
|
||||
'Blank line forbidden after `%s`' % (previous_command,)
|
||||
)
|
||||
|
||||
previous_line_blank = True
|
||||
|
@ -56,6 +57,26 @@ def check_lines(line_iter):
|
|||
if command_match:
|
||||
command = command_match.group(1)
|
||||
|
||||
if (
|
||||
command in SAME_INDENTATION_SET
|
||||
and previous_indentation_level is not None
|
||||
and indentation_level != previous_indentation_level
|
||||
):
|
||||
yield (
|
||||
line_number,
|
||||
'Line continuation should match previous indentation'
|
||||
)
|
||||
|
||||
if (
|
||||
previous_indentation_level is not None
|
||||
and indentation_level != previous_indentation_level
|
||||
and abs(indentation_level - previous_indentation_level) != 4
|
||||
):
|
||||
yield (
|
||||
line_number,
|
||||
'Indentation should be 4 spaces'
|
||||
)
|
||||
|
||||
# Check for commands requiring blank lines before them, if they
|
||||
# aren't at the start of a block.
|
||||
if (
|
||||
|
|
Reference in a new issue