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:
w0rp
2019-02-06 18:05:13 +00:00
parent 4d426bf287
commit 3e11cbd18d
44 changed files with 221 additions and 191 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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 = {}

View File

@@ -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

View File

@@ -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 = {

View File

@@ -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

View File

@@ -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)

View File

@@ -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 ''

View File

@@ -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]),
\}

View File

@@ -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'

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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)

View File

@@ -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(

View File

@@ -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'))

View File

@@ -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']

View File

@@ -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")

View File

@@ -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

View File

@@ -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