Skip to content

Commit

Permalink
Update syntax checking
Browse files Browse the repository at this point in the history
* Line continuation characters should be on the same lines.
* .vim file line indentation should be a multiple of 4.
  • Loading branch information
w0rp committed Feb 6, 2019
1 parent 4d426bf commit 3e11cbd
Show file tree
Hide file tree
Showing 44 changed files with 221 additions and 191 deletions.
49 changes: 25 additions & 24 deletions ale_linters/bib/bibclean.vim
Expand Up @@ -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

Expand All @@ -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
Expand Down
12 changes: 6 additions & 6 deletions ale_linters/c/flawfinder.vim
Expand Up @@ -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', {
Expand Down
2 changes: 1 addition & 1 deletion ale_linters/clojure/joker.vim
Expand Up @@ -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, {
Expand Down
12 changes: 6 additions & 6 deletions ale_linters/cpp/flawfinder.vim
Expand Up @@ -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', {
Expand Down
4 changes: 2 additions & 2 deletions ale_linters/crystal/ameba.vim
Expand Up @@ -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], {})
Expand All @@ -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, {
Expand Down
8 changes: 4 additions & 4 deletions ale_linters/elm/make.vim
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions ale_linters/go/langserver.vim
Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion ale_linters/hack/hhast.vim
Expand Up @@ -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')
Expand Down
2 changes: 1 addition & 1 deletion ale_linters/haskell/hie.vim
Expand Up @@ -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', {
Expand Down
8 changes: 4 additions & 4 deletions ale_linters/idris/idris.vim
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion ale_linters/kotlin/kotlinc.vim
Expand Up @@ -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)
Expand Down
14 changes: 7 additions & 7 deletions ale_linters/markdown/markdownlint.vim
Expand Up @@ -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'
\})
14 changes: 7 additions & 7 deletions ale_linters/perl6/perl6.vim
Expand Up @@ -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'])
Expand All @@ -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,
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion ale_linters/python/pylint.vim
Expand Up @@ -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, {
Expand Down
10 changes: 5 additions & 5 deletions ale_linters/slim/slimlint.vim
Expand Up @@ -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
Expand Down
18 changes: 9 additions & 9 deletions ale_linters/swift/swiftlint.vim
Expand Up @@ -6,18 +6,18 @@ 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
let l:executable = ale_linters#swift#swiftlint#GetExecutable(a:buffer)
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
Expand All @@ -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'
Expand Down
10 changes: 5 additions & 5 deletions ale_linters/verilog/vlog.vim
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions ale_linters/verilog/xvlog.vim
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion ale_linters/vhdl/ghdl.vim
Expand Up @@ -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
Expand Down

0 comments on commit 3e11cbd

Please sign in to comment.