mirror of
https://github.com/amix/vimrc
synced 2025-06-16 01:25:00 +08:00
Updated plugins
This commit is contained in:
@ -31,6 +31,6 @@ call ale#linter#Define('apiblueprint', {
|
||||
\ 'name': 'drafter',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': 'drafter',
|
||||
\ 'command': 'drafter --use-line-num --validate %t',
|
||||
\ 'command': 'drafter --use-line-num --validate',
|
||||
\ 'callback': 'ale_linters#apiblueprint#drafter#HandleErrors',
|
||||
\})
|
||||
|
@ -1,9 +1,4 @@
|
||||
" Author: Sumner Evans <sumner.evans98@gmail.com>
|
||||
" Description: write-good for AsciiDoc files
|
||||
|
||||
call ale#linter#Define('asciidoc', {
|
||||
\ 'name': 'write-good',
|
||||
\ 'executable_callback': 'ale#handlers#writegood#GetExecutable',
|
||||
\ 'command_callback': 'ale#handlers#writegood#GetCommand',
|
||||
\ 'callback': 'ale#handlers#writegood#Handle',
|
||||
\})
|
||||
call ale#handlers#writegood#DefineLinter('asciidoc')
|
||||
|
@ -14,10 +14,10 @@ function! ale_linters#c#clang#GetCommand(buffer, output) abort
|
||||
" -iquote with the directory the file is in makes #include work for
|
||||
" headers in the same directory.
|
||||
return ale#Escape(ale_linters#c#clang#GetExecutable(a:buffer))
|
||||
\ . ' -S -x c -fsyntax-only '
|
||||
\ . '-iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h')) . ' '
|
||||
\ . l:cflags
|
||||
\ . ale#Var(a:buffer, 'c_clang_options') . ' -'
|
||||
\ . ' -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', {
|
||||
@ -28,5 +28,5 @@ call ale#linter#Define('c', {
|
||||
\ {'callback': 'ale#c#GetMakeCommand', 'output_stream': 'stdout'},
|
||||
\ {'callback': 'ale_linters#c#clang#GetCommand'}
|
||||
\ ],
|
||||
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
|
||||
\ 'callback': 'ale#handlers#gcc#HandleGCCFormatWithIncludes',
|
||||
\})
|
||||
|
29
sources_non_forked/ale/ale_linters/c/clangd.vim
Normal file
29
sources_non_forked/ale/ale_linters/c/clangd.vim
Normal file
@ -0,0 +1,29 @@
|
||||
" 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#GetProjectRoot(buffer) abort
|
||||
let l:project_root = ale#path#FindNearestFile(a:buffer, 'compile_commands.json')
|
||||
return !empty(l:project_root) ? fnamemodify(l:project_root, ':h') : ''
|
||||
endfunction
|
||||
|
||||
function! ale_linters#c#clangd#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'c_clangd_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#c#clangd#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#c#clangd#GetExecutable(a:buffer)
|
||||
let l:options = ale#Var(a:buffer, 'c_clangd_options')
|
||||
|
||||
return ale#Escape(l:executable) . (!empty(l:options) ? ' ' . l:options : '')
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('c', {
|
||||
\ 'name': 'clangd',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable_callback': 'ale_linters#c#clangd#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#c#clangd#GetCommand',
|
||||
\ 'project_root_callback': 'ale_linters#c#clangd#GetProjectRoot',
|
||||
\})
|
@ -35,7 +35,7 @@ function! s:GetBuildDirectory(buffer) abort
|
||||
return l:build_dir
|
||||
endif
|
||||
|
||||
return ale#c#FindCompileCommands(a:buffer)
|
||||
return ale#path#Dirname(ale#c#FindCompileCommands(a:buffer))
|
||||
endfunction
|
||||
|
||||
function! ale_linters#c#clangtidy#GetCommand(buffer) abort
|
||||
|
32
sources_non_forked/ale/ale_linters/c/cquery.vim
Normal file
32
sources_non_forked/ale/ale_linters/c/cquery.vim
Normal file
@ -0,0 +1,32 @@
|
||||
" 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
|
||||
let l:project_root = ale#path#FindNearestFile(a:buffer, 'compile_commands.json')
|
||||
return !empty(l:project_root) ? fnamemodify(l:project_root, ':h') : ''
|
||||
endfunction
|
||||
|
||||
function! ale_linters#c#cquery#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'c_cquery_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#c#cquery#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#c#cquery#GetExecutable(a:buffer)
|
||||
return ale#Escape(l:executable)
|
||||
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_callback': 'ale_linters#c#cquery#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#c#cquery#GetCommand',
|
||||
\ 'project_root_callback': 'ale_linters#c#cquery#GetProjectRoot',
|
||||
\ 'initialization_options_callback': 'ale_linters#c#cquery#GetInitializationOptions',
|
||||
\})
|
@ -14,10 +14,10 @@ function! ale_linters#c#gcc#GetCommand(buffer, output) abort
|
||||
" -iquote with the directory the file is in makes #include work for
|
||||
" headers in the same directory.
|
||||
return ale#Escape(ale_linters#c#gcc#GetExecutable(a:buffer))
|
||||
\ . ' -S -x c -fsyntax-only '
|
||||
\ . '-iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h')) . ' '
|
||||
\ . l:cflags
|
||||
\ . ale#Var(a:buffer, 'c_gcc_options') . ' -'
|
||||
\ . ' -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_gcc_options')) . ' -'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('c', {
|
||||
@ -28,5 +28,5 @@ call ale#linter#Define('c', {
|
||||
\ {'callback': 'ale#c#GetMakeCommand', 'output_stream': 'stdout'},
|
||||
\ {'callback': 'ale_linters#c#gcc#GetCommand'}
|
||||
\ ],
|
||||
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
|
||||
\ 'callback': 'ale#handlers#gcc#HandleGCCFormatWithIncludes',
|
||||
\})
|
||||
|
@ -27,6 +27,6 @@ call ale#linter#Define('clojure', {
|
||||
\ 'name': 'joker',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': 'joker',
|
||||
\ 'command': 'joker --lint %t',
|
||||
\ 'command': 'joker --working-dir %s --lint %t',
|
||||
\ 'callback': 'ale_linters#clojure#joker#HandleJokerFormat',
|
||||
\})
|
||||
|
@ -14,10 +14,10 @@ function! ale_linters#cpp#clang#GetCommand(buffer, output) abort
|
||||
" -iquote with the directory the file is in makes #include work for
|
||||
" headers in the same directory.
|
||||
return ale#Escape(ale_linters#cpp#clang#GetExecutable(a:buffer))
|
||||
\ . ' -S -x c++ -fsyntax-only '
|
||||
\ . '-iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h')) . ' '
|
||||
\ . l:cflags
|
||||
\ . ale#Var(a:buffer, 'cpp_clang_options') . ' -'
|
||||
\ . ' -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', {
|
||||
@ -28,5 +28,5 @@ call ale#linter#Define('cpp', {
|
||||
\ {'callback': 'ale#c#GetMakeCommand', 'output_stream': 'stdout'},
|
||||
\ {'callback': 'ale_linters#cpp#clang#GetCommand'},
|
||||
\ ],
|
||||
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
|
||||
\ 'callback': 'ale#handlers#gcc#HandleGCCFormatWithIncludes',
|
||||
\})
|
||||
|
@ -16,7 +16,7 @@ function! ale_linters#cpp#clangcheck#GetCommand(buffer) abort
|
||||
let l:build_dir = ale#Var(a:buffer, 'c_build_dir')
|
||||
|
||||
if empty(l:build_dir)
|
||||
let l:build_dir = ale#c#FindCompileCommands(a:buffer)
|
||||
let l:build_dir = ale#path#Dirname(ale#c#FindCompileCommands(a:buffer))
|
||||
endif
|
||||
|
||||
" The extra arguments in the command are used to prevent .plist files from
|
||||
|
@ -29,7 +29,7 @@ function! s:GetBuildDirectory(buffer) abort
|
||||
return l:build_dir
|
||||
endif
|
||||
|
||||
return ale#c#FindCompileCommands(a:buffer)
|
||||
return ale#path#Dirname(ale#c#FindCompileCommands(a:buffer))
|
||||
endfunction
|
||||
|
||||
function! ale_linters#cpp#clangtidy#GetCommand(buffer) abort
|
||||
|
@ -14,10 +14,10 @@ function! ale_linters#cpp#gcc#GetCommand(buffer, output) abort
|
||||
" -iquote with the directory the file is in makes #include work for
|
||||
" headers in the same directory.
|
||||
return ale#Escape(ale_linters#cpp#gcc#GetExecutable(a:buffer))
|
||||
\ . ' -S -x c++ -fsyntax-only '
|
||||
\ . '-iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h')) . ' '
|
||||
\ . l:cflags
|
||||
\ . ale#Var(a:buffer, 'cpp_gcc_options') . ' -'
|
||||
\ . ' -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_gcc_options')) . ' -'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('cpp', {
|
||||
@ -29,5 +29,5 @@ call ale#linter#Define('cpp', {
|
||||
\ {'callback': 'ale#c#GetMakeCommand', 'output_stream': 'stdout'},
|
||||
\ {'callback': 'ale_linters#cpp#gcc#GetCommand'},
|
||||
\ ],
|
||||
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
|
||||
\ 'callback': 'ale#handlers#gcc#HandleGCCFormatWithIncludes',
|
||||
\})
|
||||
|
@ -28,7 +28,7 @@ endfunction
|
||||
call ale#linter#Define('elixir', {
|
||||
\ 'name': 'dialyxir',
|
||||
\ 'executable': 'mix',
|
||||
\ 'command': 'mix dialyzer',
|
||||
\ 'command': 'mix help dialyzer && mix dialyzer',
|
||||
\ 'callback': 'ale_linters#elixir#dialyxir#Handle',
|
||||
\})
|
||||
|
||||
|
@ -136,7 +136,7 @@ function! ale_linters#elm#make#ParseMessage(message) abort
|
||||
endfunction
|
||||
|
||||
function! ale_linters#elm#make#ParseMessageItem(item) abort
|
||||
if type(a:item) == type('')
|
||||
if type(a:item) is v:t_string
|
||||
return a:item
|
||||
else
|
||||
return a:item.string
|
||||
|
@ -0,0 +1,27 @@
|
||||
" 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#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'fortran_language_server_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#fortran#language_server#GetCommand(buffer) abort
|
||||
return ale#Escape(ale_linters#fortran#language_server#GetExecutable(a:buffer))
|
||||
endfunction
|
||||
|
||||
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_callback': 'ale_linters#fortran#language_server#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#fortran#language_server#GetCommand',
|
||||
\ 'project_root_callback': 'ale_linters#fortran#language_server#GetProjectRoot',
|
||||
\})
|
@ -70,7 +70,8 @@ function! ale_linters#go#gobuild#Handler(buffer, lines) abort
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('go', {
|
||||
\ 'name': 'go build',
|
||||
\ 'name': 'gobuild',
|
||||
\ 'aliases': ['go build'],
|
||||
\ 'executable': 'go',
|
||||
\ 'command_chain': [
|
||||
\ {'callback': 'ale_linters#go#gobuild#GoEnv', 'output_stream': 'stdout'},
|
||||
|
@ -9,7 +9,8 @@ function! ale_linters#go#govet#GetCommand(buffer) abort
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('go', {
|
||||
\ 'name': 'go vet',
|
||||
\ 'name': 'govet',
|
||||
\ 'aliases': ['go vet'],
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': 'go',
|
||||
\ 'command_callback': 'ale_linters#go#govet#GetCommand',
|
||||
|
19
sources_non_forked/ale/ale_linters/haskell/cabal_ghc.vim
Normal file
19
sources_non_forked/ale/ale_linters/haskell/cabal_ghc.vim
Normal file
@ -0,0 +1,19 @@
|
||||
" 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 '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_callback': 'ale_linters#haskell#cabal_ghc#GetCommand',
|
||||
\ 'callback': 'ale#handlers#haskell#HandleGHCFormat',
|
||||
\})
|
@ -2,14 +2,16 @@
|
||||
" Description: ghc-mod for Haskell files
|
||||
|
||||
call ale#linter#Define('haskell', {
|
||||
\ 'name': 'ghc-mod',
|
||||
\ 'name': 'ghc_mod',
|
||||
\ 'aliases': ['ghc-mod'],
|
||||
\ 'executable': 'ghc-mod',
|
||||
\ 'command': 'ghc-mod --map-file %s=%t check %s',
|
||||
\ 'callback': 'ale#handlers#haskell#HandleGHCFormat',
|
||||
\})
|
||||
|
||||
call ale#linter#Define('haskell', {
|
||||
\ 'name': 'stack-ghc-mod',
|
||||
\ 'name': 'stack_ghc_mod',
|
||||
\ 'aliases': ['stack-ghc-mod'],
|
||||
\ 'executable': 'stack',
|
||||
\ 'command': 'stack exec ghc-mod -- --map-file %s=%t check %s',
|
||||
\ 'callback': 'ale#handlers#haskell#HandleGHCFormat',
|
||||
|
@ -13,7 +13,8 @@ function! ale_linters#haskell#stack_build#GetCommand(buffer) abort
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('haskell', {
|
||||
\ 'name': 'stack-build',
|
||||
\ 'name': 'stack_build',
|
||||
\ 'aliases': ['stack-build'],
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': 'stack',
|
||||
\ 'command_callback': 'ale_linters#haskell#stack_build#GetCommand',
|
||||
|
@ -2,7 +2,8 @@
|
||||
" Description: ghc for Haskell files, using Stack
|
||||
|
||||
call ale#linter#Define('haskell', {
|
||||
\ 'name': 'stack-ghc',
|
||||
\ 'name': 'stack_ghc',
|
||||
\ 'aliases': ['stack-ghc'],
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': 'stack',
|
||||
\ 'command': 'stack ghc -- -fno-code -v0 %t',
|
||||
|
@ -1,9 +1,4 @@
|
||||
" Author: Sumner Evans <sumner.evans98@gmail.com>
|
||||
" Description: write-good for vim Help files
|
||||
|
||||
call ale#linter#Define('help', {
|
||||
\ 'name': 'write-good',
|
||||
\ 'executable_callback': 'ale#handlers#writegood#GetExecutable',
|
||||
\ 'command_callback': 'ale#handlers#writegood#GetCommand',
|
||||
\ 'callback': 'ale#handlers#writegood#Handle',
|
||||
\})
|
||||
call ale#handlers#writegood#DefineLinter('help')
|
||||
|
@ -1,9 +1,4 @@
|
||||
" Author: Sumner Evans <sumner.evans98@gmail.com>
|
||||
" Description: write-good for nroff files
|
||||
" Description: write-good for html files
|
||||
|
||||
call ale#linter#Define('html', {
|
||||
\ 'name': 'write-good',
|
||||
\ 'executable_callback': 'ale#handlers#writegood#GetExecutable',
|
||||
\ 'command_callback': 'ale#handlers#writegood#GetCommand',
|
||||
\ 'callback': 'ale#handlers#writegood#Handle',
|
||||
\})
|
||||
call ale#handlers#writegood#DefineLinter('html')
|
||||
|
@ -1,3 +1,4 @@
|
||||
scriptencoding utf-8
|
||||
" Author rhysd https://rhysd.github.io/, Dirk Roorda (dirkroorda), Adrián González Rus (@adrigzr)
|
||||
" Description: remark-lint for Markdown files
|
||||
call ale#Set('markdown_remark_lint_executable', 'remark')
|
||||
@ -43,7 +44,8 @@ function! ale_linters#markdown#remark_lint#Handle(buffer, lines) abort
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('markdown', {
|
||||
\ 'name': 'remark-lint',
|
||||
\ 'name': 'remark_lint',
|
||||
\ 'aliases': ['remark-lint'],
|
||||
\ 'executable_callback': 'ale_linters#markdown#remark_lint#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#markdown#remark_lint#GetCommand',
|
||||
\ 'callback': 'ale_linters#markdown#remark_lint#Handle',
|
||||
|
@ -1,9 +1,4 @@
|
||||
" Author: Sumner Evans <sumner.evans98@gmail.com>
|
||||
" Description: write-good for Markdown files
|
||||
|
||||
call ale#linter#Define('markdown', {
|
||||
\ 'name': 'write-good',
|
||||
\ 'executable_callback': 'ale#handlers#writegood#GetExecutable',
|
||||
\ 'command_callback': 'ale#handlers#writegood#GetCommand',
|
||||
\ 'callback': 'ale#handlers#writegood#Handle',
|
||||
\})
|
||||
call ale#handlers#writegood#DefineLinter('markdown')
|
||||
|
@ -1,9 +1,4 @@
|
||||
" Author: Sumner Evans <sumner.evans98@gmail.com>
|
||||
" Description: write-good for nroff files
|
||||
|
||||
call ale#linter#Define('nroff', {
|
||||
\ 'name': 'write-good',
|
||||
\ 'executable_callback': 'ale#handlers#writegood#GetExecutable',
|
||||
\ 'command_callback': 'ale#handlers#writegood#GetCommand',
|
||||
\ 'callback': 'ale#handlers#writegood#Handle',
|
||||
\})
|
||||
call ale#handlers#writegood#DefineLinter('nroff')
|
||||
|
@ -19,5 +19,5 @@ call ale#linter#Define('objc', {
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': 'clang',
|
||||
\ 'command_callback': 'ale_linters#objc#clang#GetCommand',
|
||||
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
|
||||
\ 'callback': 'ale#handlers#gcc#HandleGCCFormatWithIncludes',
|
||||
\})
|
||||
|
@ -19,5 +19,5 @@ call ale#linter#Define('objcpp', {
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': 'clang++',
|
||||
\ 'command_callback': 'ale_linters#objcpp#clang#GetCommand',
|
||||
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
|
||||
\ 'callback': 'ale#handlers#gcc#HandleGCCFormatWithIncludes',
|
||||
\})
|
||||
|
@ -1,9 +1,4 @@
|
||||
" Author: Cian Butler https://github.com/butlerx
|
||||
" Description: write-good for PO files
|
||||
|
||||
call ale#linter#Define('po', {
|
||||
\ 'name': 'write-good',
|
||||
\ 'executable_callback': 'ale#handlers#writegood#GetExecutable',
|
||||
\ 'command_callback': 'ale#handlers#writegood#GetCommand',
|
||||
\ 'callback': 'ale#handlers#writegood#Handle',
|
||||
\})
|
||||
call ale#handlers#writegood#DefineLinter('po')
|
||||
|
@ -1,9 +1,4 @@
|
||||
" Author: Sumner Evans <sumner.evans98@gmail.com>
|
||||
" Description: write-good for Pod files
|
||||
|
||||
call ale#linter#Define('pod', {
|
||||
\ 'name': 'write-good',
|
||||
\ 'executable_callback': 'ale#handlers#writegood#GetExecutable',
|
||||
\ 'command_callback': 'ale#handlers#writegood#GetCommand',
|
||||
\ 'callback': 'ale#handlers#writegood#Handle',
|
||||
\})
|
||||
call ale#handlers#writegood#DefineLinter('pod')
|
||||
|
85
sources_non_forked/ale/ale_linters/python/vulture.vim
Normal file
85
sources_non_forked/ale/ale_linters/python/vulture.vim
Normal file
@ -0,0 +1,85 @@
|
||||
" Author: Yauheni Kirylau <actionless.loveless@gmail.com>
|
||||
" Description: vulture linting for python files
|
||||
|
||||
call ale#Set('python_vulture_executable', 'vulture')
|
||||
call ale#Set('python_vulture_options', '')
|
||||
call ale#Set('python_vulture_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
call ale#Set('python_vulture_change_directory', 1)
|
||||
|
||||
|
||||
" The directory to change to before running vulture
|
||||
function! s:GetDir(buffer) abort
|
||||
let l:project_root = ale#python#FindProjectRoot(a:buffer)
|
||||
|
||||
return !empty(l:project_root)
|
||||
\ ? l:project_root
|
||||
\ : expand('#' . a:buffer . ':p:h')
|
||||
endfunction
|
||||
|
||||
|
||||
function! ale_linters#python#vulture#GetExecutable(buffer) abort
|
||||
return ale#python#FindExecutable(a:buffer, 'python_vulture', ['vulture'])
|
||||
endfunction
|
||||
|
||||
|
||||
function! ale_linters#python#vulture#GetCommand(buffer) abort
|
||||
let l:change_dir = ale#Var(a:buffer, 'python_vulture_change_directory')
|
||||
\ ? ale#path#CdString(s:GetDir(a:buffer))
|
||||
\ : ''
|
||||
|
||||
let l:executable = ale_linters#python#vulture#GetExecutable(a:buffer)
|
||||
|
||||
let l:exec_args = l:executable =~? 'pipenv$'
|
||||
\ ? ' run vulture'
|
||||
\ : ''
|
||||
|
||||
let l:lint_dest = ale#Var(a:buffer, 'python_vulture_change_directory')
|
||||
\ ? ' .'
|
||||
\ : ' %s'
|
||||
|
||||
return l:change_dir
|
||||
\ . ale#Escape(l:executable) . l:exec_args
|
||||
\ . ' '
|
||||
\ . ale#Var(a:buffer, 'python_vulture_options')
|
||||
\ . l:lint_dest
|
||||
endfunction
|
||||
|
||||
|
||||
function! ale_linters#python#vulture#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:
|
||||
let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+): (.*)$'
|
||||
let l:output = []
|
||||
let l:dir = s:GetDir(a:buffer)
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
let l:abspath = ale#path#GetAbsPath(l:dir, l:match[1])
|
||||
let l:item = {
|
||||
\ 'filename': l:abspath,
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'text': l:match[3],
|
||||
\ 'type': 'W',
|
||||
\}
|
||||
call add(l:output, l:item)
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
|
||||
call ale#linter#Define('python', {
|
||||
\ 'name': 'vulture',
|
||||
\ 'executable_callback': 'ale_linters#python#vulture#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#python#vulture#GetCommand',
|
||||
\ 'callback': 'ale_linters#python#vulture#Handle',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
@ -1,9 +1,4 @@
|
||||
" Author: Sumner Evans <sumner.evans98@gmail.com>
|
||||
" Description: write-good for reStructuredText files
|
||||
|
||||
call ale#linter#Define('rst', {
|
||||
\ 'name': 'write-good',
|
||||
\ 'executable_callback': 'ale#handlers#writegood#GetExecutable',
|
||||
\ 'command_callback': 'ale#handlers#writegood#GetCommand',
|
||||
\ 'callback': 'ale#handlers#writegood#Handle',
|
||||
\})
|
||||
call ale#handlers#writegood#DefineLinter('rst')
|
||||
|
@ -9,7 +9,8 @@ endfunction
|
||||
" Using CM requires that we set "lint_file: 1", since it reads the files
|
||||
" from the disk itself.
|
||||
call ale#linter#Define('sml', {
|
||||
\ 'name': 'smlnj-cm',
|
||||
\ 'name': 'smlnj_cm',
|
||||
\ 'aliases': ['smlnj-cm'],
|
||||
\ 'executable_callback': 'ale#handlers#sml#GetExecutableSmlnjCm',
|
||||
\ 'lint_file': 1,
|
||||
\ 'command_callback': 'ale_linters#sml#smlnj_cm#GetCommand',
|
||||
|
@ -1,9 +1,4 @@
|
||||
" Author: Sumner Evans <sumner.evans98@gmail.com>
|
||||
" Description: write-good for TeX files
|
||||
|
||||
call ale#linter#Define('tex', {
|
||||
\ 'name': 'write-good',
|
||||
\ 'executable_callback': 'ale#handlers#writegood#GetExecutable',
|
||||
\ 'command_callback': 'ale#handlers#writegood#GetCommand',
|
||||
\ 'callback': 'ale#handlers#writegood#Handle',
|
||||
\})
|
||||
call ale#handlers#writegood#DefineLinter('tex')
|
||||
|
@ -1,9 +1,4 @@
|
||||
" Author: Sumner Evans <sumner.evans98@gmail.com>
|
||||
" Description: write-good for Texinfo files
|
||||
|
||||
call ale#linter#Define('texinfo', {
|
||||
\ 'name': 'write-good',
|
||||
\ 'executable_callback': 'ale#handlers#writegood#GetExecutable',
|
||||
\ 'command_callback': 'ale#handlers#writegood#GetCommand',
|
||||
\ 'callback': 'ale#handlers#writegood#Handle',
|
||||
\})
|
||||
call ale#handlers#writegood#DefineLinter('texinfo')
|
||||
|
@ -1,9 +1,4 @@
|
||||
" Author: Sumner Evans <sumner.evans98@gmail.com>
|
||||
" Description: write-good for text files
|
||||
|
||||
call ale#linter#Define('text', {
|
||||
\ 'name': 'write-good',
|
||||
\ 'executable_callback': 'ale#handlers#writegood#GetExecutable',
|
||||
\ 'command_callback': 'ale#handlers#writegood#GetCommand',
|
||||
\ 'callback': 'ale#handlers#writegood#Handle',
|
||||
\})
|
||||
call ale#handlers#writegood#DefineLinter('text')
|
||||
|
@ -1,9 +1,4 @@
|
||||
" Author: Sumner Evans <sumner.evans98@gmail.com>
|
||||
" Description: write-good for XHTML files
|
||||
|
||||
call ale#linter#Define('xhtml', {
|
||||
\ 'name': 'write-good',
|
||||
\ 'executable_callback': 'ale#handlers#writegood#GetExecutable',
|
||||
\ 'command_callback': 'ale#handlers#writegood#GetCommand',
|
||||
\ 'callback': 'ale#handlers#writegood#Handle',
|
||||
\})
|
||||
call ale#handlers#writegood#DefineLinter('xhtml')
|
||||
|
Reference in New Issue
Block a user