diff --git a/ale_linters/asm/gcc.vim b/ale_linters/asm/gcc.vim index cbc61ed7..2ef7924e 100644 --- a/ale_linters/asm/gcc.vim +++ b/ale_linters/asm/gcc.vim @@ -1,38 +1,37 @@ " Author: Lucas Kolstad " Description: gcc linter for asm files -let g:ale_asm_gcc_options = -\ get(g:, 'ale_asm_gcc_options', '-Wall') +let g:ale_asm_gcc_options = get(g:, 'ale_asm_gcc_options', '-Wall') function! ale_linters#asm#gcc#GetCommand(buffer) abort - return 'gcc -x assembler -fsyntax-only ' - \ . '-iquote ' . fnameescape(fnamemodify(bufname(a:buffer), ':p:h')) - \ . ' ' . g:ale_asm_gcc_options . ' -' + return 'gcc -x assembler -fsyntax-only ' + \ . '-iquote ' . fnameescape(fnamemodify(bufname(a:buffer), ':p:h')) + \ . ' ' . g:ale_asm_gcc_options . ' -' endfunction function! ale_linters#asm#gcc#Handle(buffer, lines) abort - let l:pattern = '^.\+:\(\d\+\): \([^:]\+\): \(.\+\)$' - let l:output = [] + let l:pattern = '^.\+:\(\d\+\): \([^:]\+\): \(.\+\)$' + let l:output = [] - for l:line in a:lines - let l:match = matchlist(l:line, l:pattern) + for l:line in a:lines + let l:match = matchlist(l:line, l:pattern) - if len(l:match) == 0 - continue - endif + if len(l:match) == 0 + continue + endif - call add(l:output, { - \ 'bufnr': a:buffer, - \ 'lnum': l:match[1] + 0, - \ 'vcol': 0, - \ 'col': 0, - \ 'text': l:match[3], - \ 'type': l:match[2] =~? 'error' ? 'E' : 'W', - \ 'nr': -1, - \}) - endfor + call add(l:output, { + \ 'bufnr': a:buffer, + \ 'lnum': l:match[1] + 0, + \ 'vcol': 0, + \ 'col': 0, + \ 'text': l:match[3], + \ 'type': l:match[2] =~? 'error' ? 'E' : 'W', + \ 'nr': -1, + \}) + endfor - return l:output + return l:output endfunction call ale#linter#Define('asm', { diff --git a/ale_linters/chef/foodcritic.vim b/ale_linters/chef/foodcritic.vim index a3a9af2e..e6d1ddb6 100644 --- a/ale_linters/chef/foodcritic.vim +++ b/ale_linters/chef/foodcritic.vim @@ -35,10 +35,10 @@ function! ale_linters#chef#foodcritic#Handle(buffer, lines) abort endfunction function! ale_linters#chef#foodcritic#GetCommand(buffer) abort - return printf('%s %s %%t', - \ g:ale_chef_foodcritic_executable, - \ escape(g:ale_chef_foodcritic_options, '~') - \) + return printf('%s %s %%t', + \ g:ale_chef_foodcritic_executable, + \ escape(g:ale_chef_foodcritic_options, '~') + \) endfunction @@ -48,4 +48,3 @@ call ale#linter#Define('chef', { \ 'command_callback': 'ale_linters#chef#foodcritic#GetCommand', \ 'callback': 'ale_linters#chef#foodcritic#Handle', \}) - diff --git a/ale_linters/cpp/gcc.vim b/ale_linters/cpp/gcc.vim index f2261c4f..c16a0706 100644 --- a/ale_linters/cpp/gcc.vim +++ b/ale_linters/cpp/gcc.vim @@ -3,15 +3,15 @@ " Set this option to change the GCC options for warnings for C. if !exists('g:ale_cpp_gcc_options') - " added c++14 standard support - " POSIX thread and standard c++ thread and atomic library Linker - " let g:ale_cpp_gcc_options = '-std=c++1z' for c++17 - " for previous version and default, you can just use - " let g:ale_cpp_gcc_options = '-Wall' - " for more see man pages of gcc - " $ man g++ - " make sure g++ in your $PATH - " Add flags according to your requirements + " added c++14 standard support + " POSIX thread and standard c++ thread and atomic library Linker + " let g:ale_cpp_gcc_options = '-std=c++1z' for c++17 + " for previous version and default, you can just use + " let g:ale_cpp_gcc_options = '-Wall' + " for more see man pages of gcc + " $ man g++ + " make sure g++ in your $PATH + " Add flags according to your requirements let g:ale_cpp_gcc_options = '-std=c++14 -Wall' endif diff --git a/ale_linters/crystal/crystal.vim b/ale_linters/crystal/crystal.vim index 5abf7e84..95ab94ff 100644 --- a/ale_linters/crystal/crystal.vim +++ b/ale_linters/crystal/crystal.vim @@ -5,7 +5,7 @@ function! ale_linters#crystal#crystal#Handle(buffer, lines) abort let l:output = [] let l:lines = join(a:lines, '') - + if !empty(l:lines) let l:errors = json_decode(l:lines) @@ -24,11 +24,11 @@ function! ale_linters#crystal#crystal#Handle(buffer, lines) abort endfunction function! ale_linters#crystal#crystal#GetCommand(buffer) abort - let l:crystal_cmd = 'crystal build -f json --no-codegen -o ' - let l:crystal_cmd .= shellescape(g:ale#util#nul_file) - let l:crystal_cmd .= ' %t' + let l:crystal_cmd = 'crystal build -f json --no-codegen -o ' + let l:crystal_cmd .= shellescape(g:ale#util#nul_file) + let l:crystal_cmd .= ' %t' - return l:crystal_cmd + return l:crystal_cmd endfunction call ale#linter#Define('crystal', { diff --git a/ale_linters/dockerfile/hadolint.vim b/ale_linters/dockerfile/hadolint.vim index d0789ae8..df1ac799 100644 --- a/ale_linters/dockerfile/hadolint.vim +++ b/ale_linters/dockerfile/hadolint.vim @@ -1,43 +1,44 @@ " Author: hauleth - https://github.com/hauleth function! ale_linters#dockerfile#hadolint#Handle(buffer, lines) abort - " Matches patterns line the following: - " - " stdin:19: F: Pipe chain should start with a raw value. - let l:pattern = '\v^/dev/stdin:?(\d+)? (\S+) (.+)$' - let l:output = [] + " Matches patterns line the following: + " + " stdin:19: F: Pipe chain should start with a raw value. + let l:pattern = '\v^/dev/stdin:?(\d+)? (\S+) (.+)$' + let l:output = [] - for l:line in a:lines - let l:match = matchlist(l:line, l:pattern) + for l:line in a:lines + let l:match = matchlist(l:line, l:pattern) - if len(l:match) == 0 - continue - endif + if len(l:match) == 0 + continue + endif - let l:lnum = 0 + let l:lnum = 0 - if l:match[1] !=# '' - let l:lnum = l:match[1] + 0 - endif + if l:match[1] !=# '' + let l:lnum = l:match[1] + 0 + endif - let l:type = 'W' - let l:text = l:match[3] + let l:type = 'W' + let l:text = l:match[3] - call add(l:output, { - \ 'bufnr': a:buffer, - \ 'lnum': l:lnum, - \ 'col': 0, - \ 'type': l:type, - \ 'text': l:text, - \ 'nr': l:match[2], - \}) - endfor + call add(l:output, { + \ 'bufnr': a:buffer, + \ 'lnum': l:lnum, + \ 'col': 0, + \ 'type': l:type, + \ 'text': l:text, + \ 'nr': l:match[2], + \}) + endfor - return l:output + return l:output endfunction call ale#linter#Define('dockerfile', { - \ 'name': 'hadolint', - \ 'executable': 'hadolint', - \ 'command': 'hadolint -', - \ 'callback': 'ale_linters#dockerfile#hadolint#Handle' }) +\ 'name': 'hadolint', +\ 'executable': 'hadolint', +\ 'command': 'hadolint -', +\ 'callback': 'ale_linters#dockerfile#hadolint#Handle', +\}) diff --git a/ale_linters/elixir/credo.vim b/ale_linters/elixir/credo.vim index 06c2a913..ce34f47c 100644 --- a/ale_linters/elixir/credo.vim +++ b/ale_linters/elixir/credo.vim @@ -1,42 +1,43 @@ " Author: hauleth - https://github.com/hauleth function! ale_linters#elixir#credo#Handle(buffer, lines) abort - " Matches patterns line the following: - " - " lib/filename.ex:19:7: F: Pipe chain should start with a raw value. - let l:pattern = '\v:(\d+):?(\d+)?: (.): (.+)$' - let l:output = [] + " Matches patterns line the following: + " + " lib/filename.ex:19:7: F: Pipe chain should start with a raw value. + let l:pattern = '\v:(\d+):?(\d+)?: (.): (.+)$' + let l:output = [] - for l:line in a:lines - let l:match = matchlist(l:line, l:pattern) + for l:line in a:lines + let l:match = matchlist(l:line, l:pattern) - if len(l:match) == 0 - continue - endif + if len(l:match) == 0 + continue + endif - let l:type = l:match[3] - let l:text = l:match[4] + let l:type = l:match[3] + let l:text = l:match[4] - if l:type ==# 'C' - let l:type = 'E' - elseif l:type ==# 'R' - let l:type = 'W' - endif + if l:type ==# 'C' + let l:type = 'E' + elseif l:type ==# 'R' + let l:type = 'W' + endif - call add(l:output, { - \ 'bufnr': a:buffer, - \ 'lnum': l:match[1] + 0, - \ 'col': l:match[2] + 0, - \ 'type': l:type, - \ 'text': l:text, - \}) - endfor + call add(l:output, { + \ 'bufnr': a:buffer, + \ 'lnum': l:match[1] + 0, + \ 'col': l:match[2] + 0, + \ 'type': l:type, + \ 'text': l:text, + \}) + endfor - return l:output + return l:output endfunction call ale#linter#Define('elixir', { - \ 'name': 'credo', - \ 'executable': 'mix', - \ 'command': 'mix credo suggest --format=flycheck --read-from-stdin %s', - \ 'callback': 'ale_linters#elixir#credo#Handle' }) +\ 'name': 'credo', +\ 'executable': 'mix', +\ 'command': 'mix credo suggest --format=flycheck --read-from-stdin %s', +\ 'callback': 'ale_linters#elixir#credo#Handle', +\}) diff --git a/ale_linters/go/gobuild.vim b/ale_linters/go/gobuild.vim index 5187c682..eee0bf84 100644 --- a/ale_linters/go/gobuild.vim +++ b/ale_linters/go/gobuild.vim @@ -4,22 +4,25 @@ " inspired by work from dzhou121 function! ale_linters#go#gobuild#GoEnv(buffer) abort - if exists('s:go_env') - return '' - endif + if exists('s:go_env') + return '' + endif - return 'go env GOPATH GOROOT' + return 'go env GOPATH GOROOT' endfunction function! ale_linters#go#gobuild#GetCommand(buffer, goenv_output) abort - if !exists('s:go_env') - let s:go_env = { - \ 'GOPATH': a:goenv_output[0], - \ 'GOROOT': a:goenv_output[1], - \} - endif - " Run go test in local directory with relative path - return 'GOPATH=' . s:go_env.GOPATH . ' cd ' . fnamemodify(bufname(a:buffer), ':.:h') . ' && go test -c -o /dev/null ./' + if !exists('s:go_env') + let s:go_env = { + \ 'GOPATH': a:goenv_output[0], + \ 'GOROOT': a:goenv_output[1], + \} + endif + + " Run go test in local directory with relative path + return 'GOPATH=' . s:go_env.GOPATH + \ . ' cd ' . fnamemodify(bufname(a:buffer), ':.:h') + \ . ' && go test -c -o /dev/null ./' endfunction function! ale_linters#go#gobuild#Handler(buffer, lines) abort @@ -42,7 +45,7 @@ function! ale_linters#go#gobuild#HandleGoBuildErrors(buffer, full_filename, line for l:line in a:lines let l:match = matchlist(l:line, l:pattern) - " Omit errors from imported go packages + " Omit errors from imported go packages if len(l:match) == 0 || l:line !~ l:filename continue endif diff --git a/ale_linters/handlebars/embertemplatelint.vim b/ale_linters/handlebars/embertemplatelint.vim index 7a630e19..68d9ed6c 100644 --- a/ale_linters/handlebars/embertemplatelint.vim +++ b/ale_linters/handlebars/embertemplatelint.vim @@ -27,7 +27,7 @@ endfunction function! ale_linters#handlebars#embertemplatelint#Handle(buffer, lines) abort if len(a:lines) == 0 return [] - end + endif let l:output = [] diff --git a/ale_linters/nim/nimcheck.vim b/ale_linters/nim/nimcheck.vim index 0b8cfc8f..0d3a1b51 100644 --- a/ale_linters/nim/nimcheck.vim +++ b/ale_linters/nim/nimcheck.vim @@ -5,7 +5,7 @@ function! ale_linters#nim#nimcheck#Handle(buffer, lines) abort let l:buffer_filename = fnamemodify(bufname(a:buffer), ':p:t') let l:pattern = '^\(.\+\.nim\)(\(\d\+\), \(\d\+\)) \(.\+\)' - let l:output = [] + let l:output = [] for l:line in a:lines let l:match = matchlist(l:line, l:pattern) @@ -51,7 +51,7 @@ function! ale_linters#nim#nimcheck#Handle(buffer, lines) abort endfunction -function! ale_linters#nim#nimcheck#GetCommand(buffer) +function! ale_linters#nim#nimcheck#GetCommand(buffer) abort return 'nim check --path:' . fnameescape(fnamemodify(bufname(a:buffer), ':p:h')) . ' --threads:on --verbosity:0 --colors:off --listFullPaths %t' endfunction diff --git a/ale_linters/ocaml/merlin.vim b/ale_linters/ocaml/merlin.vim index 75cdb126..cfec9966 100644 --- a/ale_linters/ocaml/merlin.vim +++ b/ale_linters/ocaml/merlin.vim @@ -2,12 +2,11 @@ " Description: Report errors in OCaml code with Merlin if !exists('g:merlin') - finish + finish endif function! ale_linters#ocaml#merlin#Handle(buffer, lines) abort - let l:errors = merlin#ErrorLocList() - return l:errors + return merlin#ErrorLocList() endfunction call ale#linter#Define('ocaml', { @@ -16,4 +15,3 @@ call ale#linter#Define('ocaml', { \ 'command': 'true', \ 'callback': 'ale_linters#ocaml#merlin#Handle', \}) - diff --git a/ale_linters/ruby/rubocop.vim b/ale_linters/ruby/rubocop.vim index c1aa9536..05763b55 100644 --- a/ale_linters/ruby/rubocop.vim +++ b/ale_linters/ruby/rubocop.vim @@ -32,9 +32,9 @@ function! ale_linters#ruby#rubocop#Handle(buffer, lines) abort endfunction function! ale_linters#ruby#rubocop#GetCommand(buffer) abort - return 'rubocop --format emacs --force-exclusion ' . - \ g:ale_ruby_rubocop_options . - \ ' --stdin ' . bufname(a:buffer) + return 'rubocop --format emacs --force-exclusion ' + \ . g:ale_ruby_rubocop_options + \ . ' --stdin ' . bufname(a:buffer) endfunction " Set this option to change Rubocop options. diff --git a/ale_linters/tex/chktex.vim b/ale_linters/tex/chktex.vim index 95fd2bad..edcfa7d9 100644 --- a/ale_linters/tex/chktex.vim +++ b/ale_linters/tex/chktex.vim @@ -8,49 +8,49 @@ let g:ale_tex_chktex_options = \ get(g:, 'ale_tex_chktex_options', '-I') function! ale_linters#tex#chktex#GetCommand(buffer) abort - " Check for optional .chktexrc - let l:chktex_config = ale#util#FindNearestFile( - \ a:buffer, - \ '.chktexrc') + " Check for optional .chktexrc + let l:chktex_config = ale#util#FindNearestFile( + \ a:buffer, + \ '.chktexrc') - let l:command = g:ale_tex_chktex_executable - " Avoid bug when used without -p (last warning has gibberish for a filename) - let l:command .= ' -v0 -p stdin -q' + let l:command = g:ale_tex_chktex_executable + " Avoid bug when used without -p (last warning has gibberish for a filename) + let l:command .= ' -v0 -p stdin -q' - if !empty(l:chktex_config) - let l:command .= ' -l ' . fnameescape(l:chktex_config) - endif + if !empty(l:chktex_config) + let l:command .= ' -l ' . fnameescape(l:chktex_config) + endif - let l:command .= ' ' . g:ale_tex_chktex_options + let l:command .= ' ' . g:ale_tex_chktex_options - return l:command + return l:command endfunction function! ale_linters#tex#chktex#Handle(buffer, lines) abort - " Mattes lines like: - " - " stdin:499:2:24:Delete this space to maintain correct pagereferences. - " stdin:507:81:3:You should enclose the previous parenthesis with `{}'. - let l:pattern = '^stdin:\(\d\+\):\(\d\+\):\(\d\+\):\(.\+\)$' - let l:output = [] + " Mattes lines like: + " + " stdin:499:2:24:Delete this space to maintain correct pagereferences. + " stdin:507:81:3:You should enclose the previous parenthesis with `{}'. + let l:pattern = '^stdin:\(\d\+\):\(\d\+\):\(\d\+\):\(.\+\)$' + let l:output = [] - for l:line in a:lines - let l:match = matchlist(l:line, l:pattern) + for l:line in a:lines + let l:match = matchlist(l:line, l:pattern) - if len(l:match) == 0 - continue - endif + if len(l:match) == 0 + continue + endif - call add(l:output, { - \ 'bufnr': a:buffer, - \ 'lnum': l:match[1] + 0, - \ 'col': l:match[2] + 0, - \ 'text': l:match[4] . ' (' . (l:match[3]+0) . ')', - \ 'type': 'W', - \}) - endfor + call add(l:output, { + \ 'bufnr': a:buffer, + \ 'lnum': l:match[1] + 0, + \ 'col': l:match[2] + 0, + \ 'text': l:match[4] . ' (' . (l:match[3]+0) . ')', + \ 'type': 'W', + \}) + endfor - return l:output + return l:output endfunction call ale#linter#Define('tex', { diff --git a/ale_linters/tex/lacheck.vim b/ale_linters/tex/lacheck.vim index 94b79e6c..300e95d8 100644 --- a/ale_linters/tex/lacheck.vim +++ b/ale_linters/tex/lacheck.vim @@ -13,38 +13,38 @@ function! ale_linters#tex#lacheck#GetCommand(buffer) abort endfunction function! ale_linters#tex#lacheck#Handle(buffer, lines) abort - " Mattes lines like: - " - " "book.tex", line 37: possible unwanted space at "{" - " "book.tex", line 38: missing `\ ' after "etc." + " Mattes lines like: + " + " "book.tex", line 37: possible unwanted space at "{" + " "book.tex", line 38: missing `\ ' after "etc." - let l:pattern = '^".\+", line \(\d\+\): \(.\+\)$' - let l:output = [] + let l:pattern = '^".\+", line \(\d\+\): \(.\+\)$' + let l:output = [] - for l:line in a:lines - let l:match = matchlist(l:line, l:pattern) + for l:line in a:lines + let l:match = matchlist(l:line, l:pattern) - if len(l:match) == 0 - continue - endif + if len(l:match) == 0 + continue + endif - " lacheck follows `\input{}` commands. If the cwd is not the same as the - " file in the buffer then it will fail to find the inputed items. We do not - " want warnings from those items anyway - if !empty(matchstr(l:match[2], '^Could not open ".\+"$')) - continue - endif + " lacheck follows `\input{}` commands. If the cwd is not the same as the + " file in the buffer then it will fail to find the inputed items. We do not + " want warnings from those items anyway + if !empty(matchstr(l:match[2], '^Could not open ".\+"$')) + continue + endif - call add(l:output, { - \ 'bufnr': a:buffer, - \ 'lnum': l:match[1] + 0, - \ 'col': 0, - \ 'text': l:match[2], - \ 'type': 'W', - \}) - endfor + call add(l:output, { + \ 'bufnr': a:buffer, + \ 'lnum': l:match[1] + 0, + \ 'col': 0, + \ 'text': l:match[2], + \ 'type': 'W', + \}) + endfor - return l:output + return l:output endfunction call ale#linter#Define('tex', {