Add ALE Language Server Protocol client
This commit is contained in:
parent
3f08f570eb
commit
08f01ec164
568 changed files with 36790 additions and 2 deletions
22
pack/acp/start/ale/LICENSE
Normal file
22
pack/acp/start/ale/LICENSE
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
Copyright (c) 2016-2019, w0rp <devw0rp@gmail.com>
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
1. Redistributions of source code must retain the above copyright notice, this
|
||||||
|
list of conditions and the following disclaimer.
|
||||||
|
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer in the documentation
|
||||||
|
and/or other materials provided with the distribution.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||||
|
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
54
pack/acp/start/ale/ale_linters/ada/gcc.vim
Normal file
54
pack/acp/start/ale/ale_linters/ada/gcc.vim
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
" Author: Martino Pilia <martino.pilia@gmail.com>
|
||||||
|
" Description: Lint Ada files with GCC
|
||||||
|
|
||||||
|
call ale#Set('ada_gcc_executable', 'gcc')
|
||||||
|
|
||||||
|
" -gnatwa: activate most optional warnings
|
||||||
|
" -gnatq: try semantic analysis even if syntax errors have been found
|
||||||
|
call ale#Set('ada_gcc_options', '-gnatwa -gnatq')
|
||||||
|
|
||||||
|
function! ale_linters#ada#gcc#GetCommand(buffer) abort
|
||||||
|
" Build a suitable output file name. The output file is specified because
|
||||||
|
" the .ali file may be created even if no code generation is attempted.
|
||||||
|
" The output file name must match the source file name (except for the
|
||||||
|
" extension), so here we cannot use the null file as output.
|
||||||
|
let l:tmp_dir = fnamemodify(ale#command#CreateDirectory(a:buffer), ':p')
|
||||||
|
let l:out_file = l:tmp_dir . fnamemodify(bufname(a:buffer), ':t:r') . '.o'
|
||||||
|
|
||||||
|
" -gnatc: Check syntax and semantics only (no code generation attempted)
|
||||||
|
return '%e -x ada -c -gnatc'
|
||||||
|
\ . ' -o ' . ale#Escape(l:out_file)
|
||||||
|
\ . ' -I ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h'))
|
||||||
|
\ . ale#Pad(ale#Var(a:buffer, 'ada_gcc_options'))
|
||||||
|
\ . ' %t'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" For the message format please refer to:
|
||||||
|
" https://gcc.gnu.org/onlinedocs/gnat_ugn/Output-and-Error-Message-Control.html
|
||||||
|
" https://gcc.gnu.org/onlinedocs/gnat_ugn/Warning-Message-Control.html
|
||||||
|
function! ale_linters#ada#gcc#Handle(buffer, lines) abort
|
||||||
|
" Error format: <filename>:<lnum>:<col>: <text>
|
||||||
|
" Warning format: <filename>:<lnum>:<col>: warning: <text>
|
||||||
|
let l:re = '\v(.+):([0-9]+):([0-9]+):\s+(warning:)?\s*(.+)\s*'
|
||||||
|
let l:output = []
|
||||||
|
|
||||||
|
for l:match in ale#util#GetMatches(a:lines, l:re)
|
||||||
|
call add(l:output, {
|
||||||
|
\ 'bufnr': a:buffer,
|
||||||
|
\ 'lnum': str2nr(l:match[2]),
|
||||||
|
\ 'col': str2nr(l:match[3]),
|
||||||
|
\ 'type': l:match[4] is# 'warning:' ? 'W' : 'E',
|
||||||
|
\ 'text': l:match[5],
|
||||||
|
\})
|
||||||
|
endfor
|
||||||
|
|
||||||
|
return l:output
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('ada', {
|
||||||
|
\ 'name': 'gcc',
|
||||||
|
\ 'output_stream': 'stderr',
|
||||||
|
\ 'executable': {b -> ale#Var(b, 'ada_gcc_executable')},
|
||||||
|
\ 'command': function('ale_linters#ada#gcc#GetCommand'),
|
||||||
|
\ 'callback': 'ale_linters#ada#gcc#Handle',
|
||||||
|
\})
|
56
pack/acp/start/ale/ale_linters/ansible/ansible_lint.vim
Normal file
56
pack/acp/start/ale/ale_linters/ansible/ansible_lint.vim
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
" Author: Bjorn Neergaard <bjorn@neersighted.com>
|
||||||
|
" Description: ansible-lint for ansible-yaml files
|
||||||
|
|
||||||
|
call ale#Set('ansible_ansible_lint_executable', 'ansible-lint')
|
||||||
|
|
||||||
|
function! ale_linters#ansible#ansible_lint#GetExecutable(buffer) abort
|
||||||
|
return ale#Var(a:buffer, 'ansible_ansible_lint_executable')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#ansible#ansible_lint#Handle(buffer, lines) abort
|
||||||
|
for l:line in a:lines[:10]
|
||||||
|
if match(l:line, '^Traceback') >= 0
|
||||||
|
return [{
|
||||||
|
\ 'lnum': 1,
|
||||||
|
\ 'text': 'An exception was thrown. See :ALEDetail',
|
||||||
|
\ 'detail': join(a:lines, "\n"),
|
||||||
|
\}]
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
|
||||||
|
" Matches patterns line the following:
|
||||||
|
"
|
||||||
|
" test.yml:35: [EANSIBLE0002] Trailing whitespace
|
||||||
|
let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):?(\d+)?: \[?([[:alnum:]]+)\]? (.*)$'
|
||||||
|
let l:output = []
|
||||||
|
|
||||||
|
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||||
|
let l:code = l:match[4]
|
||||||
|
|
||||||
|
if l:code is# 'EANSIBLE0002'
|
||||||
|
\&& !ale#Var(a:buffer, 'warn_about_trailing_whitespace')
|
||||||
|
" Skip warnings for trailing whitespace if the option is off.
|
||||||
|
continue
|
||||||
|
endif
|
||||||
|
|
||||||
|
if ale#path#IsBufferPath(a:buffer, l:match[1])
|
||||||
|
call add(l:output, {
|
||||||
|
\ 'lnum': l:match[2] + 0,
|
||||||
|
\ 'col': l:match[3] + 0,
|
||||||
|
\ 'text': l:match[5],
|
||||||
|
\ 'code': l:code,
|
||||||
|
\ 'type': l:code[:0] is# 'E' ? 'E' : 'W',
|
||||||
|
\})
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
|
||||||
|
return l:output
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('ansible', {
|
||||||
|
\ 'name': 'ansible_lint',
|
||||||
|
\ 'aliases': ['ansible', 'ansible-lint'],
|
||||||
|
\ 'executable': function('ale_linters#ansible#ansible_lint#GetExecutable'),
|
||||||
|
\ 'command': '%e -p %t',
|
||||||
|
\ 'callback': 'ale_linters#ansible#ansible_lint#Handle',
|
||||||
|
\})
|
38
pack/acp/start/ale/ale_linters/apiblueprint/drafter.vim
Normal file
38
pack/acp/start/ale/ale_linters/apiblueprint/drafter.vim
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
" Author: nametake https://nametake.github.io
|
||||||
|
" Description: apiblueprint parser
|
||||||
|
|
||||||
|
function! ale_linters#apiblueprint#drafter#HandleErrors(buffer, lines) abort
|
||||||
|
" Matches patterns line the following:
|
||||||
|
"
|
||||||
|
" warning: (3) unable to parse response signature, expected 'response [<HTTP status code>] [(<media type>)]'; line 4, column 3k - line 4, column 22
|
||||||
|
" warning: (10) message-body asset is expected to be a pre-formatted code block, separate it by a newline and indent every of its line by 12 spaces or 3 tabs; line 30, column 5 - line 30, column 9; line 31, column 9 - line 31, column 14; line 32, column 9 - line 32, column 14
|
||||||
|
let l:pattern = '\(^.*\): (\d\+) \(.\{-\}\); line \(\d\+\), column \(\d\+\) - line \d\+, column \d\+\(.*; line \d\+, column \d\+ - line \(\d\+\), column \(\d\+\)\)\{-\}$'
|
||||||
|
let l:output = []
|
||||||
|
|
||||||
|
for l:match in ale#util#GetMatches(a:lines[2:], l:pattern)
|
||||||
|
let l:item = {
|
||||||
|
\ 'type': l:match[1] is# 'warning' ? 'W' : 'E',
|
||||||
|
\ 'text': l:match[2],
|
||||||
|
\ 'lnum': l:match[3] + 0,
|
||||||
|
\ 'col': l:match[4] + 0,
|
||||||
|
\}
|
||||||
|
|
||||||
|
if l:match[5] isnot# ''
|
||||||
|
let l:item.end_lnum = l:match[6] + 0
|
||||||
|
let l:item.end_col = l:match[7] + 0
|
||||||
|
endif
|
||||||
|
|
||||||
|
call add(l:output, l:item)
|
||||||
|
endfor
|
||||||
|
|
||||||
|
return l:output
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
call ale#linter#Define('apiblueprint', {
|
||||||
|
\ 'name': 'drafter',
|
||||||
|
\ 'output_stream': 'stderr',
|
||||||
|
\ 'executable': 'drafter',
|
||||||
|
\ 'command': 'drafter --use-line-num --validate',
|
||||||
|
\ 'callback': 'ale_linters#apiblueprint#drafter#HandleErrors',
|
||||||
|
\})
|
4
pack/acp/start/ale/ale_linters/asciidoc/alex.vim
Normal file
4
pack/acp/start/ale/ale_linters/asciidoc/alex.vim
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
" Author: Johannes Wienke <languitar@semipol.de>
|
||||||
|
" Description: alex for asciidoc files
|
||||||
|
|
||||||
|
call ale#handlers#alex#DefineLinter('asciidoc', '--text')
|
9
pack/acp/start/ale/ale_linters/asciidoc/proselint.vim
Normal file
9
pack/acp/start/ale/ale_linters/asciidoc/proselint.vim
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
" Author: Daniel M. Capella https://github.com/polyzen
|
||||||
|
" Description: proselint for AsciiDoc files
|
||||||
|
|
||||||
|
call ale#linter#Define('asciidoc', {
|
||||||
|
\ 'name': 'proselint',
|
||||||
|
\ 'executable': 'proselint',
|
||||||
|
\ 'command': 'proselint %t',
|
||||||
|
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
||||||
|
\})
|
9
pack/acp/start/ale/ale_linters/asciidoc/redpen.vim
Normal file
9
pack/acp/start/ale/ale_linters/asciidoc/redpen.vim
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
" Author: rhysd https://rhysd.github.io
|
||||||
|
" Description: Redpen, a proofreading tool (http://redpen.cc)
|
||||||
|
|
||||||
|
call ale#linter#Define('asciidoc', {
|
||||||
|
\ 'name': 'redpen',
|
||||||
|
\ 'executable': 'redpen',
|
||||||
|
\ 'command': 'redpen -f asciidoc -r json %t',
|
||||||
|
\ 'callback': 'ale#handlers#redpen#HandleRedpenOutput',
|
||||||
|
\})
|
9
pack/acp/start/ale/ale_linters/asciidoc/textlint.vim
Normal file
9
pack/acp/start/ale/ale_linters/asciidoc/textlint.vim
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
" Author: TANIGUCHI Masaya <ta2gch@gmail.com>
|
||||||
|
" Description: textlint for AsciiDoc files
|
||||||
|
|
||||||
|
call ale#linter#Define('asciidoc', {
|
||||||
|
\ 'name': 'textlint',
|
||||||
|
\ 'executable': function('ale#handlers#textlint#GetExecutable'),
|
||||||
|
\ 'command': function('ale#handlers#textlint#GetCommand'),
|
||||||
|
\ 'callback': 'ale#handlers#textlint#HandleTextlintOutput',
|
||||||
|
\})
|
9
pack/acp/start/ale/ale_linters/asciidoc/vale.vim
Normal file
9
pack/acp/start/ale/ale_linters/asciidoc/vale.vim
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
" Author: Jeff Kreeftmeijer https://github.com/jeffkreeftmeijer
|
||||||
|
" Description: vale for AsciiDoc files
|
||||||
|
|
||||||
|
call ale#linter#Define('asciidoc', {
|
||||||
|
\ 'name': 'vale',
|
||||||
|
\ 'executable': 'vale',
|
||||||
|
\ 'command': 'vale --output=line %t',
|
||||||
|
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
||||||
|
\})
|
4
pack/acp/start/ale/ale_linters/asciidoc/writegood.vim
Normal file
4
pack/acp/start/ale/ale_linters/asciidoc/writegood.vim
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
" Author: Sumner Evans <sumner.evans98@gmail.com>
|
||||||
|
" Description: write-good for AsciiDoc files
|
||||||
|
|
||||||
|
call ale#handlers#writegood#DefineLinter('asciidoc')
|
37
pack/acp/start/ale/ale_linters/asm/gcc.vim
Normal file
37
pack/acp/start/ale/ale_linters/asm/gcc.vim
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
" Author: Lucas Kolstad <lkolstad@uw.edu>
|
||||||
|
" Description: gcc linter for asm files
|
||||||
|
|
||||||
|
call ale#Set('asm_gcc_executable', 'gcc')
|
||||||
|
call ale#Set('asm_gcc_options', '-Wall')
|
||||||
|
|
||||||
|
function! ale_linters#asm#gcc#GetCommand(buffer) abort
|
||||||
|
" `-o /dev/null` or `-o null` is needed to catch all errors,
|
||||||
|
" -fsyntax-only doesn't catch everything.
|
||||||
|
return '%e -x assembler'
|
||||||
|
\ . ' -o ' . g:ale#util#nul_file
|
||||||
|
\ . '-iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h'))
|
||||||
|
\ . ' ' . ale#Var(a:buffer, 'asm_gcc_options') . ' -'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#asm#gcc#Handle(buffer, lines) abort
|
||||||
|
let l:pattern = '^.\+:\(\d\+\): \([^:]\+\): \(.\+\)$'
|
||||||
|
let l:output = []
|
||||||
|
|
||||||
|
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||||
|
call add(l:output, {
|
||||||
|
\ 'lnum': l:match[1] + 0,
|
||||||
|
\ 'type': l:match[2] =~? 'error' ? 'E' : 'W',
|
||||||
|
\ 'text': l:match[3],
|
||||||
|
\})
|
||||||
|
endfor
|
||||||
|
|
||||||
|
return l:output
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('asm', {
|
||||||
|
\ 'name': 'gcc',
|
||||||
|
\ 'output_stream': 'stderr',
|
||||||
|
\ 'executable': {b -> ale#Var(b, 'asm_gcc_executable')},
|
||||||
|
\ 'command': function('ale_linters#asm#gcc#GetCommand'),
|
||||||
|
\ 'callback': 'ale_linters#asm#gcc#Handle',
|
||||||
|
\})
|
22
pack/acp/start/ale/ale_linters/awk/gawk.vim
Normal file
22
pack/acp/start/ale/ale_linters/awk/gawk.vim
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
" Author: kmarc <korondi.mark@gmail.com>
|
||||||
|
" Description: This file adds support for using GNU awk with sripts.
|
||||||
|
|
||||||
|
call ale#Set('awk_gawk_executable', 'gawk')
|
||||||
|
call ale#Set('awk_gawk_options', '')
|
||||||
|
|
||||||
|
function! ale_linters#awk#gawk#GetCommand(buffer) abort
|
||||||
|
" note the --source 'BEGIN ...' is to prevent
|
||||||
|
" gawk from attempting to execute the body of the script
|
||||||
|
" it is linting.
|
||||||
|
return '%e --source ' . ale#Escape('BEGIN { exit } END { exit 1 }')
|
||||||
|
\ . ale#Pad(ale#Var(a:buffer, 'awk_gawk_options'))
|
||||||
|
\ . ' -f %t --lint /dev/null'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('awk', {
|
||||||
|
\ 'name': 'gawk',
|
||||||
|
\ 'executable': {b -> ale#Var(b, 'awk_gawk_executable')},
|
||||||
|
\ 'command': function('ale_linters#awk#gawk#GetCommand'),
|
||||||
|
\ 'callback': 'ale#handlers#gawk#HandleGawkFormat',
|
||||||
|
\ 'output_stream': 'both'
|
||||||
|
\})
|
75
pack/acp/start/ale/ale_linters/bib/bibclean.vim
Normal file
75
pack/acp/start/ale/ale_linters/bib/bibclean.vim
Normal file
|
@ -0,0 +1,75 @@
|
||||||
|
" Author: Horacio Sanson - https://github.com/hsanson
|
||||||
|
" Description: Support for bibclean linter for BibTeX files.
|
||||||
|
|
||||||
|
call ale#Set('bib_bibclean_executable', 'bibclean')
|
||||||
|
|
||||||
|
function! ale_linters#bib#bibclean#GetCommand(buffer) abort
|
||||||
|
let l:executable = ale#Var(a:buffer, 'bib_bibclean_executable')
|
||||||
|
|
||||||
|
return ale#Escape(l:executable) . ' -file-position '
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#bib#bibclean#get_type(str) abort
|
||||||
|
if a:str is# '??'
|
||||||
|
return 'E'
|
||||||
|
else
|
||||||
|
return 'W'
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#bib#bibclean#match_msg(line) abort
|
||||||
|
return matchlist(a:line, '^\(.*\) "stdin", line \(.*\): \(.*\)$')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#bib#bibclean#match_entry(line) abort
|
||||||
|
return matchlist(a:line, 'Entry input byte=.* line=\(.*\) column=\(.*\) output .*$')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#bib#bibclean#match_value(line) abort
|
||||||
|
return matchlist(a:line, 'Value input byte=.* line=\(.*\) column=\(.*\) output .*$')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#bib#bibclean#Handle(buffer, lines) abort
|
||||||
|
let l:output = []
|
||||||
|
|
||||||
|
let l:type = 'E'
|
||||||
|
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: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
|
||||||
|
endfor
|
||||||
|
|
||||||
|
return l:output
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('bib', {
|
||||||
|
\ 'name': 'bibclean',
|
||||||
|
\ 'executable': {b -> ale#Var(b, 'bib_bibclean_executable')},
|
||||||
|
\ 'command': function('ale_linters#bib#bibclean#GetCommand'),
|
||||||
|
\ 'output_stream': 'stderr',
|
||||||
|
\ 'callback': 'ale_linters#bib#bibclean#Handle',
|
||||||
|
\})
|
14
pack/acp/start/ale/ale_linters/c/ccls.vim
Normal file
14
pack/acp/start/ale/ale_linters/c/ccls.vim
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
" Author: Ye Jingchen <ye.jingchen@gmail.com>, Ben Falconer <ben@falconers.me.uk>, jtalowell <jtalowell@protonmail.com>
|
||||||
|
" Description: A language server for C
|
||||||
|
|
||||||
|
call ale#Set('c_ccls_executable', 'ccls')
|
||||||
|
call ale#Set('c_ccls_init_options', {})
|
||||||
|
|
||||||
|
call ale#linter#Define('c', {
|
||||||
|
\ 'name': 'ccls',
|
||||||
|
\ 'lsp': 'stdio',
|
||||||
|
\ 'executable': {b -> ale#Var(b, 'c_ccls_executable')},
|
||||||
|
\ 'command': '%e',
|
||||||
|
\ 'project_root': function('ale#handlers#ccls#GetProjectRoot'),
|
||||||
|
\ 'initialization_options': {b -> ale#Var(b, 'c_ccls_init_options')},
|
||||||
|
\})
|
24
pack/acp/start/ale/ale_linters/c/clang.vim
Normal file
24
pack/acp/start/ale/ale_linters/c/clang.vim
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
" Author: Masahiro H https://github.com/mshr-h
|
||||||
|
" Description: clang linter for c files
|
||||||
|
|
||||||
|
call ale#Set('c_clang_executable', 'clang')
|
||||||
|
call ale#Set('c_clang_options', '-std=c11 -Wall')
|
||||||
|
|
||||||
|
function! ale_linters#c#clang#GetCommand(buffer, output) abort
|
||||||
|
let l:cflags = ale#c#GetCFlags(a:buffer, a:output)
|
||||||
|
|
||||||
|
" -iquote with the directory the file is in makes #include work for
|
||||||
|
" headers in the same directory.
|
||||||
|
return '%e -S -x c -fsyntax-only'
|
||||||
|
\ . ' -iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h'))
|
||||||
|
\ . ale#Pad(l:cflags)
|
||||||
|
\ . ale#Pad(ale#Var(a:buffer, 'c_clang_options')) . ' -'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('c', {
|
||||||
|
\ 'name': 'clang',
|
||||||
|
\ 'output_stream': 'stderr',
|
||||||
|
\ 'executable': {b -> ale#Var(b, 'c_clang_executable')},
|
||||||
|
\ 'command': {b -> ale#c#RunMakeCommand(b, function('ale_linters#c#clang#GetCommand'))},
|
||||||
|
\ 'callback': 'ale#handlers#gcc#HandleGCCFormatWithIncludes',
|
||||||
|
\})
|
17
pack/acp/start/ale/ale_linters/c/clangd.vim
Normal file
17
pack/acp/start/ale/ale_linters/c/clangd.vim
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
" Author: Andrey Melentyev <andrey.melentyev@protonmail.com>
|
||||||
|
" Description: Clangd language server
|
||||||
|
|
||||||
|
call ale#Set('c_clangd_executable', 'clangd')
|
||||||
|
call ale#Set('c_clangd_options', '')
|
||||||
|
|
||||||
|
function! ale_linters#c#clangd#GetCommand(buffer) abort
|
||||||
|
return '%e' . ale#Pad(ale#Var(a:buffer, 'c_clangd_options'))
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('c', {
|
||||||
|
\ 'name': 'clangd',
|
||||||
|
\ 'lsp': 'stdio',
|
||||||
|
\ 'executable': {b -> ale#Var(b, 'c_clangd_executable')},
|
||||||
|
\ 'command': function('ale_linters#c#clangd#GetCommand'),
|
||||||
|
\ 'project_root': function('ale#c#FindProjectRoot'),
|
||||||
|
\})
|
49
pack/acp/start/ale/ale_linters/c/clangtidy.vim
Normal file
49
pack/acp/start/ale/ale_linters/c/clangtidy.vim
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
" Author: vdeurzen <tim@kompiler.org>, w0rp <devw0rp@gmail.com>,
|
||||||
|
" gagbo <gagbobada@gmail.com>, Andrej Radovic <r.andrej@gmail.com>
|
||||||
|
" Description: clang-tidy linter for c files
|
||||||
|
|
||||||
|
call ale#Set('c_clangtidy_executable', 'clang-tidy')
|
||||||
|
" Set this option to check the checks clang-tidy will apply.
|
||||||
|
" The number of checks that can be applied to C files is limited in contrast to
|
||||||
|
" C++
|
||||||
|
"
|
||||||
|
" Consult the check list in clang-tidy's documentation:
|
||||||
|
" http://clang.llvm.org/extra/clang-tidy/checks/list.html
|
||||||
|
|
||||||
|
call ale#Set('c_clangtidy_checks', [])
|
||||||
|
" Set this option to manually set some options for clang-tidy to use as compile
|
||||||
|
" flags.
|
||||||
|
" This will disable compile_commands.json detection.
|
||||||
|
call ale#Set('c_clangtidy_options', '')
|
||||||
|
" Set this option to manually set options for clang-tidy directly.
|
||||||
|
call ale#Set('c_clangtidy_extra_options', '')
|
||||||
|
call ale#Set('c_build_dir', '')
|
||||||
|
|
||||||
|
function! ale_linters#c#clangtidy#GetCommand(buffer) abort
|
||||||
|
let l:checks = join(ale#Var(a:buffer, 'c_clangtidy_checks'), ',')
|
||||||
|
let l:build_dir = ale#c#GetBuildDirectory(a:buffer)
|
||||||
|
|
||||||
|
" Get the extra options if we couldn't find a build directory.
|
||||||
|
let l:options = empty(l:build_dir)
|
||||||
|
\ ? ale#Var(a:buffer, 'c_clangtidy_options')
|
||||||
|
\ : ''
|
||||||
|
|
||||||
|
" Get the options to pass directly to clang-tidy
|
||||||
|
let l:extra_options = ale#Var(a:buffer, 'c_clangtidy_extra_options')
|
||||||
|
|
||||||
|
return '%e'
|
||||||
|
\ . (!empty(l:checks) ? ' -checks=' . ale#Escape(l:checks) : '')
|
||||||
|
\ . (!empty(l:extra_options) ? ' ' . ale#Escape(l:extra_options) : '')
|
||||||
|
\ . ' %s'
|
||||||
|
\ . (!empty(l:build_dir) ? ' -p ' . ale#Escape(l:build_dir) : '')
|
||||||
|
\ . (!empty(l:options) ? ' -- ' . l:options : '')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('c', {
|
||||||
|
\ 'name': 'clangtidy',
|
||||||
|
\ 'output_stream': 'stdout',
|
||||||
|
\ 'executable': {b -> ale#Var(b, 'c_clangtidy_executable')},
|
||||||
|
\ 'command': function('ale_linters#c#clangtidy#GetCommand'),
|
||||||
|
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
|
||||||
|
\ 'lint_file': 1,
|
||||||
|
\})
|
28
pack/acp/start/ale/ale_linters/c/cppcheck.vim
Normal file
28
pack/acp/start/ale/ale_linters/c/cppcheck.vim
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
" Author: Bart Libert <bart.libert@gmail.com>
|
||||||
|
" Description: cppcheck linter for c files
|
||||||
|
|
||||||
|
call ale#Set('c_cppcheck_executable', 'cppcheck')
|
||||||
|
call ale#Set('c_cppcheck_options', '--enable=style')
|
||||||
|
|
||||||
|
function! ale_linters#c#cppcheck#GetCommand(buffer) abort
|
||||||
|
let l:cd_command = ale#handlers#cppcheck#GetCdCommand(a:buffer)
|
||||||
|
let l:compile_commands_option = ale#handlers#cppcheck#GetCompileCommandsOptions(a:buffer)
|
||||||
|
let l:buffer_path_include = empty(l:compile_commands_option)
|
||||||
|
\ ? ale#handlers#cppcheck#GetBufferPathIncludeOptions(a:buffer)
|
||||||
|
\ : ''
|
||||||
|
|
||||||
|
return l:cd_command
|
||||||
|
\ . '%e -q --language=c'
|
||||||
|
\ . ale#Pad(l:compile_commands_option)
|
||||||
|
\ . ale#Pad(ale#Var(a:buffer, 'c_cppcheck_options'))
|
||||||
|
\ . l:buffer_path_include
|
||||||
|
\ . ' %t'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('c', {
|
||||||
|
\ 'name': 'cppcheck',
|
||||||
|
\ 'output_stream': 'both',
|
||||||
|
\ 'executable': {b -> ale#Var(b, 'c_cppcheck_executable')},
|
||||||
|
\ 'command': function('ale_linters#c#cppcheck#GetCommand'),
|
||||||
|
\ 'callback': 'ale#handlers#cppcheck#HandleCppCheckFormat',
|
||||||
|
\})
|
30
pack/acp/start/ale/ale_linters/c/cquery.vim
Normal file
30
pack/acp/start/ale/ale_linters/c/cquery.vim
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
" Author: Ben Falconer <ben@falconers.me.uk>, jtalowell <jtalowell@protonmail.com>
|
||||||
|
" Description: A language server for C
|
||||||
|
|
||||||
|
call ale#Set('c_cquery_executable', 'cquery')
|
||||||
|
call ale#Set('c_cquery_cache_directory', expand('~/.cache/cquery'))
|
||||||
|
|
||||||
|
function! ale_linters#c#cquery#GetProjectRoot(buffer) abort
|
||||||
|
" Try to find cquery configuration files first.
|
||||||
|
let l:config = ale#path#FindNearestFile(a:buffer, '.cquery')
|
||||||
|
|
||||||
|
if !empty(l:config)
|
||||||
|
return fnamemodify(l:config, ':h')
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Fall back on default project root detection.
|
||||||
|
return ale#c#FindProjectRoot(a:buffer)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#c#cquery#GetInitializationOptions(buffer) abort
|
||||||
|
return {'cacheDirectory': ale#Var(a:buffer, 'c_cquery_cache_directory')}
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('c', {
|
||||||
|
\ 'name': 'cquery',
|
||||||
|
\ 'lsp': 'stdio',
|
||||||
|
\ 'executable': {b -> ale#Var(b, 'c_cquery_executable')},
|
||||||
|
\ 'command': '%e',
|
||||||
|
\ 'project_root': function('ale_linters#c#cquery#GetProjectRoot'),
|
||||||
|
\ 'initialization_options': function('ale_linters#c#cquery#GetInitializationOptions'),
|
||||||
|
\})
|
25
pack/acp/start/ale/ale_linters/c/flawfinder.vim
Normal file
25
pack/acp/start/ale/ale_linters/c/flawfinder.vim
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
" Author: Christian Gibbons <cgibbons@gmu.edu>
|
||||||
|
" Description: flawfinder linter for c files
|
||||||
|
|
||||||
|
call ale#Set('c_flawfinder_executable', 'flawfinder')
|
||||||
|
call ale#Set('c_flawfinder_options', '')
|
||||||
|
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')
|
||||||
|
|
||||||
|
return '%e -CDQS'
|
||||||
|
\ . ale#Pad(ale#Var(a:buffer, 'c_flawfinder_options'))
|
||||||
|
\ . l:minlevel
|
||||||
|
\ . ' %t'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('c', {
|
||||||
|
\ 'name': 'flawfinder',
|
||||||
|
\ 'output_stream': 'stdout',
|
||||||
|
\ 'executable': {b -> ale#Var(b, 'c_flawfinder_executable')},
|
||||||
|
\ 'command': function('ale_linters#c#flawfinder#GetCommand'),
|
||||||
|
\ 'callback': 'ale#handlers#flawfinder#HandleFlawfinderFormat',
|
||||||
|
\})
|
28
pack/acp/start/ale/ale_linters/c/gcc.vim
Normal file
28
pack/acp/start/ale/ale_linters/c/gcc.vim
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
" Author: w0rp <devw0rp@gmail.com>
|
||||||
|
" Description: gcc linter for c files
|
||||||
|
|
||||||
|
call ale#Set('c_gcc_executable', 'gcc')
|
||||||
|
call ale#Set('c_gcc_options', '-std=c11 -Wall')
|
||||||
|
|
||||||
|
function! ale_linters#c#gcc#GetCommand(buffer, output) abort
|
||||||
|
let l:cflags = ale#c#GetCFlags(a:buffer, a:output)
|
||||||
|
|
||||||
|
" -iquote with the directory the file is in makes #include work for
|
||||||
|
" headers in the same directory.
|
||||||
|
"
|
||||||
|
" `-o /dev/null` or `-o null` is needed to catch all errors,
|
||||||
|
" -fsyntax-only doesn't catch everything.
|
||||||
|
return '%e -S -x c'
|
||||||
|
\ . ' -o ' . g:ale#util#nul_file
|
||||||
|
\ . ' -iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h'))
|
||||||
|
\ . ale#Pad(l:cflags)
|
||||||
|
\ . ale#Pad(ale#Var(a:buffer, 'c_gcc_options')) . ' -'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('c', {
|
||||||
|
\ 'name': 'gcc',
|
||||||
|
\ 'output_stream': 'stderr',
|
||||||
|
\ 'executable': {b -> ale#Var(b, 'c_gcc_executable')},
|
||||||
|
\ 'command': {b -> ale#c#RunMakeCommand(b, function('ale_linters#c#gcc#GetCommand'))},
|
||||||
|
\ 'callback': 'ale#handlers#gcc#HandleGCCFormatWithIncludes',
|
||||||
|
\})
|
54
pack/acp/start/ale/ale_linters/chef/cookstyle.vim
Normal file
54
pack/acp/start/ale/ale_linters/chef/cookstyle.vim
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
" Author: Raphael Hoegger - https://github.com/pfuender
|
||||||
|
" Description: Cookstyle (RuboCop based), a code style analyzer for Ruby files
|
||||||
|
|
||||||
|
call ale#Set('chef_cookstyle_executable', 'cookstyle')
|
||||||
|
call ale#Set('chef_cookstyle_options', '')
|
||||||
|
|
||||||
|
function! ale_linters#chef#cookstyle#GetCommand(buffer) abort
|
||||||
|
let l:options = ale#Var(a:buffer, 'chef_cookstyle_options')
|
||||||
|
|
||||||
|
return '%e' . ale#Pad(escape(l:options, '~')) . ' --force-exclusion --format json --stdin ' . ' %s'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#chef#cookstyle#Handle(buffer, lines) abort
|
||||||
|
if len(a:lines) == 0
|
||||||
|
return []
|
||||||
|
endif
|
||||||
|
|
||||||
|
let l:errors = ale#util#FuzzyJSONDecode(a:lines[0], {})
|
||||||
|
|
||||||
|
if !has_key(l:errors, 'summary')
|
||||||
|
\|| l:errors['summary']['offense_count'] == 0
|
||||||
|
\|| empty(l:errors['files'])
|
||||||
|
return []
|
||||||
|
endif
|
||||||
|
|
||||||
|
let l:output = []
|
||||||
|
|
||||||
|
for l:error in l:errors['files'][0]['offenses']
|
||||||
|
let l:start_col = str2nr(l:error['location']['start_column'])
|
||||||
|
let l:end_col = str2nr(l:error['location']['last_column'])
|
||||||
|
|
||||||
|
if !l:end_col
|
||||||
|
let l:end_col = l:start_col + 1
|
||||||
|
endif
|
||||||
|
|
||||||
|
call add(l:output, {
|
||||||
|
\ 'lnum': str2nr(l:error['location']['line']),
|
||||||
|
\ 'col': l:start_col,
|
||||||
|
\ 'end_col': l:end_col,
|
||||||
|
\ 'code': l:error['cop_name'],
|
||||||
|
\ 'text': l:error['message'],
|
||||||
|
\ 'type': l:error['severity'] is? 'convention' ? 'W' : 'E',
|
||||||
|
\})
|
||||||
|
endfor
|
||||||
|
|
||||||
|
return l:output
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('chef', {
|
||||||
|
\ 'name': 'cookstyle',
|
||||||
|
\ 'executable': {b -> ale#Var(b, 'chef_cookstyle_executable')},
|
||||||
|
\ 'command': function('ale_linters#chef#cookstyle#GetCommand'),
|
||||||
|
\ 'callback': 'ale_linters#chef#cookstyle#Handle',
|
||||||
|
\})
|
41
pack/acp/start/ale/ale_linters/chef/foodcritic.vim
Normal file
41
pack/acp/start/ale/ale_linters/chef/foodcritic.vim
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
" Author: Edward Larkey <edwlarkey@mac.com>
|
||||||
|
" Author: Jose Junior <jose.junior@gmail.com>
|
||||||
|
" Author: w0rp <devw0rp@gmail.com>
|
||||||
|
" Description: This file adds the foodcritic linter for Chef files.
|
||||||
|
|
||||||
|
call ale#Set('chef_foodcritic_executable', 'foodcritic')
|
||||||
|
call ale#Set('chef_foodcritic_options', '')
|
||||||
|
|
||||||
|
function! ale_linters#chef#foodcritic#GetCommand(buffer) abort
|
||||||
|
let l:options = ale#Var(a:buffer, 'chef_foodcritic_options')
|
||||||
|
|
||||||
|
return '%e' . ale#Pad(escape(l:options, '~')) . ' %s'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#chef#foodcritic#Handle(buffer, lines) abort
|
||||||
|
" Matches patterns line the following:
|
||||||
|
"
|
||||||
|
" FC002: Avoid string interpolation where not required: httpd.rb:13
|
||||||
|
let l:pattern = '\v([^:]+): (.+): ([a-zA-Z]?:?[^:]+):(\d+)$'
|
||||||
|
let l:output = []
|
||||||
|
|
||||||
|
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||||
|
call add(l:output, {
|
||||||
|
\ 'code': l:match[1],
|
||||||
|
\ 'text': l:match[2],
|
||||||
|
\ 'filename': l:match[3],
|
||||||
|
\ 'lnum': l:match[4] + 0,
|
||||||
|
\ 'type': 'W',
|
||||||
|
\})
|
||||||
|
endfor
|
||||||
|
|
||||||
|
return l:output
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('chef', {
|
||||||
|
\ 'name': 'foodcritic',
|
||||||
|
\ 'executable': {b -> ale#Var(b, 'chef_foodcritic_executable')},
|
||||||
|
\ 'command': function('ale_linters#chef#foodcritic#GetCommand'),
|
||||||
|
\ 'callback': 'ale_linters#chef#foodcritic#Handle',
|
||||||
|
\ 'lint_file': 1,
|
||||||
|
\})
|
34
pack/acp/start/ale/ale_linters/clojure/clj_kondo.vim
Normal file
34
pack/acp/start/ale/ale_linters/clojure/clj_kondo.vim
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
" Author: Masashi Iizuka <liquidz.uo@gmail.com>
|
||||||
|
" Description: linter for clojure using clj-kondo https://github.com/borkdude/clj-kondo
|
||||||
|
|
||||||
|
function! ale_linters#clojure#clj_kondo#HandleCljKondoFormat(buffer, lines) abort
|
||||||
|
" output format
|
||||||
|
" <filename>:<line>:<column>: <issue type>: <message>
|
||||||
|
let l:pattern = '\v^[a-zA-Z]?:?[^:]+:(\d+):(\d+):? ((Exception|error|warning): ?(.+))$'
|
||||||
|
let l:output = []
|
||||||
|
|
||||||
|
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||||
|
let l:type = 'E'
|
||||||
|
|
||||||
|
if l:match[4] is? 'warning'
|
||||||
|
let l:type = 'W'
|
||||||
|
endif
|
||||||
|
|
||||||
|
call add(l:output, {
|
||||||
|
\ 'lnum': l:match[1] + 0,
|
||||||
|
\ 'col': l:match[2] + 0,
|
||||||
|
\ 'text': l:match[3],
|
||||||
|
\ 'type': l:type,
|
||||||
|
\})
|
||||||
|
endfor
|
||||||
|
|
||||||
|
return l:output
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('clojure', {
|
||||||
|
\ 'name': 'clj-kondo',
|
||||||
|
\ 'output_stream': 'stdout',
|
||||||
|
\ 'executable': 'clj-kondo',
|
||||||
|
\ 'command': 'clj-kondo --lint %t',
|
||||||
|
\ 'callback': 'ale_linters#clojure#clj_kondo#HandleCljKondoFormat',
|
||||||
|
\})
|
34
pack/acp/start/ale/ale_linters/clojure/joker.vim
Normal file
34
pack/acp/start/ale/ale_linters/clojure/joker.vim
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
" Author: Nic West <nicwest@mailbox.org>
|
||||||
|
" Description: linter for clojure using joker https://github.com/candid82/joker
|
||||||
|
|
||||||
|
function! ale_linters#clojure#joker#HandleJokerFormat(buffer, lines) abort
|
||||||
|
" output format
|
||||||
|
" <filename>:<line>:<column>: <issue type>: <message>
|
||||||
|
let l:pattern = '\v^[a-zA-Z]?:?[^:]+:(\d+):(\d+):? ((Read error|Parse error|Parse warning|Exception): ?(.+))$'
|
||||||
|
let l:output = []
|
||||||
|
|
||||||
|
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||||
|
let l:type = 'E'
|
||||||
|
|
||||||
|
if l:match[4] is? 'Parse warning'
|
||||||
|
let l:type = 'W'
|
||||||
|
endif
|
||||||
|
|
||||||
|
call add(l:output, {
|
||||||
|
\ 'lnum': l:match[1] + 0,
|
||||||
|
\ 'col': l:match[2] + 0,
|
||||||
|
\ 'text': l:match[3],
|
||||||
|
\ 'type': l:type,
|
||||||
|
\})
|
||||||
|
endfor
|
||||||
|
|
||||||
|
return l:output
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('clojure', {
|
||||||
|
\ 'name': 'joker',
|
||||||
|
\ 'output_stream': 'stderr',
|
||||||
|
\ 'executable': 'joker',
|
||||||
|
\ 'command': 'joker --working-dir %s --lint %t',
|
||||||
|
\ 'callback': 'ale_linters#clojure#joker#HandleJokerFormat',
|
||||||
|
\})
|
|
@ -0,0 +1,35 @@
|
||||||
|
" Author: Yasuhiro Kiyota <yasuhiroki.duck@gmail.com>
|
||||||
|
" Description: Support cfn-python-lint for AWS Cloudformation template file
|
||||||
|
|
||||||
|
function! ale_linters#cloudformation#cfn_python_lint#Handle(buffer, lines) abort
|
||||||
|
" Matches patterns line the following:
|
||||||
|
"
|
||||||
|
" sample.template.yaml:96:7:96:15:E3012:Property Resources/Sample/Properties/FromPort should be of type Integer
|
||||||
|
let l:pattern = '\v^(.*):(\d+):(\d+):(\d+):(\d+):([[:alnum:]]+):(.*)$'
|
||||||
|
let l:output = []
|
||||||
|
|
||||||
|
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||||
|
let l:code = l:match[6]
|
||||||
|
|
||||||
|
if ale#path#IsBufferPath(a:buffer, l:match[1])
|
||||||
|
call add(l:output, {
|
||||||
|
\ 'lnum': l:match[2],
|
||||||
|
\ 'col': l:match[3],
|
||||||
|
\ 'end_lnum': l:match[4],
|
||||||
|
\ 'end_col': l:match[5],
|
||||||
|
\ 'code': l:code,
|
||||||
|
\ 'type': l:code[:0] is# 'E' ? 'E' : 'W',
|
||||||
|
\ 'text': l:match[7]
|
||||||
|
\})
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
|
||||||
|
return l:output
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('cloudformation', {
|
||||||
|
\ 'name': 'cloudformation',
|
||||||
|
\ 'executable': 'cfn-lint',
|
||||||
|
\ 'command': 'cfn-lint --template %t --format parseable',
|
||||||
|
\ 'callback': 'ale_linters#cloudformation#cfn_python_lint#Handle',
|
||||||
|
\})
|
24
pack/acp/start/ale/ale_linters/cmake/cmakelint.vim
Normal file
24
pack/acp/start/ale/ale_linters/cmake/cmakelint.vim
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
" Author: Kenneth Benzie <k.benzie83@gmail.com>
|
||||||
|
" Description: cmakelint for cmake files
|
||||||
|
|
||||||
|
let g:ale_cmake_cmakelint_executable =
|
||||||
|
\ get(g:, 'ale_cmake_cmakelint_executable', 'cmakelint')
|
||||||
|
|
||||||
|
let g:ale_cmake_cmakelint_options =
|
||||||
|
\ get(g:, 'ale_cmake_cmakelint_options', '')
|
||||||
|
|
||||||
|
function! ale_linters#cmake#cmakelint#Executable(buffer) abort
|
||||||
|
return ale#Var(a:buffer, 'cmake_cmakelint_executable')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#cmake#cmakelint#Command(buffer) abort
|
||||||
|
return ale_linters#cmake#cmakelint#Executable(a:buffer)
|
||||||
|
\ . ' ' . ale#Var(a:buffer, 'cmake_cmakelint_options') . ' %t'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('cmake', {
|
||||||
|
\ 'name': 'cmakelint',
|
||||||
|
\ 'executable': function('ale_linters#cmake#cmakelint#Executable'),
|
||||||
|
\ 'command': function('ale_linters#cmake#cmakelint#Command'),
|
||||||
|
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
||||||
|
\})
|
23
pack/acp/start/ale/ale_linters/coffee/coffee.vim
Normal file
23
pack/acp/start/ale/ale_linters/coffee/coffee.vim
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
" Author: KabbAmine - https://github.com/KabbAmine
|
||||||
|
" Description: Coffee for checking coffee files
|
||||||
|
|
||||||
|
function! ale_linters#coffee#coffee#GetExecutable(buffer) abort
|
||||||
|
return ale#path#ResolveLocalPath(
|
||||||
|
\ a:buffer,
|
||||||
|
\ 'node_modules/.bin/coffee',
|
||||||
|
\ 'coffee'
|
||||||
|
\)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#coffee#coffee#GetCommand(buffer) abort
|
||||||
|
return ale_linters#coffee#coffee#GetExecutable(a:buffer)
|
||||||
|
\ . ' -cp -s'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('coffee', {
|
||||||
|
\ 'name': 'coffee',
|
||||||
|
\ 'executable': function('ale_linters#coffee#coffee#GetExecutable'),
|
||||||
|
\ 'command': function('ale_linters#coffee#coffee#GetCommand'),
|
||||||
|
\ 'output_stream': 'stderr',
|
||||||
|
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
|
||||||
|
\})
|
43
pack/acp/start/ale/ale_linters/coffee/coffeelint.vim
Normal file
43
pack/acp/start/ale/ale_linters/coffee/coffeelint.vim
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
" Author: Prashanth Chandra https://github.com/prashcr
|
||||||
|
" Description: coffeelint linter for coffeescript files
|
||||||
|
|
||||||
|
function! ale_linters#coffee#coffeelint#GetExecutable(buffer) abort
|
||||||
|
return ale#path#ResolveLocalPath(
|
||||||
|
\ a:buffer,
|
||||||
|
\ 'node_modules/.bin/coffeelint',
|
||||||
|
\ 'coffeelint'
|
||||||
|
\)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#coffee#coffeelint#GetCommand(buffer) abort
|
||||||
|
return ale_linters#coffee#coffeelint#GetExecutable(a:buffer)
|
||||||
|
\ . ' --stdin --reporter csv'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#coffee#coffeelint#Handle(buffer, lines) abort
|
||||||
|
" Matches patterns like the following:
|
||||||
|
"
|
||||||
|
" path,lineNumber,lineNumberEnd,level,message
|
||||||
|
" stdin,14,,error,Throwing strings is forbidden
|
||||||
|
"
|
||||||
|
" Note that we currently ignore lineNumberEnd for multiline errors
|
||||||
|
let l:pattern = 'stdin,\(\d\+\),\(\d*\),\(.\{-1,}\),\(.\+\)'
|
||||||
|
let l:output = []
|
||||||
|
|
||||||
|
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||||
|
call add(l:output, {
|
||||||
|
\ 'lnum': str2nr(l:match[1]),
|
||||||
|
\ 'type': l:match[3] is# 'error' ? 'E' : 'W',
|
||||||
|
\ 'text': l:match[4],
|
||||||
|
\})
|
||||||
|
endfor
|
||||||
|
|
||||||
|
return l:output
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('coffee', {
|
||||||
|
\ 'name': 'coffeelint',
|
||||||
|
\ 'executable': function('ale_linters#coffee#coffeelint#GetExecutable'),
|
||||||
|
\ 'command': function('ale_linters#coffee#coffeelint#GetCommand'),
|
||||||
|
\ 'callback': 'ale_linters#coffee#coffeelint#Handle',
|
||||||
|
\})
|
14
pack/acp/start/ale/ale_linters/cpp/ccls.vim
Normal file
14
pack/acp/start/ale/ale_linters/cpp/ccls.vim
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
" Author: Ye Jingchen <ye.jingchen@gmail.com>, Ben Falconer <ben@falconers.me.uk>, jtalowell <jtalowell@protonmail.com>
|
||||||
|
" Description: A language server for C++
|
||||||
|
|
||||||
|
call ale#Set('cpp_ccls_executable', 'ccls')
|
||||||
|
call ale#Set('cpp_ccls_init_options', {})
|
||||||
|
|
||||||
|
call ale#linter#Define('cpp', {
|
||||||
|
\ 'name': 'ccls',
|
||||||
|
\ 'lsp': 'stdio',
|
||||||
|
\ 'executable': {b -> ale#Var(b, 'cpp_ccls_executable')},
|
||||||
|
\ 'command': '%e',
|
||||||
|
\ 'project_root': function('ale#handlers#ccls#GetProjectRoot'),
|
||||||
|
\ 'initialization_options': {b -> ale#Var(b, 'cpp_ccls_init_options')},
|
||||||
|
\})
|
24
pack/acp/start/ale/ale_linters/cpp/clang.vim
Normal file
24
pack/acp/start/ale/ale_linters/cpp/clang.vim
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
" Author: Tomota Nakamura <https://github.com/tomotanakamura>
|
||||||
|
" Description: clang linter for cpp files
|
||||||
|
|
||||||
|
call ale#Set('cpp_clang_executable', 'clang++')
|
||||||
|
call ale#Set('cpp_clang_options', '-std=c++14 -Wall')
|
||||||
|
|
||||||
|
function! ale_linters#cpp#clang#GetCommand(buffer, output) abort
|
||||||
|
let l:cflags = ale#c#GetCFlags(a:buffer, a:output)
|
||||||
|
|
||||||
|
" -iquote with the directory the file is in makes #include work for
|
||||||
|
" headers in the same directory.
|
||||||
|
return '%e -S -x c++ -fsyntax-only'
|
||||||
|
\ . ' -iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h'))
|
||||||
|
\ . ale#Pad(l:cflags)
|
||||||
|
\ . ale#Pad(ale#Var(a:buffer, 'cpp_clang_options')) . ' -'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('cpp', {
|
||||||
|
\ 'name': 'clang',
|
||||||
|
\ 'output_stream': 'stderr',
|
||||||
|
\ 'executable': {b -> ale#Var(b, 'cpp_clang_executable')},
|
||||||
|
\ 'command': {b -> ale#c#RunMakeCommand(b, function('ale_linters#cpp#clang#GetCommand'))},
|
||||||
|
\ 'callback': 'ale#handlers#gcc#HandleGCCFormatWithIncludes',
|
||||||
|
\})
|
35
pack/acp/start/ale/ale_linters/cpp/clangcheck.vim
Normal file
35
pack/acp/start/ale/ale_linters/cpp/clangcheck.vim
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
" Author: gagbo <gagbobada@gmail.com>
|
||||||
|
" Description: clang-check linter for cpp files
|
||||||
|
|
||||||
|
call ale#Set('cpp_clangcheck_executable', 'clang-check')
|
||||||
|
call ale#Set('cpp_clangcheck_options', '')
|
||||||
|
call ale#Set('c_build_dir', '')
|
||||||
|
|
||||||
|
function! ale_linters#cpp#clangcheck#GetCommand(buffer) abort
|
||||||
|
let l:user_options = ale#Var(a:buffer, 'cpp_clangcheck_options')
|
||||||
|
|
||||||
|
" Try to find compilation database to link automatically
|
||||||
|
let l:build_dir = ale#Var(a:buffer, 'c_build_dir')
|
||||||
|
|
||||||
|
if empty(l:build_dir)
|
||||||
|
let [l:root, l:json_file] = ale#c#FindCompileCommands(a:buffer)
|
||||||
|
let l:build_dir = ale#path#Dirname(l:json_file)
|
||||||
|
endif
|
||||||
|
|
||||||
|
" The extra arguments in the command are used to prevent .plist files from
|
||||||
|
" being generated. These are only added if no build directory can be
|
||||||
|
" detected.
|
||||||
|
return '%e -analyze %s'
|
||||||
|
\ . (empty(l:build_dir) ? ' -extra-arg -Xclang -extra-arg -analyzer-output=text' : '')
|
||||||
|
\ . ale#Pad(l:user_options)
|
||||||
|
\ . (!empty(l:build_dir) ? ' -p ' . ale#Escape(l:build_dir) : '')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('cpp', {
|
||||||
|
\ 'name': 'clangcheck',
|
||||||
|
\ 'output_stream': 'stderr',
|
||||||
|
\ 'executable': {b -> ale#Var(b, 'cpp_clangcheck_executable')},
|
||||||
|
\ 'command': function('ale_linters#cpp#clangcheck#GetCommand'),
|
||||||
|
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
|
||||||
|
\ 'lint_file': 1,
|
||||||
|
\})
|
17
pack/acp/start/ale/ale_linters/cpp/clangd.vim
Normal file
17
pack/acp/start/ale/ale_linters/cpp/clangd.vim
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
" Author: Andrey Melentyev <andrey.melentyev@protonmail.com>
|
||||||
|
" Description: Clangd language server
|
||||||
|
|
||||||
|
call ale#Set('cpp_clangd_executable', 'clangd')
|
||||||
|
call ale#Set('cpp_clangd_options', '')
|
||||||
|
|
||||||
|
function! ale_linters#cpp#clangd#GetCommand(buffer) abort
|
||||||
|
return '%e' . ale#Pad(ale#Var(a:buffer, 'cpp_clangd_options'))
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('cpp', {
|
||||||
|
\ 'name': 'clangd',
|
||||||
|
\ 'lsp': 'stdio',
|
||||||
|
\ 'executable': {b -> ale#Var(b, 'cpp_clangd_executable')},
|
||||||
|
\ 'command': function('ale_linters#cpp#clangd#GetCommand'),
|
||||||
|
\ 'project_root': function('ale#c#FindProjectRoot'),
|
||||||
|
\})
|
43
pack/acp/start/ale/ale_linters/cpp/clangtidy.vim
Normal file
43
pack/acp/start/ale/ale_linters/cpp/clangtidy.vim
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
" Author: vdeurzen <tim@kompiler.org>, w0rp <devw0rp@gmail.com>,
|
||||||
|
" gagbo <gagbobada@gmail.com>
|
||||||
|
" Description: clang-tidy linter for cpp files
|
||||||
|
|
||||||
|
call ale#Set('cpp_clangtidy_executable', 'clang-tidy')
|
||||||
|
" Set this option to check the checks clang-tidy will apply.
|
||||||
|
call ale#Set('cpp_clangtidy_checks', [])
|
||||||
|
" Set this option to manually set some options for clang-tidy to use as compile
|
||||||
|
" flags.
|
||||||
|
" This will disable compile_commands.json detection.
|
||||||
|
call ale#Set('cpp_clangtidy_options', '')
|
||||||
|
" Set this option to manually set options for clang-tidy directly.
|
||||||
|
call ale#Set('cpp_clangtidy_extra_options', '')
|
||||||
|
call ale#Set('c_build_dir', '')
|
||||||
|
|
||||||
|
function! ale_linters#cpp#clangtidy#GetCommand(buffer) abort
|
||||||
|
let l:checks = join(ale#Var(a:buffer, 'cpp_clangtidy_checks'), ',')
|
||||||
|
let l:build_dir = ale#c#GetBuildDirectory(a:buffer)
|
||||||
|
|
||||||
|
" Get the extra options if we couldn't find a build directory.
|
||||||
|
let l:options = empty(l:build_dir)
|
||||||
|
\ ? ale#Var(a:buffer, 'cpp_clangtidy_options')
|
||||||
|
\ : ''
|
||||||
|
|
||||||
|
" Get the options to pass directly to clang-tidy
|
||||||
|
let l:extra_options = ale#Var(a:buffer, 'cpp_clangtidy_extra_options')
|
||||||
|
|
||||||
|
return '%e'
|
||||||
|
\ . (!empty(l:checks) ? ' -checks=' . ale#Escape(l:checks) : '')
|
||||||
|
\ . (!empty(l:extra_options) ? ' ' . ale#Escape(l:extra_options) : '')
|
||||||
|
\ . ' %s'
|
||||||
|
\ . (!empty(l:build_dir) ? ' -p ' . ale#Escape(l:build_dir) : '')
|
||||||
|
\ . (!empty(l:options) ? ' -- ' . l:options : '')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('cpp', {
|
||||||
|
\ 'name': 'clangtidy',
|
||||||
|
\ 'output_stream': 'stdout',
|
||||||
|
\ 'executable': {b -> ale#Var(b, 'cpp_clangtidy_executable')},
|
||||||
|
\ 'command': function('ale_linters#cpp#clangtidy#GetCommand'),
|
||||||
|
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
|
||||||
|
\ 'lint_file': 1,
|
||||||
|
\})
|
32
pack/acp/start/ale/ale_linters/cpp/clazy.vim
Normal file
32
pack/acp/start/ale/ale_linters/cpp/clazy.vim
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
" Description: clazy linter for cpp files (clang-based and Qt-oriented)
|
||||||
|
|
||||||
|
call ale#Set('cpp_clazy_executable', 'clazy-standalone')
|
||||||
|
" Set this option to check the checks clazy will apply.
|
||||||
|
call ale#Set('cpp_clazy_checks', ['level1'])
|
||||||
|
" Set this option to manually set some options for clazy.
|
||||||
|
" This will disable compile_commands.json detection.
|
||||||
|
call ale#Set('cpp_clazy_options', '')
|
||||||
|
call ale#Set('c_build_dir', '')
|
||||||
|
|
||||||
|
function! ale_linters#cpp#clazy#GetCommand(buffer) abort
|
||||||
|
let l:checks = join(ale#Var(a:buffer, 'cpp_clazy_checks'), ',')
|
||||||
|
let l:build_dir = ale#c#GetBuildDirectory(a:buffer)
|
||||||
|
|
||||||
|
" Get the extra options if we couldn't find a build directory.
|
||||||
|
let l:options = ale#Var(a:buffer, 'cpp_clazy_options')
|
||||||
|
|
||||||
|
return '%e'
|
||||||
|
\ . (!empty(l:checks) ? ' -checks=' . ale#Escape(l:checks) : '')
|
||||||
|
\ . (!empty(l:build_dir) ? ' -p ' . ale#Escape(l:build_dir) : '')
|
||||||
|
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||||
|
\ . ' %s'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('cpp', {
|
||||||
|
\ 'name': 'clazy',
|
||||||
|
\ 'output_stream': 'stderr',
|
||||||
|
\ 'executable': {b -> ale#Var(b, 'cpp_clazy_executable')},
|
||||||
|
\ 'command': function('ale_linters#cpp#clazy#GetCommand'),
|
||||||
|
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
|
||||||
|
\ 'lint_file': 1,
|
||||||
|
\})
|
28
pack/acp/start/ale/ale_linters/cpp/cppcheck.vim
Normal file
28
pack/acp/start/ale/ale_linters/cpp/cppcheck.vim
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
" Author: Bart Libert <bart.libert@gmail.com>
|
||||||
|
" Description: cppcheck linter for cpp files
|
||||||
|
|
||||||
|
call ale#Set('cpp_cppcheck_executable', 'cppcheck')
|
||||||
|
call ale#Set('cpp_cppcheck_options', '--enable=style')
|
||||||
|
|
||||||
|
function! ale_linters#cpp#cppcheck#GetCommand(buffer) abort
|
||||||
|
let l:cd_command = ale#handlers#cppcheck#GetCdCommand(a:buffer)
|
||||||
|
let l:compile_commands_option = ale#handlers#cppcheck#GetCompileCommandsOptions(a:buffer)
|
||||||
|
let l:buffer_path_include = empty(l:compile_commands_option)
|
||||||
|
\ ? ale#handlers#cppcheck#GetBufferPathIncludeOptions(a:buffer)
|
||||||
|
\ : ''
|
||||||
|
|
||||||
|
return l:cd_command
|
||||||
|
\ . '%e -q --language=c++'
|
||||||
|
\ . ale#Pad(l:compile_commands_option)
|
||||||
|
\ . ale#Pad(ale#Var(a:buffer, 'cpp_cppcheck_options'))
|
||||||
|
\ . l:buffer_path_include
|
||||||
|
\ . ' %t'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('cpp', {
|
||||||
|
\ 'name': 'cppcheck',
|
||||||
|
\ 'output_stream': 'both',
|
||||||
|
\ 'executable': {b -> ale#Var(b, 'cpp_cppcheck_executable')},
|
||||||
|
\ 'command': function('ale_linters#cpp#cppcheck#GetCommand'),
|
||||||
|
\ 'callback': 'ale#handlers#cppcheck#HandleCppCheckFormat',
|
||||||
|
\})
|
20
pack/acp/start/ale/ale_linters/cpp/cpplint.vim
Normal file
20
pack/acp/start/ale/ale_linters/cpp/cpplint.vim
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
" Author: Dawid Kurek https://github.com/dawikur
|
||||||
|
" Description: cpplint for cpp files
|
||||||
|
|
||||||
|
call ale#Set('cpp_cpplint_executable', 'cpplint')
|
||||||
|
call ale#Set('cpp_cpplint_options', '')
|
||||||
|
|
||||||
|
function! ale_linters#cpp#cpplint#GetCommand(buffer) abort
|
||||||
|
let l:options = ale#Var(a:buffer, 'cpp_cpplint_options')
|
||||||
|
|
||||||
|
return '%e' . ale#Pad(l:options) . ' %s'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('cpp', {
|
||||||
|
\ 'name': 'cpplint',
|
||||||
|
\ 'output_stream': 'stderr',
|
||||||
|
\ 'executable': {b -> ale#Var(b, 'cpp_cpplint_executable')},
|
||||||
|
\ 'command': function('ale_linters#cpp#cpplint#GetCommand'),
|
||||||
|
\ 'callback': 'ale#handlers#cpplint#HandleCppLintFormat',
|
||||||
|
\ 'lint_file': 1,
|
||||||
|
\})
|
30
pack/acp/start/ale/ale_linters/cpp/cquery.vim
Normal file
30
pack/acp/start/ale/ale_linters/cpp/cquery.vim
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
" Author: Ben Falconer <ben@falconers.me.uk>
|
||||||
|
" Description: A language server for C++
|
||||||
|
|
||||||
|
call ale#Set('cpp_cquery_executable', 'cquery')
|
||||||
|
call ale#Set('cpp_cquery_cache_directory', expand('~/.cache/cquery'))
|
||||||
|
|
||||||
|
function! ale_linters#cpp#cquery#GetProjectRoot(buffer) abort
|
||||||
|
" Try to find cquery configuration files first.
|
||||||
|
let l:config = ale#path#FindNearestFile(a:buffer, '.cquery')
|
||||||
|
|
||||||
|
if !empty(l:config)
|
||||||
|
return fnamemodify(l:config, ':h')
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Fall back on default project root detection.
|
||||||
|
return ale#c#FindProjectRoot(a:buffer)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#cpp#cquery#GetInitializationOptions(buffer) abort
|
||||||
|
return {'cacheDirectory': ale#Var(a:buffer, 'cpp_cquery_cache_directory')}
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('cpp', {
|
||||||
|
\ 'name': 'cquery',
|
||||||
|
\ 'lsp': 'stdio',
|
||||||
|
\ 'executable': {b -> ale#Var(b, 'cpp_cquery_executable')},
|
||||||
|
\ 'command': '%e',
|
||||||
|
\ 'project_root': function('ale_linters#cpp#cquery#GetProjectRoot'),
|
||||||
|
\ 'initialization_options': function('ale_linters#cpp#cquery#GetInitializationOptions'),
|
||||||
|
\})
|
25
pack/acp/start/ale/ale_linters/cpp/flawfinder.vim
Normal file
25
pack/acp/start/ale/ale_linters/cpp/flawfinder.vim
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
" Author: Christian Gibbons <cgibbons@gmu.edu>
|
||||||
|
" Description: flawfinder linter for c++ files
|
||||||
|
|
||||||
|
call ale#Set('cpp_flawfinder_executable', 'flawfinder')
|
||||||
|
call ale#Set('cpp_flawfinder_options', '')
|
||||||
|
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')
|
||||||
|
|
||||||
|
return '%e -CDQS'
|
||||||
|
\ . ale#Var(a:buffer, 'cpp_flawfinder_options')
|
||||||
|
\ . l:minlevel
|
||||||
|
\ . ' %t'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('cpp', {
|
||||||
|
\ 'name': 'flawfinder',
|
||||||
|
\ 'output_stream': 'stdout',
|
||||||
|
\ 'executable': {b -> ale#Var(b, 'cpp_flawfinder_executable')},
|
||||||
|
\ 'command': function('ale_linters#cpp#flawfinder#GetCommand'),
|
||||||
|
\ 'callback': 'ale#handlers#flawfinder#HandleFlawfinderFormat',
|
||||||
|
\})
|
29
pack/acp/start/ale/ale_linters/cpp/gcc.vim
Normal file
29
pack/acp/start/ale/ale_linters/cpp/gcc.vim
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
" Author: geam <mdelage@student.42.fr>
|
||||||
|
" Description: gcc linter for cpp files
|
||||||
|
"
|
||||||
|
call ale#Set('cpp_gcc_executable', 'gcc')
|
||||||
|
call ale#Set('cpp_gcc_options', '-std=c++14 -Wall')
|
||||||
|
|
||||||
|
function! ale_linters#cpp#gcc#GetCommand(buffer, output) abort
|
||||||
|
let l:cflags = ale#c#GetCFlags(a:buffer, a:output)
|
||||||
|
|
||||||
|
" -iquote with the directory the file is in makes #include work for
|
||||||
|
" headers in the same directory.
|
||||||
|
"
|
||||||
|
" `-o /dev/null` or `-o null` is needed to catch all errors,
|
||||||
|
" -fsyntax-only doesn't catch everything.
|
||||||
|
return '%e -S -x c++'
|
||||||
|
\ . ' -o ' . g:ale#util#nul_file
|
||||||
|
\ . ' -iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h'))
|
||||||
|
\ . ale#Pad(l:cflags)
|
||||||
|
\ . ale#Pad(ale#Var(a:buffer, 'cpp_gcc_options')) . ' -'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('cpp', {
|
||||||
|
\ 'name': 'gcc',
|
||||||
|
\ 'aliases': ['g++'],
|
||||||
|
\ 'output_stream': 'stderr',
|
||||||
|
\ 'executable': {b -> ale#Var(b, 'cpp_gcc_executable')},
|
||||||
|
\ 'command': {b -> ale#c#RunMakeCommand(b, function('ale_linters#cpp#gcc#GetCommand'))},
|
||||||
|
\ 'callback': 'ale#handlers#gcc#HandleGCCFormatWithIncludes',
|
||||||
|
\})
|
57
pack/acp/start/ale/ale_linters/crystal/ameba.vim
Normal file
57
pack/acp/start/ale/ale_linters/crystal/ameba.vim
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
" Author: Harrison Bachrach - https://github.com/HarrisonB
|
||||||
|
" Description: Ameba, a linter for crystal files
|
||||||
|
|
||||||
|
call ale#Set('crystal_ameba_executable', 'bin/ameba')
|
||||||
|
|
||||||
|
function! ale_linters#crystal#ameba#GetCommand(buffer) abort
|
||||||
|
let l:executable = ale#Var(a:buffer, 'crystal_ameba_executable')
|
||||||
|
|
||||||
|
return ale#Escape(l:executable)
|
||||||
|
\ . ' --format json '
|
||||||
|
\ . ale#Escape(expand('#' . a:buffer . ':p'))
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Handle output from ameba
|
||||||
|
function! ale_linters#crystal#ameba#HandleAmebaOutput(buffer, lines) abort
|
||||||
|
if len(a:lines) == 0
|
||||||
|
return []
|
||||||
|
endif
|
||||||
|
|
||||||
|
let l:errors = ale#util#FuzzyJSONDecode(a:lines[0], {})
|
||||||
|
|
||||||
|
if !has_key(l:errors, 'summary')
|
||||||
|
\|| l:errors['summary']['issues_count'] == 0
|
||||||
|
\|| empty(l:errors['sources'])
|
||||||
|
return []
|
||||||
|
endif
|
||||||
|
|
||||||
|
let l:output = []
|
||||||
|
|
||||||
|
for l:error in l:errors['sources'][0]['issues']
|
||||||
|
let l:start_col = str2nr(l:error['location']['column'])
|
||||||
|
let l:end_col = str2nr(l:error['end_location']['column'])
|
||||||
|
|
||||||
|
if !l:end_col
|
||||||
|
let l:end_col = l:start_col + 1
|
||||||
|
endif
|
||||||
|
|
||||||
|
call add(l:output, {
|
||||||
|
\ 'lnum': str2nr(l:error['location']['line']),
|
||||||
|
\ 'col': l:start_col,
|
||||||
|
\ 'end_col': l:end_col,
|
||||||
|
\ 'code': l:error['rule_name'],
|
||||||
|
\ 'text': l:error['message'],
|
||||||
|
\ 'type': 'W',
|
||||||
|
\})
|
||||||
|
endfor
|
||||||
|
|
||||||
|
return l:output
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('crystal', {
|
||||||
|
\ 'name': 'ameba',
|
||||||
|
\ 'executable': {b -> ale#Var(b, 'crystal_ameba_executable')},
|
||||||
|
\ 'command': function('ale_linters#crystal#ameba#GetCommand'),
|
||||||
|
\ 'callback': 'ale_linters#crystal#ameba#HandleAmebaOutput',
|
||||||
|
\ 'lint_file': 1,
|
||||||
|
\})
|
31
pack/acp/start/ale/ale_linters/crystal/crystal.vim
Normal file
31
pack/acp/start/ale/ale_linters/crystal/crystal.vim
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
" Author: Jordan Andree <https://github.com/jordanandree>, David Alexander <opensource@thelonelyghost.com>
|
||||||
|
" Description: This file adds support for checking Crystal with crystal build
|
||||||
|
|
||||||
|
function! ale_linters#crystal#crystal#Handle(buffer, lines) abort
|
||||||
|
let l:output = []
|
||||||
|
|
||||||
|
for l:error in ale#util#FuzzyJSONDecode(a:lines, [])
|
||||||
|
call add(l:output, {
|
||||||
|
\ 'lnum': l:error.line + 0,
|
||||||
|
\ 'col': l:error.column + 0,
|
||||||
|
\ 'text': l:error.message,
|
||||||
|
\})
|
||||||
|
endfor
|
||||||
|
|
||||||
|
return l:output
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#crystal#crystal#GetCommand(buffer) abort
|
||||||
|
return 'crystal build -f json --no-codegen --no-color -o '
|
||||||
|
\ . ale#Escape(g:ale#util#nul_file)
|
||||||
|
\ . ' %s'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('crystal', {
|
||||||
|
\ 'name': 'crystal',
|
||||||
|
\ 'executable': 'crystal',
|
||||||
|
\ 'output_stream': 'both',
|
||||||
|
\ 'lint_file': 1,
|
||||||
|
\ 'command': function('ale_linters#crystal#crystal#GetCommand'),
|
||||||
|
\ 'callback': 'ale_linters#crystal#crystal#Handle',
|
||||||
|
\})
|
37
pack/acp/start/ale/ale_linters/cs/mcs.vim
Normal file
37
pack/acp/start/ale/ale_linters/cs/mcs.vim
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
let g:ale_cs_mcs_options = get(g:, 'ale_cs_mcs_options', '')
|
||||||
|
|
||||||
|
function! ale_linters#cs#mcs#GetCommand(buffer) abort
|
||||||
|
let l:options = ale#Var(a:buffer, 'cs_mcs_options')
|
||||||
|
|
||||||
|
return 'mcs -unsafe --parse'
|
||||||
|
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||||
|
\ . ' %t'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#cs#mcs#Handle(buffer, lines) abort
|
||||||
|
" Look for lines like the following.
|
||||||
|
"
|
||||||
|
" Tests.cs(12,29): error CSXXXX: ; expected
|
||||||
|
let l:pattern = '^\v(.+\.cs)\((\d+),(\d+)\)\: ([^ ]+) ([^ ]+): (.+)$'
|
||||||
|
let l:output = []
|
||||||
|
|
||||||
|
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||||
|
call add(l:output, {
|
||||||
|
\ 'lnum': l:match[2] + 0,
|
||||||
|
\ 'col': l:match[3] + 0,
|
||||||
|
\ 'type': l:match[4] is# 'error' ? 'E' : 'W',
|
||||||
|
\ 'code': l:match[5],
|
||||||
|
\ 'text': l:match[6],
|
||||||
|
\})
|
||||||
|
endfor
|
||||||
|
|
||||||
|
return l:output
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('cs',{
|
||||||
|
\ 'name': 'mcs',
|
||||||
|
\ 'output_stream': 'stderr',
|
||||||
|
\ 'executable': 'mcs',
|
||||||
|
\ 'command': function('ale_linters#cs#mcs#GetCommand'),
|
||||||
|
\ 'callback': 'ale_linters#cs#mcs#Handle',
|
||||||
|
\})
|
81
pack/acp/start/ale/ale_linters/cs/mcsc.vim
Normal file
81
pack/acp/start/ale/ale_linters/cs/mcsc.vim
Normal file
|
@ -0,0 +1,81 @@
|
||||||
|
call ale#Set('cs_mcsc_options', '')
|
||||||
|
call ale#Set('cs_mcsc_source', '')
|
||||||
|
call ale#Set('cs_mcsc_assembly_path', [])
|
||||||
|
call ale#Set('cs_mcsc_assemblies', [])
|
||||||
|
|
||||||
|
function! s:GetWorkingDirectory(buffer) abort
|
||||||
|
let l:working_directory = ale#Var(a:buffer, 'cs_mcsc_source')
|
||||||
|
|
||||||
|
if !empty(l:working_directory)
|
||||||
|
return l:working_directory
|
||||||
|
endif
|
||||||
|
|
||||||
|
return expand('#' . a:buffer . ':p:h')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#cs#mcsc#GetCommand(buffer) abort
|
||||||
|
" Pass assembly paths via the -lib: parameter.
|
||||||
|
let l:path_list = ale#Var(a:buffer, 'cs_mcsc_assembly_path')
|
||||||
|
|
||||||
|
let l:lib_option = !empty(l:path_list)
|
||||||
|
\ ? '-lib:' . join(map(copy(l:path_list), 'ale#Escape(v:val)'), ',')
|
||||||
|
\ : ''
|
||||||
|
|
||||||
|
" Pass paths to DLL files via the -r: parameter.
|
||||||
|
let l:assembly_list = ale#Var(a:buffer, 'cs_mcsc_assemblies')
|
||||||
|
|
||||||
|
let l:r_option = !empty(l:assembly_list)
|
||||||
|
\ ? '-r:' . join(map(copy(l:assembly_list), 'ale#Escape(v:val)'), ',')
|
||||||
|
\ : ''
|
||||||
|
|
||||||
|
" register temporary module target file with ale
|
||||||
|
" register temporary module target file with ALE.
|
||||||
|
let l:out = ale#command#CreateFile(a:buffer)
|
||||||
|
|
||||||
|
" The code is compiled as a module and the output is redirected to a
|
||||||
|
" temporary file.
|
||||||
|
return ale#path#CdString(s:GetWorkingDirectory(a:buffer))
|
||||||
|
\ . 'mcs -unsafe'
|
||||||
|
\ . ale#Pad(ale#Var(a:buffer, 'cs_mcsc_options'))
|
||||||
|
\ . ale#Pad(l:lib_option)
|
||||||
|
\ . ale#Pad(l:r_option)
|
||||||
|
\ . ' -out:' . l:out
|
||||||
|
\ . ' -t:module'
|
||||||
|
\ . ' -recurse:' . ale#Escape('*.cs')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#cs#mcsc#Handle(buffer, lines) abort
|
||||||
|
" Look for lines like the following.
|
||||||
|
"
|
||||||
|
" Tests.cs(12,29): error CSXXXX: ; expected
|
||||||
|
"
|
||||||
|
" NOTE: pattern also captures file name as linter compiles all
|
||||||
|
" files within the source tree rooted at the specified source
|
||||||
|
" path and not just the file loaded in the buffer
|
||||||
|
let l:pattern = '^\v(.+\.cs)\((\d+),(\d+)\)\: ([^ ]+) ([^ ]+): (.+)$'
|
||||||
|
let l:output = []
|
||||||
|
|
||||||
|
let l:dir = s:GetWorkingDirectory(a:buffer)
|
||||||
|
|
||||||
|
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||||
|
call add(l:output, {
|
||||||
|
\ 'filename': ale#path#GetAbsPath(l:dir, l:match[1]),
|
||||||
|
\ 'lnum': l:match[2] + 0,
|
||||||
|
\ 'col': l:match[3] + 0,
|
||||||
|
\ 'type': l:match[4] is# 'error' ? 'E' : 'W',
|
||||||
|
\ 'code': l:match[5],
|
||||||
|
\ 'text': l:match[6],
|
||||||
|
\})
|
||||||
|
endfor
|
||||||
|
|
||||||
|
return l:output
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('cs',{
|
||||||
|
\ 'name': 'mcsc',
|
||||||
|
\ 'output_stream': 'stderr',
|
||||||
|
\ 'executable': 'mcs',
|
||||||
|
\ 'command': function('ale_linters#cs#mcsc#GetCommand'),
|
||||||
|
\ 'callback': 'ale_linters#cs#mcsc#Handle',
|
||||||
|
\ 'lint_file': 1
|
||||||
|
\})
|
18
pack/acp/start/ale/ale_linters/css/csslint.vim
Normal file
18
pack/acp/start/ale/ale_linters/css/csslint.vim
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
" Author: w0rp <devw0rp@gmail.com>
|
||||||
|
" Description: This file adds support for checking CSS code with csslint.
|
||||||
|
|
||||||
|
function! ale_linters#css#csslint#GetCommand(buffer) abort
|
||||||
|
let l:csslintrc = ale#path#FindNearestFile(a:buffer, '.csslintrc')
|
||||||
|
let l:config_option = !empty(l:csslintrc)
|
||||||
|
\ ? '--config=' . ale#Escape(l:csslintrc)
|
||||||
|
\ : ''
|
||||||
|
|
||||||
|
return 'csslint --format=compact ' . l:config_option . ' %t'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('css', {
|
||||||
|
\ 'name': 'csslint',
|
||||||
|
\ 'executable': 'csslint',
|
||||||
|
\ 'command': function('ale_linters#css#csslint#GetCommand'),
|
||||||
|
\ 'callback': 'ale#handlers#css#HandleCSSLintFormat',
|
||||||
|
\})
|
9
pack/acp/start/ale/ale_linters/css/fecs.vim
Normal file
9
pack/acp/start/ale/ale_linters/css/fecs.vim
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
" Author: harttle <yangjvn@126.com>
|
||||||
|
" Description: fecs for CSS files
|
||||||
|
|
||||||
|
call ale#linter#Define('css', {
|
||||||
|
\ 'name': 'fecs',
|
||||||
|
\ 'executable': function('ale#handlers#fecs#GetExecutable'),
|
||||||
|
\ 'command': function('ale#handlers#fecs#GetCommand'),
|
||||||
|
\ 'callback': 'ale#handlers#fecs#Handle',
|
||||||
|
\})
|
19
pack/acp/start/ale/ale_linters/css/stylelint.vim
Normal file
19
pack/acp/start/ale/ale_linters/css/stylelint.vim
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
" Author: diartyz <diartyz@gmail.com>
|
||||||
|
|
||||||
|
call ale#Set('css_stylelint_executable', 'stylelint')
|
||||||
|
call ale#Set('css_stylelint_options', '')
|
||||||
|
call ale#Set('css_stylelint_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||||
|
|
||||||
|
function! ale_linters#css#stylelint#GetCommand(buffer) abort
|
||||||
|
return '%e ' . ale#Pad(ale#Var(a:buffer, 'css_stylelint_options'))
|
||||||
|
\ . ' --stdin-filename %s'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('css', {
|
||||||
|
\ 'name': 'stylelint',
|
||||||
|
\ 'executable': {b -> ale#node#FindExecutable(b, 'css_stylelint', [
|
||||||
|
\ 'node_modules/.bin/stylelint',
|
||||||
|
\ ])},
|
||||||
|
\ 'command': function('ale_linters#css#stylelint#GetCommand'),
|
||||||
|
\ 'callback': 'ale#handlers#css#HandleStyleLintFormat',
|
||||||
|
\})
|
46
pack/acp/start/ale/ale_linters/cucumber/cucumber.vim
Normal file
46
pack/acp/start/ale/ale_linters/cucumber/cucumber.vim
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
" Author: Eddie Lebow https://github.com/elebow
|
||||||
|
" Description: Cucumber, a BDD test tool
|
||||||
|
|
||||||
|
function! ale_linters#cucumber#cucumber#GetCommand(buffer) abort
|
||||||
|
let l:features_dir = ale#path#FindNearestDirectory(a:buffer, 'features')
|
||||||
|
|
||||||
|
if !empty(l:features_dir)
|
||||||
|
let l:features_arg = '-r ' . ale#Escape(l:features_dir)
|
||||||
|
else
|
||||||
|
let l:features_arg = ''
|
||||||
|
endif
|
||||||
|
|
||||||
|
return 'cucumber --dry-run --quiet --strict --format=json '
|
||||||
|
\ . l:features_arg . ' %t'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#cucumber#cucumber#Handle(buffer, lines) abort
|
||||||
|
try
|
||||||
|
let l:json = ale#util#FuzzyJSONDecode(a:lines, {})[0]
|
||||||
|
catch
|
||||||
|
return []
|
||||||
|
endtry
|
||||||
|
|
||||||
|
let l:output = []
|
||||||
|
|
||||||
|
for l:element in get(l:json, 'elements', [])
|
||||||
|
for l:step in l:element['steps']
|
||||||
|
if l:step['result']['status'] is# 'undefined'
|
||||||
|
call add(l:output, {
|
||||||
|
\ 'lnum': l:step['line'],
|
||||||
|
\ 'code': 'E',
|
||||||
|
\ 'text': 'Undefined step'
|
||||||
|
\})
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
endfor
|
||||||
|
|
||||||
|
return l:output
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('cucumber', {
|
||||||
|
\ 'name': 'cucumber',
|
||||||
|
\ 'executable': 'cucumber',
|
||||||
|
\ 'command': function('ale_linters#cucumber#cucumber#GetCommand'),
|
||||||
|
\ 'callback': 'ale_linters#cucumber#cucumber#Handle'
|
||||||
|
\})
|
49
pack/acp/start/ale/ale_linters/cuda/nvcc.vim
Normal file
49
pack/acp/start/ale/ale_linters/cuda/nvcc.vim
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
" Author: blahgeek <i@blahgeek.com>
|
||||||
|
" Description: NVCC linter for cuda files
|
||||||
|
|
||||||
|
call ale#Set('cuda_nvcc_executable', 'nvcc')
|
||||||
|
call ale#Set('cuda_nvcc_options', '-std=c++11')
|
||||||
|
|
||||||
|
function! ale_linters#cuda#nvcc#GetCommand(buffer) abort
|
||||||
|
" Unused: use ale#util#nul_file
|
||||||
|
" let l:output_file = ale#util#Tempname() . '.ii'
|
||||||
|
" call ale#command#ManageFile(a:buffer, l:output_file)
|
||||||
|
return '%e -cuda'
|
||||||
|
\ . ale#Pad(ale#c#IncludeOptions(ale#c#FindLocalHeaderPaths(a:buffer)))
|
||||||
|
\ . ale#Pad(ale#Var(a:buffer, 'cuda_nvcc_options'))
|
||||||
|
\ . ' %s -o ' . g:ale#util#nul_file
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#cuda#nvcc#HandleNVCCFormat(buffer, lines) abort
|
||||||
|
" Look for lines like the following.
|
||||||
|
"
|
||||||
|
" test.cu(8): error: argument of type "void *" is incompatible with parameter of type "int *"
|
||||||
|
let l:pattern = '\v^([^:\(\)]+):?\(?(\d+)\)?:(\d+)?:?\s*\w*\s*(error|warning): (.+)$'
|
||||||
|
let l:output = []
|
||||||
|
|
||||||
|
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||||
|
let l:item = {
|
||||||
|
\ 'lnum': str2nr(l:match[2]),
|
||||||
|
\ 'type': l:match[4] =~# 'error' ? 'E' : 'W',
|
||||||
|
\ 'text': l:match[5],
|
||||||
|
\ 'filename': fnamemodify(l:match[1], ':p'),
|
||||||
|
\}
|
||||||
|
|
||||||
|
if !empty(l:match[3])
|
||||||
|
let l:item.col = str2nr(l:match[3])
|
||||||
|
endif
|
||||||
|
|
||||||
|
call add(l:output, l:item)
|
||||||
|
endfor
|
||||||
|
|
||||||
|
return l:output
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('cuda', {
|
||||||
|
\ 'name': 'nvcc',
|
||||||
|
\ 'output_stream': 'stderr',
|
||||||
|
\ 'executable': {b -> ale#Var(b, 'cuda_nvcc_executable')},
|
||||||
|
\ 'command': function('ale_linters#cuda#nvcc#GetCommand'),
|
||||||
|
\ 'callback': 'ale_linters#cuda#nvcc#HandleNVCCFormat',
|
||||||
|
\ 'lint_file': 1,
|
||||||
|
\})
|
26
pack/acp/start/ale/ale_linters/cypher/cypher_lint.vim
Normal file
26
pack/acp/start/ale/ale_linters/cypher/cypher_lint.vim
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
" Author: Francisco Lopes <francisco@oblita.com>
|
||||||
|
" Description: Linting for Neo4j's Cypher
|
||||||
|
|
||||||
|
function! ale_linters#cypher#cypher_lint#Handle(buffer, lines) abort
|
||||||
|
let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):(\d+): (.*)$'
|
||||||
|
let l:output = []
|
||||||
|
|
||||||
|
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||||
|
call add(l:output, {
|
||||||
|
\ 'lnum': l:match[2] + 0,
|
||||||
|
\ 'col': l:match[3] + 0,
|
||||||
|
\ 'text': l:match[4],
|
||||||
|
\ 'type': 'E',
|
||||||
|
\})
|
||||||
|
endfor
|
||||||
|
|
||||||
|
return l:output
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('cypher', {
|
||||||
|
\ 'name': 'cypher_lint',
|
||||||
|
\ 'executable': 'cypher-lint',
|
||||||
|
\ 'command': 'cypher-lint',
|
||||||
|
\ 'output_stream': 'stderr',
|
||||||
|
\ 'callback': 'ale_linters#cypher#cypher_lint#Handle',
|
||||||
|
\})
|
22
pack/acp/start/ale/ale_linters/d/dls.vim
Normal file
22
pack/acp/start/ale/ale_linters/d/dls.vim
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
" Author: aurieh <me@aurieh.me>
|
||||||
|
" Description: A Language Server implementation for D
|
||||||
|
|
||||||
|
call ale#Set('d_dls_executable', 'dls')
|
||||||
|
|
||||||
|
function! ale_linters#d#dls#GetExecutable(buffer) abort
|
||||||
|
return ale#Var(a:buffer, 'd_dls_executable')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#d#dls#FindProjectRoot(buffer) abort
|
||||||
|
" Note: this will return . if dub config is empty
|
||||||
|
" dls can run outside DUB projects just fine
|
||||||
|
return fnamemodify(ale#d#FindDUBConfig(a:buffer), ':h')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('d', {
|
||||||
|
\ 'name': 'dls',
|
||||||
|
\ 'lsp': 'stdio',
|
||||||
|
\ 'executable': function('ale_linters#d#dls#GetExecutable'),
|
||||||
|
\ 'command': function('ale_linters#d#dls#GetExecutable'),
|
||||||
|
\ 'project_root': function('ale_linters#d#dls#FindProjectRoot'),
|
||||||
|
\})
|
74
pack/acp/start/ale/ale_linters/d/dmd.vim
Normal file
74
pack/acp/start/ale/ale_linters/d/dmd.vim
Normal file
|
@ -0,0 +1,74 @@
|
||||||
|
" Author: w0rp <devw0rp@gmail.com>
|
||||||
|
" Description: "dmd for D files"
|
||||||
|
|
||||||
|
function! ale_linters#d#dmd#GetDUBCommand(buffer) abort
|
||||||
|
" If we can't run dub, then skip this command.
|
||||||
|
if !executable('dub')
|
||||||
|
" Returning an empty string skips to the DMD command.
|
||||||
|
return ''
|
||||||
|
endif
|
||||||
|
|
||||||
|
let l:dub_file = ale#d#FindDUBConfig(a:buffer)
|
||||||
|
|
||||||
|
if empty(l:dub_file)
|
||||||
|
return ''
|
||||||
|
endif
|
||||||
|
|
||||||
|
" To support older dub versions, we just change the directory to
|
||||||
|
" the directory where we found the dub config, and then run `dub describe`
|
||||||
|
" from that directory.
|
||||||
|
return 'cd ' . ale#Escape(fnamemodify(l:dub_file, ':h'))
|
||||||
|
\ . ' && dub describe --import-paths'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#d#dmd#RunDUBCommand(buffer) abort
|
||||||
|
let l:command = ale_linters#d#dmd#GetDUBCommand(a:buffer)
|
||||||
|
|
||||||
|
if empty(l:command)
|
||||||
|
" If we can't run DUB, just run DMD.
|
||||||
|
return ale_linters#d#dmd#DMDCommand(a:buffer, [], {})
|
||||||
|
endif
|
||||||
|
|
||||||
|
return ale#command#Run(a:buffer, l:command, function('ale_linters#d#dmd#DMDCommand'))
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#d#dmd#DMDCommand(buffer, dub_output, meta) abort
|
||||||
|
let l:import_list = []
|
||||||
|
|
||||||
|
" Build a list of import paths generated from DUB, if available.
|
||||||
|
for l:line in a:dub_output
|
||||||
|
if !empty(l:line)
|
||||||
|
" The arguments must be '-Ifilename', not '-I filename'
|
||||||
|
call add(l:import_list, '-I' . ale#Escape(l:line))
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
|
||||||
|
return 'dmd '. join(l:import_list) . ' -o- -wi -vcolumns -c %t'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#d#dmd#Handle(buffer, lines) abort
|
||||||
|
" Matches patterns lines like the following:
|
||||||
|
" /tmp/tmp.qclsa7qLP7/file.d(1): Error: function declaration without return type. (Note that constructors are always named 'this')
|
||||||
|
" /tmp/tmp.G1L5xIizvB.d(8,8): Error: module weak_reference is in file 'dstruct/weak_reference.d' which cannot be read
|
||||||
|
let l:pattern = '^[^(]\+(\([0-9]\+\)\,\?\([0-9]*\)): \([^:]\+\): \(.\+\)'
|
||||||
|
let l:output = []
|
||||||
|
|
||||||
|
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||||
|
call add(l:output, {
|
||||||
|
\ 'lnum': l:match[1],
|
||||||
|
\ 'col': l:match[2],
|
||||||
|
\ 'type': l:match[3] is# 'Warning' ? 'W' : 'E',
|
||||||
|
\ 'text': l:match[4],
|
||||||
|
\})
|
||||||
|
endfor
|
||||||
|
|
||||||
|
return l:output
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('d', {
|
||||||
|
\ 'name': 'dmd',
|
||||||
|
\ 'executable': 'dmd',
|
||||||
|
\ 'command': function('ale_linters#d#dmd#RunDUBCommand'),
|
||||||
|
\ 'callback': 'ale_linters#d#dmd#Handle',
|
||||||
|
\ 'output_stream': 'stderr',
|
||||||
|
\})
|
26
pack/acp/start/ale/ale_linters/dafny/dafny.vim
Normal file
26
pack/acp/start/ale/ale_linters/dafny/dafny.vim
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
" Author: Taylor Blau <me@ttaylorr.com>
|
||||||
|
|
||||||
|
function! ale_linters#dafny#dafny#Handle(buffer, lines) abort
|
||||||
|
let l:pattern = '\v(.*)\((\d+),(\d+)\): (.*): (.*)'
|
||||||
|
let l:output = []
|
||||||
|
|
||||||
|
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||||
|
call add(l:output, {
|
||||||
|
\ 'bufnr': a:buffer,
|
||||||
|
\ 'col': l:match[3] + 0,
|
||||||
|
\ 'lnum': l:match[2] + 0,
|
||||||
|
\ 'text': l:match[5],
|
||||||
|
\ 'type': l:match[4] =~# '^Error' ? 'E' : 'W'
|
||||||
|
\ })
|
||||||
|
endfor
|
||||||
|
|
||||||
|
return l:output
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('dafny', {
|
||||||
|
\ 'name': 'dafny',
|
||||||
|
\ 'executable': 'dafny',
|
||||||
|
\ 'command': 'dafny %s /compile:0',
|
||||||
|
\ 'callback': 'ale_linters#dafny#dafny#Handle',
|
||||||
|
\ 'lint_file': 1,
|
||||||
|
\ })
|
36
pack/acp/start/ale/ale_linters/dart/dartanalyzer.vim
Normal file
36
pack/acp/start/ale/ale_linters/dart/dartanalyzer.vim
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
" Author: w0rp <devw0rp@gmail.com>
|
||||||
|
" Description: Check Dart files with dartanalyzer
|
||||||
|
|
||||||
|
call ale#Set('dart_dartanalyzer_executable', 'dartanalyzer')
|
||||||
|
|
||||||
|
function! ale_linters#dart#dartanalyzer#GetCommand(buffer) abort
|
||||||
|
let l:path = ale#path#FindNearestFile(a:buffer, '.packages')
|
||||||
|
|
||||||
|
return '%e'
|
||||||
|
\ . (!empty(l:path) ? ' --packages ' . ale#Escape(l:path) : '')
|
||||||
|
\ . ' %s'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#dart#dartanalyzer#Handle(buffer, lines) abort
|
||||||
|
let l:pattern = '\v^ ([a-z]+) . (.+) at (.+):(\d+):(\d+) . (.+)$'
|
||||||
|
let l:output = []
|
||||||
|
|
||||||
|
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||||
|
call add(l:output, {
|
||||||
|
\ 'type': l:match[1] is# 'error' ? 'E' : 'W',
|
||||||
|
\ 'text': l:match[6] . ': ' . l:match[2],
|
||||||
|
\ 'lnum': str2nr(l:match[4]),
|
||||||
|
\ 'col': str2nr(l:match[5]),
|
||||||
|
\})
|
||||||
|
endfor
|
||||||
|
|
||||||
|
return l:output
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('dart', {
|
||||||
|
\ 'name': 'dartanalyzer',
|
||||||
|
\ 'executable': {b -> ale#Var(b, 'dart_dartanalyzer_executable')},
|
||||||
|
\ 'command': function('ale_linters#dart#dartanalyzer#GetCommand'),
|
||||||
|
\ 'callback': 'ale_linters#dart#dartanalyzer#Handle',
|
||||||
|
\ 'lint_file': 1,
|
||||||
|
\})
|
20
pack/acp/start/ale/ale_linters/dart/language_server.vim
Normal file
20
pack/acp/start/ale/ale_linters/dart/language_server.vim
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
" Author: aurieh <me@aurieh.me>
|
||||||
|
" Description: A language server for dart
|
||||||
|
|
||||||
|
call ale#Set('dart_language_server_executable', 'dart_language_server')
|
||||||
|
|
||||||
|
function! ale_linters#dart#language_server#GetProjectRoot(buffer) abort
|
||||||
|
" Note: pub only looks for pubspec.yaml, there's no point in adding
|
||||||
|
" support for pubspec.yml
|
||||||
|
let l:pubspec = ale#path#FindNearestFile(a:buffer, 'pubspec.yaml')
|
||||||
|
|
||||||
|
return !empty(l:pubspec) ? fnamemodify(l:pubspec, ':h:h') : ''
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('dart', {
|
||||||
|
\ 'name': 'language_server',
|
||||||
|
\ 'lsp': 'stdio',
|
||||||
|
\ 'executable': {b -> ale#Var(b, 'dart_language_server_executable')},
|
||||||
|
\ 'command': '%e',
|
||||||
|
\ 'project_root': function('ale_linters#dart#language_server#GetProjectRoot'),
|
||||||
|
\})
|
|
@ -0,0 +1,61 @@
|
||||||
|
" Author: Alexander Olofsson <alexander.olofsson@liu.se>
|
||||||
|
|
||||||
|
call ale#Set('dockerfile_dockerfile_lint_executable', 'dockerfile_lint')
|
||||||
|
call ale#Set('dockerfile_dockerfile_lint_options', '')
|
||||||
|
|
||||||
|
function! ale_linters#dockerfile#dockerfile_lint#GetType(type) abort
|
||||||
|
if a:type is? 'error'
|
||||||
|
return 'E'
|
||||||
|
elseif a:type is? 'warn'
|
||||||
|
return 'W'
|
||||||
|
endif
|
||||||
|
|
||||||
|
return 'I'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#dockerfile#dockerfile_lint#Handle(buffer, lines) abort
|
||||||
|
try
|
||||||
|
let l:data = json_decode(join(a:lines, ''))
|
||||||
|
catch
|
||||||
|
return []
|
||||||
|
endtry
|
||||||
|
|
||||||
|
if empty(l:data)
|
||||||
|
" Should never happen, but it's better to be on the safe side
|
||||||
|
return []
|
||||||
|
endif
|
||||||
|
|
||||||
|
let l:messages = []
|
||||||
|
|
||||||
|
for l:type in ['error', 'warn', 'info']
|
||||||
|
for l:object in l:data[l:type]['data']
|
||||||
|
let l:line = get(l:object, 'line', -1)
|
||||||
|
let l:message = l:object['message']
|
||||||
|
|
||||||
|
if get(l:object, 'description', 'None') isnot# 'None'
|
||||||
|
let l:message = l:message . '. ' . l:object['description']
|
||||||
|
endif
|
||||||
|
|
||||||
|
call add(l:messages, {
|
||||||
|
\ 'lnum': l:line,
|
||||||
|
\ 'text': l:message,
|
||||||
|
\ 'type': ale_linters#dockerfile#dockerfile_lint#GetType(l:type),
|
||||||
|
\})
|
||||||
|
endfor
|
||||||
|
endfor
|
||||||
|
|
||||||
|
return l:messages
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#dockerfile#dockerfile_lint#GetCommand(buffer) abort
|
||||||
|
return '%e' . ale#Pad(ale#Var(a:buffer, 'dockerfile_dockerfile_lint_options'))
|
||||||
|
\ . ' -p -j -f'
|
||||||
|
\ . ' %t'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('dockerfile', {
|
||||||
|
\ 'name': 'dockerfile_lint',
|
||||||
|
\ 'executable': {b -> ale#Var(b, 'dockerfile_dockerfile_lint_executable')},
|
||||||
|
\ 'command': function('ale_linters#dockerfile#dockerfile_lint#GetCommand'),
|
||||||
|
\ 'callback': 'ale_linters#dockerfile#dockerfile_lint#Handle',
|
||||||
|
\})
|
99
pack/acp/start/ale/ale_linters/dockerfile/hadolint.vim
Normal file
99
pack/acp/start/ale/ale_linters/dockerfile/hadolint.vim
Normal file
|
@ -0,0 +1,99 @@
|
||||||
|
" Author: hauleth - https://github.com/hauleth
|
||||||
|
|
||||||
|
" always, yes, never
|
||||||
|
call ale#Set('dockerfile_hadolint_use_docker', 'never')
|
||||||
|
call ale#Set('dockerfile_hadolint_docker_image', 'hadolint/hadolint')
|
||||||
|
|
||||||
|
function! ale_linters#dockerfile#hadolint#Handle(buffer, lines) abort
|
||||||
|
" Matches patterns line the following:
|
||||||
|
"
|
||||||
|
" /dev/stdin:19 DL3001 Pipe chain should start with a raw value.
|
||||||
|
" /dev/stdin:19:3 unexpected thing
|
||||||
|
let l:pattern = '\v^/dev/stdin:(\d+):?(\d+)? ((DL|SC)(\d+) )?(.+)$'
|
||||||
|
let l:output = []
|
||||||
|
|
||||||
|
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||||
|
let l:lnum = 0
|
||||||
|
let l:colnum = 0
|
||||||
|
|
||||||
|
if l:match[1] isnot# ''
|
||||||
|
let l:lnum = l:match[1] + 0
|
||||||
|
endif
|
||||||
|
|
||||||
|
if l:match[2] isnot# ''
|
||||||
|
let l:colnum = l:match[2] + 0
|
||||||
|
endif
|
||||||
|
|
||||||
|
let l:type = 'W'
|
||||||
|
let l:text = l:match[6]
|
||||||
|
let l:detail = l:match[6]
|
||||||
|
let l:domain = 'https://github.com/hadolint/hadolint/wiki/'
|
||||||
|
|
||||||
|
if l:match[4] is# 'SC'
|
||||||
|
let l:domain = 'https://github.com/koalaman/shellcheck/wiki/'
|
||||||
|
endif
|
||||||
|
|
||||||
|
if l:match[5] isnot# ''
|
||||||
|
let l:code = l:match[4] . l:match[5]
|
||||||
|
let l:link = ' ( ' . l:domain . l:code . ' )'
|
||||||
|
let l:detail = l:code . l:link . "\n\n" . l:detail
|
||||||
|
else
|
||||||
|
let l:type = 'E'
|
||||||
|
endif
|
||||||
|
|
||||||
|
call add(l:output, {
|
||||||
|
\ 'lnum': l:lnum,
|
||||||
|
\ 'col': l:colnum,
|
||||||
|
\ 'type': l:type,
|
||||||
|
\ 'text': l:text,
|
||||||
|
\ 'detail': l:detail
|
||||||
|
\})
|
||||||
|
endfor
|
||||||
|
|
||||||
|
return l:output
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" This is a little different than the typical 'executable' callback. We want
|
||||||
|
" to afford the user the chance to say always use docker, never use docker,
|
||||||
|
" and use docker if the hadolint executable is not present on the system.
|
||||||
|
"
|
||||||
|
" In the case of neither docker nor hadolint executables being present, it
|
||||||
|
" really doesn't matter which we return -- either will have the effect of
|
||||||
|
" 'nope, can't use this linter!'.
|
||||||
|
|
||||||
|
function! ale_linters#dockerfile#hadolint#GetExecutable(buffer) abort
|
||||||
|
let l:use_docker = ale#Var(a:buffer, 'dockerfile_hadolint_use_docker')
|
||||||
|
|
||||||
|
" check for mandatory directives
|
||||||
|
if l:use_docker is# 'never'
|
||||||
|
return 'hadolint'
|
||||||
|
elseif l:use_docker is# 'always'
|
||||||
|
return 'docker'
|
||||||
|
endif
|
||||||
|
|
||||||
|
" if we reach here, we want to use 'hadolint' if present...
|
||||||
|
if executable('hadolint')
|
||||||
|
return 'hadolint'
|
||||||
|
endif
|
||||||
|
|
||||||
|
"... and 'docker' as a fallback.
|
||||||
|
return 'docker'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#dockerfile#hadolint#GetCommand(buffer) abort
|
||||||
|
let l:command = ale_linters#dockerfile#hadolint#GetExecutable(a:buffer)
|
||||||
|
|
||||||
|
if l:command is# 'docker'
|
||||||
|
return 'docker run --rm -i ' . ale#Var(a:buffer, 'dockerfile_hadolint_docker_image')
|
||||||
|
endif
|
||||||
|
|
||||||
|
return 'hadolint -'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
call ale#linter#Define('dockerfile', {
|
||||||
|
\ 'name': 'hadolint',
|
||||||
|
\ 'executable': function('ale_linters#dockerfile#hadolint#GetExecutable'),
|
||||||
|
\ 'command': function('ale_linters#dockerfile#hadolint#GetCommand'),
|
||||||
|
\ 'callback': 'ale_linters#dockerfile#hadolint#Handle',
|
||||||
|
\})
|
63
pack/acp/start/ale/ale_linters/elixir/credo.vim
Normal file
63
pack/acp/start/ale/ale_linters/elixir/credo.vim
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
" 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 = []
|
||||||
|
|
||||||
|
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||||
|
let l:type = l:match[3]
|
||||||
|
let l:text = l:match[4]
|
||||||
|
|
||||||
|
" Refactoring opportunities
|
||||||
|
if l:type is# 'F'
|
||||||
|
let l:type = 'W'
|
||||||
|
" Consistency
|
||||||
|
elseif l:type is# 'C'
|
||||||
|
let l:type = 'W'
|
||||||
|
" Software Design
|
||||||
|
elseif l:type is# 'D'
|
||||||
|
let l:type = 'I'
|
||||||
|
" Code Readability
|
||||||
|
elseif l:type is# 'R'
|
||||||
|
let l:type = 'I'
|
||||||
|
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
|
||||||
|
|
||||||
|
return l:output
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#elixir#credo#GetMode() abort
|
||||||
|
if get(g:, 'ale_elixir_credo_strict', 0)
|
||||||
|
return '--strict'
|
||||||
|
else
|
||||||
|
return 'suggest'
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#elixir#credo#GetCommand(buffer) abort
|
||||||
|
let l:project_root = ale#handlers#elixir#FindMixProjectRoot(a:buffer)
|
||||||
|
let l:mode = ale_linters#elixir#credo#GetMode()
|
||||||
|
|
||||||
|
return ale#path#CdString(l:project_root)
|
||||||
|
\ . 'mix help credo && '
|
||||||
|
\ . 'mix credo ' . ale_linters#elixir#credo#GetMode()
|
||||||
|
\ . ' --format=flycheck --read-from-stdin %s'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('elixir', {
|
||||||
|
\ 'name': 'credo',
|
||||||
|
\ 'executable': 'mix',
|
||||||
|
\ 'command': function('ale_linters#elixir#credo#GetCommand'),
|
||||||
|
\ 'callback': 'ale_linters#elixir#credo#Handle',
|
||||||
|
\})
|
41
pack/acp/start/ale/ale_linters/elixir/dialyxir.vim
Normal file
41
pack/acp/start/ale/ale_linters/elixir/dialyxir.vim
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
" Author: Fran C. - https://github.com/franciscoj
|
||||||
|
" Description: Add dialyzer support for elixir through dialyxir
|
||||||
|
" https://github.com/jeremyjh/dialyxir
|
||||||
|
|
||||||
|
function! ale_linters#elixir#dialyxir#Handle(buffer, lines) abort
|
||||||
|
" Matches patterns line the following:
|
||||||
|
"
|
||||||
|
" lib/filename.ex:19: Function fname/1 has no local return
|
||||||
|
let l:pattern = '\v(.+):(\d+): (.+)$'
|
||||||
|
let l:output = []
|
||||||
|
let l:type = 'W'
|
||||||
|
|
||||||
|
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||||
|
if bufname(a:buffer) == l:match[1]
|
||||||
|
call add(l:output, {
|
||||||
|
\ 'bufnr': a:buffer,
|
||||||
|
\ 'lnum': l:match[2] + 0,
|
||||||
|
\ 'col': 0,
|
||||||
|
\ 'type': l:type,
|
||||||
|
\ 'text': l:match[3],
|
||||||
|
\})
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
|
||||||
|
return l:output
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#elixir#dialyxir#GetCommand(buffer) abort
|
||||||
|
let l:project_root = ale#handlers#elixir#FindMixProjectRoot(a:buffer)
|
||||||
|
|
||||||
|
return ale#path#CdString(l:project_root)
|
||||||
|
\ . ' mix help dialyzer && mix dialyzer'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('elixir', {
|
||||||
|
\ 'name': 'dialyxir',
|
||||||
|
\ 'executable': 'mix',
|
||||||
|
\ 'command': function('ale_linters#elixir#dialyxir#GetCommand'),
|
||||||
|
\ 'callback': 'ale_linters#elixir#dialyxir#Handle',
|
||||||
|
\})
|
||||||
|
|
45
pack/acp/start/ale/ale_linters/elixir/dogma.vim
Normal file
45
pack/acp/start/ale/ale_linters/elixir/dogma.vim
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
" Author: archseer - https://github.com/archSeer
|
||||||
|
|
||||||
|
function! ale_linters#elixir#dogma#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 = []
|
||||||
|
|
||||||
|
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||||
|
let l:type = l:match[3]
|
||||||
|
let l:text = l:match[4]
|
||||||
|
|
||||||
|
if l:type is# 'C'
|
||||||
|
let l:type = 'E'
|
||||||
|
elseif l:type is# '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
|
||||||
|
|
||||||
|
return l:output
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#elixir#dogma#GetCommand(buffer) abort
|
||||||
|
let l:project_root = ale#handlers#elixir#FindMixProjectRoot(a:buffer)
|
||||||
|
|
||||||
|
return ale#path#CdString(l:project_root)
|
||||||
|
\ . ' mix help dogma && mix dogma %s --format=flycheck'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('elixir', {
|
||||||
|
\ 'name': 'dogma',
|
||||||
|
\ 'executable': 'mix',
|
||||||
|
\ 'command': function('ale_linters#elixir#dogma#GetCommand'),
|
||||||
|
\ 'lint_file': 1,
|
||||||
|
\ 'callback': 'ale_linters#elixir#dogma#Handle',
|
||||||
|
\})
|
21
pack/acp/start/ale/ale_linters/elixir/elixir_ls.vim
Normal file
21
pack/acp/start/ale/ale_linters/elixir/elixir_ls.vim
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
" Author: Jon Parise <jon@indelible.org>
|
||||||
|
" Description: ElixirLS integration (https://github.com/JakeBecker/elixir-ls)
|
||||||
|
|
||||||
|
call ale#Set('elixir_elixir_ls_release', 'elixir-ls')
|
||||||
|
call ale#Set('elixir_elixir_ls_config', {})
|
||||||
|
|
||||||
|
function! ale_linters#elixir#elixir_ls#GetExecutable(buffer) abort
|
||||||
|
let l:dir = ale#path#Simplify(ale#Var(a:buffer, 'elixir_elixir_ls_release'))
|
||||||
|
let l:cmd = has('win32') ? '\language_server.bat' : '/language_server.sh'
|
||||||
|
|
||||||
|
return l:dir . l:cmd
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('elixir', {
|
||||||
|
\ 'name': 'elixir-ls',
|
||||||
|
\ 'lsp': 'stdio',
|
||||||
|
\ 'executable': function('ale_linters#elixir#elixir_ls#GetExecutable'),
|
||||||
|
\ 'command': function('ale_linters#elixir#elixir_ls#GetExecutable'),
|
||||||
|
\ 'project_root': function('ale#handlers#elixir#FindMixUmbrellaRoot'),
|
||||||
|
\ 'lsp_config': {b -> ale#Var(b, 'elixir_elixir_ls_config')},
|
||||||
|
\})
|
52
pack/acp/start/ale/ale_linters/elixir/mix.vim
Normal file
52
pack/acp/start/ale/ale_linters/elixir/mix.vim
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
" Author: evnu - https://github.com/evnu
|
||||||
|
" Author: colbydehart - https://github.com/colbydehart
|
||||||
|
" Description: Mix compile checking for Elixir files
|
||||||
|
|
||||||
|
function! ale_linters#elixir#mix#Handle(buffer, lines) abort
|
||||||
|
" Matches patterns like the following:
|
||||||
|
"
|
||||||
|
" Error format
|
||||||
|
" ** (CompileError) apps/sim/lib/sim/server.ex:87: undefined function update_in/4
|
||||||
|
"
|
||||||
|
" TODO: Warning format
|
||||||
|
" warning: variable "foobar" does not exist and is being expanded to "foobar()", please use parentheses to remove the ambiguity or change the variable name
|
||||||
|
let l:pattern = '\v\(([^\)]+Error)\) ([^:]+):([^:]+): (.+)$'
|
||||||
|
let l:output = []
|
||||||
|
|
||||||
|
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||||
|
let l:type = 'E'
|
||||||
|
let l:text = l:match[4]
|
||||||
|
|
||||||
|
call add(l:output, {
|
||||||
|
\ 'bufnr': a:buffer,
|
||||||
|
\ 'lnum': l:match[3] + 0,
|
||||||
|
\ 'col': 0,
|
||||||
|
\ 'type': l:type,
|
||||||
|
\ 'text': l:text,
|
||||||
|
\})
|
||||||
|
endfor
|
||||||
|
|
||||||
|
return l:output
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#elixir#mix#GetCommand(buffer) abort
|
||||||
|
let l:project_root = ale#handlers#elixir#FindMixProjectRoot(a:buffer)
|
||||||
|
|
||||||
|
let l:temp_dir = ale#command#CreateDirectory(a:buffer)
|
||||||
|
|
||||||
|
let l:mix_build_path = has('win32')
|
||||||
|
\ ? 'set MIX_BUILD_PATH=' . ale#Escape(l:temp_dir) . ' &&'
|
||||||
|
\ : 'MIX_BUILD_PATH=' . ale#Escape(l:temp_dir)
|
||||||
|
|
||||||
|
return ale#path#CdString(l:project_root)
|
||||||
|
\ . l:mix_build_path
|
||||||
|
\ . ' mix compile %s'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('elixir', {
|
||||||
|
\ 'name': 'mix',
|
||||||
|
\ 'executable': 'mix',
|
||||||
|
\ 'command': function('ale_linters#elixir#mix#GetCommand'),
|
||||||
|
\ 'callback': 'ale_linters#elixir#mix#Handle',
|
||||||
|
\ 'lint_file': 1,
|
||||||
|
\})
|
22
pack/acp/start/ale/ale_linters/elm/elm_lsp.vim
Normal file
22
pack/acp/start/ale/ale_linters/elm/elm_lsp.vim
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
" Author: antew - https://github.com/antew
|
||||||
|
" Description: LSP integration for elm, currently supports diagnostics (linting)
|
||||||
|
|
||||||
|
call ale#Set('elm_lsp_executable', 'elm-lsp')
|
||||||
|
call ale#Set('elm_lsp_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||||
|
|
||||||
|
function! elm_lsp#GetRootDir(buffer) abort
|
||||||
|
let l:elm_json = ale#path#FindNearestFile(a:buffer, 'elm.json')
|
||||||
|
|
||||||
|
return !empty(l:elm_json) ? fnamemodify(l:elm_json, ':p:h') : ''
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('elm', {
|
||||||
|
\ 'name': 'elm_lsp',
|
||||||
|
\ 'lsp': 'stdio',
|
||||||
|
\ 'executable': {b -> ale#node#FindExecutable(b, 'elm_lsp', [
|
||||||
|
\ 'node_modules/.bin/elm-lsp',
|
||||||
|
\ ])},
|
||||||
|
\ 'command': '%e --stdio',
|
||||||
|
\ 'project_root': function('elm_lsp#GetRootDir'),
|
||||||
|
\ 'language': 'elm'
|
||||||
|
\})
|
240
pack/acp/start/ale/ale_linters/elm/make.vim
Normal file
240
pack/acp/start/ale/ale_linters/elm/make.vim
Normal file
|
@ -0,0 +1,240 @@
|
||||||
|
" Author: buffalocoder - https://github.com/buffalocoder, soywod - https://github.com/soywod, hecrj - https://github.com/hecrj
|
||||||
|
" Description: Elm linting in Ale. Closely follows the Syntastic checker in https://github.com/ElmCast/elm-vim.
|
||||||
|
|
||||||
|
call ale#Set('elm_make_executable', 'elm')
|
||||||
|
call ale#Set('elm_make_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||||
|
|
||||||
|
function! ale_linters#elm#make#Handle(buffer, lines) abort
|
||||||
|
let l:output = []
|
||||||
|
let l:unparsed_lines = []
|
||||||
|
|
||||||
|
for l:line in a:lines
|
||||||
|
if l:line[0] is# '{'
|
||||||
|
" Elm 0.19
|
||||||
|
call ale_linters#elm#make#HandleElm019Line(l:line, l:output)
|
||||||
|
elseif l:line[0] is# '['
|
||||||
|
" Elm 0.18
|
||||||
|
call ale_linters#elm#make#HandleElm018Line(l:line, l:output)
|
||||||
|
elseif l:line isnot# 'Successfully generated /dev/null'
|
||||||
|
call add(l:unparsed_lines, l:line)
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
|
||||||
|
if len(l:unparsed_lines) > 0
|
||||||
|
call add(l:output, {
|
||||||
|
\ 'lnum': 1,
|
||||||
|
\ 'type': 'E',
|
||||||
|
\ 'text': l:unparsed_lines[0],
|
||||||
|
\ 'detail': join(l:unparsed_lines, "\n")
|
||||||
|
\})
|
||||||
|
endif
|
||||||
|
|
||||||
|
return l:output
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#elm#make#HandleElm019Line(line, output) abort
|
||||||
|
let l:report = json_decode(a:line)
|
||||||
|
|
||||||
|
if l:report.type is? 'error'
|
||||||
|
" General problem
|
||||||
|
let l:details = ale_linters#elm#make#ParseMessage(l:report.message)
|
||||||
|
|
||||||
|
if empty(l:report.path)
|
||||||
|
let l:report.path = 'Elm'
|
||||||
|
endif
|
||||||
|
|
||||||
|
if ale_linters#elm#make#FileIsBuffer(l:report.path)
|
||||||
|
call add(a:output, {
|
||||||
|
\ 'lnum': 1,
|
||||||
|
\ 'type': 'E',
|
||||||
|
\ 'text': l:details,
|
||||||
|
\})
|
||||||
|
else
|
||||||
|
call add(a:output, {
|
||||||
|
\ 'lnum': 1,
|
||||||
|
\ 'type': 'E',
|
||||||
|
\ 'text': l:report.path .' - '. l:details,
|
||||||
|
\ 'detail': l:report.path ." ----------\n\n". l:details,
|
||||||
|
\})
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
" Compilation errors
|
||||||
|
for l:error in l:report.errors
|
||||||
|
let l:file_is_buffer = ale_linters#elm#make#FileIsBuffer(l:error.path)
|
||||||
|
|
||||||
|
for l:problem in l:error.problems
|
||||||
|
let l:details = ale_linters#elm#make#ParseMessage(l:problem.message)
|
||||||
|
|
||||||
|
if l:file_is_buffer
|
||||||
|
" Buffer module has problems
|
||||||
|
call add(a:output, {
|
||||||
|
\ 'lnum': l:problem.region.start.line,
|
||||||
|
\ 'col': l:problem.region.start.column,
|
||||||
|
\ 'end_lnum': l:problem.region.end.line,
|
||||||
|
\ 'end_col': l:problem.region.end.column,
|
||||||
|
\ 'type': 'E',
|
||||||
|
\ 'text': l:details,
|
||||||
|
\})
|
||||||
|
else
|
||||||
|
" Imported module has problems
|
||||||
|
let l:location = l:error.path .':'. l:problem.region.start.line
|
||||||
|
call add(a:output, {
|
||||||
|
\ 'lnum': 1,
|
||||||
|
\ 'type': 'E',
|
||||||
|
\ 'text': l:location .' - '. l:details,
|
||||||
|
\ 'detail': l:location ." ----------\n\n". l:details,
|
||||||
|
\})
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
endfor
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#elm#make#HandleElm018Line(line, output) abort
|
||||||
|
let l:errors = json_decode(a:line)
|
||||||
|
|
||||||
|
for l:error in l:errors
|
||||||
|
let l:file_is_buffer = ale_linters#elm#make#FileIsBuffer(l:error.file)
|
||||||
|
|
||||||
|
if l:file_is_buffer
|
||||||
|
" Current buffer has problems
|
||||||
|
call add(a:output, {
|
||||||
|
\ 'lnum': l:error.region.start.line,
|
||||||
|
\ 'col': l:error.region.start.column,
|
||||||
|
\ 'end_lnum': l:error.region.end.line,
|
||||||
|
\ 'end_col': l:error.region.end.column,
|
||||||
|
\ 'type': (l:error.type is? 'error') ? 'E' : 'W',
|
||||||
|
\ 'text': l:error.overview,
|
||||||
|
\ 'detail': l:error.overview . "\n\n" . l:error.details
|
||||||
|
\})
|
||||||
|
elseif l:error.type is? 'error'
|
||||||
|
" Imported module has errors
|
||||||
|
let l:location = l:error.file .':'. l:error.region.start.line
|
||||||
|
|
||||||
|
call add(a:output, {
|
||||||
|
\ 'lnum': 1,
|
||||||
|
\ 'type': 'E',
|
||||||
|
\ 'text': l:location .' - '. l:error.overview,
|
||||||
|
\ 'detail': l:location ." ----------\n\n". l:error.overview . "\n\n" . l:error.details
|
||||||
|
\})
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#elm#make#FileIsBuffer(path) abort
|
||||||
|
return ale#path#IsTempName(a:path)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#elm#make#ParseMessage(message) abort
|
||||||
|
return join(map(copy(a:message), 'ale_linters#elm#make#ParseMessageItem(v:val)'), '')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#elm#make#ParseMessageItem(item) abort
|
||||||
|
if type(a:item) is v:t_string
|
||||||
|
return a:item
|
||||||
|
else
|
||||||
|
return a:item.string
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#elm#make#GetPackageFile(buffer) abort
|
||||||
|
let l:elm_json = ale#path#FindNearestFile(a:buffer, 'elm.json')
|
||||||
|
|
||||||
|
if empty(l:elm_json)
|
||||||
|
" Fallback to Elm 0.18
|
||||||
|
let l:elm_json = ale#path#FindNearestFile(a:buffer, 'elm-package.json')
|
||||||
|
endif
|
||||||
|
|
||||||
|
return l:elm_json
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#elm#make#IsVersionGte19(buffer) abort
|
||||||
|
let l:elm_json = ale_linters#elm#make#GetPackageFile(a:buffer)
|
||||||
|
|
||||||
|
if l:elm_json =~# '-package'
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
return 1
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#elm#make#GetRootDir(buffer) abort
|
||||||
|
let l:elm_json = ale_linters#elm#make#GetPackageFile(a:buffer)
|
||||||
|
|
||||||
|
if empty(l:elm_json)
|
||||||
|
return ''
|
||||||
|
else
|
||||||
|
return fnamemodify(l:elm_json, ':p:h')
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#elm#make#IsTest(buffer) abort
|
||||||
|
let l:root_dir = ale_linters#elm#make#GetRootDir(a:buffer)
|
||||||
|
|
||||||
|
if empty(l:root_dir)
|
||||||
|
return 0
|
||||||
|
endif
|
||||||
|
|
||||||
|
let l:tests_dir = join([l:root_dir, 'tests', ''], has('win32') ? '\' : '/')
|
||||||
|
|
||||||
|
let l:buffer_path = fnamemodify(bufname(a:buffer), ':p')
|
||||||
|
|
||||||
|
if stridx(l:buffer_path, l:tests_dir) == 0
|
||||||
|
return 1
|
||||||
|
else
|
||||||
|
return 0
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Return the command to execute the linter in the projects directory.
|
||||||
|
" If it doesn't, then this will fail when imports are needed.
|
||||||
|
function! ale_linters#elm#make#GetCommand(buffer) abort
|
||||||
|
let l:executable = ale_linters#elm#make#GetExecutable(a:buffer)
|
||||||
|
let l:root_dir = ale_linters#elm#make#GetRootDir(a:buffer)
|
||||||
|
let l:is_v19 = ale_linters#elm#make#IsVersionGte19(a:buffer)
|
||||||
|
let l:is_using_elm_test = l:executable =~# 'elm-test$'
|
||||||
|
|
||||||
|
if empty(l:root_dir)
|
||||||
|
let l:dir_set_cmd = ''
|
||||||
|
else
|
||||||
|
let l:dir_set_cmd = 'cd ' . ale#Escape(l:root_dir) . ' && '
|
||||||
|
endif
|
||||||
|
|
||||||
|
" elm-test needs to know the path of elm-make if elm isn't installed globally.
|
||||||
|
" https://github.com/rtfeldman/node-test-runner/blob/57728f10668f2d2ab3179e7e3208bcfa9a1f19aa/README.md#--compiler
|
||||||
|
if l:is_v19 && l:is_using_elm_test
|
||||||
|
let l:elm_make_executable = ale#node#FindExecutable(a:buffer, 'elm_make', ['node_modules/.bin/elm'])
|
||||||
|
let l:elm_test_compiler_flag = ' --compiler ' . l:elm_make_executable . ' '
|
||||||
|
else
|
||||||
|
let l:elm_test_compiler_flag = ' '
|
||||||
|
endif
|
||||||
|
|
||||||
|
" The elm compiler, at the time of this writing, uses '/dev/null' as
|
||||||
|
" a sort of flag to tell the compiler not to generate an output file,
|
||||||
|
" which is why this is hard coded here.
|
||||||
|
" Source: https://github.com/elm-lang/elm-compiler/blob/19d5a769b30ec0b2fc4475985abb4cd94cd1d6c3/builder/src/Generate/Output.hs#L253
|
||||||
|
return l:dir_set_cmd . '%e make --report=json --output=/dev/null' . l:elm_test_compiler_flag . '%t'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#elm#make#GetExecutable(buffer) abort
|
||||||
|
let l:is_test = ale_linters#elm#make#IsTest(a:buffer)
|
||||||
|
let l:is_v19 = ale_linters#elm#make#IsVersionGte19(a:buffer)
|
||||||
|
|
||||||
|
if l:is_test && l:is_v19
|
||||||
|
return ale#node#FindExecutable(
|
||||||
|
\ 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
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('elm', {
|
||||||
|
\ 'name': 'make',
|
||||||
|
\ 'executable': function('ale_linters#elm#make#GetExecutable'),
|
||||||
|
\ 'output_stream': 'both',
|
||||||
|
\ 'command': function('ale_linters#elm#make#GetCommand'),
|
||||||
|
\ 'callback': 'ale_linters#elm#make#Handle'
|
||||||
|
\})
|
93
pack/acp/start/ale/ale_linters/erlang/dialyzer.vim
Normal file
93
pack/acp/start/ale/ale_linters/erlang/dialyzer.vim
Normal file
|
@ -0,0 +1,93 @@
|
||||||
|
" Author: Autoine Gagne - https://github.com/AntoineGagne
|
||||||
|
" Description: Define a checker that runs dialyzer on Erlang files.
|
||||||
|
|
||||||
|
let g:ale_erlang_dialyzer_executable =
|
||||||
|
\ get(g:, 'ale_erlang_dialyzer_executable', 'dialyzer')
|
||||||
|
let g:ale_erlang_dialyzer_plt_file =
|
||||||
|
\ get(g:, 'ale_erlang_dialyzer_plt_file', '')
|
||||||
|
let g:ale_erlang_dialyzer_rebar3_profile =
|
||||||
|
\ get(g:, 'ale_erlang_dialyzer_rebar3_profile', 'default')
|
||||||
|
|
||||||
|
function! ale_linters#erlang#dialyzer#GetRebar3Profile(buffer) abort
|
||||||
|
return ale#Var(a:buffer, 'erlang_dialyzer_rebar3_profile')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#erlang#dialyzer#FindPlt(buffer) abort
|
||||||
|
let l:plt_file = ''
|
||||||
|
let l:rebar3_profile = ale_linters#erlang#dialyzer#GetRebar3Profile(a:buffer)
|
||||||
|
let l:plt_file_directory = ale#path#FindNearestDirectory(a:buffer, '_build' . l:rebar3_profile)
|
||||||
|
|
||||||
|
if !empty(l:plt_file_directory)
|
||||||
|
let l:plt_file = split(globpath(l:plt_file_directory, '/*_plt'), '\n')
|
||||||
|
endif
|
||||||
|
|
||||||
|
if !empty(l:plt_file)
|
||||||
|
return l:plt_file[0]
|
||||||
|
endif
|
||||||
|
|
||||||
|
if !empty($REBAR_PLT_DIR)
|
||||||
|
return expand('$REBAR_PLT_DIR/dialyzer/plt')
|
||||||
|
endif
|
||||||
|
|
||||||
|
return expand('$HOME/.dialyzer_plt')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#erlang#dialyzer#GetPlt(buffer) abort
|
||||||
|
let l:plt_file = ale#Var(a:buffer, 'erlang_dialyzer_plt_file')
|
||||||
|
|
||||||
|
if !empty(l:plt_file)
|
||||||
|
return l:plt_file
|
||||||
|
endif
|
||||||
|
|
||||||
|
return ale_linters#erlang#dialyzer#FindPlt(a:buffer)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#erlang#dialyzer#GetExecutable(buffer) abort
|
||||||
|
return ale#Var(a:buffer, 'erlang_dialyzer_executable')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#erlang#dialyzer#GetCommand(buffer) abort
|
||||||
|
let l:command = ale#Escape(ale_linters#erlang#dialyzer#GetExecutable(a:buffer))
|
||||||
|
\ . ' -n'
|
||||||
|
\ . ' --plt ' . ale#Escape(ale_linters#erlang#dialyzer#GetPlt(a:buffer))
|
||||||
|
\ . ' -Wunmatched_returns'
|
||||||
|
\ . ' -Werror_handling'
|
||||||
|
\ . ' -Wrace_conditions'
|
||||||
|
\ . ' -Wunderspecs'
|
||||||
|
\ . ' %s'
|
||||||
|
|
||||||
|
return l:command
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#erlang#dialyzer#Handle(buffer, lines) abort
|
||||||
|
" Match patterns like the following:
|
||||||
|
"
|
||||||
|
" erl_tidy_prv_fmt.erl:3: Callback info about the provider behaviour is not available
|
||||||
|
let l:pattern = '^\S\+:\(\d\+\): \(.\+\)$'
|
||||||
|
let l:output = []
|
||||||
|
|
||||||
|
for l:line in a:lines
|
||||||
|
let l:match = matchlist(l:line, l:pattern)
|
||||||
|
|
||||||
|
if len(l:match) != 0
|
||||||
|
let l:code = l:match[2]
|
||||||
|
|
||||||
|
call add(l:output, {
|
||||||
|
\ 'lnum': str2nr(l:match[1]),
|
||||||
|
\ 'lcol': 0,
|
||||||
|
\ 'text': l:code,
|
||||||
|
\ 'type': 'W'
|
||||||
|
\})
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
|
||||||
|
return l:output
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('erlang', {
|
||||||
|
\ 'name': 'dialyzer',
|
||||||
|
\ 'executable': function('ale_linters#erlang#dialyzer#GetExecutable'),
|
||||||
|
\ 'command': function('ale_linters#erlang#dialyzer#GetCommand'),
|
||||||
|
\ 'callback': function('ale_linters#erlang#dialyzer#Handle'),
|
||||||
|
\ 'lint_file': 1
|
||||||
|
\})
|
96
pack/acp/start/ale/ale_linters/erlang/erlc.vim
Normal file
96
pack/acp/start/ale/ale_linters/erlang/erlc.vim
Normal file
|
@ -0,0 +1,96 @@
|
||||||
|
" Author: Magnus Ottenklinger - https://github.com/evnu
|
||||||
|
|
||||||
|
let g:ale_erlang_erlc_options = get(g:, 'ale_erlang_erlc_options', '')
|
||||||
|
|
||||||
|
function! ale_linters#erlang#erlc#GetCommand(buffer) abort
|
||||||
|
let l:output_file = ale#util#Tempname()
|
||||||
|
call ale#command#ManageFile(a:buffer, l:output_file)
|
||||||
|
|
||||||
|
return 'erlc -o ' . ale#Escape(l:output_file)
|
||||||
|
\ . ' ' . ale#Var(a:buffer, 'erlang_erlc_options')
|
||||||
|
\ . ' %t'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#erlang#erlc#Handle(buffer, lines) abort
|
||||||
|
" Matches patterns like the following:
|
||||||
|
"
|
||||||
|
" error.erl:4: variable 'B' is unbound
|
||||||
|
" error.erl:3: Warning: function main/0 is unused
|
||||||
|
" error.erl:4: Warning: variable 'A' is unused
|
||||||
|
let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+): (Warning: )?(.+)$'
|
||||||
|
|
||||||
|
" parse_transforms are a special case. The error message does not indicate a location:
|
||||||
|
" error.erl: undefined parse transform 'some_parse_transform'
|
||||||
|
let l:pattern_parse_transform = '\v(undefined parse transform .*)$'
|
||||||
|
let l:output = []
|
||||||
|
|
||||||
|
let l:pattern_no_module_definition = '\v(no module definition)$'
|
||||||
|
let l:pattern_unused = '\v(.* is unused)$'
|
||||||
|
|
||||||
|
let l:is_hrl = fnamemodify(bufname(a:buffer), ':e') is# 'hrl'
|
||||||
|
|
||||||
|
for l:line in a:lines
|
||||||
|
let l:match = matchlist(l:line, l:pattern)
|
||||||
|
|
||||||
|
" Determine if the output indicates an error. We distinguish between two cases:
|
||||||
|
"
|
||||||
|
" 1) normal errors match l:pattern
|
||||||
|
" 2) parse_transform errors match l:pattern_parse_transform
|
||||||
|
"
|
||||||
|
" If none of the patterns above match, the line can be ignored
|
||||||
|
if len(l:match) == 0 " not a 'normal' warning or error
|
||||||
|
let l:match_parse_transform = matchlist(l:line, l:pattern_parse_transform)
|
||||||
|
|
||||||
|
if len(l:match_parse_transform) == 0 " also not a parse_transform error
|
||||||
|
continue
|
||||||
|
endif
|
||||||
|
|
||||||
|
call add(l:output, {
|
||||||
|
\ 'bufnr': a:buffer,
|
||||||
|
\ 'lnum': 0,
|
||||||
|
\ 'col': 0,
|
||||||
|
\ 'type': 'E',
|
||||||
|
\ 'text': l:match_parse_transform[0],
|
||||||
|
\})
|
||||||
|
|
||||||
|
continue
|
||||||
|
endif
|
||||||
|
|
||||||
|
let l:line = l:match[2]
|
||||||
|
let l:warning_or_text = l:match[3]
|
||||||
|
let l:text = l:match[4]
|
||||||
|
|
||||||
|
" If this file is a header .hrl, ignore the following expected messages:
|
||||||
|
" - 'no module definition'
|
||||||
|
" - 'X is unused'
|
||||||
|
if l:is_hrl && (
|
||||||
|
\ match(l:text, l:pattern_no_module_definition) != -1
|
||||||
|
\ || match(l:text, l:pattern_unused) != -1
|
||||||
|
\)
|
||||||
|
continue
|
||||||
|
endif
|
||||||
|
|
||||||
|
if !empty(l:warning_or_text)
|
||||||
|
let l:type = 'W'
|
||||||
|
else
|
||||||
|
let l:type = 'E'
|
||||||
|
endif
|
||||||
|
|
||||||
|
call add(l:output, {
|
||||||
|
\ 'bufnr': a:buffer,
|
||||||
|
\ 'lnum': l:line,
|
||||||
|
\ 'col': 0,
|
||||||
|
\ 'type': l:type,
|
||||||
|
\ 'text': l:text,
|
||||||
|
\})
|
||||||
|
endfor
|
||||||
|
|
||||||
|
return l:output
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('erlang', {
|
||||||
|
\ 'name': 'erlc',
|
||||||
|
\ 'executable': 'erlc',
|
||||||
|
\ 'command': function('ale_linters#erlang#erlc#GetCommand'),
|
||||||
|
\ 'callback': 'ale_linters#erlang#erlc#Handle',
|
||||||
|
\})
|
42
pack/acp/start/ale/ale_linters/erlang/syntaxerl.vim
Normal file
42
pack/acp/start/ale/ale_linters/erlang/syntaxerl.vim
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
" Author: Dmitri Vereshchagin <dmitri.vereshchagin@gmail.com>
|
||||||
|
" Description: SyntaxErl linter for Erlang files
|
||||||
|
|
||||||
|
call ale#Set('erlang_syntaxerl_executable', 'syntaxerl')
|
||||||
|
|
||||||
|
function! ale_linters#erlang#syntaxerl#RunHelpCommand(buffer) abort
|
||||||
|
let l:executable = ale#Var(a:buffer, 'erlang_syntaxerl_executable')
|
||||||
|
|
||||||
|
return ale#command#Run(
|
||||||
|
\ a:buffer,
|
||||||
|
\ ale#Escape(l:executable) . ' -h',
|
||||||
|
\ function('ale_linters#erlang#syntaxerl#GetCommand'),
|
||||||
|
\)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#erlang#syntaxerl#GetCommand(buffer, output, meta) abort
|
||||||
|
let l:use_b_option = match(a:output, '\C\V-b, --base\>') > -1
|
||||||
|
|
||||||
|
return '%e' . (l:use_b_option ? ' -b %s %t' : ' %t')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#erlang#syntaxerl#Handle(buffer, lines) abort
|
||||||
|
let l:pattern = '\v\C:(\d+):( warning:)? (.+)'
|
||||||
|
let l:loclist = []
|
||||||
|
|
||||||
|
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||||
|
call add(l:loclist, {
|
||||||
|
\ 'lnum': l:match[1] + 0,
|
||||||
|
\ 'text': l:match[3],
|
||||||
|
\ 'type': empty(l:match[2]) ? 'E' : 'W',
|
||||||
|
\})
|
||||||
|
endfor
|
||||||
|
|
||||||
|
return l:loclist
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('erlang', {
|
||||||
|
\ 'name': 'syntaxerl',
|
||||||
|
\ 'executable': {b -> ale#Var(b, 'erlang_syntaxerl_executable')},
|
||||||
|
\ 'command': {b -> ale_linters#erlang#syntaxerl#RunHelpCommand(b)},
|
||||||
|
\ 'callback': 'ale_linters#erlang#syntaxerl#Handle',
|
||||||
|
\})
|
25
pack/acp/start/ale/ale_linters/eruby/erb.vim
Normal file
25
pack/acp/start/ale/ale_linters/eruby/erb.vim
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
" Author: Matthias Guenther - https://wikimatze.de, Eddie Lebow https://github.com/elebow
|
||||||
|
" Description: ERB from the Ruby standard library, for eruby/erb files
|
||||||
|
|
||||||
|
function! ale_linters#eruby#erb#GetCommand(buffer) abort
|
||||||
|
let l:rails_root = ale#ruby#FindRailsRoot(a:buffer)
|
||||||
|
|
||||||
|
if empty(l:rails_root)
|
||||||
|
return 'erb -P -T - -x %t | ruby -c'
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Rails-flavored eRuby does not comply with the standard as understood by
|
||||||
|
" ERB, so we'll have to do some substitution. This does not reduce the
|
||||||
|
" effectiveness of the linter—the translated code is still evaluated.
|
||||||
|
return 'ruby -r erb -e ' . ale#Escape('puts ERB.new($stdin.read.gsub(%{<%=},%{<%}), nil, %{-}).src') . '< %t | ruby -c'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('eruby', {
|
||||||
|
\ 'name': 'erb',
|
||||||
|
\ 'aliases': ['erubylint'],
|
||||||
|
\ 'executable': 'erb',
|
||||||
|
\ 'output_stream': 'stderr',
|
||||||
|
\ 'command': function('ale_linters#eruby#erb#GetCommand'),
|
||||||
|
\ 'callback': 'ale#handlers#ruby#HandleSyntaxErrors',
|
||||||
|
\})
|
||||||
|
|
32
pack/acp/start/ale/ale_linters/eruby/erubi.vim
Normal file
32
pack/acp/start/ale/ale_linters/eruby/erubi.vim
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
" Author: Eddie Lebow https://github.com/elebow
|
||||||
|
" Description: eruby checker using `erubi`
|
||||||
|
|
||||||
|
function! ale_linters#eruby#erubi#GetCommand(buffer, output, meta) abort
|
||||||
|
let l:rails_root = ale#ruby#FindRailsRoot(a:buffer)
|
||||||
|
|
||||||
|
if !empty(a:output)
|
||||||
|
" The empty command in CheckErubi returns nothing if erubi runs and
|
||||||
|
" emits an error if erubi is not present
|
||||||
|
return ''
|
||||||
|
endif
|
||||||
|
|
||||||
|
if empty(l:rails_root)
|
||||||
|
return 'ruby -r erubi/capture_end -e ' . ale#Escape('puts Erubi::CaptureEndEngine.new($stdin.read).src') . '< %t | ruby -c'
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Rails-flavored eRuby does not comply with the standard as understood by
|
||||||
|
" Erubi, so we'll have to do some substitution. This does not reduce the
|
||||||
|
" effectiveness of the linter---the translated code is still evaluated.
|
||||||
|
return 'ruby -r erubi/capture_end -e ' . ale#Escape('puts Erubi::CaptureEndEngine.new($stdin.read.gsub(%{<%=},%{<%}), nil, %{-}).src') . '< %t | ruby -c'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('eruby', {
|
||||||
|
\ 'name': 'erubi',
|
||||||
|
\ 'executable': 'ruby',
|
||||||
|
\ 'command': {buffer -> ale#command#Run(
|
||||||
|
\ buffer,
|
||||||
|
\ 'ruby -r erubi/capture_end -e ' . ale#Escape('""'),
|
||||||
|
\ function('ale_linters#eruby#erubi#GetCommand'),
|
||||||
|
\ )},
|
||||||
|
\ 'callback': 'ale#handlers#ruby#HandleSyntaxErrors',
|
||||||
|
\})
|
23
pack/acp/start/ale/ale_linters/eruby/erubis.vim
Normal file
23
pack/acp/start/ale/ale_linters/eruby/erubis.vim
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
" Author: Jake Zimmerman <jake@zimmerman.io>, Eddie Lebow https://github.com/elebow
|
||||||
|
" Description: eruby checker using `erubis`, instead of `erb`
|
||||||
|
|
||||||
|
function! ale_linters#eruby#erubis#GetCommand(buffer) abort
|
||||||
|
let l:rails_root = ale#ruby#FindRailsRoot(a:buffer)
|
||||||
|
|
||||||
|
if empty(l:rails_root)
|
||||||
|
return 'erubis -x %t | ruby -c'
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Rails-flavored eRuby does not comply with the standard as understood by
|
||||||
|
" Erubis, so we'll have to do some substitution. This does not reduce the
|
||||||
|
" effectiveness of the linter - the translated code is still evaluated.
|
||||||
|
return 'ruby -r erubis -e ' . ale#Escape('puts Erubis::Eruby.new($stdin.read.gsub(%{<%=},%{<%})).src') . '< %t | ruby -c'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('eruby', {
|
||||||
|
\ 'name': 'erubis',
|
||||||
|
\ 'executable': 'erubis',
|
||||||
|
\ 'output_stream': 'stderr',
|
||||||
|
\ 'command': function('ale_linters#eruby#erubis#GetCommand'),
|
||||||
|
\ 'callback': 'ale#handlers#ruby#HandleSyntaxErrors',
|
||||||
|
\})
|
62
pack/acp/start/ale/ale_linters/eruby/ruumba.vim
Normal file
62
pack/acp/start/ale/ale_linters/eruby/ruumba.vim
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
" Author: aclemons - https://github.com/aclemons
|
||||||
|
" based on the ale rubocop linter
|
||||||
|
" Description: Ruumba, RuboCop linting for ERB templates.
|
||||||
|
|
||||||
|
call ale#Set('eruby_ruumba_executable', 'ruumba')
|
||||||
|
call ale#Set('eruby_ruumba_options', '')
|
||||||
|
|
||||||
|
function! ale_linters#eruby#ruumba#GetCommand(buffer) abort
|
||||||
|
let l:executable = ale#Var(a:buffer, 'eruby_ruumba_executable')
|
||||||
|
|
||||||
|
return ale#handlers#ruby#EscapeExecutable(l:executable, 'ruumba')
|
||||||
|
\ . ' --format json --force-exclusion '
|
||||||
|
\ . ale#Var(a:buffer, 'eruby_ruumba_options')
|
||||||
|
\ . ' --stdin ' . ale#Escape(expand('#' . a:buffer . ':p'))
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#eruby#ruumba#Handle(buffer, lines) abort
|
||||||
|
try
|
||||||
|
let l:errors = json_decode(a:lines[0])
|
||||||
|
catch
|
||||||
|
return []
|
||||||
|
endtry
|
||||||
|
|
||||||
|
if !has_key(l:errors, 'summary')
|
||||||
|
\|| l:errors['summary']['offense_count'] == 0
|
||||||
|
\|| empty(l:errors['files'])
|
||||||
|
return []
|
||||||
|
endif
|
||||||
|
|
||||||
|
let l:output = []
|
||||||
|
|
||||||
|
for l:error in l:errors['files'][0]['offenses']
|
||||||
|
let l:start_col = l:error['location']['column'] + 0
|
||||||
|
call add(l:output, {
|
||||||
|
\ 'lnum': l:error['location']['line'] + 0,
|
||||||
|
\ 'col': l:start_col,
|
||||||
|
\ 'end_col': l:start_col + l:error['location']['length'] - 1,
|
||||||
|
\ 'code': l:error['cop_name'],
|
||||||
|
\ 'text': l:error['message'],
|
||||||
|
\ 'type': ale_linters#eruby#ruumba#GetType(l:error['severity']),
|
||||||
|
\})
|
||||||
|
endfor
|
||||||
|
|
||||||
|
return l:output
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#eruby#ruumba#GetType(severity) abort
|
||||||
|
if a:severity is? 'convention'
|
||||||
|
\|| a:severity is? 'warning'
|
||||||
|
\|| a:severity is? 'refactor'
|
||||||
|
return 'W'
|
||||||
|
endif
|
||||||
|
|
||||||
|
return 'E'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('eruby', {
|
||||||
|
\ 'name': 'ruumba',
|
||||||
|
\ 'executable': {b -> ale#Var(b, 'eruby_ruumba_executable')},
|
||||||
|
\ 'command': function('ale_linters#eruby#ruumba#GetCommand'),
|
||||||
|
\ 'callback': 'ale_linters#eruby#ruumba#Handle',
|
||||||
|
\})
|
67
pack/acp/start/ale/ale_linters/fish/fish.vim
Normal file
67
pack/acp/start/ale/ale_linters/fish/fish.vim
Normal file
|
@ -0,0 +1,67 @@
|
||||||
|
" Author: Niraj Thapaliya - https://github.com/nthapaliya
|
||||||
|
" Description: Lints fish files using fish -n
|
||||||
|
|
||||||
|
function! ale_linters#fish#fish#Handle(buffer, lines) abort
|
||||||
|
" Matches patterns such as:
|
||||||
|
"
|
||||||
|
" home/.config/fish/functions/foo.fish (line 1): Missing end to balance this function definition
|
||||||
|
" function foo
|
||||||
|
" ^
|
||||||
|
"
|
||||||
|
" OR, patterns such as:
|
||||||
|
"
|
||||||
|
" Unsupported use of '||'. In fish, please use 'COMMAND; or COMMAND'.
|
||||||
|
" /tmp/vLz620o/258/test.fish (line 2): if set -q SSH_CLIENT || set -q SSH_TTY
|
||||||
|
" ^
|
||||||
|
"
|
||||||
|
" fish -n can return errors in either format.
|
||||||
|
let l:pattern = '^\(.* (line \(\d\+\)): \)\(.*\)$'
|
||||||
|
let l:column_pattern = '^ *\^'
|
||||||
|
let l:output = []
|
||||||
|
let l:column_offset = 0
|
||||||
|
let l:last_line_with_message = ''
|
||||||
|
|
||||||
|
for l:line in a:lines
|
||||||
|
" Look for error lines first.
|
||||||
|
let l:match = matchlist(l:line, l:pattern)
|
||||||
|
|
||||||
|
if !empty(l:match)
|
||||||
|
if !empty(l:last_line_with_message)
|
||||||
|
let l:text = l:last_line_with_message
|
||||||
|
else
|
||||||
|
let l:text = l:match[3]
|
||||||
|
endif
|
||||||
|
|
||||||
|
let l:column_offset = len(l:match[1])
|
||||||
|
|
||||||
|
let l:last_line_with_message = ''
|
||||||
|
call add(l:output, {
|
||||||
|
\ 'col': 0,
|
||||||
|
\ 'lnum': str2nr(l:match[2]),
|
||||||
|
\ 'text': l:text,
|
||||||
|
\})
|
||||||
|
else
|
||||||
|
" Look for column markers like ' ^' second.
|
||||||
|
" The column index will be set according to how long the line is.
|
||||||
|
let l:column_match = matchstr(l:line, l:column_pattern)
|
||||||
|
|
||||||
|
if !empty(l:column_match) && !empty(l:output)
|
||||||
|
let l:output[-1].col = len(l:column_match) - l:column_offset
|
||||||
|
let l:last_line_with_message = ''
|
||||||
|
else
|
||||||
|
let l:last_line_with_message = l:line
|
||||||
|
let l:column_offset = 0
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
|
||||||
|
return l:output
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('fish', {
|
||||||
|
\ 'name': 'fish',
|
||||||
|
\ 'output_stream': 'stderr',
|
||||||
|
\ 'executable': 'fish',
|
||||||
|
\ 'command': 'fish -n %t',
|
||||||
|
\ 'callback': 'ale_linters#fish#fish#Handle',
|
||||||
|
\})
|
72
pack/acp/start/ale/ale_linters/fortran/gcc.vim
Normal file
72
pack/acp/start/ale/ale_linters/fortran/gcc.vim
Normal file
|
@ -0,0 +1,72 @@
|
||||||
|
" Author: w0rp <devw0rp@gmail.com>
|
||||||
|
" Description: gcc for Fortran files
|
||||||
|
|
||||||
|
" This option can be set to 0 to use -ffixed-form
|
||||||
|
call ale#Set('fortran_gcc_use_free_form', 1)
|
||||||
|
call ale#Set('fortran_gcc_executable', 'gcc')
|
||||||
|
" Set this option to change the GCC options for warnings for Fortran.
|
||||||
|
call ale#Set('fortran_gcc_options', '-Wall')
|
||||||
|
|
||||||
|
function! ale_linters#fortran#gcc#Handle(buffer, lines) abort
|
||||||
|
" We have to match a starting line and a later ending line together,
|
||||||
|
" like so.
|
||||||
|
"
|
||||||
|
" :21.34:
|
||||||
|
" Error: Expected comma in I/O list at (1)
|
||||||
|
let l:line_marker_pattern = ':\(\d\+\)[.:]\=\(\d\+\)\=:\=$'
|
||||||
|
let l:message_pattern = '^\(Error\|Warning\): \(.\+\)$'
|
||||||
|
let l:looking_for_message = 0
|
||||||
|
let l:last_loclist_obj = {}
|
||||||
|
|
||||||
|
let l:output = []
|
||||||
|
|
||||||
|
for l:line in a:lines
|
||||||
|
if l:looking_for_message
|
||||||
|
let l:match = matchlist(l:line, l:message_pattern)
|
||||||
|
else
|
||||||
|
let l:match = matchlist(l:line, l:line_marker_pattern)
|
||||||
|
endif
|
||||||
|
|
||||||
|
if len(l:match) == 0
|
||||||
|
continue
|
||||||
|
endif
|
||||||
|
|
||||||
|
if l:looking_for_message
|
||||||
|
let l:looking_for_message = 0
|
||||||
|
|
||||||
|
" 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.type = l:match[1] is# 'Warning' ? 'W' : 'E'
|
||||||
|
call add(l:output, l:last_loclist_obj)
|
||||||
|
else
|
||||||
|
let l:last_loclist_obj = {
|
||||||
|
\ 'bufnr': a:buffer,
|
||||||
|
\ 'lnum': l:match[1] + 0,
|
||||||
|
\ 'col': l:match[2] + 0,
|
||||||
|
\}
|
||||||
|
|
||||||
|
" Start looking for the message and error type.
|
||||||
|
let l:looking_for_message = 1
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
|
||||||
|
return l:output
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#fortran#gcc#GetCommand(buffer) abort
|
||||||
|
let l:layout_option = ale#Var(a:buffer, 'fortran_gcc_use_free_form')
|
||||||
|
\ ? '-ffree-form'
|
||||||
|
\ : '-ffixed-form'
|
||||||
|
|
||||||
|
return '%e -S -x f95 -fsyntax-only ' . l:layout_option
|
||||||
|
\ . ale#Pad(ale#Var(a:buffer, 'fortran_gcc_options'))
|
||||||
|
\ . ' -'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('fortran', {
|
||||||
|
\ 'name': 'gcc',
|
||||||
|
\ 'output_stream': 'stderr',
|
||||||
|
\ 'executable': {b -> ale#Var(b, 'fortran_gcc_executable')},
|
||||||
|
\ 'command': function('ale_linters#fortran#gcc#GetCommand'),
|
||||||
|
\ 'callback': 'ale_linters#fortran#gcc#Handle',
|
||||||
|
\})
|
19
pack/acp/start/ale/ale_linters/fortran/language_server.vim
Normal file
19
pack/acp/start/ale/ale_linters/fortran/language_server.vim
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
" Author: unpairedbracket ben.spiers22@gmail.com
|
||||||
|
" Description: A language server for fortran
|
||||||
|
|
||||||
|
call ale#Set('fortran_language_server_executable', 'fortls')
|
||||||
|
call ale#Set('fortran_language_server_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||||
|
|
||||||
|
function! ale_linters#fortran#language_server#GetProjectRoot(buffer) abort
|
||||||
|
let l:fortls_file = ale#path#FindNearestFile(a:buffer, '.fortls')
|
||||||
|
|
||||||
|
return !empty(l:fortls_file) ? fnamemodify(l:fortls_file, ':h') : ''
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('fortran', {
|
||||||
|
\ 'name': 'language_server',
|
||||||
|
\ 'lsp': 'stdio',
|
||||||
|
\ 'executable': {b -> ale#Var(b, 'fortran_language_server_executable')},
|
||||||
|
\ 'command': '%e',
|
||||||
|
\ 'project_root': function('ale_linters#fortran#language_server#GetProjectRoot'),
|
||||||
|
\})
|
9
pack/acp/start/ale/ale_linters/fountain/proselint.vim
Normal file
9
pack/acp/start/ale/ale_linters/fountain/proselint.vim
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
" Author: Jansen Mitchell https://github.com/JansenMitchell
|
||||||
|
" Description: proselint for Fountain files
|
||||||
|
|
||||||
|
call ale#linter#Define('fountain', {
|
||||||
|
\ 'name': 'proselint',
|
||||||
|
\ 'executable': 'proselint',
|
||||||
|
\ 'command': 'proselint %t',
|
||||||
|
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
||||||
|
\})
|
33
pack/acp/start/ale/ale_linters/fuse/fusionlint.vim
Normal file
33
pack/acp/start/ale/ale_linters/fuse/fusionlint.vim
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
" Author: RyanSquared <vandor2012@gmail.com>
|
||||||
|
" Description: `fusion-lint` linter for FusionScript files
|
||||||
|
|
||||||
|
call ale#Set('fuse_fusionlint_executable', 'fusion-lint')
|
||||||
|
call ale#Set('fuse_fusionlint_options', '')
|
||||||
|
|
||||||
|
function! ale_linters#fuse#fusionlint#GetCommand(buffer) abort
|
||||||
|
return '%e' . ale#Pad(ale#Var(a:buffer, 'fuse_fusionlint_options'))
|
||||||
|
\ . ' --filename %s -i'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#fuse#fusionlint#Handle(buffer, lines) abort
|
||||||
|
let l:pattern = '^.*:\(\d\+\):\(\d\+\): (\([WE]\)\d\+) \(.\+\)$'
|
||||||
|
let l:output = []
|
||||||
|
|
||||||
|
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||||
|
call add(l:output, {
|
||||||
|
\ 'lnum': l:match[1] + 0,
|
||||||
|
\ 'col': l:match[2] + 0,
|
||||||
|
\ 'text': l:match[4],
|
||||||
|
\ 'type': l:match[3],
|
||||||
|
\})
|
||||||
|
endfor
|
||||||
|
|
||||||
|
return l:output
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('fuse', {
|
||||||
|
\ 'name': 'fusionlint',
|
||||||
|
\ 'executable': {b -> ale#Var(b, 'fuse_fusionlint_executable')},
|
||||||
|
\ 'command': function('ale_linters#fuse#fusionlint#GetCommand'),
|
||||||
|
\ 'callback': 'ale_linters#fuse#fusionlint#Handle',
|
||||||
|
\})
|
51
pack/acp/start/ale/ale_linters/gitcommit/gitlint.vim
Normal file
51
pack/acp/start/ale/ale_linters/gitcommit/gitlint.vim
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
" Author: Nick Yamane <nick.diego@gmail.com>
|
||||||
|
" Description: gitlint for git commit message files
|
||||||
|
|
||||||
|
call ale#Set('gitcommit_gitlint_executable', 'gitlint')
|
||||||
|
call ale#Set('gitcommit_gitlint_options', '')
|
||||||
|
call ale#Set('gitcommit_gitlint_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||||
|
|
||||||
|
function! ale_linters#gitcommit#gitlint#GetExecutable(buffer) abort
|
||||||
|
return ale#python#FindExecutable(a:buffer, 'gitcommit_gitlint', ['gitlint'])
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#gitcommit#gitlint#GetCommand(buffer) abort
|
||||||
|
let l:options = ale#Var(a:buffer, 'gitcommit_gitlint_options')
|
||||||
|
|
||||||
|
return '%e' . ale#Pad(l:options) . ' lint'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#gitcommit#gitlint#Handle(buffer, lines) abort
|
||||||
|
" Matches patterns line the following:
|
||||||
|
let l:pattern = '\v^(\d+): (\w+) (.*)$'
|
||||||
|
let l:output = []
|
||||||
|
|
||||||
|
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||||
|
let l:code = l:match[2]
|
||||||
|
|
||||||
|
if !ale#Var(a:buffer, 'warn_about_trailing_whitespace')
|
||||||
|
if l:code is# 'T2' || l:code is# 'B2'
|
||||||
|
continue
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
let l:item = {
|
||||||
|
\ 'lnum': l:match[1] + 0,
|
||||||
|
\ 'text': l:match[3],
|
||||||
|
\ 'code': l:code,
|
||||||
|
\ 'type': 'E',
|
||||||
|
\}
|
||||||
|
|
||||||
|
call add(l:output, l:item)
|
||||||
|
endfor
|
||||||
|
|
||||||
|
return l:output
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('gitcommit', {
|
||||||
|
\ 'name': 'gitlint',
|
||||||
|
\ 'output_stream': 'stderr',
|
||||||
|
\ 'executable': function('ale_linters#gitcommit#gitlint#GetExecutable'),
|
||||||
|
\ 'command': function('ale_linters#gitcommit#gitlint#GetCommand'),
|
||||||
|
\ 'callback': 'ale_linters#gitcommit#gitlint#Handle',
|
||||||
|
\})
|
40
pack/acp/start/ale/ale_linters/glsl/glslang.vim
Normal file
40
pack/acp/start/ale/ale_linters/glsl/glslang.vim
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
" Author: Sven-Hendrik Haase <svenstaro@gmail.com>
|
||||||
|
" Description: glslang-based linter for glsl files
|
||||||
|
"
|
||||||
|
" TODO: Once https://github.com/KhronosGroup/glslang/pull/1047 is accepted,
|
||||||
|
" we can use stdin.
|
||||||
|
|
||||||
|
call ale#Set('glsl_glslang_executable', 'glslangValidator')
|
||||||
|
call ale#Set('glsl_glslang_options', '')
|
||||||
|
|
||||||
|
function! ale_linters#glsl#glslang#GetCommand(buffer) abort
|
||||||
|
return '%e'
|
||||||
|
\ . ale#Pad(ale#Var(a:buffer, 'glsl_glslang_options'))
|
||||||
|
\ . ' -C %t'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#glsl#glslang#Handle(buffer, lines) abort
|
||||||
|
" Matches patterns like the following:
|
||||||
|
"
|
||||||
|
" ERROR: 0:5: 'foo' : undeclared identifier
|
||||||
|
let l:pattern = '^\(.\+\): \(\d\+\):\(\d\+\): \(.\+\)'
|
||||||
|
let l:output = []
|
||||||
|
|
||||||
|
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||||
|
call add(l:output, {
|
||||||
|
\ 'lnum': str2nr(l:match[3]),
|
||||||
|
\ 'col': str2nr(l:match[2]),
|
||||||
|
\ 'text': l:match[4],
|
||||||
|
\ 'type': l:match[1] is# 'ERROR' ? 'E' : 'W',
|
||||||
|
\})
|
||||||
|
endfor
|
||||||
|
|
||||||
|
return l:output
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('glsl', {
|
||||||
|
\ 'name': 'glslang',
|
||||||
|
\ 'executable': {b -> ale#Var(b, 'glsl_glslang_executable')},
|
||||||
|
\ 'command': function('ale_linters#glsl#glslang#GetCommand'),
|
||||||
|
\ 'callback': 'ale_linters#glsl#glslang#Handle',
|
||||||
|
\})
|
30
pack/acp/start/ale/ale_linters/glsl/glslls.vim
Normal file
30
pack/acp/start/ale/ale_linters/glsl/glslls.vim
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
" Author: Sven-Hendrik Haase <svenstaro@gmail.com>
|
||||||
|
" Description: A language server for glsl
|
||||||
|
|
||||||
|
call ale#Set('glsl_glslls_executable', 'glslls')
|
||||||
|
call ale#Set('glsl_glslls_logfile', '')
|
||||||
|
|
||||||
|
function! ale_linters#glsl#glslls#GetCommand(buffer) abort
|
||||||
|
let l:logfile = ale#Var(a:buffer, 'glsl_glslls_logfile')
|
||||||
|
let l:logfile_args = ''
|
||||||
|
|
||||||
|
if l:logfile isnot# ''
|
||||||
|
let l:logfile_args = ' --verbose -l ' . l:logfile
|
||||||
|
endif
|
||||||
|
|
||||||
|
return '%e' . l:logfile_args . ' --stdin'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#glsl#glslls#GetProjectRoot(buffer) abort
|
||||||
|
let l:project_root = ale#c#FindProjectRoot(a:buffer)
|
||||||
|
|
||||||
|
return !empty(l:project_root) ? fnamemodify(l:project_root, ':h:h') : ''
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('glsl', {
|
||||||
|
\ 'name': 'glslls',
|
||||||
|
\ 'lsp': 'stdio',
|
||||||
|
\ 'executable': {b -> ale#Var(b, 'glsl_glslls_executable')},
|
||||||
|
\ 'command': function('ale_linters#glsl#glslls#GetCommand'),
|
||||||
|
\ 'project_root': function('ale_linters#glsl#glslls#GetProjectRoot'),
|
||||||
|
\})
|
29
pack/acp/start/ale/ale_linters/go/bingo.vim
Normal file
29
pack/acp/start/ale/ale_linters/go/bingo.vim
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
" Author: Jerko Steiner <https://github.com/jeremija>
|
||||||
|
" Description: https://github.com/saibing/bingo
|
||||||
|
|
||||||
|
call ale#Set('go_bingo_executable', 'bingo')
|
||||||
|
call ale#Set('go_bingo_options', '--mode stdio')
|
||||||
|
|
||||||
|
function! ale_linters#go#bingo#GetCommand(buffer) abort
|
||||||
|
return '%e' . ale#Pad(ale#Var(a:buffer, 'go_bingo_options'))
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#go#bingo#FindProjectRoot(buffer) abort
|
||||||
|
let l:project_root = ale#path#FindNearestFile(a:buffer, 'go.mod')
|
||||||
|
let l:mods = ':h'
|
||||||
|
|
||||||
|
if empty(l:project_root)
|
||||||
|
let l:project_root = ale#path#FindNearestDirectory(a:buffer, '.git')
|
||||||
|
let l:mods = ':h:h'
|
||||||
|
endif
|
||||||
|
|
||||||
|
return !empty(l:project_root) ? fnamemodify(l:project_root, l:mods) : ''
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('go', {
|
||||||
|
\ 'name': 'bingo',
|
||||||
|
\ 'lsp': 'stdio',
|
||||||
|
\ 'executable': {b -> ale#Var(b, 'go_bingo_executable')},
|
||||||
|
\ 'command': function('ale_linters#go#bingo#GetCommand'),
|
||||||
|
\ 'project_root': function('ale_linters#go#bingo#FindProjectRoot'),
|
||||||
|
\})
|
56
pack/acp/start/ale/ale_linters/go/gobuild.vim
Normal file
56
pack/acp/start/ale/ale_linters/go/gobuild.vim
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
" Author: Joshua Rubin <joshua@rubixconsulting.com>, Ben Reedy <https://github.com/breed808>,
|
||||||
|
" Jeff Willette <jrwillette88@gmail.com>
|
||||||
|
" Description: go build for Go files
|
||||||
|
" inspired by work from dzhou121 <dzhou121@gmail.com>
|
||||||
|
|
||||||
|
call ale#Set('go_go_executable', 'go')
|
||||||
|
call ale#Set('go_gobuild_options', '')
|
||||||
|
|
||||||
|
function! ale_linters#go#gobuild#GetCommand(buffer) abort
|
||||||
|
let l:options = ale#Var(a:buffer, 'go_gobuild_options')
|
||||||
|
|
||||||
|
" Run go test in local directory with relative path
|
||||||
|
return ale#path#BufferCdString(a:buffer)
|
||||||
|
\ . ale#Var(a:buffer, 'go_go_executable') . ' test'
|
||||||
|
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||||
|
\ . ' -c -o /dev/null ./'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#go#gobuild#GetMatches(lines) abort
|
||||||
|
" Matches patterns like the following:
|
||||||
|
"
|
||||||
|
" file.go:27: missing argument for Printf("%s"): format reads arg 2, have only 1 args
|
||||||
|
" file.go:53:10: if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary)
|
||||||
|
" file.go:5:2: expected declaration, found 'STRING' "log"
|
||||||
|
" go test returns relative paths so use tail of filename as part of pattern matcher
|
||||||
|
let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):?(\d+)?:? (.+)$'
|
||||||
|
|
||||||
|
return ale#util#GetMatches(a:lines, l:pattern)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#go#gobuild#Handler(buffer, lines) abort
|
||||||
|
let l:dir = expand('#' . a:buffer . ':p:h')
|
||||||
|
let l:output = []
|
||||||
|
|
||||||
|
for l:match in ale_linters#go#gobuild#GetMatches(a:lines)
|
||||||
|
call add(l:output, {
|
||||||
|
\ 'filename': ale#path#GetAbsPath(l:dir, l:match[1]),
|
||||||
|
\ 'lnum': l:match[2] + 0,
|
||||||
|
\ 'col': l:match[3] + 0,
|
||||||
|
\ 'text': l:match[4],
|
||||||
|
\ 'type': 'E',
|
||||||
|
\})
|
||||||
|
endfor
|
||||||
|
|
||||||
|
return l:output
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('go', {
|
||||||
|
\ 'name': 'gobuild',
|
||||||
|
\ 'aliases': ['go build'],
|
||||||
|
\ 'executable': {b -> ale#Var(b, 'go_go_executable')},
|
||||||
|
\ 'command': function('ale_linters#go#gobuild#GetCommand'),
|
||||||
|
\ 'output_stream': 'stderr',
|
||||||
|
\ 'callback': 'ale_linters#go#gobuild#Handler',
|
||||||
|
\ 'lint_file': 1,
|
||||||
|
\})
|
10
pack/acp/start/ale/ale_linters/go/gofmt.vim
Normal file
10
pack/acp/start/ale/ale_linters/go/gofmt.vim
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
" Author: neersighted <bjorn@neersighted.com>
|
||||||
|
" Description: gofmt for Go files
|
||||||
|
|
||||||
|
call ale#linter#Define('go', {
|
||||||
|
\ 'name': 'gofmt',
|
||||||
|
\ 'output_stream': 'stderr',
|
||||||
|
\ 'executable': 'gofmt',
|
||||||
|
\ 'command': 'gofmt -e %t',
|
||||||
|
\ 'callback': 'ale#handlers#unix#HandleAsError',
|
||||||
|
\})
|
56
pack/acp/start/ale/ale_linters/go/golangci_lint.vim
Normal file
56
pack/acp/start/ale/ale_linters/go/golangci_lint.vim
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
" Author: Sascha Grunert <mail@saschagrunert.de>
|
||||||
|
" Description: Adds support of golangci-lint
|
||||||
|
|
||||||
|
call ale#Set('go_golangci_lint_options', '--enable-all')
|
||||||
|
call ale#Set('go_golangci_lint_executable', 'golangci-lint')
|
||||||
|
call ale#Set('go_golangci_lint_package', 0)
|
||||||
|
|
||||||
|
function! ale_linters#go#golangci_lint#GetCommand(buffer) abort
|
||||||
|
let l:filename = expand('#' . a:buffer . ':t')
|
||||||
|
let l:options = ale#Var(a:buffer, 'go_golangci_lint_options')
|
||||||
|
let l:lint_package = ale#Var(a:buffer, 'go_golangci_lint_package')
|
||||||
|
|
||||||
|
if l:lint_package
|
||||||
|
return ale#path#BufferCdString(a:buffer)
|
||||||
|
\ . '%e run '
|
||||||
|
\ . l:options
|
||||||
|
endif
|
||||||
|
|
||||||
|
return ale#path#BufferCdString(a:buffer)
|
||||||
|
\ . '%e run '
|
||||||
|
\ . ale#Escape(l:filename)
|
||||||
|
\ . ' ' . l:options
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#go#golangci_lint#GetMatches(lines) abort
|
||||||
|
let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):?(\d+)?:?:?:?\s\*?(.+)$'
|
||||||
|
|
||||||
|
return ale#util#GetMatches(a:lines, l:pattern)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#go#golangci_lint#Handler(buffer, lines) abort
|
||||||
|
let l:dir = expand('#' . a:buffer . ':p:h')
|
||||||
|
let l:output = []
|
||||||
|
|
||||||
|
for l:match in ale_linters#go#golangci_lint#GetMatches(a:lines)
|
||||||
|
" l:match[1] will already be an absolute path, output from
|
||||||
|
" golangci_lint
|
||||||
|
call add(l:output, {
|
||||||
|
\ 'filename': ale#path#GetAbsPath(l:dir, l:match[1]),
|
||||||
|
\ 'lnum': l:match[2] + 0,
|
||||||
|
\ 'col': l:match[3] + 0,
|
||||||
|
\ 'type': 'E',
|
||||||
|
\ 'text': l:match[4],
|
||||||
|
\})
|
||||||
|
endfor
|
||||||
|
|
||||||
|
return l:output
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('go', {
|
||||||
|
\ 'name': 'golangci-lint',
|
||||||
|
\ 'executable': {b -> ale#Var(b, 'go_golangci_lint_executable')},
|
||||||
|
\ 'command': function('ale_linters#go#golangci_lint#GetCommand'),
|
||||||
|
\ 'callback': 'ale_linters#go#golangci_lint#Handler',
|
||||||
|
\ 'lint_file': 1,
|
||||||
|
\})
|
21
pack/acp/start/ale/ale_linters/go/golint.vim
Normal file
21
pack/acp/start/ale/ale_linters/go/golint.vim
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
" Author: neersighted <bjorn@neersighted.com>
|
||||||
|
" Description: golint for Go files
|
||||||
|
|
||||||
|
call ale#Set('go_golint_executable', 'golint')
|
||||||
|
call ale#Set('go_golint_options', '')
|
||||||
|
|
||||||
|
function! ale_linters#go#golint#GetCommand(buffer) abort
|
||||||
|
let l:options = ale#Var(a:buffer, 'go_golint_options')
|
||||||
|
|
||||||
|
return '%e'
|
||||||
|
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||||
|
\ . ' %t'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('go', {
|
||||||
|
\ 'name': 'golint',
|
||||||
|
\ 'output_stream': 'both',
|
||||||
|
\ 'executable': {b -> ale#Var(b, 'go_golint_executable')},
|
||||||
|
\ 'command': function('ale_linters#go#golint#GetCommand'),
|
||||||
|
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
||||||
|
\})
|
57
pack/acp/start/ale/ale_linters/go/gometalinter.vim
Normal file
57
pack/acp/start/ale/ale_linters/go/gometalinter.vim
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
" Author: Ben Reedy <https://github.com/breed808>, Jeff Willette <jrwillette88@gmail.com>
|
||||||
|
" Description: Adds support for the gometalinter suite for Go files
|
||||||
|
|
||||||
|
call ale#Set('go_gometalinter_options', '')
|
||||||
|
call ale#Set('go_gometalinter_executable', 'gometalinter')
|
||||||
|
call ale#Set('go_gometalinter_lint_package', 0)
|
||||||
|
|
||||||
|
function! ale_linters#go#gometalinter#GetCommand(buffer) abort
|
||||||
|
let l:filename = expand('#' . a:buffer . ':t')
|
||||||
|
let l:options = ale#Var(a:buffer, 'go_gometalinter_options')
|
||||||
|
let l:lint_package = ale#Var(a:buffer, 'go_gometalinter_lint_package')
|
||||||
|
|
||||||
|
" BufferCdString is used so that we can be sure the paths output from gometalinter can
|
||||||
|
" be calculated to absolute paths in the Handler
|
||||||
|
if l:lint_package
|
||||||
|
return ale#path#BufferCdString(a:buffer)
|
||||||
|
\ . '%e'
|
||||||
|
\ . (!empty(l:options) ? ' ' . l:options : '') . ' .'
|
||||||
|
endif
|
||||||
|
|
||||||
|
return ale#path#BufferCdString(a:buffer)
|
||||||
|
\ . '%e'
|
||||||
|
\ . ' --include=' . ale#Escape(ale#util#EscapePCRE(l:filename))
|
||||||
|
\ . (!empty(l:options) ? ' ' . l:options : '') . ' .'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#go#gometalinter#GetMatches(lines) abort
|
||||||
|
let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):?(\d+)?:?:?(warning|error):?\s\*?(.+)$'
|
||||||
|
|
||||||
|
return ale#util#GetMatches(a:lines, l:pattern)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#go#gometalinter#Handler(buffer, lines) abort
|
||||||
|
let l:dir = expand('#' . a:buffer . ':p:h')
|
||||||
|
let l:output = []
|
||||||
|
|
||||||
|
for l:match in ale_linters#go#gometalinter#GetMatches(a:lines)
|
||||||
|
" l:match[1] will already be an absolute path, output from gometalinter
|
||||||
|
call add(l:output, {
|
||||||
|
\ 'filename': ale#path#GetAbsPath(l:dir, l:match[1]),
|
||||||
|
\ 'lnum': l:match[2] + 0,
|
||||||
|
\ 'col': l:match[3] + 0,
|
||||||
|
\ 'type': tolower(l:match[4]) is# 'warning' ? 'W' : 'E',
|
||||||
|
\ 'text': l:match[5],
|
||||||
|
\})
|
||||||
|
endfor
|
||||||
|
|
||||||
|
return l:output
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('go', {
|
||||||
|
\ 'name': 'gometalinter',
|
||||||
|
\ 'executable': {b -> ale#Var(b, 'go_gometalinter_executable')},
|
||||||
|
\ 'command': function('ale_linters#go#gometalinter#GetCommand'),
|
||||||
|
\ 'callback': 'ale_linters#go#gometalinter#Handler',
|
||||||
|
\ 'lint_file': 1,
|
||||||
|
\})
|
30
pack/acp/start/ale/ale_linters/go/gopls.vim
Normal file
30
pack/acp/start/ale/ale_linters/go/gopls.vim
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
" Author: w0rp <devw0rp@gmail.com>
|
||||||
|
" Author: Jerko Steiner <https://github.com/jeremija>
|
||||||
|
" Description: https://github.com/saibing/gopls
|
||||||
|
|
||||||
|
call ale#Set('go_gopls_executable', 'gopls')
|
||||||
|
call ale#Set('go_gopls_options', '--mode stdio')
|
||||||
|
|
||||||
|
function! ale_linters#go#gopls#GetCommand(buffer) abort
|
||||||
|
return '%e' . ale#Pad(ale#Var(a:buffer, 'go_gopls_options'))
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#go#gopls#FindProjectRoot(buffer) abort
|
||||||
|
let l:project_root = ale#path#FindNearestFile(a:buffer, 'go.mod')
|
||||||
|
let l:mods = ':h'
|
||||||
|
|
||||||
|
if empty(l:project_root)
|
||||||
|
let l:project_root = ale#path#FindNearestDirectory(a:buffer, '.git')
|
||||||
|
let l:mods = ':h:h'
|
||||||
|
endif
|
||||||
|
|
||||||
|
return !empty(l:project_root) ? fnamemodify(l:project_root, l:mods) : ''
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('go', {
|
||||||
|
\ 'name': 'gopls',
|
||||||
|
\ 'lsp': 'stdio',
|
||||||
|
\ 'executable': {b -> ale#Var(b, 'go_gopls_executable')},
|
||||||
|
\ 'command': function('ale_linters#go#gopls#GetCommand'),
|
||||||
|
\ 'project_root': function('ale_linters#go#gopls#FindProjectRoot'),
|
||||||
|
\})
|
15
pack/acp/start/ale/ale_linters/go/gosimple.vim
Normal file
15
pack/acp/start/ale/ale_linters/go/gosimple.vim
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
" Author: Ben Reedy <https://github.com/breed808>
|
||||||
|
" Description: gosimple for Go files
|
||||||
|
|
||||||
|
function! ale_linters#go#gosimple#GetCommand(buffer) abort
|
||||||
|
return ale#path#BufferCdString(a:buffer) . ' gosimple .'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('go', {
|
||||||
|
\ 'name': 'gosimple',
|
||||||
|
\ 'executable': 'gosimple',
|
||||||
|
\ 'command': function('ale_linters#go#gosimple#GetCommand'),
|
||||||
|
\ 'callback': 'ale#handlers#go#Handler',
|
||||||
|
\ 'output_stream': 'both',
|
||||||
|
\ 'lint_file': 1,
|
||||||
|
\})
|
19
pack/acp/start/ale/ale_linters/go/gotype.vim
Normal file
19
pack/acp/start/ale/ale_linters/go/gotype.vim
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
" Author: Jelte Fennema <github-public@jeltef.nl>
|
||||||
|
" Description: gotype for Go files
|
||||||
|
|
||||||
|
function! ale_linters#go#gotype#GetCommand(buffer) abort
|
||||||
|
if expand('#' . a:buffer . ':p') =~# '_test\.go$'
|
||||||
|
return ''
|
||||||
|
endif
|
||||||
|
|
||||||
|
return ale#path#BufferCdString(a:buffer) . ' gotype -e .'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('go', {
|
||||||
|
\ 'name': 'gotype',
|
||||||
|
\ 'output_stream': 'stderr',
|
||||||
|
\ 'executable': 'gotype',
|
||||||
|
\ 'command': function('ale_linters#go#gotype#GetCommand'),
|
||||||
|
\ 'callback': 'ale#handlers#go#Handler',
|
||||||
|
\ 'lint_file': 1,
|
||||||
|
\})
|
27
pack/acp/start/ale/ale_linters/go/govet.vim
Normal file
27
pack/acp/start/ale/ale_linters/go/govet.vim
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
" Author: neersighted <bjorn@neersighted.com>
|
||||||
|
" Description: go vet for Go files
|
||||||
|
"
|
||||||
|
" Author: John Eikenberry <jae@zhar.net>
|
||||||
|
" Description: updated to work with go1.10
|
||||||
|
|
||||||
|
call ale#Set('go_go_executable', 'go')
|
||||||
|
call ale#Set('go_govet_options', '')
|
||||||
|
|
||||||
|
function! ale_linters#go#govet#GetCommand(buffer) abort
|
||||||
|
let l:options = ale#Var(a:buffer, 'go_govet_options')
|
||||||
|
|
||||||
|
return ale#path#BufferCdString(a:buffer) . ' '
|
||||||
|
\ . ale#Var(a:buffer, 'go_go_executable') . ' vet '
|
||||||
|
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||||
|
\ . ' .'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('go', {
|
||||||
|
\ 'name': 'govet',
|
||||||
|
\ 'aliases': ['go vet'],
|
||||||
|
\ 'output_stream': 'stderr',
|
||||||
|
\ 'executable': {b -> ale#Var(b, 'go_go_executable')},
|
||||||
|
\ 'command': function('ale_linters#go#govet#GetCommand'),
|
||||||
|
\ 'callback': 'ale#handlers#go#Handler',
|
||||||
|
\ 'lint_file': 1,
|
||||||
|
\})
|
28
pack/acp/start/ale/ale_linters/go/langserver.vim
Normal file
28
pack/acp/start/ale/ale_linters/go/langserver.vim
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
" Author: Horacio Sanson <https://github.com/hsanson>
|
||||||
|
" Description: Support for go-langserver https://github.com/sourcegraph/go-langserver
|
||||||
|
|
||||||
|
call ale#Set('go_langserver_executable', 'go-langserver')
|
||||||
|
call ale#Set('go_langserver_options', '')
|
||||||
|
|
||||||
|
function! ale_linters#go#langserver#GetCommand(buffer) abort
|
||||||
|
let l:executable = [ale#Escape(ale#Var(a:buffer, 'go_langserver_executable'))]
|
||||||
|
let l:options = ale#Var(a:buffer, 'go_langserver_options')
|
||||||
|
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')
|
||||||
|
call add(l:options, '-gocodecompletion')
|
||||||
|
endif
|
||||||
|
|
||||||
|
let l:options = uniq(sort(l:options))
|
||||||
|
|
||||||
|
return join(extend(l:executable, l:options), ' ')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('go', {
|
||||||
|
\ 'name': 'golangserver',
|
||||||
|
\ 'lsp': 'stdio',
|
||||||
|
\ 'executable': {b -> ale#Var(b, 'go_langserver_executable')},
|
||||||
|
\ 'command': function('ale_linters#go#langserver#GetCommand'),
|
||||||
|
\ 'project_root': function('ale#go#FindProjectRoot'),
|
||||||
|
\})
|
33
pack/acp/start/ale/ale_linters/go/staticcheck.vim
Normal file
33
pack/acp/start/ale/ale_linters/go/staticcheck.vim
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
" Author: Ben Reedy <https://github.com/breed808>
|
||||||
|
" Description: staticcheck for Go files
|
||||||
|
|
||||||
|
call ale#Set('go_staticcheck_options', '')
|
||||||
|
call ale#Set('go_staticcheck_lint_package', 0)
|
||||||
|
|
||||||
|
function! ale_linters#go#staticcheck#GetCommand(buffer) abort
|
||||||
|
let l:filename = expand('#' . a:buffer . ':t')
|
||||||
|
let l:options = ale#Var(a:buffer, 'go_staticcheck_options')
|
||||||
|
let l:lint_package = ale#Var(a:buffer, 'go_staticcheck_lint_package')
|
||||||
|
|
||||||
|
" BufferCdString is used so that we can be sure the paths output from
|
||||||
|
" staticcheck can be calculated to absolute paths in the Handler
|
||||||
|
if l:lint_package
|
||||||
|
return ale#path#BufferCdString(a:buffer)
|
||||||
|
\ . 'staticcheck'
|
||||||
|
\ . (!empty(l:options) ? ' ' . l:options : '') . ' .'
|
||||||
|
endif
|
||||||
|
|
||||||
|
return ale#path#BufferCdString(a:buffer)
|
||||||
|
\ . 'staticcheck'
|
||||||
|
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||||
|
\ . ' ' . ale#Escape(l:filename)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('go', {
|
||||||
|
\ 'name': 'staticcheck',
|
||||||
|
\ 'executable': 'staticcheck',
|
||||||
|
\ 'command': function('ale_linters#go#staticcheck#GetCommand'),
|
||||||
|
\ 'callback': 'ale#handlers#go#Handler',
|
||||||
|
\ 'output_stream': 'both',
|
||||||
|
\ 'lint_file': 1,
|
||||||
|
\})
|
9
pack/acp/start/ale/ale_linters/graphql/eslint.vim
Normal file
9
pack/acp/start/ale/ale_linters/graphql/eslint.vim
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
" Author: Benjie Gillam <code@benjiegillam.com>
|
||||||
|
" Description: eslint for GraphQL files
|
||||||
|
|
||||||
|
call ale#linter#Define('graphql', {
|
||||||
|
\ 'name': 'eslint',
|
||||||
|
\ 'executable': function('ale#handlers#eslint#GetExecutable'),
|
||||||
|
\ 'command': function('ale#handlers#eslint#GetCommand'),
|
||||||
|
\ 'callback': 'ale#handlers#eslint#Handle',
|
||||||
|
\})
|
15
pack/acp/start/ale/ale_linters/graphql/gqlint.vim
Normal file
15
pack/acp/start/ale/ale_linters/graphql/gqlint.vim
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
" Author: Michiel Westerbeek <happylinks@gmail.com>
|
||||||
|
" Description: Linter for GraphQL Schemas
|
||||||
|
|
||||||
|
function! ale_linters#graphql#gqlint#GetCommand(buffer) abort
|
||||||
|
return ale#path#BufferCdString(a:buffer)
|
||||||
|
\ . 'gqlint'
|
||||||
|
\ . ' --reporter=simple %t'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('graphql', {
|
||||||
|
\ 'name': 'gqlint',
|
||||||
|
\ 'executable': 'gqlint',
|
||||||
|
\ 'command': function('ale_linters#graphql#gqlint#GetCommand'),
|
||||||
|
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
||||||
|
\})
|
22
pack/acp/start/ale/ale_linters/hack/hack.vim
Normal file
22
pack/acp/start/ale/ale_linters/hack/hack.vim
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
" Author: Fred Emmott <fe@fb.com>
|
||||||
|
" Description: Hack support via `hack lsp`
|
||||||
|
|
||||||
|
call ale#Set('hack_hack_executable', 'hh_client')
|
||||||
|
|
||||||
|
function! ale_linters#hack#hack#GetProjectRoot(buffer) abort
|
||||||
|
let l:hhconfig = ale#path#FindNearestFile(a:buffer, '.hhconfig')
|
||||||
|
|
||||||
|
return !empty(l:hhconfig) ? fnamemodify(l:hhconfig, ':h') : ''
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#hack#hack#GetExecutable(buffer) abort
|
||||||
|
return ale#Var(a:buffer, 'hack_hack_executable')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('hack', {
|
||||||
|
\ 'name': 'hack',
|
||||||
|
\ 'lsp': 'stdio',
|
||||||
|
\ 'executable': function('ale_linters#hack#hack#GetExecutable'),
|
||||||
|
\ 'command': '%e lsp --from vim-ale',
|
||||||
|
\ 'project_root': function('ale_linters#hack#hack#GetProjectRoot'),
|
||||||
|
\})
|
40
pack/acp/start/ale/ale_linters/hack/hhast.vim
Normal file
40
pack/acp/start/ale/ale_linters/hack/hhast.vim
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
" Author: Fred Emmott <fe@fb.com>
|
||||||
|
" Description: Hack support via `hhast lsp`
|
||||||
|
|
||||||
|
call ale#Set('hack_hhast_executable', 'vendor/bin/hhast-lint')
|
||||||
|
|
||||||
|
function! ale_linters#hack#hhast#GetProjectRoot(buffer) abort
|
||||||
|
" Find the hack root, then figure out if it's also an HHAST root.
|
||||||
|
" Don't try to use lint configurations from vendor/foo/bar/hhast-lint.json
|
||||||
|
let l:hhconfig = ale#path#FindNearestFile(a:buffer, '.hhconfig')
|
||||||
|
|
||||||
|
if empty(l:hhconfig)
|
||||||
|
return ''
|
||||||
|
endif
|
||||||
|
|
||||||
|
let l:root = fnamemodify(l:hhconfig, ':h')
|
||||||
|
let l:hhast_config = findfile('hhast-lint.json', l:root)
|
||||||
|
|
||||||
|
return !empty(l:hhast_config) ? l:root : ''
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#hack#hhast#GetExecutable(buffer) abort
|
||||||
|
let l:root = ale_linters#hack#hhast#GetProjectRoot(a:buffer)
|
||||||
|
let l:relative = ale#Var(a:buffer, 'hack_hhast_executable')
|
||||||
|
let l:absolute = findfile(l:relative, l:root)
|
||||||
|
|
||||||
|
return !empty(l:absolute) ? l:absolute : ''
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#hack#hhast#GetInitializationOptions(buffer) abort
|
||||||
|
return {'lintMode': 'open-files'}
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('hack', {
|
||||||
|
\ 'name': 'hhast',
|
||||||
|
\ 'lsp': 'stdio',
|
||||||
|
\ 'executable': function('ale_linters#hack#hhast#GetExecutable'),
|
||||||
|
\ 'command': '%e --mode lsp --from vim-ale',
|
||||||
|
\ 'project_root': function('ale_linters#hack#hhast#GetProjectRoot'),
|
||||||
|
\ 'initialization_options': function('ale_linters#hack#hhast#GetInitializationOptions'),
|
||||||
|
\})
|
57
pack/acp/start/ale/ale_linters/haml/hamllint.vim
Normal file
57
pack/acp/start/ale/ale_linters/haml/hamllint.vim
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
" Author: Patrick Lewis - https://github.com/patricklewis, thenoseman - https://github.com/thenoseman
|
||||||
|
" Description: haml-lint for Haml files
|
||||||
|
|
||||||
|
call ale#Set('haml_hamllint_executable', 'haml-lint')
|
||||||
|
|
||||||
|
function! ale_linters#haml#hamllint#GetExecutable(buffer) abort
|
||||||
|
return ale#Var(a:buffer, 'haml_hamllint_executable')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#haml#hamllint#GetCommand(buffer) abort
|
||||||
|
let l:prefix = ''
|
||||||
|
|
||||||
|
let l:rubocop_config_file_path = ale#path#FindNearestFile(a:buffer, '.rubocop.yml')
|
||||||
|
let l:hamllint_config_file_path = ale#path#FindNearestFile(a:buffer, '.haml-lint.yml')
|
||||||
|
|
||||||
|
" Set HAML_LINT_RUBOCOP_CONF variable as it is needed for haml-lint to
|
||||||
|
" pick up the rubocop config.
|
||||||
|
"
|
||||||
|
" See https://github.com/brigade/haml-lint/blob/master/lib/haml_lint/linter/rubocop.rb#L89
|
||||||
|
" HamlLint::Linter::RuboCop#rubocop_flags
|
||||||
|
if !empty(l:rubocop_config_file_path)
|
||||||
|
if has('win32')
|
||||||
|
let l:prefix = 'set HAML_LINT_RUBOCOP_CONF=' . ale#Escape(l:rubocop_config_file_path) . ' &&'
|
||||||
|
else
|
||||||
|
let l:prefix = 'HAML_LINT_RUBOCOP_CONF=' . ale#Escape(l:rubocop_config_file_path)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
return (!empty(l:prefix) ? l:prefix . ' ' : '')
|
||||||
|
\ . ale_linters#haml#hamllint#GetExecutable(a:buffer)
|
||||||
|
\ . (!empty(l:hamllint_config_file_path) ? ' --config ' . ale#Escape(l:hamllint_config_file_path) : '')
|
||||||
|
\ . ' %t'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#haml#hamllint#Handle(buffer, lines) abort
|
||||||
|
" Matches patterns like the following:
|
||||||
|
" <path>:51 [W] RuboCop: Use the new Ruby 1.9 hash syntax.
|
||||||
|
let l:pattern = '\v^.*:(\d+) \[([EW])\] (.+)$'
|
||||||
|
let l:output = []
|
||||||
|
|
||||||
|
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||||
|
call add(l:output, {
|
||||||
|
\ 'lnum': l:match[1] + 0,
|
||||||
|
\ 'type': l:match[2],
|
||||||
|
\ 'text': l:match[3]
|
||||||
|
\})
|
||||||
|
endfor
|
||||||
|
|
||||||
|
return l:output
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('haml', {
|
||||||
|
\ 'name': 'hamllint',
|
||||||
|
\ 'executable': function('ale_linters#haml#hamllint#GetExecutable'),
|
||||||
|
\ 'command': function('ale_linters#haml#hamllint#GetCommand'),
|
||||||
|
\ 'callback': 'ale_linters#haml#hamllint#Handle'
|
||||||
|
\})
|
|
@ -0,0 +1,39 @@
|
||||||
|
" Author: Adrian Zalewski <aazalewski@hotmail.com>
|
||||||
|
" Description: Ember-template-lint for checking Handlebars files
|
||||||
|
|
||||||
|
call ale#Set('handlebars_embertemplatelint_executable', 'ember-template-lint')
|
||||||
|
call ale#Set('handlebars_embertemplatelint_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||||
|
|
||||||
|
function! ale_linters#handlebars#embertemplatelint#Handle(buffer, lines) abort
|
||||||
|
let l:output = []
|
||||||
|
let l:json = ale#util#FuzzyJSONDecode(a:lines, {})
|
||||||
|
|
||||||
|
for l:error in get(values(l:json), 0, [])
|
||||||
|
if has_key(l:error, 'fatal')
|
||||||
|
call add(l:output, {
|
||||||
|
\ 'lnum': get(l:error, 'line', 1),
|
||||||
|
\ 'col': get(l:error, 'column', 1),
|
||||||
|
\ 'text': l:error.message,
|
||||||
|
\ 'type': l:error.severity == 1 ? 'W' : 'E',
|
||||||
|
\})
|
||||||
|
else
|
||||||
|
call add(l:output, {
|
||||||
|
\ 'lnum': l:error.line,
|
||||||
|
\ 'col': l:error.column,
|
||||||
|
\ 'text': l:error.rule . ': ' . l:error.message,
|
||||||
|
\ 'type': l:error.severity == 1 ? 'W' : 'E',
|
||||||
|
\})
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
|
||||||
|
return l:output
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('handlebars', {
|
||||||
|
\ 'name': 'ember-template-lint',
|
||||||
|
\ 'executable': {b -> ale#node#FindExecutable(b, 'handlebars_embertemplatelint', [
|
||||||
|
\ 'node_modules/.bin/ember-template-lint',
|
||||||
|
\ ])},
|
||||||
|
\ 'command': '%e --json %t',
|
||||||
|
\ 'callback': 'ale_linters#handlebars#embertemplatelint#Handle',
|
||||||
|
\})
|
20
pack/acp/start/ale/ale_linters/haskell/cabal_ghc.vim
Normal file
20
pack/acp/start/ale/ale_linters/haskell/cabal_ghc.vim
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
" Author: Eric Wolf <ericwolf42@gmail.com>
|
||||||
|
" Description: ghc for Haskell files called with cabal exec
|
||||||
|
|
||||||
|
call ale#Set('haskell_cabal_ghc_options', '-fno-code -v0')
|
||||||
|
|
||||||
|
function! ale_linters#haskell#cabal_ghc#GetCommand(buffer) abort
|
||||||
|
return ale#path#BufferCdString(a:buffer)
|
||||||
|
\ . 'cabal exec -- ghc '
|
||||||
|
\ . ale#Var(a:buffer, 'haskell_cabal_ghc_options')
|
||||||
|
\ . ' %t'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('haskell', {
|
||||||
|
\ 'name': 'cabal_ghc',
|
||||||
|
\ 'aliases': ['cabal-ghc'],
|
||||||
|
\ 'output_stream': 'stderr',
|
||||||
|
\ 'executable': 'cabal',
|
||||||
|
\ 'command': function('ale_linters#haskell#cabal_ghc#GetCommand'),
|
||||||
|
\ 'callback': 'ale#handlers#haskell#HandleGHCFormat',
|
||||||
|
\})
|
18
pack/acp/start/ale/ale_linters/haskell/ghc.vim
Normal file
18
pack/acp/start/ale/ale_linters/haskell/ghc.vim
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
" Author: w0rp <devw0rp@gmail.com>
|
||||||
|
" Description: ghc for Haskell files
|
||||||
|
|
||||||
|
call ale#Set('haskell_ghc_options', '-fno-code -v0')
|
||||||
|
|
||||||
|
function! ale_linters#haskell#ghc#GetCommand(buffer) abort
|
||||||
|
return 'ghc '
|
||||||
|
\ . ale#Var(a:buffer, 'haskell_ghc_options')
|
||||||
|
\ . ' %t'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('haskell', {
|
||||||
|
\ 'name': 'ghc',
|
||||||
|
\ 'output_stream': 'stderr',
|
||||||
|
\ 'executable': 'ghc',
|
||||||
|
\ 'command': function('ale_linters#haskell#ghc#GetCommand'),
|
||||||
|
\ 'callback': 'ale#handlers#haskell#HandleGHCFormat',
|
||||||
|
\})
|
19
pack/acp/start/ale/ale_linters/haskell/ghc_mod.vim
Normal file
19
pack/acp/start/ale/ale_linters/haskell/ghc_mod.vim
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
" Author: wizzup <wizzup@gmail.com>
|
||||||
|
" Description: ghc-mod for Haskell files
|
||||||
|
|
||||||
|
call ale#Set('haskell_ghc_mod_executable', 'ghc-mod')
|
||||||
|
|
||||||
|
function! ale_linters#haskell#ghc_mod#GetCommand (buffer) abort
|
||||||
|
let l:executable = ale#Var(a:buffer, 'haskell_ghc_mod_executable')
|
||||||
|
|
||||||
|
return ale#handlers#haskell_stack#EscapeExecutable(l:executable, 'ghc-mod')
|
||||||
|
\ . ' --map-file %s=%t check %s'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('haskell', {
|
||||||
|
\ 'name': 'ghc_mod',
|
||||||
|
\ 'aliases': ['ghc-mod'],
|
||||||
|
\ 'executable': {b -> ale#Var(b, 'haskell_ghc_mod_executable')},
|
||||||
|
\ 'command': function('ale_linters#haskell#ghc_mod#GetCommand'),
|
||||||
|
\ 'callback': 'ale#handlers#haskell#HandleGHCFormat',
|
||||||
|
\})
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue