Ban use of ==# or ==? in the codebase, and prefer is# or is? instead
This commit is contained in:
parent
5010ddc28f
commit
a535d07f28
@ -21,8 +21,8 @@ function! ale_linters#ansible#ansible_lint#Handle(buffer, lines) abort
|
|||||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||||
let l:code = l:match[4]
|
let l:code = l:match[4]
|
||||||
|
|
||||||
if (l:code ==# 'EANSIBLE002')
|
if l:code is# 'EANSIBLE002'
|
||||||
\ && !ale#Var(a:buffer, 'warn_about_trailing_whitespace')
|
\&& !ale#Var(a:buffer, '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
|
||||||
@ -32,7 +32,7 @@ function! ale_linters#ansible#ansible_lint#Handle(buffer, lines) abort
|
|||||||
\ 'lnum': l:match[2] + 0,
|
\ 'lnum': l:match[2] + 0,
|
||||||
\ 'col': l:match[3] + 0,
|
\ 'col': l:match[3] + 0,
|
||||||
\ 'text': l:code . ': ' . l:match[5],
|
\ 'text': l:code . ': ' . l:match[5],
|
||||||
\ 'type': l:code[:0] ==# 'E' ? 'E' : 'W',
|
\ 'type': l:code[:0] is# 'E' ? 'E' : 'W',
|
||||||
\})
|
\})
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
|
@ -27,7 +27,7 @@ function! ale_linters#coffee#coffeelint#Handle(buffer, lines) abort
|
|||||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||||
call add(l:output, {
|
call add(l:output, {
|
||||||
\ 'lnum': str2nr(l:match[1]),
|
\ 'lnum': str2nr(l:match[1]),
|
||||||
\ 'type': l:match[3] ==# 'error' ? 'E' : 'W',
|
\ 'type': l:match[3] is# 'error' ? 'E' : 'W',
|
||||||
\ 'text': l:match[4],
|
\ 'text': l:match[4],
|
||||||
\})
|
\})
|
||||||
endfor
|
endfor
|
||||||
|
@ -60,7 +60,7 @@ function! ale_linters#d#dmd#Handle(buffer, lines) abort
|
|||||||
call add(l:output, {
|
call add(l:output, {
|
||||||
\ 'lnum': l:match[1],
|
\ 'lnum': l:match[1],
|
||||||
\ 'col': l:match[2],
|
\ 'col': l:match[2],
|
||||||
\ 'type': l:match[3] ==# 'Warning' ? 'W' : 'E',
|
\ 'type': l:match[3] is# 'Warning' ? 'W' : 'E',
|
||||||
\ 'text': l:match[4],
|
\ 'text': l:match[4],
|
||||||
\})
|
\})
|
||||||
endfor
|
endfor
|
||||||
|
@ -22,7 +22,7 @@ function! ale_linters#dart#dartanalyzer#Handle(buffer, lines) abort
|
|||||||
|
|
||||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||||
call add(l:output, {
|
call add(l:output, {
|
||||||
\ 'type': l:match[1] ==# 'error' ? 'E' : 'W',
|
\ 'type': l:match[1] is# 'error' ? 'E' : 'W',
|
||||||
\ 'text': l:match[6] . ': ' . l:match[2],
|
\ 'text': l:match[6] . ': ' . l:match[2],
|
||||||
\ 'lnum': str2nr(l:match[4]),
|
\ 'lnum': str2nr(l:match[4]),
|
||||||
\ 'col': str2nr(l:match[5]),
|
\ 'col': str2nr(l:match[5]),
|
||||||
|
@ -45,9 +45,9 @@ function! ale_linters#dockerfile#hadolint#GetExecutable(buffer) abort
|
|||||||
let l:use_docker = ale#Var(a:buffer, 'dockerfile_hadolint_use_docker')
|
let l:use_docker = ale#Var(a:buffer, 'dockerfile_hadolint_use_docker')
|
||||||
|
|
||||||
" check for mandatory directives
|
" check for mandatory directives
|
||||||
if l:use_docker ==# 'never'
|
if l:use_docker is# 'never'
|
||||||
return 'hadolint'
|
return 'hadolint'
|
||||||
elseif l:use_docker ==# 'always'
|
elseif l:use_docker is# 'always'
|
||||||
return 'docker'
|
return 'docker'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ endfunction
|
|||||||
|
|
||||||
function! ale_linters#dockerfile#hadolint#GetCommand(buffer) abort
|
function! ale_linters#dockerfile#hadolint#GetCommand(buffer) abort
|
||||||
let l:command = ale_linters#dockerfile#hadolint#GetExecutable(a:buffer)
|
let l:command = ale_linters#dockerfile#hadolint#GetExecutable(a:buffer)
|
||||||
if l:command ==# 'docker'
|
if l:command is# 'docker'
|
||||||
return 'docker run --rm -i ' . ale#Var(a:buffer, 'dockerfile_hadolint_docker_image')
|
return 'docker run --rm -i ' . ale#Var(a:buffer, 'dockerfile_hadolint_docker_image')
|
||||||
endif
|
endif
|
||||||
return 'hadolint -'
|
return 'hadolint -'
|
||||||
|
@ -11,9 +11,9 @@ function! ale_linters#elixir#credo#Handle(buffer, lines) abort
|
|||||||
let l:type = l:match[3]
|
let l:type = l:match[3]
|
||||||
let l:text = l:match[4]
|
let l:text = l:match[4]
|
||||||
|
|
||||||
if l:type ==# 'C'
|
if l:type is# 'C'
|
||||||
let l:type = 'E'
|
let l:type = 'E'
|
||||||
elseif l:type ==# 'R'
|
elseif l:type is# 'R'
|
||||||
let l:type = 'W'
|
let l:type = 'W'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -11,9 +11,9 @@ function! ale_linters#elixir#dogma#Handle(buffer, lines) abort
|
|||||||
let l:type = l:match[3]
|
let l:type = l:match[3]
|
||||||
let l:text = l:match[4]
|
let l:text = l:match[4]
|
||||||
|
|
||||||
if l:type ==# 'C'
|
if l:type is# 'C'
|
||||||
let l:type = 'E'
|
let l:type = 'E'
|
||||||
elseif l:type ==# 'R'
|
elseif l:type is# 'R'
|
||||||
let l:type = 'W'
|
let l:type = 'W'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -7,16 +7,16 @@ function! ale_linters#elm#make#Handle(buffer, lines) abort
|
|||||||
let l:temp_dir = l:is_windows ? $TMP : $TMPDIR
|
let l:temp_dir = l:is_windows ? $TMP : $TMPDIR
|
||||||
let l:unparsed_lines = []
|
let l:unparsed_lines = []
|
||||||
for l:line in a:lines
|
for l:line in a:lines
|
||||||
if l:line[0] ==# '['
|
if l:line[0] is# '['
|
||||||
let l:errors = json_decode(l:line)
|
let l:errors = json_decode(l:line)
|
||||||
|
|
||||||
for l:error in l:errors
|
for l:error in l:errors
|
||||||
" Check if file is from the temp directory.
|
" Check if file is from the temp directory.
|
||||||
" Filters out any errors not related to the buffer.
|
" Filters out any errors not related to the buffer.
|
||||||
if l:is_windows
|
if l:is_windows
|
||||||
let l:file_is_buffer = l:error.file[0:len(l:temp_dir) - 1] ==? l:temp_dir
|
let l:file_is_buffer = l:error.file[0:len(l:temp_dir) - 1] is? l:temp_dir
|
||||||
else
|
else
|
||||||
let l:file_is_buffer = l:error.file[0:len(l:temp_dir) - 1] ==# l:temp_dir
|
let l:file_is_buffer = l:error.file[0:len(l:temp_dir) - 1] is# l:temp_dir
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if l:file_is_buffer
|
if l:file_is_buffer
|
||||||
@ -25,7 +25,7 @@ function! ale_linters#elm#make#Handle(buffer, lines) abort
|
|||||||
\ 'col': l:error.region.start.column,
|
\ 'col': l:error.region.start.column,
|
||||||
\ 'end_lnum': l:error.region.end.line,
|
\ 'end_lnum': l:error.region.end.line,
|
||||||
\ 'end_col': l:error.region.end.column,
|
\ 'end_col': l:error.region.end.column,
|
||||||
\ 'type': (l:error.type ==? 'error') ? 'E' : 'W',
|
\ 'type': (l:error.type is? 'error') ? 'E' : 'W',
|
||||||
\ 'text': l:error.overview,
|
\ 'text': l:error.overview,
|
||||||
\ 'detail': l:error.overview . "\n\n" . l:error.details
|
\ 'detail': l:error.overview . "\n\n" . l:error.details
|
||||||
\})
|
\})
|
||||||
|
@ -27,7 +27,7 @@ function! ale_linters#erlang#erlc#Handle(buffer, lines) abort
|
|||||||
let l:pattern_no_module_definition = '\v(no module definition)$'
|
let l:pattern_no_module_definition = '\v(no module definition)$'
|
||||||
let l:pattern_unused = '\v(.* is unused)$'
|
let l:pattern_unused = '\v(.* is unused)$'
|
||||||
|
|
||||||
let l:is_hrl = fnamemodify(bufname(a:buffer), ':e') ==# 'hrl'
|
let l:is_hrl = fnamemodify(bufname(a:buffer), ':e') is# 'hrl'
|
||||||
|
|
||||||
for l:line in a:lines
|
for l:line in a:lines
|
||||||
let l:match = matchlist(l:line, l:pattern)
|
let l:match = matchlist(l:line, l:pattern)
|
||||||
|
@ -44,7 +44,7 @@ function! ale_linters#fortran#gcc#Handle(buffer, lines) abort
|
|||||||
|
|
||||||
" 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 l:last_loclist_obj.text = l:match[2]
|
let l:last_loclist_obj.text = l:match[2]
|
||||||
let l:last_loclist_obj.type = l:match[1] ==# 'Warning' ? 'W' : 'E'
|
let l:last_loclist_obj.type = l:match[1] is# 'Warning' ? 'W' : 'E'
|
||||||
call add(l:output, l:last_loclist_obj)
|
call add(l:output, l:last_loclist_obj)
|
||||||
else
|
else
|
||||||
let l:last_loclist_obj = {
|
let l:last_loclist_obj = {
|
||||||
|
@ -32,7 +32,7 @@ function! ale_linters#go#gometalinter#Handler(buffer, lines) abort
|
|||||||
call add(l:output, {
|
call add(l:output, {
|
||||||
\ 'lnum': l:match[2] + 0,
|
\ 'lnum': l:match[2] + 0,
|
||||||
\ 'col': l:match[3] + 0,
|
\ 'col': l:match[3] + 0,
|
||||||
\ 'type': tolower(l:match[4]) ==# 'warning' ? 'W' : 'E',
|
\ 'type': tolower(l:match[4]) is# 'warning' ? 'W' : 'E',
|
||||||
\ 'text': l:match[5],
|
\ 'text': l:match[5],
|
||||||
\})
|
\})
|
||||||
endfor
|
endfor
|
||||||
|
@ -5,9 +5,9 @@ function! ale_linters#haskell#hlint#Handle(buffer, lines) abort
|
|||||||
let l:output = []
|
let l:output = []
|
||||||
|
|
||||||
for l:error in ale#util#FuzzyJSONDecode(a:lines, [])
|
for l:error in ale#util#FuzzyJSONDecode(a:lines, [])
|
||||||
if l:error.severity ==# 'Error'
|
if l:error.severity is# 'Error'
|
||||||
let l:type = 'E'
|
let l:type = 'E'
|
||||||
elseif l:error.severity ==# 'Suggestion'
|
elseif l:error.severity is# 'Suggestion'
|
||||||
let l:type = 'I'
|
let l:type = 'I'
|
||||||
else
|
else
|
||||||
let l:type = 'W'
|
let l:type = 'W'
|
||||||
|
@ -46,7 +46,7 @@ function! ale_linters#html#tidy#Handle(buffer, lines) abort
|
|||||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||||
let l:line = l:match[1] + 0
|
let l:line = l:match[1] + 0
|
||||||
let l:col = l:match[2] + 0
|
let l:col = l:match[2] + 0
|
||||||
let l:type = l:match[3] ==# 'Error' ? 'E' : 'W'
|
let l:type = l:match[3] is# 'Error' ? 'E' : 'W'
|
||||||
let l:text = l:match[4]
|
let l:text = l:match[4]
|
||||||
|
|
||||||
call add(l:output, {
|
call add(l:output, {
|
||||||
|
@ -68,14 +68,14 @@ function! ale_linters#java#javac#Handle(buffer, lines) abort
|
|||||||
let l:output[-1].col = len(l:match[1])
|
let l:output[-1].col = len(l:match[1])
|
||||||
elseif empty(l:match[3])
|
elseif empty(l:match[3])
|
||||||
" Add symbols to 'cannot find symbol' errors.
|
" Add symbols to 'cannot find symbol' errors.
|
||||||
if l:output[-1].text ==# 'error: cannot find symbol'
|
if l:output[-1].text is# 'error: cannot find symbol'
|
||||||
let l:output[-1].text .= ': ' . l:match[2]
|
let l:output[-1].text .= ': ' . l:match[2]
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
call add(l:output, {
|
call add(l:output, {
|
||||||
\ 'lnum': l:match[1] + 0,
|
\ 'lnum': l:match[1] + 0,
|
||||||
\ 'text': l:match[2] . ':' . l:match[3],
|
\ 'text': l:match[2] . ':' . l:match[3],
|
||||||
\ 'type': l:match[2] ==# 'error' ? 'E' : 'W',
|
\ 'type': l:match[2] is# 'error' ? 'E' : 'W',
|
||||||
\})
|
\})
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
|
@ -46,7 +46,7 @@ function! s:GetJSONLines(lines) abort
|
|||||||
let l:start_index = 0
|
let l:start_index = 0
|
||||||
|
|
||||||
for l:line in a:lines
|
for l:line in a:lines
|
||||||
if l:line[:0] ==# '{'
|
if l:line[:0] is# '{'
|
||||||
break
|
break
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -77,13 +77,13 @@ function! ale_linters#javascript#flow#Handle(buffer, lines) abort
|
|||||||
" In certain cases, `l:message.loc.source` points to a different path
|
" In certain cases, `l:message.loc.source` points to a different path
|
||||||
" than the buffer one, thus we skip this loc information too.
|
" than the buffer one, thus we skip this loc information too.
|
||||||
if has_key(l:message, 'loc')
|
if has_key(l:message, 'loc')
|
||||||
\&& l:line ==# 0
|
\&& l:line is# 0
|
||||||
\&& ale#path#IsBufferPath(a:buffer, l:message.loc.source)
|
\&& ale#path#IsBufferPath(a:buffer, l:message.loc.source)
|
||||||
let l:line = l:message.loc.start.line + 0
|
let l:line = l:message.loc.start.line + 0
|
||||||
let l:col = l:message.loc.start.column + 0
|
let l:col = l:message.loc.start.column + 0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if l:text ==# ''
|
if l:text is# ''
|
||||||
let l:text = l:message.descr . ':'
|
let l:text = l:message.descr . ':'
|
||||||
else
|
else
|
||||||
let l:text = l:text . ' ' . l:message.descr
|
let l:text = l:text . ' ' . l:message.descr
|
||||||
@ -98,7 +98,7 @@ function! ale_linters#javascript#flow#Handle(buffer, lines) abort
|
|||||||
\ 'lnum': l:line,
|
\ 'lnum': l:line,
|
||||||
\ 'col': l:col,
|
\ 'col': l:col,
|
||||||
\ 'text': l:text,
|
\ 'text': l:text,
|
||||||
\ 'type': l:error.level ==# 'error' ? 'E' : 'W',
|
\ 'type': l:error.level is# 'error' ? 'E' : 'W',
|
||||||
\})
|
\})
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@ function! ale_linters#kotlin#kotlinc#Handle(buffer, lines) abort
|
|||||||
if l:buf_abspath !=# l:curbuf_abspath
|
if l:buf_abspath !=# l:curbuf_abspath
|
||||||
continue
|
continue
|
||||||
endif
|
endif
|
||||||
let l:type_marker_str = l:type ==# 'warning' ? 'W' : 'E'
|
let l:type_marker_str = l:type is# 'warning' ? 'W' : 'E'
|
||||||
|
|
||||||
call add(l:output, {
|
call add(l:output, {
|
||||||
\ 'lnum': l:line,
|
\ 'lnum': l:line,
|
||||||
@ -145,7 +145,7 @@ function! ale_linters#kotlin#kotlinc#Handle(buffer, lines) abort
|
|||||||
let l:type = l:match[1]
|
let l:type = l:match[1]
|
||||||
let l:text = l:match[2]
|
let l:text = l:match[2]
|
||||||
|
|
||||||
let l:type_marker_str = l:type ==# 'warning' || l:type ==# 'info' ? 'W' : 'E'
|
let l:type_marker_str = l:type is# 'warning' || l:type is# 'info' ? 'W' : 'E'
|
||||||
|
|
||||||
call add(l:output, {
|
call add(l:output, {
|
||||||
\ 'lnum': 1,
|
\ 'lnum': 1,
|
||||||
|
@ -30,7 +30,7 @@ function! ale_linters#matlab#mlint#Handle(buffer, lines) abort
|
|||||||
|
|
||||||
" Suppress erroneous waring about filename
|
" Suppress erroneous waring about filename
|
||||||
" TODO: Enable this error when copying filename is supported
|
" TODO: Enable this error when copying filename is supported
|
||||||
if l:code ==# 'FNDEF'
|
if l:code is# 'FNDEF'
|
||||||
continue
|
continue
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ function! ale_linters#nim#nimcheck#Handle(buffer, lines) abort
|
|||||||
|
|
||||||
if len(l:textmatch) > 0
|
if len(l:textmatch) > 0
|
||||||
let l:errortype = l:textmatch[1]
|
let l:errortype = l:textmatch[1]
|
||||||
if l:errortype ==# 'Error'
|
if l:errortype is# 'Error'
|
||||||
let l:type = 'E'
|
let l:type = 'E'
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
@ -21,7 +21,7 @@ function! ale_linters#perl#perlcritic#GetProfile(buffer) abort
|
|||||||
|
|
||||||
" first see if we've been overridden
|
" first see if we've been overridden
|
||||||
let l:profile = ale#Var(a:buffer, 'perl_perlcritic_profile')
|
let l:profile = ale#Var(a:buffer, 'perl_perlcritic_profile')
|
||||||
if l:profile ==? ''
|
if l:profile is? ''
|
||||||
return ''
|
return ''
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ function! ale_linters#php#phpcs#Handle(buffer, lines) abort
|
|||||||
\ 'lnum': l:match[1] + 0,
|
\ 'lnum': l:match[1] + 0,
|
||||||
\ 'col': l:match[2] + 0,
|
\ 'col': l:match[2] + 0,
|
||||||
\ 'text': l:text,
|
\ 'text': l:text,
|
||||||
\ 'type': l:type ==# 'error' ? 'E' : 'W',
|
\ 'type': l:type is# 'error' ? 'E' : 'W',
|
||||||
\})
|
\})
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
|
@ -115,7 +115,7 @@ function! ale_linters#python#flake8#Handle(buffer, lines) abort
|
|||||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||||
let l:code = l:match[3]
|
let l:code = l:match[3]
|
||||||
|
|
||||||
if (l:code ==# 'W291' || l:code ==# 'W293')
|
if (l:code is# 'W291' || l:code is# 'W293')
|
||||||
\ && !ale#Var(a:buffer, 'warn_about_trailing_whitespace')
|
\ && !ale#Var(a:buffer, '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
|
||||||
@ -128,12 +128,12 @@ function! ale_linters#python#flake8#Handle(buffer, lines) abort
|
|||||||
\ 'type': 'W',
|
\ 'type': 'W',
|
||||||
\}
|
\}
|
||||||
|
|
||||||
if l:code[:0] ==# 'F' || l:code ==# 'E999'
|
if l:code[:0] is# 'F' || l:code is# 'E999'
|
||||||
let l:item.type = 'E'
|
let l:item.type = 'E'
|
||||||
elseif l:code[:0] ==# 'E'
|
elseif l:code[:0] is# 'E'
|
||||||
let l:item.type = 'E'
|
let l:item.type = 'E'
|
||||||
let l:item.sub_type = 'style'
|
let l:item.sub_type = 'style'
|
||||||
elseif l:code[:0] ==# 'W'
|
elseif l:code[:0] is# 'W'
|
||||||
let l:item.sub_type = 'style'
|
let l:item.sub_type = 'style'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -31,13 +31,13 @@ function! ale_linters#python#pylint#Handle(buffer, lines) abort
|
|||||||
"let l:failed = append(0, l:match)
|
"let l:failed = append(0, l:match)
|
||||||
let l:code = l:match[3]
|
let l:code = l:match[3]
|
||||||
|
|
||||||
if (l:code ==# 'C0303')
|
if (l:code is# 'C0303')
|
||||||
\ && !ale#Var(a:buffer, 'warn_about_trailing_whitespace')
|
\ && !ale#Var(a:buffer, '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
|
||||||
|
|
||||||
if l:code ==# 'I0011'
|
if l:code is# 'I0011'
|
||||||
" Skip 'Locally disabling' message
|
" Skip 'Locally disabling' message
|
||||||
continue
|
continue
|
||||||
endif
|
endif
|
||||||
@ -46,7 +46,7 @@ function! ale_linters#python#pylint#Handle(buffer, lines) abort
|
|||||||
\ 'lnum': l:match[1] + 0,
|
\ 'lnum': l:match[1] + 0,
|
||||||
\ 'col': l:match[2] + 1,
|
\ 'col': l:match[2] + 1,
|
||||||
\ 'text': l:code . ': ' . l:match[5] . ' (' . l:match[4] . ')',
|
\ 'text': l:code . ': ' . l:match[5] . ' (' . l:match[4] . ')',
|
||||||
\ 'type': l:code[:0] ==# 'E' ? 'E' : 'W',
|
\ 'type': l:code[:0] is# 'E' ? 'E' : 'W',
|
||||||
\})
|
\})
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ endfunction
|
|||||||
function! ale_linters#ruby#brakeman#GetCommand(buffer) abort
|
function! ale_linters#ruby#brakeman#GetCommand(buffer) abort
|
||||||
let l:rails_root = ale#ruby#FindRailsRoot(a:buffer)
|
let l:rails_root = ale#ruby#FindRailsRoot(a:buffer)
|
||||||
|
|
||||||
if l:rails_root ==? ''
|
if l:rails_root is? ''
|
||||||
return ''
|
return ''
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ function! ale_linters#ruby#rails_best_practices#GetCommand(buffer) abort
|
|||||||
|
|
||||||
let l:rails_root = ale#ruby#FindRailsRoot(a:buffer)
|
let l:rails_root = ale#ruby#FindRailsRoot(a:buffer)
|
||||||
|
|
||||||
if l:rails_root ==? ''
|
if l:rails_root is? ''
|
||||||
return ''
|
return ''
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -43,9 +43,9 @@ function! ale_linters#ruby#rubocop#Handle(buffer, lines) abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! ale_linters#ruby#rubocop#GetType(severity) abort
|
function! ale_linters#ruby#rubocop#GetType(severity) abort
|
||||||
if a:severity ==? 'convention'
|
if a:severity is? 'convention'
|
||||||
\|| a:severity ==? 'warning'
|
\|| a:severity is? 'warning'
|
||||||
\|| a:severity ==? 'refactor'
|
\|| a:severity is? 'refactor'
|
||||||
return 'W'
|
return 'W'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ function! ale_linters#scala#scalac#Handle(buffer, lines) abort
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
let l:text = l:match[3]
|
let l:text = l:match[3]
|
||||||
let l:type = l:match[2] ==# 'error' ? 'E' : 'W'
|
let l:type = l:match[2] is# 'error' ? 'E' : 'W'
|
||||||
let l:col = 0
|
let l:col = 0
|
||||||
|
|
||||||
if l:ln + 1 < len(a:lines)
|
if l:ln + 1 < len(a:lines)
|
||||||
|
@ -19,7 +19,7 @@ function! ale_linters#scss#scsslint#Handle(buffer, lines) abort
|
|||||||
\ 'lnum': l:match[1] + 0,
|
\ 'lnum': l:match[1] + 0,
|
||||||
\ 'col': l:match[2] + 0,
|
\ 'col': l:match[2] + 0,
|
||||||
\ 'text': l:match[4],
|
\ 'text': l:match[4],
|
||||||
\ 'type': l:match[3] ==# 'E' ? 'E' : 'W',
|
\ 'type': l:match[3] is# 'E' ? 'E' : 'W',
|
||||||
\})
|
\})
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ endif
|
|||||||
if !exists('g:ale_sh_shell_default_shell')
|
if !exists('g:ale_sh_shell_default_shell')
|
||||||
let g:ale_sh_shell_default_shell = fnamemodify($SHELL, ':t')
|
let g:ale_sh_shell_default_shell = fnamemodify($SHELL, ':t')
|
||||||
|
|
||||||
if g:ale_sh_shell_default_shell ==# '' || g:ale_sh_shell_default_shell ==# 'fish'
|
if g:ale_sh_shell_default_shell is# '' || g:ale_sh_shell_default_shell is# 'fish'
|
||||||
let g:ale_sh_shell_default_shell = 'bash'
|
let g:ale_sh_shell_default_shell = 'bash'
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
@ -29,7 +29,7 @@ function! ale_linters#sml#smlnj#Handle(buffer, lines) abort
|
|||||||
\ 'bufnr': a:buffer,
|
\ 'bufnr': a:buffer,
|
||||||
\ 'lnum': l:match[1] + 0,
|
\ 'lnum': l:match[1] + 0,
|
||||||
\ 'text': l:match[2] . ': ' . l:match[3],
|
\ 'text': l:match[2] . ': ' . l:match[3],
|
||||||
\ 'type': l:match[2] ==# 'error' ? 'E' : 'W',
|
\ 'type': l:match[2] is# 'error' ? 'E' : 'W',
|
||||||
\})
|
\})
|
||||||
continue
|
continue
|
||||||
endif
|
endif
|
||||||
|
@ -28,7 +28,7 @@ function! ale_linters#tcl#nagelfar#Handle(buffer, lines) abort
|
|||||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||||
call add(l:output, {
|
call add(l:output, {
|
||||||
\ 'lnum': l:match[1] + 0,
|
\ 'lnum': l:match[1] + 0,
|
||||||
\ 'type': l:match[2] ==# 'N' ? 'W' : l:match[2],
|
\ 'type': l:match[2] is# 'N' ? 'W' : l:match[2],
|
||||||
\ 'text': l:match[3],
|
\ 'text': l:match[3],
|
||||||
\})
|
\})
|
||||||
endfor
|
endfor
|
||||||
|
@ -17,7 +17,7 @@ function! ale_linters#typescript#tslint#Handle(buffer, lines) abort
|
|||||||
for l:error in ale#util#FuzzyJSONDecode(a:lines, [])
|
for l:error in ale#util#FuzzyJSONDecode(a:lines, [])
|
||||||
if ale#path#IsBufferPath(a:buffer, l:error.name)
|
if ale#path#IsBufferPath(a:buffer, l:error.name)
|
||||||
call add(l:output, {
|
call add(l:output, {
|
||||||
\ 'type': (get(l:error, 'ruleSeverity', '') ==# 'WARNING' ? 'W' : 'E'),
|
\ 'type': (get(l:error, 'ruleSeverity', '') is# 'WARNING' ? 'W' : 'E'),
|
||||||
\ 'text': l:error.failure,
|
\ 'text': l:error.failure,
|
||||||
\ 'lnum': l:error.startPosition.line + 1,
|
\ 'lnum': l:error.startPosition.line + 1,
|
||||||
\ 'col': l:error.startPosition.character + 1,
|
\ 'col': l:error.startPosition.character + 1,
|
||||||
|
@ -14,7 +14,7 @@ function! ale_linters#verilog#iverilog#Handle(buffer, lines) abort
|
|||||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||||
let l:line = l:match[1] + 0
|
let l:line = l:match[1] + 0
|
||||||
let l:type = l:match[2] =~# 'error' ? 'E' : 'W'
|
let l:type = l:match[2] =~# 'error' ? 'E' : 'W'
|
||||||
let l:text = l:match[2] ==# 'syntax error' ? 'syntax error' : l:match[4]
|
let l:text = l:match[2] is# 'syntax error' ? 'syntax error' : l:match[4]
|
||||||
|
|
||||||
call add(l:output, {
|
call add(l:output, {
|
||||||
\ 'lnum': l:line,
|
\ 'lnum': l:line,
|
||||||
|
@ -33,7 +33,7 @@ function! ale_linters#verilog#verilator#Handle(buffer, lines) abort
|
|||||||
|
|
||||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||||
let l:line = l:match[3] + 0
|
let l:line = l:match[3] + 0
|
||||||
let l:type = l:match[1] ==# 'Error' ? 'E' : 'W'
|
let l:type = l:match[1] is# 'Error' ? 'E' : 'W'
|
||||||
let l:text = l:match[4]
|
let l:text = l:match[4]
|
||||||
let l:file = l:match[2]
|
let l:file = l:match[2]
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ function! ale_linters#yaml#swaglint#Handle(buffer, lines) abort
|
|||||||
|
|
||||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||||
let l:obj = {
|
let l:obj = {
|
||||||
\ 'type': l:match[1] ==# 'error' ? 'E' : 'W',
|
\ 'type': l:match[1] is# 'error' ? 'E' : 'W',
|
||||||
\ 'lnum': l:match[2] + 0,
|
\ 'lnum': l:match[2] + 0,
|
||||||
\ 'col': l:match[3] + 0,
|
\ 'col': l:match[3] + 0,
|
||||||
\ 'text': l:match[4],
|
\ 'text': l:match[4],
|
||||||
|
@ -33,7 +33,7 @@ function! ale_linters#yaml#yamllint#Handle(buffer, lines) abort
|
|||||||
\ 'lnum': l:line,
|
\ 'lnum': l:line,
|
||||||
\ 'col': l:col,
|
\ 'col': l:col,
|
||||||
\ 'text': l:text,
|
\ 'text': l:text,
|
||||||
\ 'type': l:type ==# 'error' ? 'E' : 'W',
|
\ 'type': l:type is# 'error' ? 'E' : 'W',
|
||||||
\})
|
\})
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ function! ale#Queue(delay, ...) abort
|
|||||||
|
|
||||||
" Remember that we want to check files for this buffer.
|
" Remember that we want to check files for this buffer.
|
||||||
" We will remember this until we finally run the linters, via any event.
|
" We will remember this until we finally run the linters, via any event.
|
||||||
if l:linting_flag ==# 'lint_file'
|
if l:linting_flag is# 'lint_file'
|
||||||
let s:should_lint_file_for_buffer[bufnr('%')] = 1
|
let s:should_lint_file_for_buffer[bufnr('%')] = 1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -157,7 +157,7 @@ endfunction
|
|||||||
" Escape a string suitably for each platform.
|
" Escape a string suitably for each platform.
|
||||||
" shellescape does not work on Windows.
|
" shellescape does not work on Windows.
|
||||||
function! ale#Escape(str) abort
|
function! ale#Escape(str) abort
|
||||||
if fnamemodify(&shell, ':t') ==? 'cmd.exe'
|
if fnamemodify(&shell, ':t') is? 'cmd.exe'
|
||||||
" If the string contains spaces, it will be surrounded by quotes.
|
" If the string contains spaces, it will be surrounded by quotes.
|
||||||
" Otherwise, special characters will be escaped with carets (^).
|
" Otherwise, special characters will be escaped with carets (^).
|
||||||
return substitute(
|
return substitute(
|
||||||
|
@ -9,7 +9,7 @@ function! ale#c#FindProjectRoot(buffer) abort
|
|||||||
let l:path = fnamemodify(l:full_path, ':h')
|
let l:path = fnamemodify(l:full_path, ':h')
|
||||||
|
|
||||||
" Correct .git path detection.
|
" Correct .git path detection.
|
||||||
if fnamemodify(l:path, ':t') ==# '.git'
|
if fnamemodify(l:path, ':t') is# '.git'
|
||||||
let l:path = fnamemodify(l:path, ':h')
|
let l:path = fnamemodify(l:path, ':h')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ function! ale#completion#FilterSuggestionsByPrefix(suggestions, prefix) abort
|
|||||||
" foo.
|
" foo.
|
||||||
" ^
|
" ^
|
||||||
" We need to include all of the given suggestions.
|
" We need to include all of the given suggestions.
|
||||||
if a:prefix ==# '.'
|
if a:prefix is# '.'
|
||||||
return a:suggestions
|
return a:suggestions
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ function! ale#completion#FilterSuggestionsByPrefix(suggestions, prefix) abort
|
|||||||
for l:suggestion in a:suggestions
|
for l:suggestion in a:suggestions
|
||||||
" Add suggestions if the suggestion starts with a case-insensitive
|
" Add suggestions if the suggestion starts with a case-insensitive
|
||||||
" match for the prefix.
|
" match for the prefix.
|
||||||
if l:suggestion.word[: len(a:prefix) - 1] ==? a:prefix
|
if l:suggestion.word[: len(a:prefix) - 1] is? a:prefix
|
||||||
call add(l:filtered_suggestions, l:suggestion)
|
call add(l:filtered_suggestions, l:suggestion)
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
@ -150,9 +150,9 @@ function! ale#completion#ParseTSServerCompletionEntryDetails(response) abort
|
|||||||
call add(l:documentationParts, l:part.text)
|
call add(l:documentationParts, l:part.text)
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
if l:suggestion.kind ==# 'clasName'
|
if l:suggestion.kind is# 'clasName'
|
||||||
let l:kind = 'f'
|
let l:kind = 'f'
|
||||||
elseif l:suggestion.kind ==# 'parameterName'
|
elseif l:suggestion.kind is# 'parameterName'
|
||||||
let l:kind = 'f'
|
let l:kind = 'f'
|
||||||
else
|
else
|
||||||
let l:kind = 'v'
|
let l:kind = 'v'
|
||||||
@ -182,7 +182,7 @@ function! s:HandleTSServerLSPResponse(conn_id, response) abort
|
|||||||
|
|
||||||
let l:command = get(a:response, 'command', '')
|
let l:command = get(a:response, 'command', '')
|
||||||
|
|
||||||
if l:command ==# 'completions'
|
if l:command is# 'completions'
|
||||||
let l:names = ale#completion#ParseTSServerCompletions(a:response)
|
let l:names = ale#completion#ParseTSServerCompletions(a:response)
|
||||||
|
|
||||||
if !empty(l:names)
|
if !empty(l:names)
|
||||||
@ -196,7 +196,7 @@ function! s:HandleTSServerLSPResponse(conn_id, response) abort
|
|||||||
\ ),
|
\ ),
|
||||||
\)
|
\)
|
||||||
endif
|
endif
|
||||||
elseif l:command ==# 'completionEntryDetails'
|
elseif l:command is# 'completionEntryDetails'
|
||||||
call ale#completion#Show(
|
call ale#completion#Show(
|
||||||
\ a:response,
|
\ a:response,
|
||||||
\ 'ale#completion#ParseTSServerCompletionEntryDetails',
|
\ 'ale#completion#ParseTSServerCompletionEntryDetails',
|
||||||
@ -256,7 +256,7 @@ function! ale#completion#GetCompletions() abort
|
|||||||
\}
|
\}
|
||||||
|
|
||||||
for l:linter in ale#linter#Get(&filetype)
|
for l:linter in ale#linter#Get(&filetype)
|
||||||
if l:linter.lsp ==# 'tsserver'
|
if l:linter.lsp is# 'tsserver'
|
||||||
call s:GetLSPCompletions(l:linter)
|
call s:GetLSPCompletions(l:linter)
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
" Return a formatted message according to g:ale_echo_msg_format variable
|
" Return a formatted message according to g:ale_echo_msg_format variable
|
||||||
function! s:GetMessage(linter, type, text) abort
|
function! s:GetMessage(linter, type, text) abort
|
||||||
let l:msg = g:ale_echo_msg_format
|
let l:msg = g:ale_echo_msg_format
|
||||||
let l:type = a:type ==# 'E'
|
let l:type = a:type is# 'E'
|
||||||
\ ? g:ale_echo_msg_error_str
|
\ ? g:ale_echo_msg_error_str
|
||||||
\ : g:ale_echo_msg_warning_str
|
\ : g:ale_echo_msg_warning_str
|
||||||
|
|
||||||
@ -22,12 +22,12 @@ function! s:EchoWithShortMess(setting, message) abort
|
|||||||
|
|
||||||
try
|
try
|
||||||
" Turn shortmess on or off.
|
" Turn shortmess on or off.
|
||||||
if a:setting ==# 'on'
|
if a:setting is# 'on'
|
||||||
setlocal shortmess+=T
|
setlocal shortmess+=T
|
||||||
" echomsg is needed for the message to get truncated and appear in
|
" echomsg is needed for the message to get truncated and appear in
|
||||||
" the message history.
|
" the message history.
|
||||||
exec "norm! :echomsg a:message\n"
|
exec "norm! :echomsg a:message\n"
|
||||||
elseif a:setting ==# 'off'
|
elseif a:setting is# 'off'
|
||||||
setlocal shortmess-=T
|
setlocal shortmess-=T
|
||||||
" Regular echo is needed for printing newline characters.
|
" Regular echo is needed for printing newline characters.
|
||||||
echo a:message
|
echo a:message
|
||||||
|
@ -81,7 +81,7 @@ function! s:EchoCommandHistory() abort
|
|||||||
let l:status_message = l:item.status
|
let l:status_message = l:item.status
|
||||||
|
|
||||||
" Include the exit code in output if we have it.
|
" Include the exit code in output if we have it.
|
||||||
if l:item.status ==# 'finished'
|
if l:item.status is# 'finished'
|
||||||
let l:status_message .= ' - exit code ' . l:item.exit_code
|
let l:status_message .= ' - exit code ' . l:item.exit_code
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -224,7 +224,7 @@ function! s:HandleTSServerDiagnostics(response, error_type) abort
|
|||||||
" tsserver sends syntax and semantic errors in separate messages, so we
|
" tsserver sends syntax and semantic errors in separate messages, so we
|
||||||
" have to collect the messages separately for each buffer and join them
|
" have to collect the messages separately for each buffer and join them
|
||||||
" back together again.
|
" back together again.
|
||||||
if a:error_type ==# 'syntax'
|
if a:error_type is# 'syntax'
|
||||||
let l:info.syntax_loclist = l:thislist
|
let l:info.syntax_loclist = l:thislist
|
||||||
else
|
else
|
||||||
let l:info.semantic_loclist = l:thislist
|
let l:info.semantic_loclist = l:thislist
|
||||||
@ -247,16 +247,16 @@ endfunction
|
|||||||
function! ale#engine#HandleLSPResponse(conn_id, response) abort
|
function! ale#engine#HandleLSPResponse(conn_id, response) abort
|
||||||
let l:method = get(a:response, 'method', '')
|
let l:method = get(a:response, 'method', '')
|
||||||
|
|
||||||
if get(a:response, 'jsonrpc', '') ==# '2.0' && has_key(a:response, 'error')
|
if get(a:response, 'jsonrpc', '') is# '2.0' && has_key(a:response, 'error')
|
||||||
" Uncomment this line to print LSP error messages.
|
" Uncomment this line to print LSP error messages.
|
||||||
" call s:HandleLSPErrorMessage(a:response.error.message)
|
" call s:HandleLSPErrorMessage(a:response.error.message)
|
||||||
elseif l:method ==# 'textDocument/publishDiagnostics'
|
elseif l:method is# 'textDocument/publishDiagnostics'
|
||||||
call s:HandleLSPDiagnostics(a:conn_id, a:response)
|
call s:HandleLSPDiagnostics(a:conn_id, a:response)
|
||||||
elseif get(a:response, 'type', '') ==# 'event'
|
elseif get(a:response, 'type', '') is# 'event'
|
||||||
\&& get(a:response, 'event', '') ==# 'semanticDiag'
|
\&& get(a:response, 'event', '') is# 'semanticDiag'
|
||||||
call s:HandleTSServerDiagnostics(a:response, 'semantic')
|
call s:HandleTSServerDiagnostics(a:response, 'semantic')
|
||||||
elseif get(a:response, 'type', '') ==# 'event'
|
elseif get(a:response, 'type', '') is# 'event'
|
||||||
\&& get(a:response, 'event', '') ==# 'syntaxDiag'
|
\&& get(a:response, 'event', '') is# 'syntaxDiag'
|
||||||
call s:HandleTSServerDiagnostics(a:response, 'syntax')
|
call s:HandleTSServerDiagnostics(a:response, 'syntax')
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
@ -313,17 +313,17 @@ endfunction
|
|||||||
function! s:RemapItemTypes(type_map, loclist) abort
|
function! s:RemapItemTypes(type_map, loclist) abort
|
||||||
for l:item in a:loclist
|
for l:item in a:loclist
|
||||||
let l:key = l:item.type
|
let l:key = l:item.type
|
||||||
\ . (get(l:item, 'sub_type', '') ==# 'style' ? 'S' : '')
|
\ . (get(l:item, 'sub_type', '') is# 'style' ? 'S' : '')
|
||||||
let l:new_key = get(a:type_map, l:key, '')
|
let l:new_key = get(a:type_map, l:key, '')
|
||||||
|
|
||||||
if l:new_key ==# 'E'
|
if l:new_key is# 'E'
|
||||||
\|| l:new_key ==# 'ES'
|
\|| l:new_key is# 'ES'
|
||||||
\|| l:new_key ==# 'W'
|
\|| l:new_key is# 'W'
|
||||||
\|| l:new_key ==# 'WS'
|
\|| l:new_key is# 'WS'
|
||||||
\|| l:new_key ==# 'I'
|
\|| l:new_key is# 'I'
|
||||||
let l:item.type = l:new_key[0]
|
let l:item.type = l:new_key[0]
|
||||||
|
|
||||||
if l:new_key ==# 'ES' || l:new_key ==# 'WS'
|
if l:new_key is# 'ES' || l:new_key is# 'WS'
|
||||||
let l:item.sub_type = 'style'
|
let l:item.sub_type = 'style'
|
||||||
elseif has_key(l:item, 'sub_type')
|
elseif has_key(l:item, 'sub_type')
|
||||||
call remove(l:item, 'sub_type')
|
call remove(l:item, 'sub_type')
|
||||||
@ -465,9 +465,9 @@ function! s:RunJob(options) abort
|
|||||||
\ 'exit_cb': function('s:HandleExit'),
|
\ 'exit_cb': function('s:HandleExit'),
|
||||||
\}
|
\}
|
||||||
|
|
||||||
if l:output_stream ==# 'stderr'
|
if l:output_stream is# 'stderr'
|
||||||
let l:job_options.err_cb = function('s:GatherOutput')
|
let l:job_options.err_cb = function('s:GatherOutput')
|
||||||
elseif l:output_stream ==# 'both'
|
elseif l:output_stream is# 'both'
|
||||||
let l:job_options.out_cb = function('s:GatherOutput')
|
let l:job_options.out_cb = function('s:GatherOutput')
|
||||||
let l:job_options.err_cb = function('s:GatherOutput')
|
let l:job_options.err_cb = function('s:GatherOutput')
|
||||||
else
|
else
|
||||||
@ -635,7 +635,7 @@ function! s:CheckWithLSP(buffer, linter) abort
|
|||||||
" Remember the linter this connection is for.
|
" Remember the linter this connection is for.
|
||||||
let s:lsp_linter_map[l:id] = a:linter.name
|
let s:lsp_linter_map[l:id] = a:linter.name
|
||||||
|
|
||||||
let l:change_message = a:linter.lsp ==# 'tsserver'
|
let l:change_message = a:linter.lsp is# 'tsserver'
|
||||||
\ ? ale#lsp#tsserver_message#Geterr(a:buffer)
|
\ ? ale#lsp#tsserver_message#Geterr(a:buffer)
|
||||||
\ : ale#lsp#message#DidChange(a:buffer)
|
\ : ale#lsp#message#DidChange(a:buffer)
|
||||||
let l:request_id = ale#lsp#Send(l:id, l:change_message, l:root)
|
let l:request_id = ale#lsp#Send(l:id, l:change_message, l:root)
|
||||||
|
@ -186,9 +186,9 @@ function! s:RunJob(options) abort
|
|||||||
if l:read_temporary_file
|
if l:read_temporary_file
|
||||||
" TODO: Check that a temporary file is set here.
|
" TODO: Check that a temporary file is set here.
|
||||||
let l:job_info.file_to_read = l:temporary_file
|
let l:job_info.file_to_read = l:temporary_file
|
||||||
elseif l:output_stream ==# 'stderr'
|
elseif l:output_stream is# 'stderr'
|
||||||
let l:job_options.err_cb = function('s:GatherOutput')
|
let l:job_options.err_cb = function('s:GatherOutput')
|
||||||
elseif l:output_stream ==# 'both'
|
elseif l:output_stream is# 'both'
|
||||||
let l:job_options.out_cb = function('s:GatherOutput')
|
let l:job_options.out_cb = function('s:GatherOutput')
|
||||||
let l:job_options.err_cb = function('s:GatherOutput')
|
let l:job_options.err_cb = function('s:GatherOutput')
|
||||||
else
|
else
|
||||||
@ -320,7 +320,7 @@ function! ale#fix#InitBufferData(buffer, fixing_flag) abort
|
|||||||
\ 'lines_before': getbufline(a:buffer, 1, '$'),
|
\ 'lines_before': getbufline(a:buffer, 1, '$'),
|
||||||
\ 'filename': expand('#' . a:buffer . ':p'),
|
\ 'filename': expand('#' . a:buffer . ':p'),
|
||||||
\ 'done': 0,
|
\ 'done': 0,
|
||||||
\ 'should_save': a:fixing_flag ==# 'save_file',
|
\ 'should_save': a:fixing_flag is# 'save_file',
|
||||||
\ 'temporary_directory_list': [],
|
\ 'temporary_directory_list': [],
|
||||||
\}
|
\}
|
||||||
endfunction
|
endfunction
|
||||||
@ -342,7 +342,7 @@ function! ale#fix#Fix(...) abort
|
|||||||
let l:callback_list = s:GetCallbacks()
|
let l:callback_list = s:GetCallbacks()
|
||||||
|
|
||||||
if empty(l:callback_list)
|
if empty(l:callback_list)
|
||||||
if l:fixing_flag ==# ''
|
if l:fixing_flag is# ''
|
||||||
echoerr 'No fixers have been defined. Try :ALEFixSuggest'
|
echoerr 'No fixers have been defined. Try :ALEFixSuggest'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ function! ale#handlers#cppcheck#HandleCppCheckFormat(buffer, lines) abort
|
|||||||
if ale#path#IsBufferPath(a:buffer, l:match[1])
|
if ale#path#IsBufferPath(a:buffer, l:match[1])
|
||||||
call add(l:output, {
|
call add(l:output, {
|
||||||
\ 'lnum': str2nr(l:match[2]),
|
\ 'lnum': str2nr(l:match[2]),
|
||||||
\ 'type': l:match[3] ==# 'error' ? 'E' : 'W',
|
\ 'type': l:match[3] is# 'error' ? 'E' : 'W',
|
||||||
\ 'text': l:match[4],
|
\ 'text': l:match[4],
|
||||||
\})
|
\})
|
||||||
endif
|
endif
|
||||||
|
@ -29,7 +29,7 @@ function! ale#handlers#css#HandleCSSLintFormat(buffer, lines) abort
|
|||||||
\ 'lnum': l:match[1] + 0,
|
\ 'lnum': l:match[1] + 0,
|
||||||
\ 'col': l:match[2] + 0,
|
\ 'col': l:match[2] + 0,
|
||||||
\ 'text': l:text,
|
\ 'text': l:text,
|
||||||
\ 'type': l:type ==# 'Warning' ? 'W' : 'E',
|
\ 'type': l:type is# 'Warning' ? 'W' : 'E',
|
||||||
\})
|
\})
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ function! ale#handlers#css#HandleStyleLintFormat(buffer, lines) abort
|
|||||||
call add(l:output, {
|
call add(l:output, {
|
||||||
\ 'lnum': l:match[1] + 0,
|
\ 'lnum': l:match[1] + 0,
|
||||||
\ 'col': l:match[2] + 0,
|
\ 'col': l:match[2] + 0,
|
||||||
\ 'type': l:match[3] ==# '✖' ? 'E' : 'W',
|
\ 'type': l:match[3] is# '✖' ? 'E' : 'W',
|
||||||
\ 'text': l:match[4] . ' [' . l:match[5] . ']',
|
\ 'text': l:match[4] . ' [' . l:match[5] . ']',
|
||||||
\})
|
\})
|
||||||
endfor
|
endfor
|
||||||
|
@ -92,7 +92,7 @@ function! ale#handlers#eslint#Handle(buffer, lines) abort
|
|||||||
\ 'lnum': l:match[1] + 0,
|
\ 'lnum': l:match[1] + 0,
|
||||||
\ 'col': l:match[2] + 0,
|
\ 'col': l:match[2] + 0,
|
||||||
\ 'text': l:text,
|
\ 'text': l:text,
|
||||||
\ 'type': l:type ==# 'Warning' ? 'W' : 'E',
|
\ 'type': l:type is# 'Warning' ? 'W' : 'E',
|
||||||
\}
|
\}
|
||||||
|
|
||||||
for l:col_match in ale#util#GetMatches(l:text, s:col_end_patterns)
|
for l:col_match in ale#util#GetMatches(l:text, s:col_end_patterns)
|
||||||
|
@ -81,7 +81,7 @@ function! ale#handlers#gcc#HandleGCCFormat(buffer, lines) abort
|
|||||||
let l:included_filename = ''
|
let l:included_filename = ''
|
||||||
endif
|
endif
|
||||||
elseif l:include_lnum > 0
|
elseif l:include_lnum > 0
|
||||||
\&& (empty(l:included_filename) || l:included_filename ==# l:match[1])
|
\&& (empty(l:included_filename) || l:included_filename is# l:match[1])
|
||||||
" If we hit the first error after an include header, or the
|
" If we hit the first error after an include header, or the
|
||||||
" errors below have the same name as the first filename we see,
|
" errors below have the same name as the first filename we see,
|
||||||
" then include these lines, and remember what that filename was.
|
" then include these lines, and remember what that filename was.
|
||||||
@ -96,7 +96,7 @@ function! ale#handlers#gcc#HandleGCCFormat(buffer, lines) abort
|
|||||||
let l:included_filename = ''
|
let l:included_filename = ''
|
||||||
|
|
||||||
if s:IsHeaderFile(bufname(bufnr('')))
|
if s:IsHeaderFile(bufname(bufnr('')))
|
||||||
\&& l:match[5][:len(s:pragma_error) - 1] ==# s:pragma_error
|
\&& l:match[5][:len(s:pragma_error) - 1] is# s:pragma_error
|
||||||
continue
|
continue
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ function! ale#handlers#haskell#HandleGHCFormat(buffer, lines) abort
|
|||||||
for l:line in a:lines
|
for l:line in a:lines
|
||||||
if len(matchlist(l:line, l:pattern)) > 0
|
if len(matchlist(l:line, l:pattern)) > 0
|
||||||
call add(l:corrected_lines, l:line)
|
call add(l:corrected_lines, l:line)
|
||||||
elseif l:line ==# ''
|
elseif l:line is# ''
|
||||||
call add(l:corrected_lines, l:line)
|
call add(l:corrected_lines, l:line)
|
||||||
else
|
else
|
||||||
if len(l:corrected_lines) > 0
|
if len(l:corrected_lines) > 0
|
||||||
@ -42,10 +42,10 @@ function! ale#handlers#haskell#HandleGHCFormat(buffer, lines) abort
|
|||||||
let l:text = l:errors[2]
|
let l:text = l:errors[2]
|
||||||
else
|
else
|
||||||
let l:ghc_type = ''
|
let l:ghc_type = ''
|
||||||
let l:text = l:match[4][:0] ==# ' ' ? l:match[4][1:] : l:match[4]
|
let l:text = l:match[4][:0] is# ' ' ? l:match[4][1:] : l:match[4]
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if l:ghc_type ==? 'Warning'
|
if l:ghc_type is? 'Warning'
|
||||||
let l:type = 'W'
|
let l:type = 'W'
|
||||||
else
|
else
|
||||||
let l:type = 'E'
|
let l:type = 'E'
|
||||||
|
@ -47,7 +47,7 @@ function! ale#handlers#rust#HandleRustErrorsForFile(buffer, full_filename, lines
|
|||||||
for l:span in l:error.spans
|
for l:span in l:error.spans
|
||||||
if (
|
if (
|
||||||
\ l:span.is_primary
|
\ l:span.is_primary
|
||||||
\ && (ale#path#IsBufferPath(a:buffer, l:span.file_name) || l:span.file_name ==# '<anon>')
|
\ && (ale#path#IsBufferPath(a:buffer, l:span.file_name) || l:span.file_name is# '<anon>')
|
||||||
\)
|
\)
|
||||||
call add(l:output, {
|
call add(l:output, {
|
||||||
\ 'lnum': l:span.line_start,
|
\ 'lnum': l:span.line_start,
|
||||||
|
@ -65,15 +65,15 @@ function! ale#highlight#UpdateHighlights() abort
|
|||||||
call ale#highlight#RemoveHighlights()
|
call ale#highlight#RemoveHighlights()
|
||||||
|
|
||||||
for l:item in l:item_list
|
for l:item in l:item_list
|
||||||
if l:item.type ==# 'W'
|
if l:item.type is# 'W'
|
||||||
if get(l:item, 'sub_type', '') ==# 'style'
|
if get(l:item, 'sub_type', '') is# 'style'
|
||||||
let l:group = 'ALEStyleWarning'
|
let l:group = 'ALEStyleWarning'
|
||||||
else
|
else
|
||||||
let l:group = 'ALEWarning'
|
let l:group = 'ALEWarning'
|
||||||
endif
|
endif
|
||||||
elseif l:item.type ==# 'I'
|
elseif l:item.type is# 'I'
|
||||||
let l:group = 'ALEInfo'
|
let l:group = 'ALEInfo'
|
||||||
elseif get(l:item, 'sub_type', '') ==# 'style'
|
elseif get(l:item, 'sub_type', '') is# 'style'
|
||||||
let l:group = 'ALEStyleError'
|
let l:group = 'ALEStyleError'
|
||||||
else
|
else
|
||||||
let l:group = 'ALEError'
|
let l:group = 'ALEError'
|
||||||
|
@ -34,7 +34,7 @@ function! ale#job#JoinNeovimOutput(job, last_line, data, mode, callback) abort
|
|||||||
let l:new_last_line = a:last_line . a:data[0]
|
let l:new_last_line = a:last_line . a:data[0]
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if a:mode ==# 'raw'
|
if a:mode is# 'raw'
|
||||||
if !empty(l:lines)
|
if !empty(l:lines)
|
||||||
call a:callback(a:job, join(l:lines, "\n") . "\n")
|
call a:callback(a:job, join(l:lines, "\n") . "\n")
|
||||||
endif
|
endif
|
||||||
@ -50,7 +50,7 @@ endfunction
|
|||||||
function! s:NeoVimCallback(job, data, event) abort
|
function! s:NeoVimCallback(job, data, event) abort
|
||||||
let l:info = s:job_map[a:job]
|
let l:info = s:job_map[a:job]
|
||||||
|
|
||||||
if a:event ==# 'stdout'
|
if a:event is# 'stdout'
|
||||||
let l:info.out_cb_line = ale#job#JoinNeovimOutput(
|
let l:info.out_cb_line = ale#job#JoinNeovimOutput(
|
||||||
\ a:job,
|
\ a:job,
|
||||||
\ l:info.out_cb_line,
|
\ l:info.out_cb_line,
|
||||||
@ -58,7 +58,7 @@ function! s:NeoVimCallback(job, data, event) abort
|
|||||||
\ l:info.mode,
|
\ l:info.mode,
|
||||||
\ ale#util#GetFunction(l:info.out_cb),
|
\ ale#util#GetFunction(l:info.out_cb),
|
||||||
\)
|
\)
|
||||||
elseif a:event ==# 'stderr'
|
elseif a:event is# 'stderr'
|
||||||
let l:info.err_cb_line = ale#job#JoinNeovimOutput(
|
let l:info.err_cb_line = ale#job#JoinNeovimOutput(
|
||||||
\ a:job,
|
\ a:job,
|
||||||
\ l:info.err_cb_line,
|
\ l:info.err_cb_line,
|
||||||
@ -117,7 +117,7 @@ function! s:VimCloseCallback(channel) abort
|
|||||||
|
|
||||||
" job_status() can trigger the exit handler.
|
" job_status() can trigger the exit handler.
|
||||||
" The channel can close before the job has exited.
|
" The channel can close before the job has exited.
|
||||||
if job_status(l:job) ==# 'dead'
|
if job_status(l:job) is# 'dead'
|
||||||
try
|
try
|
||||||
if !empty(l:info) && has_key(l:info, 'exit_cb')
|
if !empty(l:info) && has_key(l:info, 'exit_cb')
|
||||||
call ale#util#GetFunction(l:info.exit_cb)(l:job_id, l:info.exit_code)
|
call ale#util#GetFunction(l:info.exit_cb)(l:job_id, l:info.exit_code)
|
||||||
@ -142,7 +142,7 @@ function! s:VimExitCallback(job, exit_code) abort
|
|||||||
let l:info.exit_code = a:exit_code
|
let l:info.exit_code = a:exit_code
|
||||||
|
|
||||||
" The program can exit before the data has finished being read.
|
" The program can exit before the data has finished being read.
|
||||||
if ch_status(job_getchannel(a:job)) ==# 'closed'
|
if ch_status(job_getchannel(a:job)) is# 'closed'
|
||||||
try
|
try
|
||||||
if !empty(l:info) && has_key(l:info, 'exit_cb')
|
if !empty(l:info) && has_key(l:info, 'exit_cb')
|
||||||
call ale#util#GetFunction(l:info.exit_cb)(l:job_id, a:exit_code)
|
call ale#util#GetFunction(l:info.exit_cb)(l:job_id, a:exit_code)
|
||||||
@ -273,7 +273,7 @@ function! ale#job#IsRunning(job_id) abort
|
|||||||
endtry
|
endtry
|
||||||
elseif has_key(s:job_map, a:job_id)
|
elseif has_key(s:job_map, a:job_id)
|
||||||
let l:job = s:job_map[a:job_id].job
|
let l:job = s:job_map[a:job_id].job
|
||||||
return job_status(l:job) ==# 'run'
|
return job_status(l:job) is# 'run'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
@ -296,7 +296,7 @@ function! ale#job#Stop(job_id) abort
|
|||||||
|
|
||||||
" We must close the channel for reading the buffer if it is open
|
" We must close the channel for reading the buffer if it is open
|
||||||
" when stopping a job. Otherwise, we will get errors in the status line.
|
" when stopping a job. Otherwise, we will get errors in the status line.
|
||||||
if ch_status(job_getchannel(l:job)) ==# 'open'
|
if ch_status(job_getchannel(l:job)) is# 'open'
|
||||||
call ch_close_in(job_getchannel(l:job))
|
call ch_close_in(job_getchannel(l:job))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ function! ale#linter#PreProcess(linter) abort
|
|||||||
throw '`name` must be defined to name the linter'
|
throw '`name` must be defined to name the linter'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let l:needs_address = l:obj.lsp ==# 'socket'
|
let l:needs_address = l:obj.lsp is# 'socket'
|
||||||
let l:needs_executable = l:obj.lsp !=# 'socket'
|
let l:needs_executable = l:obj.lsp !=# 'socket'
|
||||||
let l:needs_command = l:obj.lsp !=# 'socket'
|
let l:needs_command = l:obj.lsp !=# 'socket'
|
||||||
let l:needs_lsp_details = !empty(l:obj.lsp)
|
let l:needs_lsp_details = !empty(l:obj.lsp)
|
||||||
@ -311,7 +311,7 @@ function! ale#linter#Get(original_filetypes) abort
|
|||||||
let l:all_linters = ale#linter#GetAll(l:filetype)
|
let l:all_linters = ale#linter#GetAll(l:filetype)
|
||||||
let l:filetype_linters = []
|
let l:filetype_linters = []
|
||||||
|
|
||||||
if type(l:linter_names) == type('') && l:linter_names ==# 'all'
|
if type(l:linter_names) == type('') && l:linter_names is# 'all'
|
||||||
let l:filetype_linters = l:all_linters
|
let l:filetype_linters = l:all_linters
|
||||||
elseif type(l:linter_names) == type([])
|
elseif type(l:linter_names) == type([])
|
||||||
" Select only the linters we or the user has specified.
|
" Select only the linters we or the user has specified.
|
||||||
@ -383,7 +383,7 @@ function! ale#linter#StartLSP(buffer, linter, callback) abort
|
|||||||
return {}
|
return {}
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if a:linter.lsp ==# 'socket'
|
if a:linter.lsp is# 'socket'
|
||||||
let l:address = ale#linter#GetAddress(a:buffer, a:linter)
|
let l:address = ale#linter#GetAddress(a:buffer, a:linter)
|
||||||
let l:conn_id = ale#lsp#ConnectToAddress(
|
let l:conn_id = ale#lsp#ConnectToAddress(
|
||||||
\ l:address,
|
\ l:address,
|
||||||
@ -425,7 +425,7 @@ function! ale#linter#StartLSP(buffer, linter, callback) abort
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
" The change message needs to be sent for tsserver before doing anything.
|
" The change message needs to be sent for tsserver before doing anything.
|
||||||
if a:linter.lsp ==# 'tsserver'
|
if a:linter.lsp is# 'tsserver'
|
||||||
call ale#lsp#Send(l:conn_id, ale#lsp#tsserver_message#Change(a:buffer))
|
call ale#lsp#Send(l:conn_id, ale#lsp#tsserver_message#Change(a:buffer))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
" Return 1 if there is a buffer with buftype == 'quickfix' in bufffer list
|
" Return 1 if there is a buffer with buftype == 'quickfix' in bufffer list
|
||||||
function! ale#list#IsQuickfixOpen() abort
|
function! ale#list#IsQuickfixOpen() abort
|
||||||
for l:buf in range(1, bufnr('$'))
|
for l:buf in range(1, bufnr('$'))
|
||||||
if getbufvar(l:buf, '&buftype') ==# 'quickfix'
|
if getbufvar(l:buf, '&buftype') is# 'quickfix'
|
||||||
return 1
|
return 1
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
@ -18,7 +18,7 @@ function! s:ShouldOpen(buffer) abort
|
|||||||
let l:saved = getbufvar(a:buffer, 'ale_save_event_fired', 0)
|
let l:saved = getbufvar(a:buffer, 'ale_save_event_fired', 0)
|
||||||
|
|
||||||
return (type(l:val) == type(1) && l:val == 1)
|
return (type(l:val) == type(1) && l:val == 1)
|
||||||
\ || (type(l:val) == type('') && l:val ==# 'on_save' && l:saved)
|
\ || (type(l:val) == type('') && l:val is# 'on_save' && l:saved)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! ale#list#SetLists(buffer, loclist) abort
|
function! ale#list#SetLists(buffer, loclist) abort
|
||||||
@ -51,8 +51,8 @@ function! ale#list#SetLists(buffer, loclist) abort
|
|||||||
if s:ShouldOpen(a:buffer) && (l:keep_open || !empty(a:loclist))
|
if s:ShouldOpen(a:buffer) && (l:keep_open || !empty(a:loclist))
|
||||||
let l:winnr = winnr()
|
let l:winnr = winnr()
|
||||||
let l:mode = mode()
|
let l:mode = mode()
|
||||||
let l:reset_visual_selection = l:mode ==? 'v' || l:mode ==# "\<c-v>"
|
let l:reset_visual_selection = l:mode is? 'v' || l:mode is# "\<c-v>"
|
||||||
let l:reset_character_selection = l:mode ==? 's' || l:mode ==# "\<c-s>"
|
let l:reset_character_selection = l:mode is? 's' || l:mode is# "\<c-s>"
|
||||||
|
|
||||||
if g:ale_set_quickfix
|
if g:ale_set_quickfix
|
||||||
if !ale#list#IsQuickfixOpen()
|
if !ale#list#IsQuickfixOpen()
|
||||||
|
@ -17,7 +17,7 @@ function! ale#loclist_jumping#FindNearest(direction, wrap) abort
|
|||||||
let l:search_item = {'lnum': l:pos[1], 'col': l:pos[2]}
|
let l:search_item = {'lnum': l:pos[1], 'col': l:pos[2]}
|
||||||
|
|
||||||
" When searching backwards, so we can find the next smallest match.
|
" When searching backwards, so we can find the next smallest match.
|
||||||
if a:direction ==# 'before'
|
if a:direction is# 'before'
|
||||||
let l:loclist = reverse(copy(l:loclist))
|
let l:loclist = reverse(copy(l:loclist))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -36,11 +36,11 @@ function! ale#loclist_jumping#FindNearest(direction, wrap) abort
|
|||||||
\ l:search_item
|
\ l:search_item
|
||||||
\)
|
\)
|
||||||
|
|
||||||
if a:direction ==# 'before' && l:cmp_value < 0
|
if a:direction is# 'before' && l:cmp_value < 0
|
||||||
return [l:item.lnum, l:item.col]
|
return [l:item.lnum, l:item.col]
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if a:direction ==# 'after' && l:cmp_value > 0
|
if a:direction is# 'after' && l:cmp_value > 0
|
||||||
return [l:item.lnum, l:item.col]
|
return [l:item.lnum, l:item.col]
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
|
@ -190,17 +190,17 @@ function! ale#lsp#HandleOtherInitializeResponses(conn, response) abort
|
|||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if get(a:response, 'method', '') ==# ''
|
if get(a:response, 'method', '') is# ''
|
||||||
if has_key(get(a:response, 'result', {}), 'capabilities')
|
if has_key(get(a:response, 'result', {}), 'capabilities')
|
||||||
for [l:dir, l:project] in l:uninitialized_projects
|
for [l:dir, l:project] in l:uninitialized_projects
|
||||||
call s:MarkProjectAsInitialized(a:conn, l:project)
|
call s:MarkProjectAsInitialized(a:conn, l:project)
|
||||||
endfor
|
endfor
|
||||||
endif
|
endif
|
||||||
elseif get(a:response, 'method', '') ==# 'textDocument/publishDiagnostics'
|
elseif get(a:response, 'method', '') is# 'textDocument/publishDiagnostics'
|
||||||
let l:filename = ale#path#FromURI(a:response.params.uri)
|
let l:filename = ale#path#FromURI(a:response.params.uri)
|
||||||
|
|
||||||
for [l:dir, l:project] in l:uninitialized_projects
|
for [l:dir, l:project] in l:uninitialized_projects
|
||||||
if l:filename[:len(l:dir) - 1] ==# l:dir
|
if l:filename[:len(l:dir) - 1] is# l:dir
|
||||||
call s:MarkProjectAsInitialized(a:conn, l:project)
|
call s:MarkProjectAsInitialized(a:conn, l:project)
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
@ -215,7 +215,7 @@ function! ale#lsp#HandleMessage(conn, message) abort
|
|||||||
|
|
||||||
" Call our callbacks.
|
" Call our callbacks.
|
||||||
for l:response in l:response_list
|
for l:response in l:response_list
|
||||||
if get(l:response, 'method', '') ==# 'initialize'
|
if get(l:response, 'method', '') is# 'initialize'
|
||||||
call s:HandleInitializeResponse(a:conn, l:response)
|
call s:HandleInitializeResponse(a:conn, l:response)
|
||||||
else
|
else
|
||||||
call ale#lsp#HandleOtherInitializeResponses(a:conn, l:response)
|
call ale#lsp#HandleOtherInitializeResponses(a:conn, l:response)
|
||||||
@ -304,7 +304,7 @@ function! ale#lsp#ConnectToAddress(address, project_root, callback) abort
|
|||||||
\})
|
\})
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if ch_status(l:conn.channnel) ==# 'fail'
|
if ch_status(l:conn.channnel) is# 'fail'
|
||||||
return 0
|
return 0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -319,7 +319,7 @@ endfunction
|
|||||||
function! s:SendMessageData(conn, data) abort
|
function! s:SendMessageData(conn, data) abort
|
||||||
if has_key(a:conn, 'executable')
|
if has_key(a:conn, 'executable')
|
||||||
call ale#job#SendRaw(a:conn.id, a:data)
|
call ale#job#SendRaw(a:conn.id, a:data)
|
||||||
elseif has_key(a:conn, 'channel') && ch_status(a:conn.channnel) ==# 'open'
|
elseif has_key(a:conn, 'channel') && ch_status(a:conn.channnel) is# 'open'
|
||||||
" Send the message to the server
|
" Send the message to the server
|
||||||
call ch_sendraw(a:conn.channel, a:data)
|
call ch_sendraw(a:conn.channel, a:data)
|
||||||
else
|
else
|
||||||
|
@ -65,7 +65,7 @@ endfunction
|
|||||||
" Return 1 if a path is an absolute path.
|
" Return 1 if a path is an absolute path.
|
||||||
function! ale#path#IsAbsolute(filename) abort
|
function! ale#path#IsAbsolute(filename) abort
|
||||||
" Check for /foo and C:\foo, etc.
|
" Check for /foo and C:\foo, etc.
|
||||||
return a:filename[:0] ==# '/' || a:filename[1:2] ==# ':\'
|
return a:filename[:0] is# '/' || a:filename[1:2] is# ':\'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Given a filename, return 1 if the file represents some temporary file
|
" Given a filename, return 1 if the file represents some temporary file
|
||||||
@ -78,7 +78,7 @@ function! ale#path#IsTempName(filename) abort
|
|||||||
\]
|
\]
|
||||||
|
|
||||||
for l:prefix in l:prefix_list
|
for l:prefix in l:prefix_list
|
||||||
if a:filename[:len(l:prefix) - 1] ==# l:prefix
|
if a:filename[:len(l:prefix) - 1] is# l:prefix
|
||||||
return 1
|
return 1
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
@ -90,19 +90,19 @@ endfunction
|
|||||||
" two paths represent the same file on disk.
|
" two paths represent the same file on disk.
|
||||||
function! ale#path#IsBufferPath(buffer, complex_filename) abort
|
function! ale#path#IsBufferPath(buffer, complex_filename) abort
|
||||||
" If the path is one of many different names for stdin, we have a match.
|
" If the path is one of many different names for stdin, we have a match.
|
||||||
if a:complex_filename ==# '-'
|
if a:complex_filename is# '-'
|
||||||
\|| a:complex_filename ==# 'stdin'
|
\|| a:complex_filename is# 'stdin'
|
||||||
\|| a:complex_filename[:0] ==# '<'
|
\|| a:complex_filename[:0] is# '<'
|
||||||
return 1
|
return 1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let l:test_filename = ale#path#Simplify(a:complex_filename)
|
let l:test_filename = ale#path#Simplify(a:complex_filename)
|
||||||
|
|
||||||
if l:test_filename[:1] ==# './'
|
if l:test_filename[:1] is# './'
|
||||||
let l:test_filename = l:test_filename[2:]
|
let l:test_filename = l:test_filename[2:]
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if l:test_filename[:1] ==# '..'
|
if l:test_filename[:1] is# '..'
|
||||||
" Remove ../../ etc. from the front of the path.
|
" Remove ../../ etc. from the front of the path.
|
||||||
let l:test_filename = substitute(l:test_filename, '\v^(\.\.[/\\])+', '/', '')
|
let l:test_filename = substitute(l:test_filename, '\v^(\.\.[/\\])+', '/', '')
|
||||||
endif
|
endif
|
||||||
@ -114,8 +114,8 @@ function! ale#path#IsBufferPath(buffer, complex_filename) abort
|
|||||||
|
|
||||||
let l:buffer_filename = expand('#' . a:buffer . ':p')
|
let l:buffer_filename = expand('#' . a:buffer . ':p')
|
||||||
|
|
||||||
return l:buffer_filename ==# l:test_filename
|
return l:buffer_filename is# l:test_filename
|
||||||
\ || l:buffer_filename[-len(l:test_filename):] ==# l:test_filename
|
\ || l:buffer_filename[-len(l:test_filename):] is# l:test_filename
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Given a path, return every component of the path, moving upwards.
|
" Given a path, return every component of the path, moving upwards.
|
||||||
@ -133,7 +133,7 @@ function! ale#path#Upwards(path) abort
|
|||||||
if ale#Has('win32') && a:path =~# '^[a-zA-z]:\'
|
if ale#Has('win32') && a:path =~# '^[a-zA-z]:\'
|
||||||
" Add \ to C: for C:\, etc.
|
" Add \ to C: for C:\, etc.
|
||||||
let l:path_list[-1] .= '\'
|
let l:path_list[-1] .= '\'
|
||||||
elseif a:path[0] ==# '/'
|
elseif a:path[0] is# '/'
|
||||||
" If the path starts with /, even on Windows, add / and / to all paths.
|
" If the path starts with /, even on Windows, add / and / to all paths.
|
||||||
call map(l:path_list, '''/'' . v:val')
|
call map(l:path_list, '''/'' . v:val')
|
||||||
call add(l:path_list, '/')
|
call add(l:path_list, '/')
|
||||||
@ -146,10 +146,10 @@ endfunction
|
|||||||
" relatives paths will not be prefixed with the protocol.
|
" relatives paths will not be prefixed with the protocol.
|
||||||
" For Windows paths, the `:` in C:\ etc. will not be percent-encoded.
|
" For Windows paths, the `:` in C:\ etc. will not be percent-encoded.
|
||||||
function! ale#path#ToURI(path) abort
|
function! ale#path#ToURI(path) abort
|
||||||
let l:has_drive_letter = a:path[1:2] ==# ':\'
|
let l:has_drive_letter = a:path[1:2] is# ':\'
|
||||||
|
|
||||||
return substitute(
|
return substitute(
|
||||||
\ ((l:has_drive_letter || a:path[:0] ==# '/') ? 'file://' : '')
|
\ ((l:has_drive_letter || a:path[:0] is# '/') ? 'file://' : '')
|
||||||
\ . (l:has_drive_letter ? '/' . a:path[:2] : '')
|
\ . (l:has_drive_letter ? '/' . a:path[:2] : '')
|
||||||
\ . ale#uri#Encode(l:has_drive_letter ? a:path[3:] : a:path),
|
\ . ale#uri#Encode(l:has_drive_letter ? a:path[3:] : a:path),
|
||||||
\ '\\',
|
\ '\\',
|
||||||
@ -160,7 +160,7 @@ endfunction
|
|||||||
|
|
||||||
function! ale#path#FromURI(uri) abort
|
function! ale#path#FromURI(uri) abort
|
||||||
let l:i = len('file://')
|
let l:i = len('file://')
|
||||||
let l:encoded_path = a:uri[: l:i - 1] ==# 'file://' ? a:uri[l:i :] : a:uri
|
let l:encoded_path = a:uri[: l:i - 1] is# 'file://' ? a:uri[l:i :] : a:uri
|
||||||
|
|
||||||
return ale#uri#Decode(l:encoded_path)
|
return ale#uri#Decode(l:encoded_path)
|
||||||
endfunction
|
endfunction
|
||||||
|
@ -13,7 +13,7 @@ function! ale#pattern_options#SetOptions() abort
|
|||||||
endfor
|
endfor
|
||||||
|
|
||||||
for l:key in keys(l:options)
|
for l:key in keys(l:options)
|
||||||
if l:key[:0] ==# '&'
|
if l:key[:0] is# '&'
|
||||||
call setbufvar(bufnr(''), l:key, l:options[l:key])
|
call setbufvar(bufnr(''), l:key, l:options[l:key])
|
||||||
else
|
else
|
||||||
let b:[l:key] = l:options[l:key]
|
let b:[l:key] = l:options[l:key]
|
||||||
|
@ -168,9 +168,9 @@ function! ale#sign#GetSignType(sublist) abort
|
|||||||
let l:highest_level = 100
|
let l:highest_level = 100
|
||||||
|
|
||||||
for l:item in a:sublist
|
for l:item in a:sublist
|
||||||
let l:level = (l:item.type ==# 'I' ? 2 : l:item.type ==# 'W')
|
let l:level = (l:item.type is# 'I' ? 2 : l:item.type is# 'W')
|
||||||
|
|
||||||
if get(l:item, 'sub_type', '') ==# 'style'
|
if get(l:item, 'sub_type', '') is# 'style'
|
||||||
let l:level += 10
|
let l:level += 10
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -26,15 +26,15 @@ function! ale#statusline#Update(buffer, loclist) abort
|
|||||||
let l:count.total = len(a:loclist)
|
let l:count.total = len(a:loclist)
|
||||||
|
|
||||||
for l:entry in a:loclist
|
for l:entry in a:loclist
|
||||||
if l:entry.type ==# 'W'
|
if l:entry.type is# 'W'
|
||||||
if get(l:entry, 'sub_type', '') ==# 'style'
|
if get(l:entry, 'sub_type', '') is# 'style'
|
||||||
let l:count.style_warning += 1
|
let l:count.style_warning += 1
|
||||||
else
|
else
|
||||||
let l:count.warning += 1
|
let l:count.warning += 1
|
||||||
endif
|
endif
|
||||||
elseif l:entry.type ==# 'I'
|
elseif l:entry.type is# 'I'
|
||||||
let l:count.info += 1
|
let l:count.info += 1
|
||||||
elseif get(l:entry, 'sub_type', '') ==# 'style'
|
elseif get(l:entry, 'sub_type', '') is# 'style'
|
||||||
let l:count.style_error += 1
|
let l:count.style_error += 1
|
||||||
else
|
else
|
||||||
let l:count.error += 1
|
let l:count.error += 1
|
||||||
|
@ -193,7 +193,7 @@ endfunction
|
|||||||
" The buffer number is required for determining the fileformat setting for
|
" The buffer number is required for determining the fileformat setting for
|
||||||
" the buffer.
|
" the buffer.
|
||||||
function! ale#util#Writefile(buffer, lines, filename) abort
|
function! ale#util#Writefile(buffer, lines, filename) abort
|
||||||
let l:corrected_lines = getbufvar(a:buffer, '&fileformat') ==# 'dos'
|
let l:corrected_lines = getbufvar(a:buffer, '&fileformat') is# 'dos'
|
||||||
\ ? map(copy(a:lines), 'v:val . "\r"')
|
\ ? map(copy(a:lines), 'v:val . "\r"')
|
||||||
\ : a:lines
|
\ : a:lines
|
||||||
|
|
||||||
|
@ -65,6 +65,8 @@ if (( FIX_ERRORS )); then
|
|||||||
for directory in "${directories[@]}"; do
|
for directory in "${directories[@]}"; do
|
||||||
sed -i "s/^\(function.*)\) *$/\1 abort/" "$directory"/**/*.vim
|
sed -i "s/^\(function.*)\) *$/\1 abort/" "$directory"/**/*.vim
|
||||||
sed -i "s/shellescape(/ale#Escape(/" "$directory"/**/*.vim
|
sed -i "s/shellescape(/ale#Escape(/" "$directory"/**/*.vim
|
||||||
|
sed -i 's/==#/is#/g' "$directory"/**/*.vim
|
||||||
|
sed -i 's/==?/is?/g' "$directory"/**/*.vim
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -80,5 +82,7 @@ check_errors 'let g:ale_\w\+_\w\+_args =' 'Name your option g:ale_<filetype>_<li
|
|||||||
check_errors 'shellescape(' 'Use ale#Escape instead of shellescape'
|
check_errors 'shellescape(' 'Use ale#Escape instead of shellescape'
|
||||||
check_errors 'simplify(' 'Use ale#path#Simplify instead of simplify'
|
check_errors 'simplify(' 'Use ale#path#Simplify instead of simplify'
|
||||||
check_errors "expand(['\"]%" "Use expand('#' . a:buffer . '...') instead. You might get a filename for the wrong buffer."
|
check_errors "expand(['\"]%" "Use expand('#' . a:buffer . '...') instead. You might get a filename for the wrong buffer."
|
||||||
|
check_errors '==#' "Use 'is#' instead of '==#'. 0 ==# 'foobar' is true"
|
||||||
|
check_errors '==?' "Use 'is?' instead of '==?'. 0 ==? 'foobar' is true"
|
||||||
|
|
||||||
exit $RETURN_CODE
|
exit $RETURN_CODE
|
||||||
|
@ -206,11 +206,11 @@ function! ALEInitAuGroups() abort
|
|||||||
augroup ALERunOnTextChangedGroup
|
augroup ALERunOnTextChangedGroup
|
||||||
autocmd!
|
autocmd!
|
||||||
if g:ale_enabled
|
if g:ale_enabled
|
||||||
if l:text_changed ==? 'always' || l:text_changed ==# '1'
|
if l:text_changed is? 'always' || l:text_changed is# '1'
|
||||||
autocmd TextChanged,TextChangedI * call ale#Queue(g:ale_lint_delay)
|
autocmd TextChanged,TextChangedI * call ale#Queue(g:ale_lint_delay)
|
||||||
elseif l:text_changed ==? 'normal'
|
elseif l:text_changed is? 'normal'
|
||||||
autocmd TextChanged * call ale#Queue(g:ale_lint_delay)
|
autocmd TextChanged * call ale#Queue(g:ale_lint_delay)
|
||||||
elseif l:text_changed ==? 'insert'
|
elseif l:text_changed is? 'insert'
|
||||||
autocmd TextChangedI * call ale#Queue(g:ale_lint_delay)
|
autocmd TextChangedI * call ale#Queue(g:ale_lint_delay)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
Loading…
Reference in New Issue
Block a user