diff --git a/sources_non_forked/ale/LICENSE b/sources_non_forked/ale/LICENSE new file mode 100644 index 00000000..739ccae0 --- /dev/null +++ b/sources_non_forked/ale/LICENSE @@ -0,0 +1,22 @@ +Copyright (c) 2016-2018, w0rp +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. diff --git a/sources_non_forked/ale/after/plugin/ale.vim b/sources_non_forked/ale/after/plugin/ale.vim new file mode 100644 index 00000000..d738dbdd --- /dev/null +++ b/sources_non_forked/ale/after/plugin/ale.vim @@ -0,0 +1,37 @@ +" Author: w0rp +" Description: Follow-up checks for the plugin: warn about conflicting plugins. + +" A flag for ensuring that this is not run more than one time. +if exists('g:loaded_ale_after') + finish +endif + +" Set the flag so this file is not run more than one time. +let g:loaded_ale_after = 1 + +" Check if the flag is available and set to 0 to disable checking for and +" emitting conflicting plugin warnings. +if exists('g:ale_emit_conflict_warnings') && !g:ale_emit_conflict_warnings + finish +endif + +" Conflicting Plugins Checks + +function! s:GetConflictingPluginWarning(plugin_name) abort + return 'ALE conflicts with ' . a:plugin_name + \ . '. Uninstall it, or disable this warning with ' + \ . '`let g:ale_emit_conflict_warnings = 0` in your vimrc file, ' + \ . '*before* plugins are loaded.' +endfunction + +if exists('g:loaded_syntastic_plugin') + throw s:GetConflictingPluginWarning('Syntastic') +endif + +if exists('g:loaded_neomake') + throw s:GetConflictingPluginWarning('Neomake') +endif + +if exists('g:loaded_validator_plugin') + throw s:GetConflictingPluginWarning('Validator') +endif diff --git a/sources_non_forked/ale/ale_linters/ansible/ansible_lint.vim b/sources_non_forked/ale/ale_linters/ansible/ansible_lint.vim new file mode 100644 index 00000000..0b3b39c8 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/ansible/ansible_lint.vim @@ -0,0 +1,49 @@ +" Author: Bjorn Neergaard +" Description: ansible-lint for ansible-yaml files + +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', +\ 'executable': 'ansible', +\ 'command': 'ansible-lint -p %t', +\ 'callback': 'ale_linters#ansible#ansible_lint#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/apiblueprint/drafter.vim b/sources_non_forked/ale/ale_linters/apiblueprint/drafter.vim new file mode 100644 index 00000000..9cded359 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/apiblueprint/drafter.vim @@ -0,0 +1,36 @@ +" 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 [] [()]'; 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 %t', +\ 'callback': 'ale_linters#apiblueprint#drafter#HandleErrors', +\}) diff --git a/sources_non_forked/ale/ale_linters/asciidoc/alex.vim b/sources_non_forked/ale/ale_linters/asciidoc/alex.vim new file mode 100644 index 00000000..79b04fc3 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/asciidoc/alex.vim @@ -0,0 +1,11 @@ +" Author: Johannes Wienke +" Description: alex for asciidoc files + +call ale#linter#Define('help', { +\ 'name': 'alex', +\ 'executable': 'alex', +\ 'command': 'alex %s -t', +\ 'output_stream': 'stderr', +\ 'callback': 'ale#handlers#alex#Handle', +\ 'lint_file': 1, +\}) diff --git a/sources_non_forked/ale/ale_linters/asciidoc/proselint.vim b/sources_non_forked/ale/ale_linters/asciidoc/proselint.vim new file mode 100644 index 00000000..b636c067 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/asciidoc/proselint.vim @@ -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', +\}) diff --git a/sources_non_forked/ale/ale_linters/asciidoc/redpen.vim b/sources_non_forked/ale/ale_linters/asciidoc/redpen.vim new file mode 100644 index 00000000..819e385f --- /dev/null +++ b/sources_non_forked/ale/ale_linters/asciidoc/redpen.vim @@ -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', +\}) diff --git a/sources_non_forked/ale/ale_linters/asciidoc/write-good.vim b/sources_non_forked/ale/ale_linters/asciidoc/write-good.vim new file mode 100644 index 00000000..c986cc6c --- /dev/null +++ b/sources_non_forked/ale/ale_linters/asciidoc/write-good.vim @@ -0,0 +1,9 @@ +" Author: Sumner Evans +" 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', +\}) diff --git a/sources_non_forked/ale/ale_linters/asm/gcc.vim b/sources_non_forked/ale/ale_linters/asm/gcc.vim new file mode 100644 index 00000000..4ac876f8 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/asm/gcc.vim @@ -0,0 +1,39 @@ +" Author: Lucas Kolstad +" 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#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'asm_gcc_executable') +endfunction + +function! ale_linters#asm#gcc#GetCommand(buffer) abort + return ale#Escape(ale_linters#asm#gcc#GetExecutable(a:buffer)) + \ . ' -x assembler -fsyntax-only ' + \ . '-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_callback': 'ale_linters#asm#gcc#GetExecutable', +\ 'command_callback': 'ale_linters#asm#gcc#GetCommand', +\ 'callback': 'ale_linters#asm#gcc#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/awk/gawk.vim b/sources_non_forked/ale/ale_linters/awk/gawk.vim new file mode 100644 index 00000000..3e9987b3 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/awk/gawk.vim @@ -0,0 +1,30 @@ +" Author: kmarc +" Description: This file adds support for using GNU awk with sripts. + +let g:ale_awk_gawk_executable = +\ get(g:, 'ale_awk_gawk_executable', 'gawk') + +let g:ale_awk_gawk_options = +\ get(g:, 'ale_awk_gawk_options', '') + +function! ale_linters#awk#gawk#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'awk_gawk_executable') +endfunction + +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 ale_linters#awk#gawk#GetExecutable(a:buffer) + \ . " --source 'BEGIN { exit } END { exit 1 }'" + \ . ' ' . ale#Var(a:buffer, 'awk_gawk_options') + \ . ' ' . '-f %t --lint /dev/null' +endfunction + +call ale#linter#Define('awk', { +\ 'name': 'gawk', +\ 'executable_callback': 'ale_linters#awk#gawk#GetExecutable', +\ 'command_callback': 'ale_linters#awk#gawk#GetCommand', +\ 'callback': 'ale#handlers#gawk#HandleGawkFormat', +\ 'output_stream': 'both' +\}) diff --git a/sources_non_forked/ale/ale_linters/c/clang.vim b/sources_non_forked/ale/ale_linters/c/clang.vim new file mode 100644 index 00000000..ddec4fcb --- /dev/null +++ b/sources_non_forked/ale/ale_linters/c/clang.vim @@ -0,0 +1,32 @@ +" 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#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'c_clang_executable') +endfunction + +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 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') . ' -' +endfunction + +call ale#linter#Define('c', { +\ 'name': 'clang', +\ 'output_stream': 'stderr', +\ 'executable_callback': 'ale_linters#c#clang#GetExecutable', +\ 'command_chain': [ +\ {'callback': 'ale#c#GetMakeCommand', 'output_stream': 'stdout'}, +\ {'callback': 'ale_linters#c#clang#GetCommand'} +\ ], +\ 'callback': 'ale#handlers#gcc#HandleGCCFormat', +\}) diff --git a/sources_non_forked/ale/ale_linters/c/clangtidy.vim b/sources_non_forked/ale/ale_linters/c/clangtidy.vim new file mode 100644 index 00000000..47faa1ef --- /dev/null +++ b/sources_non_forked/ale/ale_linters/c/clangtidy.vim @@ -0,0 +1,64 @@ +" Author: vdeurzen , w0rp , +" gagbo , Andrej Radovic +" 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. +" This will disable compile_commands.json detection. +call ale#Set('c_clangtidy_options', '') +call ale#Set('c_build_dir', '') + +function! ale_linters#c#clangtidy#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'c_clangtidy_executable') +endfunction + +function! s:GetBuildDirectory(buffer) abort + " Don't include build directory for header files, as compile_commands.json + " files don't consider headers to be translation units, and provide no + " commands for compiling header files. + if expand('#' . a:buffer) =~# '\v\.(h|hpp)$' + return '' + endif + + let l:build_dir = ale#Var(a:buffer, 'c_build_dir') + + " c_build_dir has the priority if defined + if !empty(l:build_dir) + return l:build_dir + endif + + return ale#c#FindCompileCommands(a:buffer) +endfunction + +function! ale_linters#c#clangtidy#GetCommand(buffer) abort + let l:checks = join(ale#Var(a:buffer, 'c_clangtidy_checks'), ',') + let l:build_dir = s: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') + \ : '' + + return ale#Escape(ale_linters#c#clangtidy#GetExecutable(a:buffer)) + \ . (!empty(l:checks) ? ' -checks=' . ale#Escape(l:checks) : '') + \ . ' %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_callback': 'ale_linters#c#clangtidy#GetExecutable', +\ 'command_callback': 'ale_linters#c#clangtidy#GetCommand', +\ 'callback': 'ale#handlers#gcc#HandleGCCFormat', +\ 'lint_file': 1, +\}) diff --git a/sources_non_forked/ale/ale_linters/c/cppcheck.vim b/sources_non_forked/ale/ale_linters/c/cppcheck.vim new file mode 100644 index 00000000..4db93f74 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/c/cppcheck.vim @@ -0,0 +1,39 @@ +" Author: Bart Libert +" 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#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'c_cppcheck_executable') +endfunction + +function! ale_linters#c#cppcheck#GetCommand(buffer) abort + " Search upwards from the file for compile_commands.json. + " + " If we find it, we'll `cd` to where the compile_commands.json file is, + " then use the file to set up import paths, etc. + let l:compile_commmands_path = ale#path#FindNearestFile(a:buffer, 'compile_commands.json') + + let l:cd_command = !empty(l:compile_commmands_path) + \ ? ale#path#CdString(fnamemodify(l:compile_commmands_path, ':h')) + \ : '' + let l:compile_commands_option = !empty(l:compile_commmands_path) + \ ? '--project=compile_commands.json ' + \ : '' + + return l:cd_command + \ . ale#Escape(ale_linters#c#cppcheck#GetExecutable(a:buffer)) + \ . ' -q --language=c ' + \ . l:compile_commands_option + \ . ale#Var(a:buffer, 'c_cppcheck_options') + \ . ' %t' +endfunction + +call ale#linter#Define('c', { +\ 'name': 'cppcheck', +\ 'output_stream': 'both', +\ 'executable_callback': 'ale_linters#c#cppcheck#GetExecutable', +\ 'command_callback': 'ale_linters#c#cppcheck#GetCommand', +\ 'callback': 'ale#handlers#cppcheck#HandleCppCheckFormat', +\}) diff --git a/sources_non_forked/ale/ale_linters/c/flawfinder.vim b/sources_non_forked/ale/ale_linters/c/flawfinder.vim new file mode 100644 index 00000000..df6fbebe --- /dev/null +++ b/sources_non_forked/ale/ale_linters/c/flawfinder.vim @@ -0,0 +1,31 @@ +" Author: Christian Gibbons +" 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#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'c_flawfinder_executable') +endfunction + +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 ale#Escape(ale_linters#c#flawfinder#GetExecutable(a:buffer)) + \ . ' -CDQS' + \ . ale#Var(a:buffer, 'c_flawfinder_options') + \ . l:minlevel + \ . ' %t' +endfunction + +call ale#linter#Define('c', { +\ 'name': 'flawfinder', +\ 'output_stream': 'stdout', +\ 'executable_callback': 'ale_linters#c#flawfinder#GetExecutable', +\ 'command_callback': 'ale_linters#c#flawfinder#GetCommand', +\ 'callback': 'ale#handlers#flawfinder#HandleFlawfinderFormat', +\}) diff --git a/sources_non_forked/ale/ale_linters/c/gcc.vim b/sources_non_forked/ale/ale_linters/c/gcc.vim new file mode 100644 index 00000000..98563952 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/c/gcc.vim @@ -0,0 +1,32 @@ +" Author: w0rp +" 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#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'c_gcc_executable') +endfunction + +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. + 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') . ' -' +endfunction + +call ale#linter#Define('c', { +\ 'name': 'gcc', +\ 'output_stream': 'stderr', +\ 'executable_callback': 'ale_linters#c#gcc#GetExecutable', +\ 'command_chain': [ +\ {'callback': 'ale#c#GetMakeCommand', 'output_stream': 'stdout'}, +\ {'callback': 'ale_linters#c#gcc#GetCommand'} +\ ], +\ 'callback': 'ale#handlers#gcc#HandleGCCFormat', +\}) diff --git a/sources_non_forked/ale/ale_linters/chef/foodcritic.vim b/sources_non_forked/ale/ale_linters/chef/foodcritic.vim new file mode 100644 index 00000000..2c28246c --- /dev/null +++ b/sources_non_forked/ale/ale_linters/chef/foodcritic.vim @@ -0,0 +1,48 @@ +" Author: Edward Larkey +" Author: Jose Junior +" Author: w0rp +" 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#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'chef_foodcritic_executable') +endfunction + +function! ale_linters#chef#foodcritic#GetCommand(buffer) abort + let l:executable = ale_linters#chef#foodcritic#GetExecutable(a:buffer) + let l:options = ale#Var(a:buffer, 'chef_foodcritic_options') + + return ale#Escape(l:executable) + \ . (!empty(l:options) ? ' ' . 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_callback': 'ale_linters#chef#foodcritic#GetExecutable', +\ 'command_callback': 'ale_linters#chef#foodcritic#GetCommand', +\ 'callback': 'ale_linters#chef#foodcritic#Handle', +\ 'lint_file': 1, +\}) diff --git a/sources_non_forked/ale/ale_linters/clojure/joker.vim b/sources_non_forked/ale/ale_linters/clojure/joker.vim new file mode 100644 index 00000000..e78066fe --- /dev/null +++ b/sources_non_forked/ale/ale_linters/clojure/joker.vim @@ -0,0 +1,32 @@ +" Author: Nic West +" Description: linter for clojure using joker https://github.com/candid82/joker + +function! ale_linters#clojure#joker#HandleJokerFormat(buffer, lines) abort + " output format + " ::: : + 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 --lint %t', +\ 'callback': 'ale_linters#clojure#joker#HandleJokerFormat', +\}) diff --git a/sources_non_forked/ale/ale_linters/cmake/cmakelint.vim b/sources_non_forked/ale/ale_linters/cmake/cmakelint.vim new file mode 100644 index 00000000..78676518 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/cmake/cmakelint.vim @@ -0,0 +1,24 @@ +" Author: Kenneth Benzie +" 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_callback': 'ale_linters#cmake#cmakelint#Executable', +\ 'command_callback': 'ale_linters#cmake#cmakelint#Command', +\ 'callback': 'ale#handlers#unix#HandleAsWarning', +\}) diff --git a/sources_non_forked/ale/ale_linters/coffee/coffee.vim b/sources_non_forked/ale/ale_linters/coffee/coffee.vim new file mode 100644 index 00000000..f2539281 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/coffee/coffee.vim @@ -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_callback': 'ale_linters#coffee#coffee#GetExecutable', +\ 'command_callback': 'ale_linters#coffee#coffee#GetCommand', +\ 'output_stream': 'stderr', +\ 'callback': 'ale#handlers#gcc#HandleGCCFormat', +\}) diff --git a/sources_non_forked/ale/ale_linters/coffee/coffeelint.vim b/sources_non_forked/ale/ale_linters/coffee/coffeelint.vim new file mode 100644 index 00000000..6d3df353 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/coffee/coffeelint.vim @@ -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_callback': 'ale_linters#coffee#coffeelint#GetExecutable', +\ 'command_callback': 'ale_linters#coffee#coffeelint#GetCommand', +\ 'callback': 'ale_linters#coffee#coffeelint#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/cpp/clang.vim b/sources_non_forked/ale/ale_linters/cpp/clang.vim new file mode 100644 index 00000000..e8d96187 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/cpp/clang.vim @@ -0,0 +1,32 @@ +" Author: Tomota Nakamura +" 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#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'cpp_clang_executable') +endfunction + +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 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') . ' -' +endfunction + +call ale#linter#Define('cpp', { +\ 'name': 'clang', +\ 'output_stream': 'stderr', +\ 'executable_callback': 'ale_linters#cpp#clang#GetExecutable', +\ 'command_chain': [ +\ {'callback': 'ale#c#GetMakeCommand', 'output_stream': 'stdout'}, +\ {'callback': 'ale_linters#cpp#clang#GetCommand'}, +\ ], +\ 'callback': 'ale#handlers#gcc#HandleGCCFormat', +\}) diff --git a/sources_non_forked/ale/ale_linters/cpp/clangcheck.vim b/sources_non_forked/ale/ale_linters/cpp/clangcheck.vim new file mode 100644 index 00000000..a109d5d3 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/cpp/clangcheck.vim @@ -0,0 +1,39 @@ +" Author: gagbo +" 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#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'cpp_clangcheck_executable') +endfunction + +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:build_dir = ale#c#FindCompileCommands(a:buffer) + 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 ale#Escape(ale_linters#cpp#clangcheck#GetExecutable(a:buffer)) + \ . ' -analyze %s' + \ . (empty(l:build_dir) ? ' -extra-arg -Xclang -extra-arg -analyzer-output=text' : '') + \ . (!empty(l:user_options) ? ' ' . 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_callback': 'ale_linters#cpp#clangcheck#GetExecutable', +\ 'command_callback': 'ale_linters#cpp#clangcheck#GetCommand', +\ 'callback': 'ale#handlers#gcc#HandleGCCFormat', +\ 'lint_file': 1, +\}) diff --git a/sources_non_forked/ale/ale_linters/cpp/clangtidy.vim b/sources_non_forked/ale/ale_linters/cpp/clangtidy.vim new file mode 100644 index 00000000..1d5fb77a --- /dev/null +++ b/sources_non_forked/ale/ale_linters/cpp/clangtidy.vim @@ -0,0 +1,58 @@ +" Author: vdeurzen , w0rp , +" gagbo +" 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. +" This will disable compile_commands.json detection. +call ale#Set('cpp_clangtidy_options', '') +call ale#Set('c_build_dir', '') + +function! ale_linters#cpp#clangtidy#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'cpp_clangtidy_executable') +endfunction + +function! s:GetBuildDirectory(buffer) abort + " Don't include build directory for header files, as compile_commands.json + " files don't consider headers to be translation units, and provide no + " commands for compiling header files. + if expand('#' . a:buffer) =~# '\v\.(h|hpp)$' + return '' + endif + + let l:build_dir = ale#Var(a:buffer, 'c_build_dir') + + " c_build_dir has the priority if defined + if !empty(l:build_dir) + return l:build_dir + endif + + return ale#c#FindCompileCommands(a:buffer) +endfunction + +function! ale_linters#cpp#clangtidy#GetCommand(buffer) abort + let l:checks = join(ale#Var(a:buffer, 'cpp_clangtidy_checks'), ',') + let l:build_dir = s: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') + \ : '' + + return ale#Escape(ale_linters#cpp#clangtidy#GetExecutable(a:buffer)) + \ . (!empty(l:checks) ? ' -checks=' . ale#Escape(l:checks) : '') + \ . ' %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_callback': 'ale_linters#cpp#clangtidy#GetExecutable', +\ 'command_callback': 'ale_linters#cpp#clangtidy#GetCommand', +\ 'callback': 'ale#handlers#gcc#HandleGCCFormat', +\ 'lint_file': 1, +\}) diff --git a/sources_non_forked/ale/ale_linters/cpp/cppcheck.vim b/sources_non_forked/ale/ale_linters/cpp/cppcheck.vim new file mode 100644 index 00000000..8b2aa802 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/cpp/cppcheck.vim @@ -0,0 +1,39 @@ +" Author: Bart Libert +" 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#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'cpp_cppcheck_executable') +endfunction + +function! ale_linters#cpp#cppcheck#GetCommand(buffer) abort + " Search upwards from the file for compile_commands.json. + " + " If we find it, we'll `cd` to where the compile_commands.json file is, + " then use the file to set up import paths, etc. + let l:compile_commmands_path = ale#path#FindNearestFile(a:buffer, 'compile_commands.json') + + let l:cd_command = !empty(l:compile_commmands_path) + \ ? ale#path#CdString(fnamemodify(l:compile_commmands_path, ':h')) + \ : '' + let l:compile_commands_option = !empty(l:compile_commmands_path) + \ ? '--project=compile_commands.json ' + \ : '' + + return l:cd_command + \ . ale#Escape(ale_linters#cpp#cppcheck#GetExecutable(a:buffer)) + \ . ' -q --language=c++ ' + \ . l:compile_commands_option + \ . ale#Var(a:buffer, 'cpp_cppcheck_options') + \ . ' %t' +endfunction + +call ale#linter#Define('cpp', { +\ 'name': 'cppcheck', +\ 'output_stream': 'both', +\ 'executable_callback': 'ale_linters#cpp#cppcheck#GetExecutable', +\ 'command_callback': 'ale_linters#cpp#cppcheck#GetCommand', +\ 'callback': 'ale#handlers#cppcheck#HandleCppCheckFormat', +\}) diff --git a/sources_non_forked/ale/ale_linters/cpp/cpplint.vim b/sources_non_forked/ale/ale_linters/cpp/cpplint.vim new file mode 100644 index 00000000..346ac815 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/cpp/cpplint.vim @@ -0,0 +1,26 @@ +" 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#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'cpp_cpplint_executable') +endfunction + +function! ale_linters#cpp#cpplint#GetCommand(buffer) abort + let l:options = ale#Var(a:buffer, 'cpp_cpplint_options') + + return ale#Escape(ale_linters#cpp#cpplint#GetExecutable(a:buffer)) + \ . (!empty(l:options) ? ' ' . l:options : '') + \ . ' %s' +endfunction + +call ale#linter#Define('cpp', { +\ 'name': 'cpplint', +\ 'output_stream': 'stderr', +\ 'executable_callback': 'ale_linters#cpp#cpplint#GetExecutable', +\ 'command_callback': 'ale_linters#cpp#cpplint#GetCommand', +\ 'callback': 'ale#handlers#cpplint#HandleCppLintFormat', +\ 'lint_file': 1, +\}) diff --git a/sources_non_forked/ale/ale_linters/cpp/flawfinder.vim b/sources_non_forked/ale/ale_linters/cpp/flawfinder.vim new file mode 100644 index 00000000..c63ecb38 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/cpp/flawfinder.vim @@ -0,0 +1,30 @@ +" Author: Christian Gibbons +" 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) + +function! ale_linters#cpp#flawfinder#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'cpp_flawfinder_executable') +endfunction + +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 ale#Escape(ale_linters#cpp#flawfinder#GetExecutable(a:buffer)) + \ . ' -CDQS' + \ . ale#Var(a:buffer, 'cpp_flawfinder_options') + \ . l:minlevel + \ . ' %t' +endfunction + +call ale#linter#Define('cpp', { +\ 'name': 'flawfinder', +\ 'output_stream': 'stdout', +\ 'executable_callback': 'ale_linters#cpp#flawfinder#GetExecutable', +\ 'command_callback': 'ale_linters#cpp#flawfinder#GetCommand', +\ 'callback': 'ale#handlers#flawfinder#HandleFlawfinderFormat', +\}) diff --git a/sources_non_forked/ale/ale_linters/cpp/gcc.vim b/sources_non_forked/ale/ale_linters/cpp/gcc.vim new file mode 100644 index 00000000..577c9f79 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/cpp/gcc.vim @@ -0,0 +1,32 @@ +" Author: geam +" 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#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'cpp_gcc_executable') +endfunction + +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. + 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') . ' -' +endfunction + +call ale#linter#Define('cpp', { +\ 'name': 'g++', +\ 'output_stream': 'stderr', +\ 'executable_callback': 'ale_linters#cpp#gcc#GetExecutable', +\ 'command_chain': [ +\ {'callback': 'ale#c#GetMakeCommand', 'output_stream': 'stdout'}, +\ {'callback': 'ale_linters#cpp#gcc#GetCommand'}, +\ ], +\ 'callback': 'ale#handlers#gcc#HandleGCCFormat', +\}) diff --git a/sources_non_forked/ale/ale_linters/crystal/crystal.vim b/sources_non_forked/ale/ale_linters/crystal/crystal.vim new file mode 100644 index 00000000..81579d63 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/crystal/crystal.vim @@ -0,0 +1,31 @@ +" Author: Jordan Andree , David Alexander +" 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_callback': 'ale_linters#crystal#crystal#GetCommand', +\ 'callback': 'ale_linters#crystal#crystal#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/cs/mcs.vim b/sources_non_forked/ale/ale_linters/cs/mcs.vim new file mode 100644 index 00000000..b5c4054a --- /dev/null +++ b/sources_non_forked/ale/ale_linters/cs/mcs.vim @@ -0,0 +1,33 @@ +let g:ale_cs_mcs_options = get(g:, 'ale_cs_mcs_options', '') + +function! ale_linters#cs#mcs#GetCommand(buffer) abort + return 'mcs -unsafe --parse ' . ale#Var(a:buffer, 'cs_mcs_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_callback': 'ale_linters#cs#mcs#GetCommand', +\ 'callback': 'ale_linters#cs#mcs#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/cs/mcsc.vim b/sources_non_forked/ale/ale_linters/cs/mcsc.vim new file mode 100644 index 00000000..8a78d3b3 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/cs/mcsc.vim @@ -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 + let l:out = tempname() + call ale#engine#ManageFile(a:buffer, l:out) + + " 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#Var(a:buffer, 'cs_mcsc_options') + \ . ' ' . l:lib_option + \ . ' ' . 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_callback': 'ale_linters#cs#mcsc#GetCommand', +\ 'callback': 'ale_linters#cs#mcsc#Handle', +\ 'lint_file': 1 +\}) diff --git a/sources_non_forked/ale/ale_linters/css/csslint.vim b/sources_non_forked/ale/ale_linters/css/csslint.vim new file mode 100644 index 00000000..98b7fdd4 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/css/csslint.vim @@ -0,0 +1,18 @@ +" Author: w0rp +" 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_callback': 'ale_linters#css#csslint#GetCommand', +\ 'callback': 'ale#handlers#css#HandleCSSLintFormat', +\}) diff --git a/sources_non_forked/ale/ale_linters/css/stylelint.vim b/sources_non_forked/ale/ale_linters/css/stylelint.vim new file mode 100644 index 00000000..9f683190 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/css/stylelint.vim @@ -0,0 +1,24 @@ +" Author: diartyz + +call ale#Set('css_stylelint_executable', 'stylelint') +call ale#Set('css_stylelint_options', '') +call ale#Set('css_stylelint_use_global', 0) + +function! ale_linters#css#stylelint#GetExecutable(buffer) abort + return ale#node#FindExecutable(a:buffer, 'css_stylelint', [ + \ 'node_modules/.bin/stylelint', + \]) +endfunction + +function! ale_linters#css#stylelint#GetCommand(buffer) abort + return ale_linters#css#stylelint#GetExecutable(a:buffer) + \ . ' ' . ale#Var(a:buffer, 'css_stylelint_options') + \ . ' --stdin-filename %s' +endfunction + +call ale#linter#Define('css', { +\ 'name': 'stylelint', +\ 'executable_callback': 'ale_linters#css#stylelint#GetExecutable', +\ 'command_callback': 'ale_linters#css#stylelint#GetCommand', +\ 'callback': 'ale#handlers#css#HandleStyleLintFormat', +\}) diff --git a/sources_non_forked/ale/ale_linters/cuda/nvcc.vim b/sources_non_forked/ale/ale_linters/cuda/nvcc.vim new file mode 100644 index 00000000..7aaa5cc3 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/cuda/nvcc.vim @@ -0,0 +1,56 @@ +" Author: blahgeek +" 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#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'cuda_nvcc_executable') +endfunction + +function! ale_linters#cuda#nvcc#GetCommand(buffer) abort + " Unused: use ale#util#nul_file + " let l:output_file = tempname() . '.ii' + " call ale#engine#ManageFile(a:buffer, l:output_file) + + return ale#Escape(ale_linters#cuda#nvcc#GetExecutable(a:buffer)) + \ . ' -cuda ' + \ . ale#c#IncludeOptions(ale#c#FindLocalHeaderPaths(a:buffer)) + \ . 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_callback': 'ale_linters#cuda#nvcc#GetExecutable', +\ 'command_callback': 'ale_linters#cuda#nvcc#GetCommand', +\ 'callback': 'ale_linters#cuda#nvcc#HandleNVCCFormat', +\ 'lint_file': 1, +\}) diff --git a/sources_non_forked/ale/ale_linters/d/dmd.vim b/sources_non_forked/ale/ale_linters/d/dmd.vim new file mode 100644 index 00000000..b91238ae --- /dev/null +++ b/sources_non_forked/ale/ale_linters/d/dmd.vim @@ -0,0 +1,79 @@ +" Author: w0rp +" Description: "dmd for D files" + +function! s:FindDUBConfig(buffer) abort + " Find a DUB configuration file in ancestor paths. + " The most DUB-specific names will be tried first. + for l:possible_filename in ['dub.sdl', 'dub.json', 'package.json'] + let l:dub_file = ale#path#FindNearestFile(a:buffer, l:possible_filename) + + if !empty(l:dub_file) + return l:dub_file + endif + endfor + + return '' +endfunction + +function! ale_linters#d#dmd#DUBCommand(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 = s: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#DMDCommand(buffer, dub_output) 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- -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_chain': [ +\ {'callback': 'ale_linters#d#dmd#DUBCommand', 'output_stream': 'stdout'}, +\ {'callback': 'ale_linters#d#dmd#DMDCommand', 'output_stream': 'stderr'}, +\ ], +\ 'callback': 'ale_linters#d#dmd#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/dafny/dafny.vim b/sources_non_forked/ale/ale_linters/dafny/dafny.vim new file mode 100644 index 00000000..8bbf1b13 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/dafny/dafny.vim @@ -0,0 +1,25 @@ +" Author: Taylor Blau + +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, +\ }) diff --git a/sources_non_forked/ale/ale_linters/dart/dartanalyzer.vim b/sources_non_forked/ale/ale_linters/dart/dartanalyzer.vim new file mode 100644 index 00000000..ef33c9d4 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/dart/dartanalyzer.vim @@ -0,0 +1,41 @@ +" Author: w0rp +" Description: Check Dart files with dartanalyzer + +call ale#Set('dart_dartanalyzer_executable', 'dartanalyzer') + +function! ale_linters#dart#dartanalyzer#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'dart_dartanalyzer_executable') +endfunction + +function! ale_linters#dart#dartanalyzer#GetCommand(buffer) abort + let l:executable = ale_linters#dart#dartanalyzer#GetExecutable(a:buffer) + let l:path = ale#path#FindNearestFile(a:buffer, '.packages') + + return ale#Escape(l:executable) + \ . (!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_callback': 'ale_linters#dart#dartanalyzer#GetExecutable', +\ 'command_callback': 'ale_linters#dart#dartanalyzer#GetCommand', +\ 'callback': 'ale_linters#dart#dartanalyzer#Handle', +\ 'lint_file': 1, +\}) diff --git a/sources_non_forked/ale/ale_linters/dart/language_server.vim b/sources_non_forked/ale/ale_linters/dart/language_server.vim new file mode 100644 index 00000000..15c77017 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/dart/language_server.vim @@ -0,0 +1,30 @@ +" Author: aurieh +" Description: A language server for dart + +call ale#Set('dart_language_server_executable', 'dart_language_server') + +function! ale_linters#dart#language_server#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'dart_language_server_executable') +endfunction + +function! ale_linters#dart#language_server#GetLanguage(buffer) abort + return 'dart' +endfunction + +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_callback': 'ale_linters#dart#language_server#GetExecutable', +\ 'command_callback': 'ale_linters#dart#language_server#GetExecutable', +\ 'language_callback': 'ale_linters#dart#language_server#GetLanguage', +\ 'project_root_callback': 'ale_linters#dart#language_server#GetProjectRoot', +\}) + diff --git a/sources_non_forked/ale/ale_linters/dockerfile/hadolint.vim b/sources_non_forked/ale/ale_linters/dockerfile/hadolint.vim new file mode 100644 index 00000000..7772afbd --- /dev/null +++ b/sources_non_forked/ale/ale_linters/dockerfile/hadolint.vim @@ -0,0 +1,97 @@ +" 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_callback': 'ale_linters#dockerfile#hadolint#GetExecutable', +\ 'command_callback': 'ale_linters#dockerfile#hadolint#GetCommand', +\ 'callback': 'ale_linters#dockerfile#hadolint#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/elixir/credo.vim b/sources_non_forked/ale/ale_linters/elixir/credo.vim new file mode 100644 index 00000000..af2ff48a --- /dev/null +++ b/sources_non_forked/ale/ale_linters/elixir/credo.vim @@ -0,0 +1,37 @@ +" 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] + + 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 + +call ale#linter#Define('elixir', { +\ 'name': 'credo', +\ 'executable': 'mix', +\ 'command': 'mix help credo && mix credo suggest --format=flycheck --read-from-stdin %s', +\ 'callback': 'ale_linters#elixir#credo#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/elixir/dialyxir.vim b/sources_non_forked/ale/ale_linters/elixir/dialyxir.vim new file mode 100644 index 00000000..5ef3a047 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/elixir/dialyxir.vim @@ -0,0 +1,34 @@ +" 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 + +call ale#linter#Define('elixir', { +\ 'name': 'dialyxir', +\ 'executable': 'mix', +\ 'command': 'mix dialyzer', +\ 'callback': 'ale_linters#elixir#dialyxir#Handle', +\}) + diff --git a/sources_non_forked/ale/ale_linters/elixir/dogma.vim b/sources_non_forked/ale/ale_linters/elixir/dogma.vim new file mode 100644 index 00000000..71cf4f4c --- /dev/null +++ b/sources_non_forked/ale/ale_linters/elixir/dogma.vim @@ -0,0 +1,38 @@ +" 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 + +call ale#linter#Define('elixir', { +\ 'name': 'dogma', +\ 'executable': 'mix', +\ 'command': 'mix help dogma && mix dogma %s --format=flycheck', +\ 'lint_file': 1, +\ 'callback': 'ale_linters#elixir#dogma#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/elm/make.vim b/sources_non_forked/ale/ale_linters/elm/make.vim new file mode 100644 index 00000000..3783b5e3 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/elm/make.vim @@ -0,0 +1,89 @@ +" Author: buffalocoder - https://github.com/buffalocoder, soywod - https://github.com/soywod +" Description: Elm linting in Ale. Closely follows the Syntastic checker in https://github.com/ElmCast/elm-vim. + +call ale#Set('elm_make_executable', 'elm-make') +call ale#Set('elm_make_use_global', 0) + +function! ale_linters#elm#make#GetExecutable(buffer) abort + return ale#node#FindExecutable(a:buffer, 'elm_make', [ + \ 'node_modules/.bin/elm-make', + \]) +endfunction + +function! ale_linters#elm#make#Handle(buffer, lines) abort + let l:output = [] + let l:is_windows = has('win32') + let l:temp_dir = l:is_windows ? $TMP : $TMPDIR + let l:unparsed_lines = [] + for l:line in a:lines + if l:line[0] is# '[' + let l:errors = json_decode(l:line) + + for l:error in l:errors + " Check if file is from the temp directory. + " Filters out any errors not related to the buffer. + if l:is_windows + let l:file_is_buffer = l:error.file[0:len(l:temp_dir) - 1] is? l:temp_dir + else + let l:file_is_buffer = l:error.file[0:len(l:temp_dir) - 1] is# l:temp_dir + endif + + if l:file_is_buffer + call add(l: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 + \}) + endif + endfor + 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 + +" 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:elm_package = ale#path#FindNearestFile(a:buffer, 'elm-package.json') + let l:elm_exe = ale_linters#elm#make#GetExecutable(a:buffer) + if empty(l:elm_package) + let l:dir_set_cmd = '' + else + let l:root_dir = fnamemodify(l:elm_package, ':p:h') + let l:dir_set_cmd = 'cd ' . ale#Escape(l:root_dir) . ' && ' + endif + + " The elm-make 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. It does not use NUL on Windows. + " Source: https://github.com/elm-lang/elm-make/blob/master/src/Flags.hs + let l:elm_cmd = ale#Escape(l:elm_exe) + \ . ' --report=json' + \ . ' --output=/dev/null' + + return l:dir_set_cmd . ' ' . l:elm_cmd . ' %t' +endfunction + +call ale#linter#Define('elm', { +\ 'name': 'make', +\ 'executable_callback': 'ale_linters#elm#make#GetExecutable', +\ 'output_stream': 'both', +\ 'command_callback': 'ale_linters#elm#make#GetCommand', +\ 'callback': 'ale_linters#elm#make#Handle' +\}) diff --git a/sources_non_forked/ale/ale_linters/erlang/erlc.vim b/sources_non_forked/ale/ale_linters/erlang/erlc.vim new file mode 100644 index 00000000..bddb175d --- /dev/null +++ b/sources_non_forked/ale/ale_linters/erlang/erlc.vim @@ -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 = tempname() + call ale#engine#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_callback': 'ale_linters#erlang#erlc#GetCommand', +\ 'callback': 'ale_linters#erlang#erlc#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/erlang/syntaxerl.vim b/sources_non_forked/ale/ale_linters/erlang/syntaxerl.vim new file mode 100644 index 00000000..46ecdcb7 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/erlang/syntaxerl.vim @@ -0,0 +1,53 @@ +" Author: Dmitri Vereshchagin +" Description: SyntaxErl linter for Erlang files + +call ale#Set('erlang_syntaxerl_executable', 'syntaxerl') + + +function! ale_linters#erlang#syntaxerl#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'erlang_syntaxerl_executable') +endfunction + + +function! ale_linters#erlang#syntaxerl#FeatureCheck(buffer) abort + return s:GetEscapedExecutable(a:buffer) . ' -h' +endfunction + + +function! ale_linters#erlang#syntaxerl#GetCommand(buffer, output) abort + let l:use_b_option = match(a:output, '\C\V-b, --base\>') > -1 + + return s:GetEscapedExecutable(a:buffer) . (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 + + +function! s:GetEscapedExecutable(buffer) abort + return ale#Escape(ale_linters#erlang#syntaxerl#GetExecutable(a:buffer)) +endfunction + + +call ale#linter#Define('erlang', { +\ 'name': 'syntaxerl', +\ 'executable_callback': 'ale_linters#erlang#syntaxerl#GetExecutable', +\ 'command_chain': [ +\ {'callback': 'ale_linters#erlang#syntaxerl#FeatureCheck'}, +\ {'callback': 'ale_linters#erlang#syntaxerl#GetCommand'}, +\ ], +\ 'callback': 'ale_linters#erlang#syntaxerl#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/eruby/erb.vim b/sources_non_forked/ale/ale_linters/eruby/erb.vim new file mode 100644 index 00000000..61d97032 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/eruby/erb.vim @@ -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_callback': 'ale_linters#eruby#erb#GetCommand', +\ 'callback': 'ale#handlers#ruby#HandleSyntaxErrors', +\}) + diff --git a/sources_non_forked/ale/ale_linters/eruby/erubi.vim b/sources_non_forked/ale/ale_linters/eruby/erubi.vim new file mode 100644 index 00000000..6f2d3ac6 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/eruby/erubi.vim @@ -0,0 +1,35 @@ +" Author: Eddie Lebow https://github.com/elebow +" Description: eruby checker using `erubi` + +function! ale_linters#eruby#erubi#CheckErubi(buffer) abort + return 'ruby -r erubi/capture_end -e ' . ale#Escape('""') +endfunction + +function! ale_linters#eruby#erubi#GetCommand(buffer, check_erubi_output) abort + let l:rails_root = ale#ruby#FindRailsRoot(a:buffer) + + if (!empty(a:check_erubi_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_chain': [ +\ {'callback': 'ale_linters#eruby#erubi#CheckErubi'}, +\ {'callback': 'ale_linters#eruby#erubi#GetCommand', 'output_stream': 'stderr'}, +\ ], +\ 'callback': 'ale#handlers#ruby#HandleSyntaxErrors', +\}) diff --git a/sources_non_forked/ale/ale_linters/eruby/erubis.vim b/sources_non_forked/ale/ale_linters/eruby/erubis.vim new file mode 100644 index 00000000..1ebd4a05 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/eruby/erubis.vim @@ -0,0 +1,23 @@ +" Author: Jake Zimmerman , 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_callback': 'ale_linters#eruby#erubis#GetCommand', +\ 'callback': 'ale#handlers#ruby#HandleSyntaxErrors', +\}) diff --git a/sources_non_forked/ale/ale_linters/fish/fish.vim b/sources_non_forked/ale/ale_linters/fish/fish.vim new file mode 100644 index 00000000..87ede29a --- /dev/null +++ b/sources_non_forked/ale/ale_linters/fish/fish.vim @@ -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', +\}) diff --git a/sources_non_forked/ale/ale_linters/fortran/gcc.vim b/sources_non_forked/ale/ale_linters/fortran/gcc.vim new file mode 100644 index 00000000..5f2ac018 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/fortran/gcc.vim @@ -0,0 +1,86 @@ +" Author: w0rp +" Description: gcc for Fortran files + +" This option can be set to 0 to use -ffixed-form +if !exists('g:ale_fortran_gcc_use_free_form') + let g:ale_fortran_gcc_use_free_form = 1 +endif + +if !exists('g:ale_fortran_gcc_executable') + let g:ale_fortran_gcc_executable = 'gcc' +endif + +" Set this option to change the GCC options for warnings for Fortran. +if !exists('g:ale_fortran_gcc_options') + let g:ale_fortran_gcc_options = '-Wall' +endif + +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#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'fortran_gcc_executable') +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 ale_linters#fortran#gcc#GetExecutable(a:buffer) + \ . ' -S -x f95 -fsyntax-only ' + \ . l:layout_option . ' ' + \ . ale#Var(a:buffer, 'fortran_gcc_options') . ' ' + \ . '-' +endfunction + +call ale#linter#Define('fortran', { +\ 'name': 'gcc', +\ 'output_stream': 'stderr', +\ 'executable_callback': 'ale_linters#fortran#gcc#GetExecutable', +\ 'command_callback': 'ale_linters#fortran#gcc#GetCommand', +\ 'callback': 'ale_linters#fortran#gcc#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/fountain/proselint.vim b/sources_non_forked/ale/ale_linters/fountain/proselint.vim new file mode 100644 index 00000000..353a2e5f --- /dev/null +++ b/sources_non_forked/ale/ale_linters/fountain/proselint.vim @@ -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', +\}) diff --git a/sources_non_forked/ale/ale_linters/fuse/fusionlint.vim b/sources_non_forked/ale/ale_linters/fuse/fusionlint.vim new file mode 100644 index 00000000..968e801b --- /dev/null +++ b/sources_non_forked/ale/ale_linters/fuse/fusionlint.vim @@ -0,0 +1,41 @@ +" Author: RyanSquared +" Description: `fusion-lint` linter for FusionScript files + +let g:ale_fuse_fusionlint_executable = +\ get(g:, 'ale_fuse_fusionlint_executable', 'fusion-lint') + +let g:ale_fuse_fusionlint_options = +\ get(g:, 'ale_fuse_fusionlint_options', '') + +function! ale_linters#fuse#fusionlint#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'fuse_fusionlint_executable') +endfunction + +function! ale_linters#fuse#fusionlint#GetCommand(buffer) abort + return ale#Escape(ale_linters#fuse#fusionlint#GetExecutable(a:buffer)) + \ . ' ' . 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_callback': 'ale_linters#fuse#fusionlint#GetExecutable', +\ 'command_callback': 'ale_linters#fuse#fusionlint#GetCommand', +\ 'callback': 'ale_linters#fuse#fusionlint#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/gitcommit/gitlint.vim b/sources_non_forked/ale/ale_linters/gitcommit/gitlint.vim new file mode 100644 index 00000000..49aeda7c --- /dev/null +++ b/sources_non_forked/ale/ale_linters/gitcommit/gitlint.vim @@ -0,0 +1,52 @@ +" Author: Nick Yamane +" Description: gitlint for git commit message files + +let g:ale_gitcommit_gitlint_executable = +\ get(g:, 'ale_gitcommit_gitlint_executable', 'gitlint') +let g:ale_gitcommit_gitlint_options = get(g:, 'ale_gitcommit_gitlint_options', '') +let g:ale_gitcommit_gitlint_use_global = get(g:, 'ale_gitcommit_gitlint_use_global', 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') + let l:executable = ale_linters#gitcommit#gitlint#GetExecutable(a:buffer) + return ale#Escape(l:executable) + \ . (!empty(l:options) ? ' ' . 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] + + 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_callback': 'ale_linters#gitcommit#gitlint#GetExecutable', +\ 'command_callback': 'ale_linters#gitcommit#gitlint#GetCommand', +\ 'callback': 'ale_linters#gitcommit#gitlint#Handle', +\}) + diff --git a/sources_non_forked/ale/ale_linters/glsl/glslang.vim b/sources_non_forked/ale/ale_linters/glsl/glslang.vim new file mode 100644 index 00000000..21a03ee2 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/glsl/glslang.vim @@ -0,0 +1,46 @@ +" Author: Sven-Hendrik Haase +" Description: glslang-based linter for glsl files +" +" TODO: Once https://github.com/KhronosGroup/glslang/pull/1047 is accepted, +" we can use stdin. + +let g:ale_glsl_glslang_executable = +\ get(g:, 'ale_glsl_glslang_executable', 'glslangValidator') + +let g:ale_glsl_glslang_options = get(g:, 'ale_glsl_glslang_options', '') + +function! ale_linters#glsl#glslang#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'glsl_glslang_executable') +endfunction + +function! ale_linters#glsl#glslang#GetCommand(buffer) abort + return ale_linters#glsl#glslang#GetExecutable(a:buffer) + \ . ' ' . 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_callback': 'ale_linters#glsl#glslang#GetExecutable', +\ 'command_callback': 'ale_linters#glsl#glslang#GetCommand', +\ 'callback': 'ale_linters#glsl#glslang#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/glsl/glslls.vim b/sources_non_forked/ale/ale_linters/glsl/glslls.vim new file mode 100644 index 00000000..67ea379c --- /dev/null +++ b/sources_non_forked/ale/ale_linters/glsl/glslls.vim @@ -0,0 +1,38 @@ +" Author: Sven-Hendrik Haase +" Description: A language server for glsl + +call ale#Set('glsl_glslls_executable', 'glslls') +call ale#Set('glsl_glslls_logfile', '') + +function! ale_linters#glsl#glslls#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'glsl_glslls_executable') +endfunction + +function! ale_linters#glsl#glslls#GetCommand(buffer) abort + let l:executable = ale_linters#glsl#glslls#GetExecutable(a:buffer) + 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 ale#Escape(l:executable) . l:logfile_args . ' --stdin' +endfunction + +function! ale_linters#glsl#glslls#GetLanguage(buffer) abort + return 'glsl' +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_callback': 'ale_linters#glsl#glslls#GetExecutable', +\ 'command_callback': 'ale_linters#glsl#glslls#GetCommand', +\ 'language_callback': 'ale_linters#glsl#glslls#GetLanguage', +\ 'project_root_callback': 'ale_linters#glsl#glslls#GetProjectRoot', +\}) diff --git a/sources_non_forked/ale/ale_linters/go/gobuild.vim b/sources_non_forked/ale/ale_linters/go/gobuild.vim new file mode 100644 index 00000000..068877a3 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/go/gobuild.vim @@ -0,0 +1,81 @@ +" Author: Joshua Rubin , Ben Reedy , +" Jeff Willette +" Description: go build for Go files +" inspired by work from dzhou121 + +call ale#Set('go_gobuild_options', '') + +function! ale_linters#go#gobuild#ResetEnv() abort + unlet! s:go_env +endfunction + +function! ale_linters#go#gobuild#GoEnv(buffer) abort + if exists('s:go_env') + return '' + endif + + return 'go env GOPATH GOROOT' +endfunction + +function! ale_linters#go#gobuild#GetCommand(buffer, goenv_output) abort + let l:options = ale#Var(a:buffer, 'go_gobuild_options') + + if !exists('s:go_env') + let s:go_env = { + \ 'GOPATH': a:goenv_output[0], + \ 'GOROOT': a:goenv_output[1], + \} + endif + + let l:gopath_env_command = has('win32') + \ ? 'set GOPATH=' . ale#Escape(s:go_env.GOPATH) . ' && ' + \ : 'GOPATH=' . ale#Escape(s:go_env.GOPATH) . ' ' + + " Run go test in local directory with relative path + return l:gopath_env_command + \ . ale#path#BufferCdString(a:buffer) + \ . 'go 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': 'go build', +\ 'executable': 'go', +\ 'command_chain': [ +\ {'callback': 'ale_linters#go#gobuild#GoEnv', 'output_stream': 'stdout'}, +\ {'callback': 'ale_linters#go#gobuild#GetCommand', 'output_stream': 'stderr'}, +\ ], +\ 'callback': 'ale_linters#go#gobuild#Handler', +\ 'lint_file': 1, +\}) diff --git a/sources_non_forked/ale/ale_linters/go/gofmt.vim b/sources_non_forked/ale/ale_linters/go/gofmt.vim new file mode 100644 index 00000000..337deef8 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/go/gofmt.vim @@ -0,0 +1,10 @@ +" Author: neersighted +" 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', +\}) diff --git a/sources_non_forked/ale/ale_linters/go/golint.vim b/sources_non_forked/ale/ale_linters/go/golint.vim new file mode 100644 index 00000000..d580fda2 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/go/golint.vim @@ -0,0 +1,10 @@ +" Author: neersighted +" Description: golint for Go files + +call ale#linter#Define('go', { +\ 'name': 'golint', +\ 'output_stream': 'both', +\ 'executable': 'golint', +\ 'command': 'golint %t', +\ 'callback': 'ale#handlers#unix#HandleAsWarning', +\}) diff --git a/sources_non_forked/ale/ale_linters/go/gometalinter.vim b/sources_non_forked/ale/ale_linters/go/gometalinter.vim new file mode 100644 index 00000000..375a8b0f --- /dev/null +++ b/sources_non_forked/ale/ale_linters/go/gometalinter.vim @@ -0,0 +1,62 @@ +" Author: Ben Reedy , Jeff Willette +" 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#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'go_gometalinter_executable') +endfunction + +function! ale_linters#go#gometalinter#GetCommand(buffer) abort + let l:executable = ale_linters#go#gometalinter#GetExecutable(a:buffer) + 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) + \ . ale#Escape(l:executable) + \ . (!empty(l:options) ? ' ' . l:options : '') . ' .' + endif + + return ale#path#BufferCdString(a:buffer) + \ . ale#Escape(l:executable) + \ . ' --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_callback': 'ale_linters#go#gometalinter#GetExecutable', +\ 'command_callback': 'ale_linters#go#gometalinter#GetCommand', +\ 'callback': 'ale_linters#go#gometalinter#Handler', +\ 'lint_file': 1, +\}) diff --git a/sources_non_forked/ale/ale_linters/go/gosimple.vim b/sources_non_forked/ale/ale_linters/go/gosimple.vim new file mode 100644 index 00000000..dbdc3fcf --- /dev/null +++ b/sources_non_forked/ale/ale_linters/go/gosimple.vim @@ -0,0 +1,15 @@ +" Author: Ben Reedy +" 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_callback': 'ale_linters#go#gosimple#GetCommand', +\ 'callback': 'ale#handlers#go#Handler', +\ 'output_stream': 'both', +\ 'lint_file': 1, +\}) diff --git a/sources_non_forked/ale/ale_linters/go/gotype.vim b/sources_non_forked/ale/ale_linters/go/gotype.vim new file mode 100644 index 00000000..f4bb274e --- /dev/null +++ b/sources_non_forked/ale/ale_linters/go/gotype.vim @@ -0,0 +1,20 @@ +" Author: Jelte Fennema +" 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 .' +endfunction + +call ale#linter#Define('go', { +\ 'name': 'gotype', +\ 'output_stream': 'stderr', +\ 'executable': 'gotype', +\ 'command_callback': 'ale_linters#go#gotype#GetCommand', +\ 'callback': 'ale#handlers#go#Handler', +\ 'lint_file': 1, +\}) diff --git a/sources_non_forked/ale/ale_linters/go/govet.vim b/sources_non_forked/ale/ale_linters/go/govet.vim new file mode 100644 index 00000000..edf9eb66 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/go/govet.vim @@ -0,0 +1,18 @@ +" Author: neersighted +" Description: go vet for Go files +" +" Author: John Eikenberry +" Description: updated to work with go1.10 + +function! ale_linters#go#govet#GetCommand(buffer) abort + return ale#path#BufferCdString(a:buffer) . ' go vet .' +endfunction + +call ale#linter#Define('go', { +\ 'name': 'go vet', +\ 'output_stream': 'stderr', +\ 'executable': 'go', +\ 'command_callback': 'ale_linters#go#govet#GetCommand', +\ 'callback': 'ale#handlers#go#Handler', +\ 'lint_file': 1, +\}) diff --git a/sources_non_forked/ale/ale_linters/go/staticcheck.vim b/sources_non_forked/ale/ale_linters/go/staticcheck.vim new file mode 100644 index 00000000..a3464015 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/go/staticcheck.vim @@ -0,0 +1,33 @@ +" Author: Ben Reedy +" 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_callback': 'ale_linters#go#staticcheck#GetCommand', +\ 'callback': 'ale#handlers#go#Handler', +\ 'output_stream': 'both', +\ 'lint_file': 1, +\}) diff --git a/sources_non_forked/ale/ale_linters/graphql/eslint.vim b/sources_non_forked/ale/ale_linters/graphql/eslint.vim new file mode 100644 index 00000000..dfcbf9d9 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/graphql/eslint.vim @@ -0,0 +1,9 @@ +" Author: Benjie Gillam +" Description: eslint for GraphQL files + +call ale#linter#Define('graphql', { +\ 'name': 'eslint', +\ 'executable_callback': 'ale#handlers#eslint#GetExecutable', +\ 'command_callback': 'ale#handlers#eslint#GetCommand', +\ 'callback': 'ale#handlers#eslint#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/graphql/gqlint.vim b/sources_non_forked/ale/ale_linters/graphql/gqlint.vim new file mode 100644 index 00000000..882cc697 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/graphql/gqlint.vim @@ -0,0 +1,9 @@ +" Author: Michiel Westerbeek +" Description: Linter for GraphQL Schemas + +call ale#linter#Define('graphql', { +\ 'name': 'gqlint', +\ 'executable': 'gqlint', +\ 'command': 'gqlint --reporter=simple %t', +\ 'callback': 'ale#handlers#unix#HandleAsWarning', +\}) diff --git a/sources_non_forked/ale/ale_linters/haml/hamllint.vim b/sources_non_forked/ale/ale_linters/haml/hamllint.vim new file mode 100644 index 00000000..d6633599 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/haml/hamllint.vim @@ -0,0 +1,51 @@ +" Author: Patrick Lewis - https://github.com/patricklewis, thenoseman - https://github.com/thenoseman +" Description: haml-lint for Haml files + +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 ale#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 . ' ' : '') + \ . 'haml-lint' + \ . (!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: + " :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': 'haml-lint', +\ 'command_callback': 'ale_linters#haml#hamllint#GetCommand', +\ 'callback': 'ale_linters#haml#hamllint#Handle' +\}) diff --git a/sources_non_forked/ale/ale_linters/handlebars/embertemplatelint.vim b/sources_non_forked/ale/ale_linters/handlebars/embertemplatelint.vim new file mode 100644 index 00000000..68ea7155 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/handlebars/embertemplatelint.vim @@ -0,0 +1,48 @@ +" Author: Adrian Zalewski +" Description: Ember-template-lint for checking Handlebars files + +call ale#Set('handlebars_embertemplatelint_executable', 'ember-template-lint') +call ale#Set('handlebars_embertemplatelint_use_global', 0) + +function! ale_linters#handlebars#embertemplatelint#GetExecutable(buffer) abort + return ale#node#FindExecutable(a:buffer, 'handlebars_embertemplatelint', [ + \ 'node_modules/.bin/ember-template-lint', + \]) +endfunction + +function! ale_linters#handlebars#embertemplatelint#GetCommand(buffer) abort + return ale_linters#handlebars#embertemplatelint#GetExecutable(a:buffer) + \ . ' --json %t' +endfunction + +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_callback': 'ale_linters#handlebars#embertemplatelint#GetExecutable', +\ 'command_callback': 'ale_linters#handlebars#embertemplatelint#GetCommand', +\ 'callback': 'ale_linters#handlebars#embertemplatelint#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/haskell/ghc-mod.vim b/sources_non_forked/ale/ale_linters/haskell/ghc-mod.vim new file mode 100644 index 00000000..1b15d8c2 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/haskell/ghc-mod.vim @@ -0,0 +1,16 @@ +" Author: wizzup +" Description: ghc-mod for Haskell files + +call ale#linter#Define('haskell', { +\ 'name': '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', +\ 'executable': 'stack', +\ 'command': 'stack exec ghc-mod -- --map-file %s=%t check %s', +\ 'callback': 'ale#handlers#haskell#HandleGHCFormat', +\}) diff --git a/sources_non_forked/ale/ale_linters/haskell/ghc.vim b/sources_non_forked/ale/ale_linters/haskell/ghc.vim new file mode 100644 index 00000000..daf91c8f --- /dev/null +++ b/sources_non_forked/ale/ale_linters/haskell/ghc.vim @@ -0,0 +1,18 @@ +" Author: w0rp +" 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_callback': 'ale_linters#haskell#ghc#GetCommand', +\ 'callback': 'ale#handlers#haskell#HandleGHCFormat', +\}) diff --git a/sources_non_forked/ale/ale_linters/haskell/hdevtools.vim b/sources_non_forked/ale/ale_linters/haskell/hdevtools.vim new file mode 100644 index 00000000..93c7ddd6 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/haskell/hdevtools.vim @@ -0,0 +1,22 @@ +" Author: rob-b, Takano Akio +" Description: hdevtools for Haskell files + +call ale#Set('haskell_hdevtools_executable', 'hdevtools') +call ale#Set('haskell_hdevtools_options', '-g -Wall') + +function! ale_linters#haskell#hdevtools#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'haskell_hdevtools_executable') +endfunction + +function! ale_linters#haskell#hdevtools#GetCommand(buffer) abort + return ale#Escape(ale_linters#haskell#hdevtools#GetExecutable(a:buffer)) + \ . ' check ' . ale#Var(a:buffer, 'haskell_hdevtools_options') + \ . ' -p %s %t' +endfunction + +call ale#linter#Define('haskell', { +\ 'name': 'hdevtools', +\ 'executable_callback': 'ale_linters#haskell#hdevtools#GetExecutable', +\ 'command_callback': 'ale_linters#haskell#hdevtools#GetCommand', +\ 'callback': 'ale#handlers#haskell#HandleGHCFormat', +\}) diff --git a/sources_non_forked/ale/ale_linters/haskell/hlint.vim b/sources_non_forked/ale/ale_linters/haskell/hlint.vim new file mode 100644 index 00000000..be40d92c --- /dev/null +++ b/sources_non_forked/ale/ale_linters/haskell/hlint.vim @@ -0,0 +1,34 @@ +" Author: jparoz +" Description: hlint for Haskell files + +function! ale_linters#haskell#hlint#Handle(buffer, lines) abort + let l:output = [] + + for l:error in ale#util#FuzzyJSONDecode(a:lines, []) + if l:error.severity is# 'Error' + let l:type = 'E' + elseif l:error.severity is# 'Suggestion' + let l:type = 'I' + else + let l:type = 'W' + endif + + call add(l:output, { + \ 'lnum': str2nr(l:error.startLine), + \ 'col': str2nr(l:error.startColumn), + \ 'end_lnum': str2nr(l:error.endLine), + \ 'end_col': str2nr(l:error.endColumn), + \ 'text': l:error.severity . ': ' . l:error.hint . '. Found: ' . l:error.from . ' Why not: ' . l:error.to, + \ 'type': l:type, + \}) + endfor + + return l:output +endfunction + +call ale#linter#Define('haskell', { +\ 'name': 'hlint', +\ 'executable': 'hlint', +\ 'command': 'hlint --color=never --json -', +\ 'callback': 'ale_linters#haskell#hlint#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/haskell/stack_build.vim b/sources_non_forked/ale/ale_linters/haskell/stack_build.vim new file mode 100644 index 00000000..44e2e86f --- /dev/null +++ b/sources_non_forked/ale/ale_linters/haskell/stack_build.vim @@ -0,0 +1,22 @@ +" Author: Jake Zimmerman +" Description: Like stack-ghc, but for entire projects +" +" Note: Ideally, this would *only* typecheck. Right now, it also does codegen. +" See . + +call ale#Set('haskell_stack_build_options', '--fast') + +function! ale_linters#haskell#stack_build#GetCommand(buffer) abort + let l:flags = ale#Var(a:buffer, 'haskell_stack_build_options') + + return 'stack build ' . l:flags +endfunction + +call ale#linter#Define('haskell', { +\ 'name': 'stack-build', +\ 'output_stream': 'stderr', +\ 'executable': 'stack', +\ 'command_callback': 'ale_linters#haskell#stack_build#GetCommand', +\ 'lint_file': 1, +\ 'callback': 'ale#handlers#haskell#HandleGHCFormat', +\}) diff --git a/sources_non_forked/ale/ale_linters/haskell/stack_ghc.vim b/sources_non_forked/ale/ale_linters/haskell/stack_ghc.vim new file mode 100644 index 00000000..0367dc24 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/haskell/stack_ghc.vim @@ -0,0 +1,10 @@ +" Author: w0rp +" Description: ghc for Haskell files, using Stack + +call ale#linter#Define('haskell', { +\ 'name': 'stack-ghc', +\ 'output_stream': 'stderr', +\ 'executable': 'stack', +\ 'command': 'stack ghc -- -fno-code -v0 %t', +\ 'callback': 'ale#handlers#haskell#HandleGHCFormat', +\}) diff --git a/sources_non_forked/ale/ale_linters/help/alex.vim b/sources_non_forked/ale/ale_linters/help/alex.vim new file mode 100644 index 00000000..21b23b4f --- /dev/null +++ b/sources_non_forked/ale/ale_linters/help/alex.vim @@ -0,0 +1,11 @@ +" Author: Johannes Wienke +" Description: alex for help files + +call ale#linter#Define('help', { +\ 'name': 'alex', +\ 'executable': 'alex', +\ 'command': 'alex %s -t', +\ 'output_stream': 'stderr', +\ 'callback': 'ale#handlers#alex#Handle', +\ 'lint_file': 1, +\}) diff --git a/sources_non_forked/ale/ale_linters/help/proselint.vim b/sources_non_forked/ale/ale_linters/help/proselint.vim new file mode 100644 index 00000000..62124502 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/help/proselint.vim @@ -0,0 +1,9 @@ +" Author: Daniel M. Capella https://github.com/polyzen +" Description: proselint for Vim help files + +call ale#linter#Define('help', { +\ 'name': 'proselint', +\ 'executable': 'proselint', +\ 'command': 'proselint %t', +\ 'callback': 'ale#handlers#unix#HandleAsWarning', +\}) diff --git a/sources_non_forked/ale/ale_linters/help/write-good.vim b/sources_non_forked/ale/ale_linters/help/write-good.vim new file mode 100644 index 00000000..11254cd2 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/help/write-good.vim @@ -0,0 +1,9 @@ +" Author: Sumner Evans +" 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', +\}) diff --git a/sources_non_forked/ale/ale_linters/html/alex.vim b/sources_non_forked/ale/ale_linters/html/alex.vim new file mode 100644 index 00000000..5a1f61e9 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/html/alex.vim @@ -0,0 +1,11 @@ +" Author: Johannes Wienke +" Description: alex for HTML files + +call ale#linter#Define('html', { +\ 'name': 'alex', +\ 'executable': 'alex', +\ 'command': 'alex %s -t', +\ 'output_stream': 'stderr', +\ 'callback': 'ale#handlers#alex#Handle', +\ 'lint_file': 1, +\}) diff --git a/sources_non_forked/ale/ale_linters/html/htmlhint.vim b/sources_non_forked/ale/ale_linters/html/htmlhint.vim new file mode 100644 index 00000000..88a83f1d --- /dev/null +++ b/sources_non_forked/ale/ale_linters/html/htmlhint.vim @@ -0,0 +1,38 @@ +" Author: KabbAmine , deathmaz <00maz1987@gmail.com>, diartyz +" Description: HTMLHint for checking html files + +call ale#Set('html_htmlhint_options', '') +call ale#Set('html_htmlhint_executable', 'htmlhint') +call ale#Set('html_htmlhint_use_global', 0) + +function! ale_linters#html#htmlhint#GetExecutable(buffer) abort + return ale#node#FindExecutable(a:buffer, 'html_htmlhint', [ + \ 'node_modules/.bin/htmlhint', + \]) +endfunction + +function! ale_linters#html#htmlhint#GetCommand(buffer) abort + let l:options = ale#Var(a:buffer, 'html_htmlhint_options') + let l:config = l:options !~# '--config' + \ ? ale#path#FindNearestFile(a:buffer, '.htmlhintrc') + \ : '' + + if !empty(l:config) + let l:options .= ' --config ' . ale#Escape(l:config) + endif + + if !empty(l:options) + let l:options = substitute(l:options, '--format=unix', '', '') + endif + + return ale#Escape(ale_linters#html#htmlhint#GetExecutable(a:buffer)) + \ . (!empty(l:options) ? ' ' . l:options : '') + \ . ' --format=unix %t' +endfunction + +call ale#linter#Define('html', { +\ 'name': 'htmlhint', +\ 'executable_callback': 'ale_linters#html#htmlhint#GetExecutable', +\ 'command_callback': 'ale_linters#html#htmlhint#GetCommand', +\ 'callback': 'ale#handlers#unix#HandleAsError', +\}) diff --git a/sources_non_forked/ale/ale_linters/html/proselint.vim b/sources_non_forked/ale/ale_linters/html/proselint.vim new file mode 100644 index 00000000..9fd7d671 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/html/proselint.vim @@ -0,0 +1,9 @@ +" Author: Daniel M. Capella https://github.com/polyzen +" Description: proselint for HTML files + +call ale#linter#Define('html', { +\ 'name': 'proselint', +\ 'executable': 'proselint', +\ 'command': 'proselint %t', +\ 'callback': 'ale#handlers#unix#HandleAsWarning', +\}) diff --git a/sources_non_forked/ale/ale_linters/html/tidy.vim b/sources_non_forked/ale/ale_linters/html/tidy.vim new file mode 100644 index 00000000..34152c6b --- /dev/null +++ b/sources_non_forked/ale/ale_linters/html/tidy.vim @@ -0,0 +1,77 @@ +" Author: KabbAmine +" Description: This file adds support for checking HTML code with tidy. + +" CLI options +let g:ale_html_tidy_executable = get(g:, 'ale_html_tidy_executable', 'tidy') +" Look for the old _args variable first. +let s:default_options = get(g:, 'ale_html_tidy_args', '-q -e -language en') +let g:ale_html_tidy_options = get(g:, 'ale_html_tidy_options', s:default_options) + +function! ale_linters#html#tidy#GetCommand(buffer) abort + " Specify file encoding in options + " (Idea taken from https://github.com/scrooloose/syntastic/blob/master/syntax_checkers/html/tidy.vim) + let l:file_encoding = get({ + \ 'ascii': '-ascii', + \ 'big5': '-big5', + \ 'cp1252': '-win1252', + \ 'cp850': '-ibm858', + \ 'cp932': '-shiftjis', + \ 'iso-2022-jp': '-iso-2022', + \ 'latin1': '-latin1', + \ 'macroman': '-mac', + \ 'sjis': '-shiftjis', + \ 'utf-16le': '-utf16le', + \ 'utf-16': '-utf16', + \ 'utf-8': '-utf8', + \ }, &fileencoding, '-utf8') + + " On macOS, old tidy (released on 31 Oct 2006) is installed. It does not + " consider HTML5 so we should avoid it. + let l:executable = ale#Var(a:buffer, 'html_tidy_executable') + if has('mac') && l:executable is# 'tidy' && exists('*exepath') + \ && exepath(l:executable) is# '/usr/bin/tidy' + return '' + endif + + return printf('%s %s %s -', + \ l:executable, + \ ale#Var(a:buffer, 'html_tidy_options'), + \ l:file_encoding + \) +endfunction + +function! ale_linters#html#tidy#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'html_tidy_executable') +endfunction + +function! ale_linters#html#tidy#Handle(buffer, lines) abort + " Matches patterns lines like the following: + " line 7 column 5 - Warning: missing before + + let l:pattern = '^line \(\d\+\) column \(\d\+\) - \(Warning\|Error\): \(.\+\)$' + let l:output = [] + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + let l:line = l:match[1] + 0 + let l:col = l:match[2] + 0 + let l:type = l:match[3] is# 'Error' ? 'E' : 'W' + let l:text = l:match[4] + + call add(l:output, { + \ 'lnum': l:line, + \ 'col': l:col, + \ 'text': l:text, + \ 'type': l:type, + \}) + endfor + + return l:output +endfunction + +call ale#linter#Define('html', { +\ 'name': 'tidy', +\ 'executable_callback': 'ale_linters#html#tidy#GetExecutable', +\ 'output_stream': 'stderr', +\ 'command_callback': 'ale_linters#html#tidy#GetCommand', +\ 'callback': 'ale_linters#html#tidy#Handle', +\ }) diff --git a/sources_non_forked/ale/ale_linters/html/write-good.vim b/sources_non_forked/ale/ale_linters/html/write-good.vim new file mode 100644 index 00000000..9fae8821 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/html/write-good.vim @@ -0,0 +1,9 @@ +" Author: Sumner Evans +" Description: write-good for nroff 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', +\}) diff --git a/sources_non_forked/ale/ale_linters/idris/idris.vim b/sources_non_forked/ale/ale_linters/idris/idris.vim new file mode 100644 index 00000000..115d04fc --- /dev/null +++ b/sources_non_forked/ale/ale_linters/idris/idris.vim @@ -0,0 +1,87 @@ +" Author: Scott Bonds +" Description: default Idris compiler + +call ale#Set('idris_idris_executable', 'idris') +call ale#Set('idris_idris_options', '--total --warnpartial --warnreach --warnipkg') + +function! ale_linters#idris#idris#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'idris_idris_executable') +endfunction + +function! ale_linters#idris#idris#GetCommand(buffer) abort + let l:options = ale#Var(a:buffer, 'idris_idris_options') + + return ale#Escape(ale_linters#idris#idris#GetExecutable(a:buffer)) + \ . (!empty(l:options) ? ' ' . l:options : '') + \ . ' --check %s' +endfunction + +function! ale_linters#idris#idris#Handle(buffer, lines) abort + " This was copied almost verbatim from ale#handlers#haskell#HandleGHCFormat + + " Look for lines like the following: + " foo.idr:2:6:When checking right hand side of main with expected type + " bar.idr:11:11-13: + let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):(\d+)(-\d+)?:(.*)?$' + let l:output = [] + + let l:corrected_lines = [] + + for l:line in a:lines + if len(matchlist(l:line, l:pattern)) > 0 + call add(l:corrected_lines, l:line) + elseif len(l:corrected_lines) > 0 + if l:line is# '' + let l:corrected_lines[-1] .= ' ' " turn a blank line into a space + else + let l:corrected_lines[-1] .= l:line + endif + let l:corrected_lines[-1] = substitute(l:corrected_lines[-1], '\s\+', ' ', 'g') + endif + endfor + + for l:line in l:corrected_lines + let l:match = matchlist(l:line, l:pattern) + + if len(l:match) == 0 + continue + endif + + if !ale#path#IsBufferPath(a:buffer, l:match[1]) + continue + endif + + let l:errors = matchlist(l:match[5], '\v([wW]arning|[eE]rror) - ?(.*)') + + if len(l:errors) > 0 + let l:ghc_type = l:errors[1] + let l:text = l:errors[2] + else + let l:ghc_type = '' + let l:text = l:match[5][:0] is# ' ' ? l:match[5][1:] : l:match[5] + endif + + if l:ghc_type is? 'Warning' + let l:type = 'W' + else + let l:type = 'E' + endif + + call add(l:output, { + \ 'lnum': l:match[2] + 0, + \ 'col': l:match[3] + 0, + \ 'text': l:text, + \ 'type': l:type, + \}) + endfor + + return l:output +endfunction + +call ale#linter#Define('idris', { +\ 'name': 'idris', +\ 'executable_callback': 'ale_linters#idris#idris#GetExecutable', +\ 'command_callback': 'ale_linters#idris#idris#GetCommand', +\ 'callback': 'ale_linters#idris#idris#Handle', +\}) + diff --git a/sources_non_forked/ale/ale_linters/java/checkstyle.vim b/sources_non_forked/ale/ale_linters/java/checkstyle.vim new file mode 100644 index 00000000..8155170a --- /dev/null +++ b/sources_non_forked/ale/ale_linters/java/checkstyle.vim @@ -0,0 +1,36 @@ +" Author: Devon Meunier +" Description: checkstyle for Java files + +function! ale_linters#java#checkstyle#Handle(buffer, lines) abort + let l:pattern = '\v\[(WARN|ERROR)\] [a-zA-Z]?:?[^:]+:(\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? 'WARN' ? 'W' : 'E', + \ 'lnum': l:match[2] + 0, + \ 'col': l:match[3] + 0, + \ 'text': l:match[4], + \ 'code': l:match[5], + \}) + endfor + + return l:output +endfunction + +function! ale_linters#java#checkstyle#GetCommand(buffer) abort + return 'checkstyle ' + \ . ale#Var(a:buffer, 'java_checkstyle_options') + \ . ' %t' +endfunction + +if !exists('g:ale_java_checkstyle_options') + let g:ale_java_checkstyle_options = '-c /google_checks.xml' +endif + +call ale#linter#Define('java', { +\ 'name': 'checkstyle', +\ 'executable': 'checkstyle', +\ 'command_callback': 'ale_linters#java#checkstyle#GetCommand', +\ 'callback': 'ale_linters#java#checkstyle#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/java/javac.vim b/sources_non_forked/ale/ale_linters/java/javac.vim new file mode 100644 index 00000000..73e84147 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/java/javac.vim @@ -0,0 +1,128 @@ +" Author: farenjihn , w0rp +" Description: Lints java files using javac + +let s:classpath_sep = has('unix') ? ':' : ';' + +let g:ale_java_javac_options = get(g:, 'ale_java_javac_options', '') +let g:ale_java_javac_classpath = get(g:, 'ale_java_javac_classpath', '') + +function! ale_linters#java#javac#GetImportPaths(buffer) abort + let l:pom_path = ale#path#FindNearestFile(a:buffer, 'pom.xml') + + if !empty(l:pom_path) && executable('mvn') + return ale#path#CdString(fnamemodify(l:pom_path, ':h')) + \ . 'mvn dependency:build-classpath' + endif + + let l:classpath_command = ale#gradle#BuildClasspathCommand(a:buffer) + if !empty(l:classpath_command) + return l:classpath_command + endif + + return '' +endfunction + +function! s:BuildClassPathOption(buffer, import_paths) abort + " Filter out lines like [INFO], etc. + let l:class_paths = filter(a:import_paths[:], 'v:val !~# ''[''') + call extend( + \ l:class_paths, + \ split(ale#Var(a:buffer, 'java_javac_classpath'), s:classpath_sep), + \) + + return !empty(l:class_paths) + \ ? '-cp ' . ale#Escape(join(l:class_paths, s:classpath_sep)) + \ : '' +endfunction + +function! ale_linters#java#javac#GetCommand(buffer, import_paths) abort + let l:cp_option = s:BuildClassPathOption(a:buffer, a:import_paths) + let l:sp_option = '' + + " Find the src directory, for files in this project. + let l:src_dir = ale#path#FindNearestDirectory(a:buffer, 'src/main/java') + let l:sp_dirs = [] + + if !empty(l:src_dir) + call add(l:sp_dirs, l:src_dir) + + " Automatically include the jaxb directory too, if it's there. + let l:jaxb_dir = fnamemodify(l:src_dir, ':h:h') + \ . (has('win32') ? '\jaxb\' : '/jaxb/') + + if isdirectory(l:jaxb_dir) + call add(l:sp_dirs, l:jaxb_dir) + endif + + " Automatically include the test directory, but only for test code. + if expand('#' . a:buffer . ':p') =~? '\vsrc[/\\]test[/\\]java' + let l:test_dir = fnamemodify(l:src_dir, ':h:h:h') + \ . (has('win32') ? '\test\java\' : '/test/java/') + + if isdirectory(l:test_dir) + call add(l:sp_dirs, l:test_dir) + endif + endif + endif + + if !empty(l:sp_dirs) + let l:sp_option = '-sourcepath ' + \ . ale#Escape(join(l:sp_dirs, s:classpath_sep)) + endif + + " Create .class files in a temporary directory, which we will delete later. + let l:class_file_directory = ale#engine#CreateDirectory(a:buffer) + + " Always run javac from the directory the file is in, so we can resolve + " relative paths correctly. + return ale#path#BufferCdString(a:buffer) + \ . 'javac -Xlint' + \ . ' ' . l:cp_option + \ . ' ' . l:sp_option + \ . ' -d ' . ale#Escape(l:class_file_directory) + \ . ' ' . ale#Var(a:buffer, 'java_javac_options') + \ . ' %t' +endfunction + +function! ale_linters#java#javac#Handle(buffer, lines) abort + " Look for lines like the following. + " + " Main.java:13: warning: [deprecation] donaught() in Testclass has been deprecated + " Main.java:16: error: ';' expected + + let l:directory = expand('#' . a:buffer . ':p:h') + let l:pattern = '\v^(.*):(\d+): (.+):(.+)$' + let l:col_pattern = '\v^(\s*\^)$' + let l:symbol_pattern = '\v^ +symbol: *(class|method) +([^ ]+)' + let l:output = [] + + for l:match in ale#util#GetMatches(a:lines, [l:pattern, l:col_pattern, l:symbol_pattern]) + if empty(l:match[2]) && empty(l:match[3]) + let l:output[-1].col = len(l:match[1]) + elseif empty(l:match[3]) + " Add symbols to 'cannot find symbol' errors. + if l:output[-1].text is# 'error: cannot find symbol' + let l:output[-1].text .= ': ' . l:match[2] + endif + else + call add(l:output, { + \ 'filename': ale#path#GetAbsPath(l:directory, l:match[1]), + \ 'lnum': l:match[2] + 0, + \ 'text': l:match[3] . ':' . l:match[4], + \ 'type': l:match[3] is# 'error' ? 'E' : 'W', + \}) + endif + endfor + + return l:output +endfunction + +call ale#linter#Define('java', { +\ 'name': 'javac', +\ 'executable': 'javac', +\ 'command_chain': [ +\ {'callback': 'ale_linters#java#javac#GetImportPaths', 'output_stream': 'stdout'}, +\ {'callback': 'ale_linters#java#javac#GetCommand', 'output_stream': 'stderr'}, +\ ], +\ 'callback': 'ale_linters#java#javac#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/javascript/eslint.vim b/sources_non_forked/ale/ale_linters/javascript/eslint.vim new file mode 100644 index 00000000..23e16949 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/javascript/eslint.vim @@ -0,0 +1,10 @@ +" Author: w0rp +" Description: eslint for JavaScript files + +call ale#linter#Define('javascript', { +\ 'name': 'eslint', +\ 'output_stream': 'both', +\ 'executable_callback': 'ale#handlers#eslint#GetExecutable', +\ 'command_callback': 'ale#handlers#eslint#GetCommand', +\ 'callback': 'ale#handlers#eslint#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/javascript/flow.vim b/sources_non_forked/ale/ale_linters/javascript/flow.vim new file mode 100644 index 00000000..643ea190 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/javascript/flow.vim @@ -0,0 +1,178 @@ +" Author: Zach Perrault -- @zperrault +" Author: Florian Beeres +" Description: FlowType checking for JavaScript files + +call ale#Set('javascript_flow_executable', 'flow') +call ale#Set('javascript_flow_use_home_config', 0) +call ale#Set('javascript_flow_use_global', 0) + +function! ale_linters#javascript#flow#GetExecutable(buffer) abort + let l:flow_config = ale#path#FindNearestFile(a:buffer, '.flowconfig') + + if empty(l:flow_config) + " Don't run Flow if we can't find a .flowconfig file. + return '' + endif + + " Don't run Flow with a configuration file from the home directory by + " default, which can eat all of your RAM. + if fnamemodify(l:flow_config, ':h') is? $HOME + \&& !ale#Var(a:buffer, 'javascript_flow_use_home_config') + return '' + endif + + return ale#node#FindExecutable(a:buffer, 'javascript_flow', [ + \ 'node_modules/.bin/flow', + \]) +endfunction + +function! ale_linters#javascript#flow#VersionCheck(buffer) abort + let l:executable = ale_linters#javascript#flow#GetExecutable(a:buffer) + + if empty(l:executable) + return '' + endif + + return ale#Escape(l:executable) . ' --version' +endfunction + +function! ale_linters#javascript#flow#GetCommand(buffer, version_lines) abort + let l:executable = ale_linters#javascript#flow#GetExecutable(a:buffer) + + if empty(l:executable) + return '' + endif + + let l:version = ale#semver#GetVersion(l:executable, a:version_lines) + + " If we can parse the version number, then only use --respect-pragma + " if the version is >= 0.36.0, which added the argument. + let l:use_respect_pragma = empty(l:version) + \ || ale#semver#GTE(l:version, [0, 36]) + + return ale#Escape(l:executable) + \ . ' check-contents' + \ . (l:use_respect_pragma ? ' --respect-pragma': '') + \ . ' --json --from ale %s' +endfunction + +" Filter lines of flow output until we find the first line where the JSON +" output starts. +function! s:GetJSONLines(lines) abort + let l:start_index = 0 + + for l:line in a:lines + if l:line[:0] is# '{' + break + endif + + let l:start_index += 1 + endfor + + return a:lines[l:start_index :] +endfunction + +function! s:ExtraErrorMsg(current, new) abort + let l:newMsg = '' + + if a:current is# '' + " extra messages appear to already have a : + let l:newMsg = a:new + else + let l:newMsg = a:current . ' ' . a:new + endif + + return l:newMsg +endfunction + + +function! s:GetDetails(error) abort + let l:detail = '' + + for l:extra_error in a:error.extra + + if has_key(l:extra_error, 'message') + for l:extra_message in l:extra_error.message + let l:detail = s:ExtraErrorMsg(l:detail, l:extra_message.descr) + endfor + endif + + if has_key(l:extra_error, 'children') + for l:child in l:extra_error.children + for l:child_message in l:child.message + let l:detail = l:detail . ' ' . l:child_message.descr + endfor + endfor + endif + + endfor + + return l:detail +endfunction + +function! ale_linters#javascript#flow#Handle(buffer, lines) abort + let l:str = join(s:GetJSONLines(a:lines), '') + + if empty(l:str) + return [] + endif + + let l:flow_output = json_decode(l:str) + let l:output = [] + + for l:error in get(l:flow_output, 'errors', []) + " Each error is broken up into parts + let l:text = '' + let l:line = 0 + let l:col = 0 + + for l:message in l:error.message + " Comments have no line of column information, so we skip them. + " In certain cases, `l:message.loc.source` points to a different path + " than the buffer one, thus we skip this loc information too. + if has_key(l:message, 'loc') + \&& l:line is# 0 + \&& ale#path#IsBufferPath(a:buffer, l:message.loc.source) + let l:line = l:message.loc.start.line + 0 + let l:col = l:message.loc.start.column + 0 + endif + + if l:text is# '' + let l:text = l:message.descr . ':' + else + let l:text = l:text . ' ' . l:message.descr + endif + endfor + + if has_key(l:error, 'operation') + let l:text = l:text . ' See also: ' . l:error.operation.descr + endif + + let l:errorToAdd = { + \ 'lnum': l:line, + \ 'col': l:col, + \ 'text': l:text, + \ 'type': has_key(l:error, 'level') && l:error.level is# 'error' ? 'E' : 'W', + \} + + if has_key(l:error, 'extra') + let l:errorToAdd.detail = s:GetDetails(l:error) + endif + + call add(l:output, l:errorToAdd) + + endfor + + return l:output +endfunction + +call ale#linter#Define('javascript', { +\ 'name': 'flow', +\ 'executable_callback': 'ale_linters#javascript#flow#GetExecutable', +\ 'command_chain': [ +\ {'callback': 'ale_linters#javascript#flow#VersionCheck'}, +\ {'callback': 'ale_linters#javascript#flow#GetCommand'}, +\ ], +\ 'callback': 'ale_linters#javascript#flow#Handle', +\ 'add_newline': !has('win32'), +\}) diff --git a/sources_non_forked/ale/ale_linters/javascript/jscs.vim b/sources_non_forked/ale/ale_linters/javascript/jscs.vim new file mode 100644 index 00000000..bcf3ee3a --- /dev/null +++ b/sources_non_forked/ale/ale_linters/javascript/jscs.vim @@ -0,0 +1,67 @@ +" Author: Chris Kyrouac - https://github.com/fijshion +" Description: jscs for JavaScript files + +call ale#Set('javascript_jscs_executable', 'jscs') +call ale#Set('javascript_jscs_use_global', 0) + +function! ale_linters#javascript#jscs#GetExecutable(buffer) abort + return ale#node#FindExecutable(a:buffer, 'javascript_jscs', [ + \ 'node_modules/.bin/jscs', + \]) +endfunction + +function! ale_linters#javascript#jscs#GetCommand(buffer) abort + " Search for a local JShint config locaation, and default to a global one. + let l:jscs_config = ale#path#ResolveLocalPath( + \ a:buffer, + \ '.jscsrc', + \ get(g:, 'ale_jscs_config_loc', '') + \) + + let l:command = ale#Escape(ale_linters#javascript#jscs#GetExecutable(a:buffer)) + let l:command .= ' --reporter inline --no-colors' + + if !empty(l:jscs_config) + let l:command .= ' --config ' . ale#Escape(l:jscs_config) + endif + + let l:command .= ' -' + + return l:command +endfunction + +function! ale_linters#javascript#jscs#Handle(buffer, lines) abort + " Matches patterns looking like the following + " + " foobar.js: line 2, col 1, Expected indentation of 1 characters + " + let l:pattern = '\v^.*:\s+line (\d+),\s+col\s+(\d+),\s+(.*)$' + let l:output = [] + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + let l:obj = { + \ 'lnum': l:match[1] + 0, + \ 'col': l:match[2] + 0, + \ 'text': l:match[3] + \} + + let l:code_match = matchlist(l:match[3], '\v([^ :]+): (.+)$') + + if !empty(l:code_match) + let l:obj.code = l:code_match[1] + let l:obj.text = l:code_match[2] + endif + + call add(l:output, l:obj) + endfor + + return l:output +endfunction + +call ale#linter#Define('javascript', { +\ 'name': 'jscs', +\ 'executable_callback': 'ale_linters#javascript#jscs#GetExecutable', +\ 'command_callback': 'ale_linters#javascript#jscs#GetCommand', +\ 'callback': 'ale_linters#javascript#jscs#Handle', +\}) + diff --git a/sources_non_forked/ale/ale_linters/javascript/jshint.vim b/sources_non_forked/ale/ale_linters/javascript/jshint.vim new file mode 100644 index 00000000..93b16a8f --- /dev/null +++ b/sources_non_forked/ale/ale_linters/javascript/jshint.vim @@ -0,0 +1,38 @@ +" Author: Chris Kyrouac - https://github.com/fijshion +" Description: JSHint for Javascript files + +call ale#Set('javascript_jshint_executable', 'jshint') +call ale#Set('javascript_jshint_use_global', 0) + +function! ale_linters#javascript#jshint#GetExecutable(buffer) abort + return ale#node#FindExecutable(a:buffer, 'javascript_jshint', [ + \ 'node_modules/.bin/jshint', + \]) +endfunction + +function! ale_linters#javascript#jshint#GetCommand(buffer) abort + " Search for a local JShint config locaation, and default to a global one. + let l:jshint_config = ale#path#ResolveLocalPath( + \ a:buffer, + \ '.jshintrc', + \ get(g:, 'ale_jshint_config_loc', '') + \) + + let l:command = ale#Escape(ale_linters#javascript#jshint#GetExecutable(a:buffer)) + let l:command .= ' --reporter unix --extract auto' + + if !empty(l:jshint_config) + let l:command .= ' --config ' . ale#Escape(l:jshint_config) + endif + + let l:command .= ' -' + + return l:command +endfunction + +call ale#linter#Define('javascript', { +\ 'name': 'jshint', +\ 'executable_callback': 'ale_linters#javascript#jshint#GetExecutable', +\ 'command_callback': 'ale_linters#javascript#jshint#GetCommand', +\ 'callback': 'ale#handlers#unix#HandleAsError', +\}) diff --git a/sources_non_forked/ale/ale_linters/javascript/standard.vim b/sources_non_forked/ale/ale_linters/javascript/standard.vim new file mode 100644 index 00000000..aa6a3a72 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/javascript/standard.vim @@ -0,0 +1,30 @@ +" Author: Ahmed El Gabri <@ahmedelgabri> +" Description: standardjs for JavaScript files + +call ale#Set('javascript_standard_executable', 'standard') +call ale#Set('javascript_standard_use_global', 0) +call ale#Set('javascript_standard_options', '') + +function! ale_linters#javascript#standard#GetExecutable(buffer) abort + return ale#node#FindExecutable(a:buffer, 'javascript_standard', [ + \ 'node_modules/standard/bin/cmd.js', + \ 'node_modules/.bin/standard', + \]) +endfunction + +function! ale_linters#javascript#standard#GetCommand(buffer) abort + let l:executable = ale_linters#javascript#standard#GetExecutable(a:buffer) + let l:options = ale#Var(a:buffer, 'javascript_standard_options') + + return ale#node#Executable(a:buffer, l:executable) + \ . (!empty(l:options) ? ' ' . l:options : '') + \ . ' --stdin %s' +endfunction + +" standard uses eslint and the output format is the same +call ale#linter#Define('javascript', { +\ 'name': 'standard', +\ 'executable_callback': 'ale_linters#javascript#standard#GetExecutable', +\ 'command_callback': 'ale_linters#javascript#standard#GetCommand', +\ 'callback': 'ale#handlers#eslint#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/javascript/xo.vim b/sources_non_forked/ale/ale_linters/javascript/xo.vim new file mode 100644 index 00000000..cf305eb4 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/javascript/xo.vim @@ -0,0 +1,26 @@ +" Author: Daniel Lupu +" Description: xo for JavaScript files + +call ale#Set('javascript_xo_executable', 'xo') +call ale#Set('javascript_xo_use_global', 0) +call ale#Set('javascript_xo_options', '') + +function! ale_linters#javascript#xo#GetExecutable(buffer) abort + return ale#node#FindExecutable(a:buffer, 'javascript_xo', [ + \ 'node_modules/.bin/xo', + \]) +endfunction + +function! ale_linters#javascript#xo#GetCommand(buffer) abort + return ale#Escape(ale_linters#javascript#xo#GetExecutable(a:buffer)) + \ . ' ' . ale#Var(a:buffer, 'javascript_xo_options') + \ . ' --reporter unix --stdin --stdin-filename %s' +endfunction + +" xo uses eslint and the output format is the same +call ale#linter#Define('javascript', { +\ 'name': 'xo', +\ 'executable_callback': 'ale_linters#javascript#xo#GetExecutable', +\ 'command_callback': 'ale_linters#javascript#xo#GetCommand', +\ 'callback': 'ale#handlers#eslint#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/json/jsonlint.vim b/sources_non_forked/ale/ale_linters/json/jsonlint.vim new file mode 100644 index 00000000..75f47088 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/json/jsonlint.vim @@ -0,0 +1,27 @@ +" Author: KabbAmine + +function! ale_linters#json#jsonlint#Handle(buffer, lines) abort + " Matches patterns like the following: + " line 2, col 15, found: 'STRING' - expected: 'EOF', '}', ',', ']'. + + let l:pattern = '^line \(\d\+\), col \(\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[3], + \}) + endfor + + return l:output +endfunction + +call ale#linter#Define('json', { +\ 'name': 'jsonlint', +\ 'executable': 'jsonlint', +\ 'output_stream': 'stderr', +\ 'command': 'jsonlint --compact -', +\ 'callback': 'ale_linters#json#jsonlint#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/kotlin/kotlinc.vim b/sources_non_forked/ale/ale_linters/kotlin/kotlinc.vim new file mode 100644 index 00000000..00f94be5 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/kotlin/kotlinc.vim @@ -0,0 +1,170 @@ +" Author: Francis Agyapong +" Description: A linter for the Kotlin programming language that uses kotlinc + +let g:ale_kotlin_kotlinc_options = get(g:, 'ale_kotlin_kotlinc_options', '') +let g:ale_kotlin_kotlinc_enable_config = get(g:, 'ale_kotlin_kotlinc_enable_config', 0) +let g:ale_kotlin_kotlinc_config_file = get(g:, 'ale_kotlin_kotlinc_config_file', '.ale_kotlinc_config') +let g:ale_kotlin_kotlinc_classpath = get(g:, 'ale_kotlin_kotlinc_classpath', '') +let g:ale_kotlin_kotlinc_sourcepath = get(g:, 'ale_kotlin_kotlinc_sourcepath', '') +let g:ale_kotlin_kotlinc_use_module_file = get(g:, 'ale_kotlin_kotlinc_use_module_file', 0) +let g:ale_kotlin_kotlinc_module_filename = get(g:, 'ale_kotlin_kotlinc_module_filename', 'module.xml') + +let s:classpath_sep = has('unix') ? ':' : ';' + +function! ale_linters#kotlin#kotlinc#GetImportPaths(buffer) abort + " exec maven/gradle only if classpath is not set + if ale#Var(a:buffer, 'kotlin_kotlinc_classpath') isnot# '' + return '' + else + let l:pom_path = ale#path#FindNearestFile(a:buffer, 'pom.xml') + if !empty(l:pom_path) && executable('mvn') + return ale#path#CdString(fnamemodify(l:pom_path, ':h')) + \ . 'mvn dependency:build-classpath' + endif + + let l:classpath_command = ale#gradle#BuildClasspathCommand(a:buffer) + if !empty(l:classpath_command) + return l:classpath_command + endif + + return '' + endif +endfunction + +function! s:BuildClassPathOption(buffer, import_paths) abort + " Filter out lines like [INFO], etc. + let l:class_paths = filter(a:import_paths[:], 'v:val !~# ''[''') + call extend( + \ l:class_paths, + \ split(ale#Var(a:buffer, 'kotlin_kotlinc_classpath'), s:classpath_sep), + \) + + return !empty(l:class_paths) + \ ? ' -cp ' . ale#Escape(join(l:class_paths, s:classpath_sep)) + \ : '' +endfunction + +function! ale_linters#kotlin#kotlinc#GetCommand(buffer, import_paths) abort + let l:kotlinc_opts = ale#Var(a:buffer, 'kotlin_kotlinc_options') + let l:command = 'kotlinc ' + + " If the config file is enabled and readable, source it + if ale#Var(a:buffer, 'kotlin_kotlinc_enable_config') + let l:conf = expand(ale#Var(a:buffer, 'kotlin_kotlinc_config_file'), 1) + + if filereadable(l:conf) + execute 'source ' . fnameescape(l:conf) + endif + endif + + " If use module and module file is readable use that and return + if ale#Var(a:buffer, 'kotlin_kotlinc_use_module_file') + let l:module_filename = ale#Escape(expand(ale#Var(a:buffer, 'kotlin_kotlinc_module_filename'), 1)) + + if filereadable(l:module_filename) + let l:kotlinc_opts .= ' -module ' . l:module_filename + let l:command .= 'kotlinc ' . l:kotlinc_opts + + return l:command + endif + endif + + " We only get here if not using module or the module file not readable + if ale#Var(a:buffer, 'kotlin_kotlinc_classpath') isnot# '' + let l:kotlinc_opts .= ' -cp ' . ale#Var(a:buffer, 'kotlin_kotlinc_classpath') + else + " get classpath from maven/gradle + let l:kotlinc_opts .= s:BuildClassPathOption(a:buffer, a:import_paths) + endif + + let l:fname = '' + if ale#Var(a:buffer, 'kotlin_kotlinc_sourcepath') isnot# '' + let l:fname .= expand(ale#Var(a:buffer, 'kotlin_kotlinc_sourcepath'), 1) . ' ' + else + " Find the src directory for files in this project. + + let l:project_root = ale#gradle#FindProjectRoot(a:buffer) + if !empty(l:project_root) + let l:src_dir = l:project_root + else + let l:src_dir = ale#path#FindNearestDirectory(a:buffer, 'src/main/java') + \ . ' ' . ale#path#FindNearestDirectory(a:buffer, 'src/main/kotlin') + endif + + let l:fname .= expand(l:src_dir, 1) . ' ' + endif + let l:fname .= ale#Escape(expand('#' . a:buffer . ':p')) + let l:command .= l:kotlinc_opts . ' ' . l:fname + + return l:command +endfunction + +function! ale_linters#kotlin#kotlinc#Handle(buffer, lines) abort + let l:code_pattern = '^\(.*\):\([0-9]\+\):\([0-9]\+\):\s\+\(error\|warning\):\s\+\(.*\)' + let l:general_pattern = '^\(warning\|error\|info\):\s*\(.*\)' + let l:output = [] + + for l:line in a:lines + let l:match = matchlist(l:line, l:code_pattern) + + if len(l:match) == 0 + continue + endif + + let l:file = l:match[1] + let l:line = l:match[2] + 0 + let l:column = l:match[3] + 0 + let l:type = l:match[4] + let l:text = l:match[5] + + let l:buf_abspath = fnamemodify(l:file, ':p') + let l:curbuf_abspath = expand('#' . a:buffer . ':p') + + " Skip if file is not loaded + if l:buf_abspath isnot# l:curbuf_abspath + continue + endif + let l:type_marker_str = l:type is# 'warning' ? 'W' : 'E' + + call add(l:output, { + \ 'lnum': l:line, + \ 'col': l:column, + \ 'text': l:text, + \ 'type': l:type_marker_str, + \}) + endfor + + " Non-code related messages + for l:line in a:lines + let l:match = matchlist(l:line, l:general_pattern) + + if len(l:match) == 0 + continue + endif + + let l:type = l:match[1] + let l:text = l:match[2] + + let l:type_marker_str = l:type is# 'warning' || l:type is# 'info' ? 'W' : 'E' + + call add(l:output, { + \ 'lnum': 1, + \ 'text': l:text, + \ 'type': l:type_marker_str, + \}) + endfor + + return l:output +endfunction + +call ale#linter#Define('kotlin', { +\ 'name': 'kotlinc', +\ 'executable': 'kotlinc', +\ 'command_chain': [ +\ {'callback': 'ale_linters#kotlin#kotlinc#GetImportPaths', 'output_stream': 'stdout'}, +\ {'callback': 'ale_linters#kotlin#kotlinc#GetCommand', 'output_stream': 'stderr'}, +\ ], +\ 'callback': 'ale_linters#kotlin#kotlinc#Handle', +\ 'lint_file': 1, +\}) + diff --git a/sources_non_forked/ale/ale_linters/kotlin/ktlint.vim b/sources_non_forked/ale/ale_linters/kotlin/ktlint.vim new file mode 100644 index 00000000..f474e845 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/kotlin/ktlint.vim @@ -0,0 +1,54 @@ +" Author: Francis Agyapong +" Description: Lint kotlin files using ktlint + +call ale#Set('kotlin_ktlint_executable', 'ktlint') +call ale#Set('kotlin_ktlint_rulesets', []) +call ale#Set('kotlin_ktlint_format', 0) + + +function! ale_linters#kotlin#ktlint#GetCommand(buffer) abort + let l:executable = ale#Var(a:buffer, 'kotlin_ktlint_executable') + let l:file_path = expand('#' . a:buffer . ':p') + let l:options = '' + + " Formmatted content written to original file, not sure how to handle + " if ale#Var(a:buffer, 'kotlin_ktlint_format') + " let l:options = l:options . ' --format' + " endif + + for l:ruleset in ale#Var(a:buffer, 'kotlin_ktlint_rulesets') + let l:options = l:options . ' --ruleset ' . l:ruleset + endfor + + return l:executable . ' ' . l:options . ' ' . l:file_path +endfunction + +function! ale_linters#kotlin#ktlint#Handle(buffer, lines) abort + let l:message_pattern = '^\(.*\):\([0-9]\+\):\([0-9]\+\):\s\+\(.*\)' + let l:output = [] + + for l:match in ale#util#GetMatches(a:lines, l:message_pattern) + let l:line = l:match[2] + 0 + let l:column = l:match[3] + 0 + let l:text = l:match[4] + + let l:type = l:text =~? 'not a valid kotlin file' ? 'E' : 'W' + + call add(l:output, { + \ 'lnum': l:line, + \ 'col': l:column, + \ 'text': l:text, + \ 'type': l:type + \}) + endfor + + return l:output +endfunction + +call ale#linter#Define('kotlin', { +\ 'name': 'ktlint', +\ 'executable': 'ktlint', +\ 'command_callback': 'ale_linters#kotlin#ktlint#GetCommand', +\ 'callback': 'ale_linters#kotlin#ktlint#Handle', +\ 'lint_file': 1 +\}) diff --git a/sources_non_forked/ale/ale_linters/less/lessc.vim b/sources_non_forked/ale/ale_linters/less/lessc.vim new file mode 100644 index 00000000..108679de --- /dev/null +++ b/sources_non_forked/ale/ale_linters/less/lessc.vim @@ -0,0 +1,56 @@ +" Author: zanona , w0rp +" Description: This file adds support for checking Less code with lessc. + +call ale#Set('less_lessc_executable', 'lessc') +call ale#Set('less_lessc_options', '') +call ale#Set('less_lessc_use_global', 0) + +function! ale_linters#less#lessc#GetExecutable(buffer) abort + return ale#node#FindExecutable(a:buffer, 'less_lessc', [ + \ 'node_modules/.bin/lessc', + \]) +endfunction + +function! ale_linters#less#lessc#GetCommand(buffer) abort + let l:executable = ale_linters#less#lessc#GetExecutable(a:buffer) + let l:dir = expand('#' . a:buffer . ':p:h') + let l:options = ale#Var(a:buffer, 'less_lessc_options') + + return ale#Escape(l:executable) + \ . ' --no-color --lint' + \ . ' --include-path=' . ale#Escape(l:dir) + \ . (!empty(l:options) ? ' ' . l:options : '') + \ . ' -' +endfunction + +function! ale_linters#less#lessc#Handle(buffer, lines) abort + let l:dir = expand('#' . a:buffer . ':p:h') + " Matches patterns like the following: + let l:pattern = '^\(\w\+\): \(.\{-}\) in \(.\{-}\) on line \(\d\+\), column \(\d\+\):$' + let l:output = [] + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + let l:item = { + \ 'lnum': l:match[4] + 0, + \ 'col': l:match[5] + 0, + \ 'text': l:match[2], + \ 'type': 'E', + \} + + if l:match[3] isnot# '-' + let l:item.filename = ale#path#GetAbsPath(l:dir, l:match[3]) + endif + + call add(l:output, l:item) + endfor + + return l:output +endfunction + +call ale#linter#Define('less', { +\ 'name': 'lessc', +\ 'executable_callback': 'ale_linters#less#lessc#GetExecutable', +\ 'command_callback': 'ale_linters#less#lessc#GetCommand', +\ 'callback': 'ale_linters#less#lessc#Handle', +\ 'output_stream': 'stderr', +\}) diff --git a/sources_non_forked/ale/ale_linters/less/stylelint.vim b/sources_non_forked/ale/ale_linters/less/stylelint.vim new file mode 100644 index 00000000..690c8c93 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/less/stylelint.vim @@ -0,0 +1,27 @@ +" Author: diartyz , w0rp + +call ale#Set('less_stylelint_executable', 'stylelint') +call ale#Set('less_stylelint_options', '') +call ale#Set('less_stylelint_use_global', 0) + +function! ale_linters#less#stylelint#GetExecutable(buffer) abort + return ale#node#FindExecutable(a:buffer, 'less_stylelint', [ + \ 'node_modules/.bin/stylelint', + \]) +endfunction + +function! ale_linters#less#stylelint#GetCommand(buffer) abort + let l:executable = ale_linters#less#stylelint#GetExecutable(a:buffer) + let l:options = ale#Var(a:buffer, 'less_stylelint_options') + + return ale#Escape(l:executable) + \ . (!empty(l:options) ? ' ' . l:options : '') + \ . ' --stdin-filename %s' +endfunction + +call ale#linter#Define('less', { +\ 'name': 'stylelint', +\ 'executable_callback': 'ale_linters#less#stylelint#GetExecutable', +\ 'command_callback': 'ale_linters#less#stylelint#GetCommand', +\ 'callback': 'ale#handlers#css#HandleStyleLintFormat', +\}) diff --git a/sources_non_forked/ale/ale_linters/llvm/llc.vim b/sources_non_forked/ale/ale_linters/llvm/llc.vim new file mode 100644 index 00000000..0a4903eb --- /dev/null +++ b/sources_non_forked/ale/ale_linters/llvm/llc.vim @@ -0,0 +1,35 @@ +" Author: rhysd +" Description: Support for checking LLVM IR with llc + +call ale#Set('llvm_llc_executable', 'llc') + +function! ale_linters#llvm#llc#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'llvm_llc_executable') +endfunction + +function! ale_linters#llvm#llc#GetCommand(buffer) abort + return ale#Escape(ale_linters#llvm#llc#GetExecutable(a:buffer)) + \ . ' -filetype=null -o=' + \ . ale#Escape(g:ale#util#nul_file) +endfunction + +function! ale_linters#llvm#llc#HandleErrors(buffer, lines) abort + " Handle '{path}: {file}:{line}:{col}: error: {message}' format + let l:pattern = '\v^[a-zA-Z]?:?[^:]+: [^:]+:(\d+):(\d+): (.+)$' + let l:matches = ale#util#GetMatches(a:lines, l:pattern) + + return map(l:matches, "{ + \ 'lnum': str2nr(v:val[1]), + \ 'col': str2nr(v:val[2]), + \ 'text': v:val[3], + \ 'type': 'E', + \}") +endfunction + +call ale#linter#Define('llvm', { +\ 'name': 'llc', +\ 'executable_callback': 'ale_linters#llvm#llc#GetExecutable', +\ 'output_stream': 'stderr', +\ 'command_callback': 'ale_linters#llvm#llc#GetCommand', +\ 'callback': 'ale_linters#llvm#llc#HandleErrors', +\}) diff --git a/sources_non_forked/ale/ale_linters/lua/luac.vim b/sources_non_forked/ale/ale_linters/lua/luac.vim new file mode 100644 index 00000000..4a6bb403 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/lua/luac.vim @@ -0,0 +1,40 @@ +" Author: Jon Xie https://github.com/xiejiangzhi +" Description: luac linter for lua files + +call ale#Set('lua_luac_executable', 'luac') + +function! ale_linters#lua#luac#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'lua_luac_executable') +endfunction + +function! ale_linters#lua#luac#GetCommand(buffer) abort + let l:executable = ale_linters#lua#luac#GetExecutable(a:buffer) + return ale#Escape(l:executable) . ' -p - ' +endfunction + +function! ale_linters#lua#luac#Handle(buffer, lines) abort + " Matches patterns line the following: + " + " luac: stdin:5: '=' expected near ')' + " luac: stdin:8: ')' expected (to close '(' at line 6) near '123' + let l:pattern = '\v^.*:(\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': 'E', + \ 'text': l:match[2], + \}) + endfor + + return l:output +endfunction + +call ale#linter#Define('lua', { +\ 'name': 'luac', +\ 'executable_callback': 'ale_linters#lua#luac#GetExecutable', +\ 'command_callback': 'ale_linters#lua#luac#GetCommand', +\ 'output_stream': 'stderr', +\ 'callback': 'ale_linters#lua#luac#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/lua/luacheck.vim b/sources_non_forked/ale/ale_linters/lua/luacheck.vim new file mode 100644 index 00000000..725153c6 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/lua/luacheck.vim @@ -0,0 +1,52 @@ +" Author: Sol Bekic https://github.com/s-ol +" Description: luacheck linter for lua files + +let g:ale_lua_luacheck_executable = +\ get(g:, 'ale_lua_luacheck_executable', 'luacheck') + +let g:ale_lua_luacheck_options = +\ get(g:, 'ale_lua_luacheck_options', '') + +function! ale_linters#lua#luacheck#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'lua_luacheck_executable') +endfunction + +function! ale_linters#lua#luacheck#GetCommand(buffer) abort + return ale#Escape(ale_linters#lua#luacheck#GetExecutable(a:buffer)) + \ . ' ' . ale#Var(a:buffer, 'lua_luacheck_options') + \ . ' --formatter plain --codes --filename %s -' +endfunction + +function! ale_linters#lua#luacheck#Handle(buffer, lines) abort + " Matches patterns line the following: + " + " artal.lua:159:17: (W111) shadowing definition of loop variable 'i' on line 106 + " artal.lua:182:7: (W213) unused loop variable 'i' + let l:pattern = '^.*:\(\d\+\):\(\d\+\): (\([WE]\)\(\d\+\)) \(.\+\)$' + let l:output = [] + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + if !ale#Var(a:buffer, 'warn_about_trailing_whitespace') + \ && l:match[3] is# 'W' + \ && index(range(611, 614), str2nr(l:match[4])) >= 0 + continue + endif + + call add(l:output, { + \ 'lnum': l:match[1] + 0, + \ 'col': l:match[2] + 0, + \ 'type': l:match[3], + \ 'code': l:match[3] . l:match[4], + \ 'text': l:match[5], + \}) + endfor + + return l:output +endfunction + +call ale#linter#Define('lua', { +\ 'name': 'luacheck', +\ 'executable_callback': 'ale_linters#lua#luacheck#GetExecutable', +\ 'command_callback': 'ale_linters#lua#luacheck#GetCommand', +\ 'callback': 'ale_linters#lua#luacheck#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/mail/alex.vim b/sources_non_forked/ale/ale_linters/mail/alex.vim new file mode 100644 index 00000000..b0651ccd --- /dev/null +++ b/sources_non_forked/ale/ale_linters/mail/alex.vim @@ -0,0 +1,11 @@ +" Author: Johannes Wienke +" Description: alex for HTML files + +call ale#linter#Define('mail', { +\ 'name': 'alex', +\ 'executable': 'alex', +\ 'command': 'alex %s -t', +\ 'output_stream': 'stderr', +\ 'callback': 'ale#handlers#alex#Handle', +\ 'lint_file': 1, +\}) diff --git a/sources_non_forked/ale/ale_linters/mail/proselint.vim b/sources_non_forked/ale/ale_linters/mail/proselint.vim new file mode 100644 index 00000000..82c8d1f8 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/mail/proselint.vim @@ -0,0 +1,9 @@ +" Author: Daniel M. Capella https://github.com/polyzen +" Description: proselint for mail files + +call ale#linter#Define('mail', { +\ 'name': 'proselint', +\ 'executable': 'proselint', +\ 'command': 'proselint %t', +\ 'callback': 'ale#handlers#unix#HandleAsWarning', +\}) diff --git a/sources_non_forked/ale/ale_linters/mail/vale.vim b/sources_non_forked/ale/ale_linters/mail/vale.vim new file mode 100644 index 00000000..e6dfd2ec --- /dev/null +++ b/sources_non_forked/ale/ale_linters/mail/vale.vim @@ -0,0 +1,9 @@ +" Author: chew-z https://github.com/chew-z +" Description: vale for Markdown files + +call ale#linter#Define('mail', { +\ 'name': 'vale', +\ 'executable': 'vale', +\ 'command': 'vale --output=JSON %t', +\ 'callback': 'ale#handlers#vale#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/make/checkmake.vim b/sources_non_forked/ale/ale_linters/make/checkmake.vim new file mode 100644 index 00000000..63c35db3 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/make/checkmake.vim @@ -0,0 +1,24 @@ +" Author: aurieh - https://github.com/aurieh + +function! ale_linters#make#checkmake#Handle(buffer, lines) abort + let l:pattern = '\v^(\d+):(.+):(.+)$' + let l:output = [] + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + call add(l:output, { + \ 'bufnr': a:buffer, + \ 'lnum': l:match[1] + 0, + \ 'type': 'E', + \ 'code': l:match[2], + \ 'text': l:match[3], + \}) + endfor + return l:output +endfunction + +call ale#linter#Define('make', { +\ 'name': 'checkmake', +\ 'executable': 'checkmake', +\ 'command': 'checkmake %s --format="{{.LineNumber}}:{{.Rule}}:{{.Violation}}"', +\ 'callback': 'ale_linters#make#checkmake#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/markdown/alex.vim b/sources_non_forked/ale/ale_linters/markdown/alex.vim new file mode 100644 index 00000000..29306141 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/markdown/alex.vim @@ -0,0 +1,11 @@ +" Author: Johannes Wienke +" Description: alex for markdown files + +call ale#linter#Define('markdown', { +\ 'name': 'alex', +\ 'executable': 'alex', +\ 'command': 'alex %s -t', +\ 'output_stream': 'stderr', +\ 'callback': 'ale#handlers#alex#Handle', +\ 'lint_file': 1, +\}) diff --git a/sources_non_forked/ale/ale_linters/markdown/markdownlint.vim b/sources_non_forked/ale/ale_linters/markdown/markdownlint.vim new file mode 100644 index 00000000..5c8af650 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/markdown/markdownlint.vim @@ -0,0 +1,11 @@ +" Author: Ty-Lucas Kelley +" Description: Adds support for markdownlint + +call ale#linter#Define('markdown', { + \ 'name': 'markdownlint', + \ 'executable': 'markdownlint', + \ 'lint_file': 1, + \ 'output_stream': 'both', + \ 'command': 'markdownlint %s', + \ 'callback': 'ale#handlers#markdownlint#Handle' +\ }) diff --git a/sources_non_forked/ale/ale_linters/markdown/mdl.vim b/sources_non_forked/ale/ale_linters/markdown/mdl.vim new file mode 100644 index 00000000..16b08cc5 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/markdown/mdl.vim @@ -0,0 +1,40 @@ +" Author: Steve Dignam , Josh Leeb-du Toit +" Description: Support for mdl, a markdown linter. + +call ale#Set('markdown_mdl_executable', 'mdl') +call ale#Set('markdown_mdl_options', '') + +function! ale_linters#markdown#mdl#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'markdown_mdl_executable') +endfunction + +function! ale_linters#markdown#mdl#GetCommand(buffer) abort + let l:executable = ale_linters#markdown#mdl#GetExecutable(a:buffer) + let l:options = ale#Var(a:buffer, 'markdown_mdl_options') + + return ale#Escape(l:executable) + \ . (!empty(l:options) ? ' ' . l:options : '') +endfunction + +function! ale_linters#markdown#mdl#Handle(buffer, lines) abort + " matches: '(stdin):173: MD004 Unordered list style' + 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, + \ 'text': l:match[2], + \ 'type': 'W', + \}) + endfor + + return l:output +endfunction + +call ale#linter#Define('markdown', { +\ 'name': 'mdl', +\ 'executable_callback': 'ale_linters#markdown#mdl#GetExecutable', +\ 'command_callback': 'ale_linters#markdown#mdl#GetCommand', +\ 'callback': 'ale_linters#markdown#mdl#Handle' +\}) diff --git a/sources_non_forked/ale/ale_linters/markdown/proselint.vim b/sources_non_forked/ale/ale_linters/markdown/proselint.vim new file mode 100644 index 00000000..289d8819 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/markdown/proselint.vim @@ -0,0 +1,9 @@ +" Author: poohzrn https://github.com/poohzrn +" Description: proselint for Markdown files + +call ale#linter#Define('markdown', { +\ 'name': 'proselint', +\ 'executable': 'proselint', +\ 'command': 'proselint %t', +\ 'callback': 'ale#handlers#unix#HandleAsWarning', +\}) diff --git a/sources_non_forked/ale/ale_linters/markdown/redpen.vim b/sources_non_forked/ale/ale_linters/markdown/redpen.vim new file mode 100644 index 00000000..ff2cbaf8 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/markdown/redpen.vim @@ -0,0 +1,9 @@ +" Author: rhysd https://rhysd.github.io +" Description: Redpen, a proofreading tool (http://redpen.cc) + +call ale#linter#Define('markdown', { +\ 'name': 'redpen', +\ 'executable': 'redpen', +\ 'command': 'redpen -f markdown -r json %t', +\ 'callback': 'ale#handlers#redpen#HandleRedpenOutput', +\}) diff --git a/sources_non_forked/ale/ale_linters/markdown/remark_lint.vim b/sources_non_forked/ale/ale_linters/markdown/remark_lint.vim new file mode 100644 index 00000000..98dd0d7b --- /dev/null +++ b/sources_non_forked/ale/ale_linters/markdown/remark_lint.vim @@ -0,0 +1,34 @@ +" Author rhysd https://rhysd.github.io/, Dirk Roorda (dirkroorda), Adrián González Rus (@adrigzr) +" Description: remark-lint for Markdown files + +function! ale_linters#markdown#remark_lint#Handle(buffer, lines) abort + " matches: ' 1:4 warning Incorrect list-item indent: add 1 space list-item-indent remark-lint' + " matches: ' 18:71-19:1 error Missing new line after list item list-item-spacing remark-lint', + let l:pattern = '^ \+\(\d\+\):\(\d\+\)\(-\(\d\+\):\(\d\+\)\)\? \(warning\|error\) \(.\+\)$' + let l:output = [] + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + let l:item = { + \ 'lnum': l:match[1] + 0, + \ 'col': l:match[2] + 0, + \ 'type': l:match[6] is# 'error' ? 'E' : 'W', + \ 'text': l:match[7], + \} + if l:match[3] isnot# '' + let l:item.end_lnum = l:match[4] + 0 + let l:item.end_col = l:match[5] + 0 + endif + call add(l:output, l:item) + endfor + + return l:output +endfunction + +call ale#linter#Define('markdown', { +\ 'name': 'remark-lint', +\ 'executable': 'remark', +\ 'command': 'remark --no-stdout --no-color %s', +\ 'callback': 'ale_linters#markdown#remark_lint#Handle', +\ 'lint_file': 1, +\ 'output_stream': 'stderr', +\}) diff --git a/sources_non_forked/ale/ale_linters/markdown/textlint.vim b/sources_non_forked/ale/ale_linters/markdown/textlint.vim new file mode 100644 index 00000000..26458506 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/markdown/textlint.vim @@ -0,0 +1,9 @@ +" Author: tokida https://rouger.info, Yasuhiro Kiyota +" Description: textlint, a proofreading tool (https://textlint.github.io/) + +call ale#linter#Define('markdown', { +\ 'name': 'textlint', +\ 'executable_callback': 'ale#handlers#textlint#GetExecutable', +\ 'command_callback': 'ale#handlers#textlint#GetCommand', +\ 'callback': 'ale#handlers#textlint#HandleTextlintOutput', +\}) diff --git a/sources_non_forked/ale/ale_linters/markdown/vale.vim b/sources_non_forked/ale/ale_linters/markdown/vale.vim new file mode 100644 index 00000000..838c4db2 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/markdown/vale.vim @@ -0,0 +1,9 @@ +" Author: chew-z https://github.com/chew-z +" Description: vale for Markdown files + +call ale#linter#Define('markdown', { +\ 'name': 'vale', +\ 'executable': 'vale', +\ 'command': 'vale --output=JSON %t', +\ 'callback': 'ale#handlers#vale#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/markdown/write-good.vim b/sources_non_forked/ale/ale_linters/markdown/write-good.vim new file mode 100644 index 00000000..21dbff1a --- /dev/null +++ b/sources_non_forked/ale/ale_linters/markdown/write-good.vim @@ -0,0 +1,9 @@ +" Author: Sumner Evans +" 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', +\}) diff --git a/sources_non_forked/ale/ale_linters/matlab/mlint.vim b/sources_non_forked/ale/ale_linters/matlab/mlint.vim new file mode 100644 index 00000000..32766334 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/matlab/mlint.vim @@ -0,0 +1,55 @@ +" Author: awlayton +" Description: mlint for MATLAB files + +let g:ale_matlab_mlint_executable = +\ get(g:, 'ale_matlab_mlint_executable', 'mlint') + +function! ale_linters#matlab#mlint#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'matlab_mlint_executable') +endfunction + +function! ale_linters#matlab#mlint#GetCommand(buffer) abort + let l:executable = ale_linters#matlab#mlint#GetExecutable(a:buffer) + + return l:executable . ' -id %t' +endfunction + +function! ale_linters#matlab#mlint#Handle(buffer, lines) abort + " Matches patterns like the following: + " + " L 27 (C 1): FNDEF: Terminate statement with semicolon to suppress output. + " L 30 (C 13-15): FNDEF: A quoted string is unterminated. + let l:pattern = '^L \(\d\+\) (C \([0-9-]\+\)): \([A-Z]\+\): \(.\+\)$' + let l:output = [] + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + let l:lnum = l:match[1] + 0 + let l:col = l:match[2] + 0 + let l:code = l:match[3] + let l:text = l:match[4] + + " Suppress erroneous waring about filename + " TODO: Enable this error when copying filename is supported + if l:code is# 'FNDEF' + continue + endif + + call add(l:output, { + \ 'bufnr': a:buffer, + \ 'lnum': l:lnum, + \ 'col': l:col, + \ 'text': l:text, + \ 'type': 'W', + \}) + endfor + + return l:output +endfunction + +call ale#linter#Define('matlab', { +\ 'name': 'mlint', +\ 'executable_callback': 'ale_linters#matlab#mlint#GetExecutable', +\ 'command_callback': 'ale_linters#matlab#mlint#GetCommand', +\ 'output_stream': 'stderr', +\ 'callback': 'ale_linters#matlab#mlint#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/nim/nimcheck.vim b/sources_non_forked/ale/ale_linters/nim/nimcheck.vim new file mode 100644 index 00000000..bff45f7d --- /dev/null +++ b/sources_non_forked/ale/ale_linters/nim/nimcheck.vim @@ -0,0 +1,65 @@ +" Author: Baabelfish +" Description: Typechecking for nim files + +function! ale_linters#nim#nimcheck#Handle(buffer, lines) abort + let l:buffer_filename = fnamemodify(bufname(a:buffer), ':p:t') + let l:pattern = '^\(.\+\.nim\)(\(\d\+\), \(\d\+\)) \(.\+\)' + let l:output = [] + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + " Only show errors of the current buffer + " NOTE: Checking filename only is OK because nim enforces unique + " module names. + let l:temp_buffer_filename = fnamemodify(l:match[1], ':p:t') + + if l:buffer_filename isnot# '' && l:temp_buffer_filename isnot# l:buffer_filename + continue + endif + + let l:item = { + \ 'lnum': l:match[2] + 0, + \ 'col': l:match[3] + 0, + \ 'text': l:match[4], + \ 'type': 'W', + \} + + " Extract error type from message of type 'Error: Some error message' + let l:error_match = matchlist(l:item.text, '^\(.\{-}\): \(.\+\)$') + + if !empty(l:error_match) + if l:error_match[1] is# 'Error' + let l:item.type = 'E' + let l:item.text = l:error_match[2] + elseif l:error_match[1] is# 'Warning' + \|| l:error_match[1] is# 'Hint' + let l:item.text = l:error_match[2] + endif + endif + + let l:code_match = matchlist(l:item.text, '\v^(.+) \[([^ \[]+)\]$') + + if !empty(l:code_match) + let l:item.text = l:code_match[1] + let l:item.code = l:code_match[2] + endif + + call add(l:output, l:item) + endfor + + return l:output +endfunction + + +function! ale_linters#nim#nimcheck#GetCommand(buffer) abort + return 'nim check --verbosity:0 --colors:off --listFullPaths %s' +endfunction + + +call ale#linter#Define('nim', { +\ 'name': 'nimcheck', +\ 'executable': 'nim', +\ 'output_stream': 'both', +\ 'command_callback': 'ale_linters#nim#nimcheck#GetCommand', +\ 'callback': 'ale_linters#nim#nimcheck#Handle', +\ 'lint_file': 1, +\}) diff --git a/sources_non_forked/ale/ale_linters/nix/nix.vim b/sources_non_forked/ale/ale_linters/nix/nix.vim new file mode 100644 index 00000000..0a0c5c3e --- /dev/null +++ b/sources_non_forked/ale/ale_linters/nix/nix.vim @@ -0,0 +1,26 @@ +" Author: Alistair Bill <@alibabzo> +" Description: nix-instantiate linter for nix files + +function! ale_linters#nix#nix#Handle(buffer, lines) abort + let l:pattern = '^\(.\+\): \(.\+\), at .*:\(\d\+\):\(\d\+\)$' + let l:output = [] + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + call add(l:output, { + \ 'lnum': l:match[3] + 0, + \ 'col': l:match[4] + 0, + \ 'text': l:match[1] . ': ' . l:match[2], + \ 'type': l:match[1] =~# '^error' ? 'E' : 'W', + \}) + endfor + + return l:output +endfunction + +call ale#linter#Define('nix', { +\ 'name': 'nix', +\ 'output_stream': 'stderr', +\ 'executable': 'nix-instantiate', +\ 'command': 'nix-instantiate --parse -', +\ 'callback': 'ale_linters#nix#nix#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/nroff/alex.vim b/sources_non_forked/ale/ale_linters/nroff/alex.vim new file mode 100644 index 00000000..a10db2dd --- /dev/null +++ b/sources_non_forked/ale/ale_linters/nroff/alex.vim @@ -0,0 +1,11 @@ +" Author: Johannes Wienke +" Description: alex for nroff files + +call ale#linter#Define('nroff', { +\ 'name': 'alex', +\ 'executable': 'alex', +\ 'command': 'alex %s -t', +\ 'output_stream': 'stderr', +\ 'callback': 'ale#handlers#alex#Handle', +\ 'lint_file': 1, +\}) diff --git a/sources_non_forked/ale/ale_linters/nroff/proselint.vim b/sources_non_forked/ale/ale_linters/nroff/proselint.vim new file mode 100644 index 00000000..a23e56b1 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/nroff/proselint.vim @@ -0,0 +1,9 @@ +" Author: Daniel M. Capella https://github.com/polyzen +" Description: proselint for nroff files + +call ale#linter#Define('nroff', { +\ 'name': 'proselint', +\ 'executable': 'proselint', +\ 'command': 'proselint %t', +\ 'callback': 'ale#handlers#unix#HandleAsWarning', +\}) diff --git a/sources_non_forked/ale/ale_linters/nroff/write-good.vim b/sources_non_forked/ale/ale_linters/nroff/write-good.vim new file mode 100644 index 00000000..d318fb28 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/nroff/write-good.vim @@ -0,0 +1,9 @@ +" Author: Sumner Evans +" 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', +\}) diff --git a/sources_non_forked/ale/ale_linters/objc/clang.vim b/sources_non_forked/ale/ale_linters/objc/clang.vim new file mode 100644 index 00000000..f4725a0e --- /dev/null +++ b/sources_non_forked/ale/ale_linters/objc/clang.vim @@ -0,0 +1,23 @@ +" Author: Bang Lee +" Description: clang linter for objc files + +" Set this option to change the Clang options for warnings for ObjC. +if !exists('g:ale_objc_clang_options') + let g:ale_objc_clang_options = '-std=c11 -Wall' +endif + +function! ale_linters#objc#clang#GetCommand(buffer) abort + " -iquote with the directory the file is in makes #include work for + " headers in the same directory. + return 'clang -S -x objective-c -fsyntax-only ' + \ . '-iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h')) + \ . ' ' . ale#Var(a:buffer, 'objc_clang_options') . ' -' +endfunction + +call ale#linter#Define('objc', { +\ 'name': 'clang', +\ 'output_stream': 'stderr', +\ 'executable': 'clang', +\ 'command_callback': 'ale_linters#objc#clang#GetCommand', +\ 'callback': 'ale#handlers#gcc#HandleGCCFormat', +\}) diff --git a/sources_non_forked/ale/ale_linters/objcpp/clang.vim b/sources_non_forked/ale/ale_linters/objcpp/clang.vim new file mode 100644 index 00000000..0e9cefe9 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/objcpp/clang.vim @@ -0,0 +1,23 @@ +" Author: Bang Lee +" Description: clang linter for objcpp files + +" Set this option to change the Clang options for warnings for ObjCPP. +if !exists('g:ale_objcpp_clang_options') + let g:ale_objcpp_clang_options = '-std=c++14 -Wall' +endif + +function! ale_linters#objcpp#clang#GetCommand(buffer) abort + " -iquote with the directory the file is in makes #include work for + " headers in the same directory. + return 'clang++ -S -x objective-c++ -fsyntax-only ' + \ . '-iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h')) + \ . ' ' . ale#Var(a:buffer, 'objcpp_clang_options') . ' -' +endfunction + +call ale#linter#Define('objcpp', { +\ 'name': 'clang', +\ 'output_stream': 'stderr', +\ 'executable': 'clang++', +\ 'command_callback': 'ale_linters#objcpp#clang#GetCommand', +\ 'callback': 'ale#handlers#gcc#HandleGCCFormat', +\}) diff --git a/sources_non_forked/ale/ale_linters/ocaml/merlin.vim b/sources_non_forked/ale/ale_linters/ocaml/merlin.vim new file mode 100644 index 00000000..cfec9966 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/ocaml/merlin.vim @@ -0,0 +1,17 @@ +" Author: Andrey Popp -- @andreypopp +" Description: Report errors in OCaml code with Merlin + +if !exists('g:merlin') + finish +endif + +function! ale_linters#ocaml#merlin#Handle(buffer, lines) abort + return merlin#ErrorLocList() +endfunction + +call ale#linter#Define('ocaml', { +\ 'name': 'merlin', +\ 'executable': 'ocamlmerlin', +\ 'command': 'true', +\ 'callback': 'ale_linters#ocaml#merlin#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/ocaml/ols.vim b/sources_non_forked/ale/ale_linters/ocaml/ols.vim new file mode 100644 index 00000000..c0255a6c --- /dev/null +++ b/sources_non_forked/ale/ale_linters/ocaml/ols.vim @@ -0,0 +1,14 @@ +" Author: Michael Jungo +" Description: A language server for OCaml + +call ale#Set('ocaml_ols_executable', 'ocaml-language-server') +call ale#Set('ocaml_ols_use_global', 0) + +call ale#linter#Define('ocaml', { +\ 'name': 'ols', +\ 'lsp': 'stdio', +\ 'executable_callback': 'ale#handlers#ols#GetExecutable', +\ 'command_callback': 'ale#handlers#ols#GetCommand', +\ 'language_callback': 'ale#handlers#ols#GetLanguage', +\ 'project_root_callback': 'ale#handlers#ols#GetProjectRoot', +\}) diff --git a/sources_non_forked/ale/ale_linters/perl/perl.vim b/sources_non_forked/ale/ale_linters/perl/perl.vim new file mode 100644 index 00000000..1b9aa95e --- /dev/null +++ b/sources_non_forked/ale/ale_linters/perl/perl.vim @@ -0,0 +1,68 @@ +" Author: Vincent Lequertier +" Description: This file adds support for checking perl syntax + +let g:ale_perl_perl_executable = +\ get(g:, 'ale_perl_perl_executable', 'perl') + +let g:ale_perl_perl_options = +\ get(g:, 'ale_perl_perl_options', '-c -Mwarnings -Ilib') + +function! ale_linters#perl#perl#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'perl_perl_executable') +endfunction + +function! ale_linters#perl#perl#GetCommand(buffer) abort + return ale#Escape(ale_linters#perl#perl#GetExecutable(a:buffer)) + \ . ' ' . ale#Var(a:buffer, 'perl_perl_options') + \ . ' %t' +endfunction + +let s:begin_failed_skip_pattern = '\v' . join([ +\ '^Compilation failed in require', +\ '^Can''t locate', +\], '|') + +function! ale_linters#perl#perl#Handle(buffer, lines) abort + let l:pattern = '\(.\+\) at \(.\+\) line \(\d\+\)' + let l:output = [] + let l:basename = expand('#' . a:buffer . ':t') + + let l:type = 'E' + if a:lines[-1] =~# 'syntax OK' + let l:type = 'W' + endif + + let l:seen = {} + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + let l:line = l:match[3] + let l:file = l:match[2] + let l:text = l:match[1] + + if ale#path#IsBufferPath(a:buffer, l:file) + \ && !has_key(l:seen,l:line) + \ && ( + \ l:text isnot# 'BEGIN failed--compilation aborted' + \ || empty(l:output) + \ || match(l:output[-1].text, s:begin_failed_skip_pattern) < 0 + \ ) + call add(l:output, { + \ 'lnum': l:line, + \ 'text': l:text, + \ 'type': l:type, + \}) + + let l:seen[l:line] = 1 + endif + endfor + + return l:output +endfunction + +call ale#linter#Define('perl', { +\ 'name': 'perl', +\ 'executable_callback': 'ale_linters#perl#perl#GetExecutable', +\ 'output_stream': 'both', +\ 'command_callback': 'ale_linters#perl#perl#GetCommand', +\ 'callback': 'ale_linters#perl#perl#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/perl/perlcritic.vim b/sources_non_forked/ale/ale_linters/perl/perlcritic.vim new file mode 100644 index 00000000..24f7eb86 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/perl/perlcritic.vim @@ -0,0 +1,77 @@ +" Author: Vincent Lequertier , Chris Weyl +" Description: This file adds support for checking perl with perl critic + +let g:ale_perl_perlcritic_executable = +\ get(g:, 'ale_perl_perlcritic_executable', 'perlcritic') + +let g:ale_perl_perlcritic_profile = +\ get(g:, 'ale_perl_perlcritic_profile', '.perlcriticrc') + +let g:ale_perl_perlcritic_options = +\ get(g:, 'ale_perl_perlcritic_options', '') + +let g:ale_perl_perlcritic_showrules = +\ get(g:, 'ale_perl_perlcritic_showrules', 0) + +function! ale_linters#perl#perlcritic#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'perl_perlcritic_executable') +endfunction + +function! ale_linters#perl#perlcritic#GetProfile(buffer) abort + + " first see if we've been overridden + let l:profile = ale#Var(a:buffer, 'perl_perlcritic_profile') + if l:profile is? '' + return '' + endif + + " otherwise, iterate upwards to find it + return ale#path#FindNearestFile(a:buffer, l:profile) +endfunction + +function! ale_linters#perl#perlcritic#GetCommand(buffer) abort + let l:critic_verbosity = '%l:%c %m\n' + if ale#Var(a:buffer, 'perl_perlcritic_showrules') + let l:critic_verbosity = '%l:%c %m [%p]\n' + endif + + let l:profile = ale_linters#perl#perlcritic#GetProfile(a:buffer) + let l:options = ale#Var(a:buffer, 'perl_perlcritic_options') + + let l:command = ale#Escape(ale_linters#perl#perlcritic#GetExecutable(a:buffer)) + \ . " --verbose '". l:critic_verbosity . "' --nocolor" + + if l:profile isnot? '' + let l:command .= ' --profile ' . ale#Escape(l:profile) + endif + if l:options isnot? '' + let l:command .= ' ' . l:options + endif + + return l:command +endfunction + + +function! ale_linters#perl#perlcritic#Handle(buffer, lines) abort + let l:pattern = '\(\d\+\):\(\d\+\) \(.\+\)' + 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], + \ 'text': l:match[3], + \ 'type': 'W' + \}) + endfor + + return l:output +endfunction + +call ale#linter#Define('perl', { +\ 'name': 'perlcritic', +\ 'output_stream': 'stdout', +\ 'executable_callback': 'ale_linters#perl#perlcritic#GetExecutable', +\ 'command_callback': 'ale_linters#perl#perlcritic#GetCommand', +\ 'callback': 'ale_linters#perl#perlcritic#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/php/hack.vim b/sources_non_forked/ale/ale_linters/php/hack.vim new file mode 100644 index 00000000..77d3a588 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/php/hack.vim @@ -0,0 +1,28 @@ +" Author: Zefei Xuan +" Description: Hack type checking (http://hacklang.org/) + +function! ale_linters#php#hack#Handle(buffer, lines) abort + let l:pattern = '^\(.*\):\(\d\+\):\(\d\+\),\(\d\+\): \(.\+])\)$' + let l:output = [] + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + if a:buffer != bufnr(l:match[1]) + continue + endif + + call add(l:output, { + \ 'lnum': l:match[2] + 0, + \ 'col': l:match[3] + 0, + \ 'text': l:match[5], + \}) + endfor + + return l:output +endfunction + +call ale#linter#Define('php', { +\ 'name': 'hack', +\ 'executable': 'hh_client', +\ 'command': 'hh_client --retries 0 --retry-if-init false', +\ 'callback': 'ale_linters#php#hack#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/php/langserver.vim b/sources_non_forked/ale/ale_linters/php/langserver.vim new file mode 100644 index 00000000..be2d6ef1 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/php/langserver.vim @@ -0,0 +1,34 @@ +" Author: Eric Stern +" Description: PHP Language server integration for ALE + +call ale#Set('php_langserver_executable', 'php-language-server.php') +call ale#Set('php_langserver_use_global', 0) + +function! ale_linters#php#langserver#GetExecutable(buffer) abort + return ale#node#FindExecutable(a:buffer, 'php_langserver', [ + \ 'vendor/bin/php-language-server.php', + \]) +endfunction + +function! ale_linters#php#langserver#GetCommand(buffer) abort + return 'php ' . ale#Escape(ale_linters#php#langserver#GetExecutable(a:buffer)) +endfunction + +function! ale_linters#php#langserver#GetLanguage(buffer) abort + return 'php' +endfunction + +function! ale_linters#php#langserver#GetProjectRoot(buffer) abort + let l:git_path = ale#path#FindNearestDirectory(a:buffer, '.git') + + return !empty(l:git_path) ? fnamemodify(l:git_path, ':h:h') : '' +endfunction + +call ale#linter#Define('php', { +\ 'name': 'langserver', +\ 'lsp': 'stdio', +\ 'executable_callback': 'ale_linters#php#langserver#GetExecutable', +\ 'command_callback': 'ale_linters#php#langserver#GetCommand', +\ 'language_callback': 'ale_linters#php#langserver#GetLanguage', +\ 'project_root_callback': 'ale_linters#php#langserver#GetProjectRoot', +\}) diff --git a/sources_non_forked/ale/ale_linters/php/phan.vim b/sources_non_forked/ale/ale_linters/php/phan.vim new file mode 100644 index 00000000..f3b3d48f --- /dev/null +++ b/sources_non_forked/ale/ale_linters/php/phan.vim @@ -0,0 +1,36 @@ +" Author: diegoholiveira +" Description: static analyzer for PHP + +" Define the minimum severity +let g:ale_php_phan_minimum_severity = get(g:, 'ale_php_phan_minimum_severity', 0) + +function! ale_linters#php#phan#GetCommand(buffer) abort + return 'phan -y ' + \ . ale#Var(a:buffer, 'php_phan_minimum_severity') + \ . ' %s' +endfunction + +function! ale_linters#php#phan#Handle(buffer, lines) abort + " Matches against lines like the following: + " + " /path/to/some-filename.php:18 ERRORTYPE message + let l:pattern = '^.*:\(\d\+\)\s\(\w\+\)\s\(.\+\)$' + let l:output = [] + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + call add(l:output, { + \ 'lnum': l:match[1] + 0, + \ 'text': l:match[3], + \ 'type': 'W', + \}) + endfor + + return l:output +endfunction + +call ale#linter#Define('php', { +\ 'name': 'phan', +\ 'executable': 'phan', +\ 'command_callback': 'ale_linters#php#phan#GetCommand', +\ 'callback': 'ale_linters#php#phan#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/php/php.vim b/sources_non_forked/ale/ale_linters/php/php.vim new file mode 100644 index 00000000..6470383b --- /dev/null +++ b/sources_non_forked/ale/ale_linters/php/php.vim @@ -0,0 +1,37 @@ +" Author: Spencer Wood , Adriaan Zonnenberg +" Description: This file adds support for checking PHP with php-cli + +function! ale_linters#php#php#Handle(buffer, lines) abort + " Matches patterns like the following: + " + " PHP 7.1<= - Parse error: syntax error, unexpected ';', expecting ']' in - on line 15 + " PHP 7.2>= - Parse error: syntax error, unexpected ';', expecting ']' in Standard input code on line 15 + let l:pattern = '\v^%(Fatal|Parse) error:\s+(.+unexpected ''(.+)%(expecting.+)@, Eric Stern +" Description: phpcs for PHP files + +let g:ale_php_phpcs_standard = get(g:, 'ale_php_phpcs_standard', '') + +call ale#Set('php_phpcs_executable', 'phpcs') +call ale#Set('php_phpcs_use_global', 0) + +function! ale_linters#php#phpcs#GetExecutable(buffer) abort + return ale#node#FindExecutable(a:buffer, 'php_phpcs', [ + \ 'vendor/bin/phpcs', + \ 'phpcs' + \]) +endfunction + +function! ale_linters#php#phpcs#GetCommand(buffer) abort + let l:executable = ale_linters#php#phpcs#GetExecutable(a:buffer) + + let l:standard = ale#Var(a:buffer, 'php_phpcs_standard') + let l:standard_option = !empty(l:standard) + \ ? '--standard=' . l:standard + \ : '' + + return ale#Escape(l:executable) + \ . ' -s --report=emacs --stdin-path=%s ' . l:standard_option +endfunction + +function! ale_linters#php#phpcs#Handle(buffer, lines) abort + " Matches against lines like the following: + " + " /path/to/some-filename.php:18:3: error - Line indented incorrectly; expected 4 spaces, found 2 (Generic.WhiteSpace.ScopeIndent.IncorrectExact) + let l:pattern = '^.*:\(\d\+\):\(\d\+\): \(.\+\) - \(.\+\) (\(.\+\))$' + let l:output = [] + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + let l:code = l:match[5] + let l:text = l:match[4] . ' (' . l:code . ')' + let l:type = l:match[3] + + call add(l:output, { + \ 'lnum': l:match[1] + 0, + \ 'col': l:match[2] + 0, + \ 'text': l:text, + \ 'type': l:type is# 'error' ? 'E' : 'W', + \}) + endfor + + return l:output +endfunction + +call ale#linter#Define('php', { +\ 'name': 'phpcs', +\ 'executable_callback': 'ale_linters#php#phpcs#GetExecutable', +\ 'command_callback': 'ale_linters#php#phpcs#GetCommand', +\ 'callback': 'ale_linters#php#phpcs#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/php/phpmd.vim b/sources_non_forked/ale/ale_linters/php/phpmd.vim new file mode 100644 index 00000000..e9450752 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/php/phpmd.vim @@ -0,0 +1,45 @@ +" Author: medains , David Sierra +" Description: phpmd for PHP files + +let g:ale_php_phpmd_executable = get(g:, 'ale_php_phpmd_executable', 'phpmd') + +" Set to change the ruleset +let g:ale_php_phpmd_ruleset = get(g:, 'ale_php_phpmd_ruleset', 'cleancode,codesize,controversial,design,naming,unusedcode') + +function! ale_linters#php#phpmd#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'php_phpmd_executable') +endfunction + +function! ale_linters#php#phpmd#GetCommand(buffer) abort + let l:executable = ale_linters#php#phpmd#GetExecutable(a:buffer) + + return ale#Escape(l:executable) + \ . ' %s text ' + \ . ale#Var(a:buffer, 'php_phpmd_ruleset') + \ . ' --ignore-violations-on-exit %t' +endfunction + +function! ale_linters#php#phpmd#Handle(buffer, lines) abort + " Matches against lines like the following: + " + " /path/to/some-filename.php:18 message + let l:pattern = '^.*:\(\d\+\)\s\+\(.\+\)$' + let l:output = [] + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + call add(l:output, { + \ 'lnum': l:match[1] + 0, + \ 'text': l:match[2], + \ 'type': 'W', + \}) + endfor + + return l:output +endfunction + +call ale#linter#Define('php', { +\ 'name': 'phpmd', +\ 'executable_callback': 'ale_linters#php#phpmd#GetExecutable', +\ 'command_callback': 'ale_linters#php#phpmd#GetCommand', +\ 'callback': 'ale_linters#php#phpmd#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/php/phpstan.vim b/sources_non_forked/ale/ale_linters/php/phpstan.vim new file mode 100644 index 00000000..24762086 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/php/phpstan.vim @@ -0,0 +1,53 @@ +" Author: medains , ardis +" Description: phpstan for PHP files + +" Set to change the ruleset +let g:ale_php_phpstan_executable = get(g:, 'ale_php_phpstan_executable', 'phpstan') +let g:ale_php_phpstan_level = get(g:, 'ale_php_phpstan_level', '4') +let g:ale_php_phpstan_configuration = get(g:, 'ale_php_phpstan_configuration', '') + +function! ale_linters#php#phpstan#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'php_phpstan_executable') +endfunction + +function! ale_linters#php#phpstan#GetCommand(buffer) abort + let l:executable = ale_linters#php#phpstan#GetExecutable(a:buffer) + + let l:configuration = ale#Var(a:buffer, 'php_phpstan_configuration') + let l:configuration_option = !empty(l:configuration) + \ ? ' -c ' . l:configuration + \ : '' + + return ale#Escape(l:executable) + \ . ' analyze -l' + \ . ale#Var(a:buffer, 'php_phpstan_level') + \ . ' --errorFormat raw' + \ . l:configuration_option + \ . ' %s' +endfunction + +function! ale_linters#php#phpstan#Handle(buffer, lines) abort + " Matches against lines like the following: + " + " filename.php:15:message + " C:\folder\filename.php:15:message + let l:pattern = '^\([a-zA-Z]:\)\?[^:]\+:\(\d\+\):\(.*\)$' + let l:output = [] + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + call add(l:output, { + \ 'lnum': l:match[2] + 0, + \ 'text': l:match[3], + \ 'type': 'W', + \}) + endfor + + return l:output +endfunction + +call ale#linter#Define('php', { +\ 'name': 'phpstan', +\ 'executable_callback': 'ale_linters#php#phpstan#GetExecutable', +\ 'command_callback': 'ale_linters#php#phpstan#GetCommand', +\ 'callback': 'ale_linters#php#phpstan#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/po/alex.vim b/sources_non_forked/ale/ale_linters/po/alex.vim new file mode 100644 index 00000000..411d835b --- /dev/null +++ b/sources_non_forked/ale/ale_linters/po/alex.vim @@ -0,0 +1,11 @@ +" Author: Cian Butler https://github.com/butlerx +" Description: alex for PO files + +call ale#linter#Define('po', { +\ 'name': 'alex', +\ 'executable': 'alex', +\ 'command': 'alex %s -t', +\ 'output_stream': 'stderr', +\ 'callback': 'ale#handlers#alex#Handle', +\ 'lint_file': 1, +\}) diff --git a/sources_non_forked/ale/ale_linters/po/msgfmt.vim b/sources_non_forked/ale/ale_linters/po/msgfmt.vim new file mode 100644 index 00000000..578792bf --- /dev/null +++ b/sources_non_forked/ale/ale_linters/po/msgfmt.vim @@ -0,0 +1,10 @@ +" Author: Cian Butler https://github.com/butlerx +" Description: msgfmt for PO files + +call ale#linter#Define('po', { +\ 'name': 'msgfmt', +\ 'executable': 'msgfmt', +\ 'output_stream': 'stderr', +\ 'command': 'msgfmt --statistics --output-file=- %t', +\ 'callback': 'ale#handlers#unix#HandleAsWarning', +\}) diff --git a/sources_non_forked/ale/ale_linters/po/proselint.vim b/sources_non_forked/ale/ale_linters/po/proselint.vim new file mode 100644 index 00000000..ce132508 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/po/proselint.vim @@ -0,0 +1,9 @@ +" Author: Cian Butler https://github.com/butlerx +" Description: proselint for PO files + +call ale#linter#Define('po', { +\ 'name': 'proselint', +\ 'executable': 'proselint', +\ 'command': 'proselint %t', +\ 'callback': 'ale#handlers#unix#HandleAsWarning', +\}) diff --git a/sources_non_forked/ale/ale_linters/po/write-good.vim b/sources_non_forked/ale/ale_linters/po/write-good.vim new file mode 100644 index 00000000..5a01cb66 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/po/write-good.vim @@ -0,0 +1,9 @@ +" 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', +\}) diff --git a/sources_non_forked/ale/ale_linters/pod/alex.vim b/sources_non_forked/ale/ale_linters/pod/alex.vim new file mode 100644 index 00000000..5c09befb --- /dev/null +++ b/sources_non_forked/ale/ale_linters/pod/alex.vim @@ -0,0 +1,11 @@ +" Author: Johannes Wienke +" Description: alex for pod files + +call ale#linter#Define('pod', { +\ 'name': 'alex', +\ 'executable': 'alex', +\ 'command': 'alex %s -t', +\ 'output_stream': 'stderr', +\ 'callback': 'ale#handlers#alex#Handle', +\ 'lint_file': 1, +\}) diff --git a/sources_non_forked/ale/ale_linters/pod/proselint.vim b/sources_non_forked/ale/ale_linters/pod/proselint.vim new file mode 100644 index 00000000..2eb83f56 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/pod/proselint.vim @@ -0,0 +1,9 @@ +" Author: Daniel M. Capella https://github.com/polyzen +" Description: proselint for Pod files + +call ale#linter#Define('pod', { +\ 'name': 'proselint', +\ 'executable': 'proselint', +\ 'command': 'proselint %t', +\ 'callback': 'ale#handlers#unix#HandleAsWarning', +\}) diff --git a/sources_non_forked/ale/ale_linters/pod/write-good.vim b/sources_non_forked/ale/ale_linters/pod/write-good.vim new file mode 100644 index 00000000..14ed5c0c --- /dev/null +++ b/sources_non_forked/ale/ale_linters/pod/write-good.vim @@ -0,0 +1,9 @@ +" Author: Sumner Evans +" 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', +\}) diff --git a/sources_non_forked/ale/ale_linters/pony/ponyc.vim b/sources_non_forked/ale/ale_linters/pony/ponyc.vim new file mode 100644 index 00000000..b3329053 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/pony/ponyc.vim @@ -0,0 +1,21 @@ +" Description: ponyc linter for pony files + +call ale#Set('pony_ponyc_executable', 'ponyc') +call ale#Set('pony_ponyc_options', '--pass paint') + +function! ale_linters#pony#ponyc#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'pony_ponyc_executable') +endfunction + +function! ale_linters#pony#ponyc#GetCommand(buffer) abort + return ale#Escape(ale_linters#pony#ponyc#GetExecutable(a:buffer)) + \ . ' ' . ale#Var(a:buffer, 'pony_ponyc_options') +endfunction + +call ale#linter#Define('pony', { +\ 'name': 'ponyc', +\ 'output_stream': 'stderr', +\ 'executable_callback': 'ale_linters#pony#ponyc#GetExecutable', +\ 'command_callback': 'ale_linters#pony#ponyc#GetCommand', +\ 'callback': 'ale#handlers#pony#HandlePonycFormat', +\}) diff --git a/sources_non_forked/ale/ale_linters/proto/protoc_gen_lint.vim b/sources_non_forked/ale/ale_linters/proto/protoc_gen_lint.vim new file mode 100644 index 00000000..c8b5c331 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/proto/protoc_gen_lint.vim @@ -0,0 +1,27 @@ +" Author: Jeff Willette +" Description: run the protoc-gen-lint plugin for the protoc binary + +call ale#Set('proto_protoc_gen_lint_options', '') + +function! ale_linters#proto#protoc_gen_lint#GetCommand(buffer) abort + let l:dirname = expand('#' . a:buffer . ':p:h') + + let l:options = ['-I ' . ale#Escape(l:dirname)] + + if !empty(ale#Var(a:buffer, 'proto_protoc_gen_lint_options')) + let l:options += [ale#Var(a:buffer, 'proto_protoc_gen_lint_options')] + endif + + let l:options += ['--lint_out=. ' . '%s'] + + return 'protoc' . ' ' . join(l:options) +endfunction + +call ale#linter#Define('proto', { +\ 'name': 'protoc-gen-lint', +\ 'lint_file': 1, +\ 'output_stream': 'stderr', +\ 'executable': 'protoc', +\ 'command_callback': 'ale_linters#proto#protoc_gen_lint#GetCommand', +\ 'callback': 'ale#handlers#unix#HandleAsError', +\}) diff --git a/sources_non_forked/ale/ale_linters/pug/puglint.vim b/sources_non_forked/ale/ale_linters/pug/puglint.vim new file mode 100644 index 00000000..6c29efe9 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/pug/puglint.vim @@ -0,0 +1,48 @@ +" Author: w0rp - +" Description: pug-lint for checking Pug/Jade files. + +call ale#Set('pug_puglint_options', '') +call ale#Set('pug_puglint_executable', 'pug-lint') +call ale#Set('pug_puglint_use_global', 0) + +function! ale_linters#pug#puglint#GetExecutable(buffer) abort + return ale#node#FindExecutable(a:buffer, 'pug_puglint', [ + \ 'node_modules/.bin/pug-lint', + \]) +endfunction + +function! s:FindConfig(buffer) abort + for l:filename in [ + \ '.pug-lintrc', + \ '.pug-lintrc.js', + \ '.pug-lintrc.json', + \ 'package.json', + \] + let l:config = ale#path#FindNearestFile(a:buffer, l:filename) + + if !empty(l:config) + return l:config + endif + endfor + + return '' +endfunction + +function! ale_linters#pug#puglint#GetCommand(buffer) abort + let l:executable = ale_linters#pug#puglint#GetExecutable(a:buffer) + let l:options = ale#Var(a:buffer, 'pug_puglint_options') + let l:config = s:FindConfig(a:buffer) + + return ale#Escape(l:executable) + \ . (!empty(l:options) ? ' ' . l:options : '') + \ . (!empty(l:config) ? ' -c ' . ale#Escape(l:config) : '') + \ . ' -r inline %t' +endfunction + +call ale#linter#Define('pug', { +\ 'name': 'puglint', +\ 'executable_callback': 'ale_linters#pug#puglint#GetExecutable', +\ 'output_stream': 'stderr', +\ 'command_callback': 'ale_linters#pug#puglint#GetCommand', +\ 'callback': 'ale#handlers#unix#HandleAsError', +\}) diff --git a/sources_non_forked/ale/ale_linters/puppet/puppet.vim b/sources_non_forked/ale/ale_linters/puppet/puppet.vim new file mode 100644 index 00000000..8beeb61e --- /dev/null +++ b/sources_non_forked/ale/ale_linters/puppet/puppet.vim @@ -0,0 +1,28 @@ +" Author: Alexander Olofsson + +function! ale_linters#puppet#puppet#Handle(buffer, lines) abort + " Matches patterns like the following: + " Error: Could not parse for environment production: Syntax error at ':' at /root/puppetcode/modules/nginx/manifests/init.pp:43:12 + " Error: Could not parse for environment production: Syntax error at '='; expected '}' at /root/puppetcode/modules/pancakes/manifests/init.pp:5" + + let l:pattern = '^Error: .*: \(.\+\) at .\+\.pp:\(\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[1], + \}) + endfor + + return l:output +endfunction + +call ale#linter#Define('puppet', { +\ 'name': 'puppet', +\ 'executable': 'puppet', +\ 'output_stream': 'stderr', +\ 'command': 'puppet parser validate --color=false %t', +\ 'callback': 'ale_linters#puppet#puppet#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/puppet/puppetlint.vim b/sources_non_forked/ale/ale_linters/puppet/puppetlint.vim new file mode 100644 index 00000000..13da511b --- /dev/null +++ b/sources_non_forked/ale/ale_linters/puppet/puppetlint.vim @@ -0,0 +1,26 @@ +" Author: Alexander Olofsson , Robert Flechtner +" Description: puppet-lint for puppet files + +let g:ale_puppet_puppetlint_executable = +\ get(g:, 'ale_puppet_puppetlint_executable', 'puppet-lint') + +let g:ale_puppet_puppetlint_options = +\ get(g:, 'ale_puppet_puppetlint_options', '--no-autoloader_layout-check') + +function! ale_linters#puppet#puppetlint#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'puppet_puppetlint_executable') +endfunction + +function! ale_linters#puppet#puppetlint#GetCommand(buffer) abort + return ale_linters#puppet#puppetlint#GetExecutable(a:buffer) + \ . ' ' . ale#Var(a:buffer, 'puppet_puppetlint_options') + \ . ' --log-format "-:%{line}:%{column}: %{kind}: [%{check}] %{message}"' + \ . ' %t' +endfunction + +call ale#linter#Define('puppet', { +\ 'name': 'puppetlint', +\ 'executable_callback': 'ale_linters#puppet#puppetlint#GetExecutable', +\ 'command_callback': 'ale_linters#puppet#puppetlint#GetCommand', +\ 'callback': 'ale#handlers#gcc#HandleGCCFormat', +\}) diff --git a/sources_non_forked/ale/ale_linters/pyrex/cython.vim b/sources_non_forked/ale/ale_linters/pyrex/cython.vim new file mode 100644 index 00000000..bd5a447f --- /dev/null +++ b/sources_non_forked/ale/ale_linters/pyrex/cython.vim @@ -0,0 +1,10 @@ +" Author: w0rp +" Description: cython syntax checking for cython files. + +call ale#linter#Define('pyrex', { +\ 'name': 'cython', +\ 'output_stream': 'stderr', +\ 'executable': 'cython', +\ 'command': 'cython --warning-extra -o ' . g:ale#util#nul_file . ' %t', +\ 'callback': 'ale#handlers#unix#HandleAsError', +\}) diff --git a/sources_non_forked/ale/ale_linters/python/flake8.vim b/sources_non_forked/ale/ale_linters/python/flake8.vim new file mode 100644 index 00000000..e7bbcfb1 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/python/flake8.vim @@ -0,0 +1,146 @@ +" Author: w0rp +" Description: flake8 for python files + +let g:ale_python_flake8_executable = +\ get(g:, 'ale_python_flake8_executable', 'flake8') + +" Support an old setting as a fallback. +let s:default_options = get(g:, 'ale_python_flake8_args', '') +let g:ale_python_flake8_options = +\ get(g:, 'ale_python_flake8_options', s:default_options) +let g:ale_python_flake8_use_global = get(g:, 'ale_python_flake8_use_global', 0) + +function! s:UsingModule(buffer) abort + return ale#Var(a:buffer, 'python_flake8_options') =~# ' *-m flake8' +endfunction + +function! ale_linters#python#flake8#GetExecutable(buffer) abort + if !s:UsingModule(a:buffer) + return ale#python#FindExecutable(a:buffer, 'python_flake8', ['flake8']) + endif + + return ale#Var(a:buffer, 'python_flake8_executable') +endfunction + +function! ale_linters#python#flake8#VersionCheck(buffer) abort + let l:executable = ale_linters#python#flake8#GetExecutable(a:buffer) + + " If we have previously stored the version number in a cache, then + " don't look it up again. + if ale#semver#HasVersion(l:executable) + " Returning an empty string skips this command. + return '' + endif + + let l:executable = ale#Escape(l:executable) + let l:module_string = s:UsingModule(a:buffer) ? ' -m flake8' : '' + + return l:executable . l:module_string . ' --version' +endfunction + +function! ale_linters#python#flake8#GetCommand(buffer, version_output) abort + let l:executable = ale_linters#python#flake8#GetExecutable(a:buffer) + let l:version = ale#semver#GetVersion(l:executable, a:version_output) + + " Only include the --stdin-display-name argument if we can parse the + " flake8 version, and it is recent enough to support it. + let l:display_name_args = ale#semver#GTE(l:version, [3, 0, 0]) + \ ? ' --stdin-display-name %s' + \ : '' + + let l:options = ale#Var(a:buffer, 'python_flake8_options') + + return ale#Escape(l:executable) + \ . (!empty(l:options) ? ' ' . l:options : '') + \ . ' --format=default' + \ . l:display_name_args . ' -' +endfunction + +let s:end_col_pattern_map = { +\ 'F405': '\(.\+\) may be undefined', +\ 'F821': 'undefined name ''\([^'']\+\)''', +\ 'F999': '^''\([^'']\+\)''', +\ 'F841': 'local variable ''\([^'']\+\)''', +\} + +function! ale_linters#python#flake8#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: + " + " Matches patterns line the following: + " + " stdin:6:6: E111 indentation is not a multiple of four + 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[3] + + if (l:code is# 'W291' || l:code is# 'W293') + \ && !ale#Var(a:buffer, 'warn_about_trailing_whitespace') + " Skip warnings for trailing whitespace if the option is off. + continue + endif + + if l:code is# 'W391' + \&& !ale#Var(a:buffer, 'warn_about_trailing_blank_lines') + " Skip warnings for trailing blank lines if the option is off + continue + endif + + let l:item = { + \ 'lnum': l:match[1] + 0, + \ 'col': l:match[2] + 0, + \ 'text': l:match[4], + \ 'code': l:code, + \ 'type': 'W', + \} + + if l:code[:0] is# 'F' + if l:code isnot# 'F401' + let l:item.type = 'E' + endif + elseif l:code[:0] is# 'E' + let l:item.type = 'E' + + if l:code isnot# 'E999' && l:code isnot# 'E112' + let l:item.sub_type = 'style' + endif + elseif l:code[:0] is# 'W' + let l:item.sub_type = 'style' + endif + + let l:end_col_pattern = get(s:end_col_pattern_map, l:code, '') + + if !empty(l:end_col_pattern) + let l:end_col_match = matchlist(l:match[4], l:end_col_pattern) + + if !empty(l:end_col_match) + let l:item.end_col = l:item.col + len(l:end_col_match[1]) - 1 + endif + endif + + call add(l:output, l:item) + endfor + + return l:output +endfunction + +call ale#linter#Define('python', { +\ 'name': 'flake8', +\ 'executable_callback': 'ale_linters#python#flake8#GetExecutable', +\ 'command_chain': [ +\ {'callback': 'ale_linters#python#flake8#VersionCheck'}, +\ {'callback': 'ale_linters#python#flake8#GetCommand', 'output_stream': 'both'}, +\ ], +\ 'callback': 'ale_linters#python#flake8#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/python/mypy.vim b/sources_non_forked/ale/ale_linters/python/mypy.vim new file mode 100644 index 00000000..c1c91742 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/python/mypy.vim @@ -0,0 +1,71 @@ +" Author: Keith Smiley , w0rp +" Description: mypy support for optional python typechecking + +call ale#Set('python_mypy_executable', 'mypy') +call ale#Set('python_mypy_ignore_invalid_syntax', 0) +call ale#Set('python_mypy_options', '') +call ale#Set('python_mypy_use_global', 0) + +function! ale_linters#python#mypy#GetExecutable(buffer) abort + return ale#python#FindExecutable(a:buffer, 'python_mypy', ['mypy']) +endfunction + +" The directory to change to before running mypy +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#mypy#GetCommand(buffer) abort + let l:dir = s:GetDir(a:buffer) + let l:executable = ale_linters#python#mypy#GetExecutable(a:buffer) + + " We have to always switch to an explicit directory for a command so + " we can know with certainty the base path for the 'filename' keys below. + return ale#path#CdString(l:dir) + \ . ale#Escape(l:executable) + \ . ' --show-column-numbers ' + \ . ale#Var(a:buffer, 'python_mypy_options') + \ . ' --shadow-file %s %t %s' +endfunction + +function! ale_linters#python#mypy#Handle(buffer, lines) abort + let l:dir = s:GetDir(a:buffer) + " Look for lines like the following: + " + " file.py:4: error: No library stub file for module 'django.db' + " + " Lines like these should be ignored below: + " + " file.py:4: note: (Stub files are from https://github.com/python/typeshed) + let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):?(\d+)?: (error|warning): (.+)$' + let l:output = [] + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + " Skip invalid syntax errors if the option is on. + if l:match[5] is# 'invalid syntax' + \&& ale#Var(a:buffer, 'python_mypy_ignore_invalid_syntax') + continue + endif + + 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', + \ 'text': l:match[5], + \}) + endfor + + return l:output +endfunction + +call ale#linter#Define('python', { +\ 'name': 'mypy', +\ 'executable_callback': 'ale_linters#python#mypy#GetExecutable', +\ 'command_callback': 'ale_linters#python#mypy#GetCommand', +\ 'callback': 'ale_linters#python#mypy#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/python/prospector.vim b/sources_non_forked/ale/ale_linters/python/prospector.vim new file mode 100644 index 00000000..66af598a --- /dev/null +++ b/sources_non_forked/ale/ale_linters/python/prospector.vim @@ -0,0 +1,82 @@ +" Author: chocoelho +" Description: prospector linter python files + +let g:ale_python_prospector_executable = +\ get(g:, 'ale_python_prospector_executable', 'prospector') + +let g:ale_python_prospector_options = +\ get(g:, 'ale_python_prospector_options', '') + +let g:ale_python_prospector_use_global = get(g:, 'ale_python_prospector_use_global', 0) + +function! ale_linters#python#prospector#GetExecutable(buffer) abort + return ale#python#FindExecutable(a:buffer, 'python_prospector', ['prospector']) +endfunction + +function! ale_linters#python#prospector#GetCommand(buffer) abort + return ale#Escape(ale_linters#python#prospector#GetExecutable(a:buffer)) + \ . ' ' . ale#Var(a:buffer, 'python_prospector_options') + \ . ' --messages-only --absolute-paths --zero-exit --output-format json' + \ . ' %s' +endfunction + +function! ale_linters#python#prospector#Handle(buffer, lines) abort + let l:output = [] + + let l:prospector_error = json_decode(join(a:lines, '')) + + for l:error in l:prospector_error.messages + if (l:error.code is# 'W291' || l:error.code is# 'W293' || l:error.code is# 'trailing-whitespace') + \ && !ale#Var(a:buffer, 'warn_about_trailing_whitespace') + " Skip warnings for trailing whitespace if the option is off. + continue + endif + + if l:error.code is# 'W391' + \&& !ale#Var(a:buffer, 'warn_about_trailing_blank_lines') + " Skip warnings for trailing blank lines if the option is off + continue + endif + + if l:error.source =~# '\v\[%(dodgy|mccabe|pep8|pep257|pyroma)\]$' + let l:sub_type = 'style' + else + let l:sub_type = '' + endif + + if l:error.source =~# '\v\[pylint\]$' + let l:type = l:error.code =~? '\m^[CRW]' ? 'W' : 'E' + elseif l:error.source =~# '\v\[%(frosted|pep8)\]$' + let l:type = l:error.code =~? '\m^W' ? 'W' : 'E' + elseif l:error.source =~# '\v\[%(dodgy|pyroma|vulture)\]$' + let l:type = 'W' + else + let l:type = 'E' + endif + + let l:item = { + \ 'lnum': l:error.location.line, + \ 'col': l:error.location.character + 1, + \ 'text': l:error.message, + \ 'code': printf('(%s) %s', l:error.source, l:error.code), + \ 'type': l:type, + \ 'sub_type': l:sub_type, + \} + + if l:sub_type is# '' + unlet l:item.sub_type + endif + + call add(l:output, l:item) + endfor + + return l:output +endfunction + +call ale#linter#Define('python', { +\ 'name': 'prospector', +\ 'executable_callback': 'ale_linters#python#prospector#GetExecutable', +\ 'command_callback': 'ale_linters#python#prospector#GetCommand', +\ 'callback': 'ale_linters#python#prospector#Handle', +\ 'lint_file': 1, +\}) diff --git a/sources_non_forked/ale/ale_linters/python/pycodestyle.vim b/sources_non_forked/ale/ale_linters/python/pycodestyle.vim new file mode 100644 index 00000000..19f05a53 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/python/pycodestyle.vim @@ -0,0 +1,63 @@ +" Author: Michael Thiesen +" Description: pycodestyle linting for python files + +call ale#Set('python_pycodestyle_executable', 'pycodestyle') +call ale#Set('python_pycodestyle_options', '') +call ale#Set('python_pycodestyle_use_global', 0) + +function! ale_linters#python#pycodestyle#GetExecutable(buffer) abort + return ale#python#FindExecutable(a:buffer, 'python_pycodestyle', ['pycodestyle']) +endfunction + +function! ale_linters#python#pycodestyle#GetCommand(buffer) abort + return ale#Escape(ale_linters#python#pycodestyle#GetExecutable(a:buffer)) + \ . ' ' + \ . ale#Var(a:buffer, 'python_pycodestyle_options') + \ . ' -' +endfunction + +function! ale_linters#python#pycodestyle#Handle(buffer, lines) abort + let l:pattern = '\v^(\S*):(\d*):(\d*): ([EW]\d+) (.*)$' + let l:output = [] + + " lines are formatted as follows: + " file.py:21:26: W291 trailing whitespace + for l:match in ale#util#GetMatches(a:lines, l:pattern) + if(l:match[4] is# 'W291' || l:match[4] is# 'W293') + \&& !ale#Var(a:buffer, 'warn_about_trailing_whitespace') + " Skip warnings for trailing whitespace if the option is off. + continue + endif + + if l:match[4] is# 'W391' + \&& !ale#Var(a:buffer, 'warn_about_trailing_blank_lines') + " Skip warnings for trailing blank lines if the option is off + continue + endif + + let l:item = { + \ 'lnum': l:match[2] + 0, + \ 'col': l:match[3] + 0, + \ 'type': l:match[4][0], + \ 'sub_type': 'style', + \ 'text': l:match[5], + \ 'code': l:match[4], + \} + + " E999 and E112 are syntax errors. + if l:match[4] is# 'E999' || l:match[4] is# 'E112' + unlet l:item.sub_type + endif + + call add(l:output, l:item) + endfor + + return l:output +endfunction + +call ale#linter#Define('python', { +\ 'name': 'pycodestyle', +\ 'executable_callback': 'ale_linters#python#pycodestyle#GetExecutable', +\ 'command_callback': 'ale_linters#python#pycodestyle#GetCommand', +\ 'callback': 'ale_linters#python#pycodestyle#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/python/pyflakes.vim b/sources_non_forked/ale/ale_linters/python/pyflakes.vim new file mode 100644 index 00000000..b4a0b5f9 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/python/pyflakes.vim @@ -0,0 +1,38 @@ +" Author: w0rp +" Description: pyflakes for python files + +call ale#Set('python_pyflakes_executable', 'pyflakes') +call ale#Set('python_pyflakes_use_global', 0) + +function! ale_linters#python#pyflakes#GetExecutable(buffer) abort + return ale#python#FindExecutable(a:buffer, 'python_pyflakes', ['pyflakes']) +endfunction + +function! ale_linters#python#pyflakes#GetCommand(buffer) abort + let l:executable = ale_linters#python#pyflakes#GetExecutable(a:buffer) + + return ale#Escape(l:executable) . ' %t' +endfunction + +function! ale_linters#python#pyflakes#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[1] + 0, + \ 'col': l:match[2] + 0, + \ 'text': l:match[3], + \}) + endfor + + return l:output +endfunction + +call ale#linter#Define('python', { +\ 'name': 'pyflakes', +\ 'executable_callback': 'ale_linters#python#pyflakes#GetExecutable', +\ 'command_callback': 'ale_linters#python#pyflakes#GetCommand', +\ 'callback': 'ale_linters#python#pyflakes#Handle', +\ 'output_stream': 'both', +\}) diff --git a/sources_non_forked/ale/ale_linters/python/pylint.vim b/sources_non_forked/ale/ale_linters/python/pylint.vim new file mode 100644 index 00000000..e3e6624d --- /dev/null +++ b/sources_non_forked/ale/ale_linters/python/pylint.vim @@ -0,0 +1,63 @@ +" Author: keith +" Description: pylint for python files + +let g:ale_python_pylint_executable = +\ get(g:, 'ale_python_pylint_executable', 'pylint') + +let g:ale_python_pylint_options = +\ get(g:, 'ale_python_pylint_options', '') + +let g:ale_python_pylint_use_global = get(g:, 'ale_python_pylint_use_global', 0) + +function! ale_linters#python#pylint#GetExecutable(buffer) abort + return ale#python#FindExecutable(a:buffer, 'python_pylint', ['pylint']) +endfunction + +function! ale_linters#python#pylint#GetCommand(buffer) abort + return ale#Escape(ale_linters#python#pylint#GetExecutable(a:buffer)) + \ . ' ' . ale#Var(a:buffer, 'python_pylint_options') + \ . ' --output-format text --msg-template="{path}:{line}:{column}: {msg_id} ({symbol}) {msg}" --reports n' + \ . ' %s' +endfunction + +function! ale_linters#python#pylint#Handle(buffer, lines) abort + " Matches patterns like the following: + " + " test.py:4:4: W0101 (unreachable) Unreachable code + let l:pattern = '\v^[^:]+:(\d+):(\d+): ([[:alnum:]]+) \(([^(]*)\) (.*)$' + let l:output = [] + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + "let l:failed = append(0, l:match) + let l:code = l:match[3] + + if (l:code is# 'C0303') + \ && !ale#Var(a:buffer, 'warn_about_trailing_whitespace') + " Skip warnings for trailing whitespace if the option is off. + continue + endif + + if l:code is# 'I0011' + " Skip 'Locally disabling' message + continue + endif + + call add(l:output, { + \ 'lnum': l:match[1] + 0, + \ 'col': l:match[2] + 1, + \ 'text': l:match[5], + \ 'code': l:match[4], + \ 'type': l:code[:0] is# 'E' ? 'E' : 'W', + \}) + endfor + + return l:output +endfunction + +call ale#linter#Define('python', { +\ 'name': 'pylint', +\ 'executable_callback': 'ale_linters#python#pylint#GetExecutable', +\ 'command_callback': 'ale_linters#python#pylint#GetCommand', +\ 'callback': 'ale_linters#python#pylint#Handle', +\ 'lint_file': 1, +\}) diff --git a/sources_non_forked/ale/ale_linters/python/pyls.vim b/sources_non_forked/ale/ale_linters/python/pyls.vim new file mode 100644 index 00000000..9888853f --- /dev/null +++ b/sources_non_forked/ale/ale_linters/python/pyls.vim @@ -0,0 +1,28 @@ +" Author: aurieh +" Description: A language server for Python + +call ale#Set('python_pyls_executable', 'pyls') +call ale#Set('python_pyls_use_global', 0) + +function! ale_linters#python#pyls#GetExecutable(buffer) abort + return ale#python#FindExecutable(a:buffer, 'python_pyls', ['pyls']) +endfunction + +function! ale_linters#python#pyls#GetCommand(buffer) abort + let l:executable = ale_linters#python#pyls#GetExecutable(a:buffer) + + return ale#Escape(l:executable) +endfunction + +function! ale_linters#python#pyls#GetLanguage(buffer) abort + return 'python' +endfunction + +call ale#linter#Define('python', { +\ 'name': 'pyls', +\ 'lsp': 'stdio', +\ 'executable_callback': 'ale_linters#python#pyls#GetExecutable', +\ 'command_callback': 'ale_linters#python#pyls#GetCommand', +\ 'language_callback': 'ale_linters#python#pyls#GetLanguage', +\ 'project_root_callback': 'ale#python#FindProjectRoot', +\}) diff --git a/sources_non_forked/ale/ale_linters/qml/qmllint.vim b/sources_non_forked/ale/ale_linters/qml/qmllint.vim new file mode 100644 index 00000000..c2258a14 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/qml/qmllint.vim @@ -0,0 +1,29 @@ +" Author: pylipp (www.github.com/pylipp) +" Description: qmllint for QML files + +" Find lines like +" /home/foo_user42/code-base/qml/Screen.qml:11 : Expected token `}' +function! ale_linters#qml#qmllint#Handle(buffer, lines) abort + let l:pattern = '\v^[/_-a-zA-z0-9\. ]+:(\d+) : (.*)$' + let l:output = [] + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + let l:item = { + \ 'lnum': l:match[1] + 0, + \ 'col': 0, + \ 'text': l:match[2], + \ 'type': 'E', + \} + call add(l:output, l:item) + endfor + + return l:output +endfunction + +call ale#linter#Define('qml', { +\ 'name': 'qmllint', +\ 'output_stream': 'stderr', +\ 'executable': 'qmllint', +\ 'command': 'qmllint %t', +\ 'callback': 'ale_linters#qml#qmllint#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/r/lintr.vim b/sources_non_forked/ale/ale_linters/r/lintr.vim new file mode 100644 index 00000000..51e5c562 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/r/lintr.vim @@ -0,0 +1,35 @@ +" Author: Michel Lang , w0rp , +" Fenner Macrae +" Description: This file adds support for checking R code with lintr. + +let g:ale_r_lintr_options = get(g:, 'ale_r_lintr_options', 'with_defaults()') +" A reasonable alternative default: +" get(g:, 'ale_r_lintr_options', 'with_defaults(object_usage_linter = NULL)') + + +let g:ale_r_lintr_lint_package = get(g:, 'ale_r_lintr_lint_package', 0) + +function! ale_linters#r#lintr#GetCommand(buffer) abort + if ale#Var(a:buffer, 'r_lintr_lint_package') + let l:lint_cmd = 'lint_package(cache = FALSE, linters = ' + \ . ale#Var(a:buffer, 'r_lintr_options') . ')' + else + let l:lint_cmd = 'lint(cache = FALSE, commandArgs(TRUE), ' + \ . ale#Var(a:buffer, 'r_lintr_options') . ')' + endif + + let l:cmd_string = 'suppressPackageStartupMessages(library(lintr));' + \ . l:lint_cmd + + return ale#path#BufferCdString(a:buffer) + \ . 'Rscript -e ' + \ . ale#Escape(l:cmd_string) . ' %t' +endfunction + +call ale#linter#Define('r', { +\ 'name': 'lintr', +\ 'executable': 'Rscript', +\ 'command_callback': 'ale_linters#r#lintr#GetCommand', +\ 'callback': 'ale#handlers#gcc#HandleGCCFormat', +\ 'output_stream': 'both', +\}) diff --git a/sources_non_forked/ale/ale_linters/reason/merlin.vim b/sources_non_forked/ale/ale_linters/reason/merlin.vim new file mode 100644 index 00000000..7bef7df8 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/reason/merlin.vim @@ -0,0 +1,17 @@ +" Author: Andrey Popp -- @andreypopp +" Description: Report errors in ReasonML code with Merlin + +if !exists('g:merlin') + finish +endif + +function! ale_linters#reason#merlin#Handle(buffer, lines) abort + return merlin#ErrorLocList() +endfunction + +call ale#linter#Define('reason', { +\ 'name': 'merlin', +\ 'executable': 'ocamlmerlin', +\ 'command': 'true', +\ 'callback': 'ale_linters#reason#merlin#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/reason/ols.vim b/sources_non_forked/ale/ale_linters/reason/ols.vim new file mode 100644 index 00000000..b2cd5f79 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/reason/ols.vim @@ -0,0 +1,14 @@ +" Author: Michael Jungo +" Description: A language server for Reason + +call ale#Set('reason_ols_executable', 'ocaml-language-server') +call ale#Set('reason_ols_use_global', 0) + +call ale#linter#Define('reason', { +\ 'name': 'ols', +\ 'lsp': 'stdio', +\ 'executable_callback': 'ale#handlers#ols#GetExecutable', +\ 'command_callback': 'ale#handlers#ols#GetCommand', +\ 'language_callback': 'ale#handlers#ols#GetLanguage', +\ 'project_root_callback': 'ale#handlers#ols#GetProjectRoot', +\}) diff --git a/sources_non_forked/ale/ale_linters/review/redpen.vim b/sources_non_forked/ale/ale_linters/review/redpen.vim new file mode 100644 index 00000000..0006cab9 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/review/redpen.vim @@ -0,0 +1,9 @@ +" Author: rhysd https://rhysd.github.io +" Description: Redpen, a proofreading tool (http://redpen.cc) + +call ale#linter#Define('review', { +\ 'name': 'redpen', +\ 'executable': 'redpen', +\ 'command': 'redpen -f review -r json %t', +\ 'callback': 'ale#handlers#redpen#HandleRedpenOutput', +\}) diff --git a/sources_non_forked/ale/ale_linters/rst/alex.vim b/sources_non_forked/ale/ale_linters/rst/alex.vim new file mode 100644 index 00000000..e637eae7 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/rst/alex.vim @@ -0,0 +1,11 @@ +" Author: Johannes Wienke +" Description: alex for rst files + +call ale#linter#Define('rst', { +\ 'name': 'alex', +\ 'executable': 'alex', +\ 'command': 'alex %s -t', +\ 'output_stream': 'stderr', +\ 'callback': 'ale#handlers#alex#Handle', +\ 'lint_file': 1, +\}) diff --git a/sources_non_forked/ale/ale_linters/rst/proselint.vim b/sources_non_forked/ale/ale_linters/rst/proselint.vim new file mode 100644 index 00000000..018347ae --- /dev/null +++ b/sources_non_forked/ale/ale_linters/rst/proselint.vim @@ -0,0 +1,9 @@ +" Author: Daniel M. Capella https://github.com/polyzen +" Description: proselint for reStructuredText files + +call ale#linter#Define('rst', { +\ 'name': 'proselint', +\ 'executable': 'proselint', +\ 'command': 'proselint %t', +\ 'callback': 'ale#handlers#unix#HandleAsWarning', +\}) diff --git a/sources_non_forked/ale/ale_linters/rst/redpen.vim b/sources_non_forked/ale/ale_linters/rst/redpen.vim new file mode 100644 index 00000000..ac966c56 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/rst/redpen.vim @@ -0,0 +1,9 @@ +" Author: rhysd https://rhysd.github.io +" Description: Redpen, a proofreading tool (http://redpen.cc) + +call ale#linter#Define('rst', { +\ 'name': 'redpen', +\ 'executable': 'redpen', +\ 'command': 'redpen -f rest -r json %t', +\ 'callback': 'ale#handlers#redpen#HandleRedpenOutput', +\}) diff --git a/sources_non_forked/ale/ale_linters/rst/rstcheck.vim b/sources_non_forked/ale/ale_linters/rst/rstcheck.vim new file mode 100644 index 00000000..b660627f --- /dev/null +++ b/sources_non_forked/ale/ale_linters/rst/rstcheck.vim @@ -0,0 +1,37 @@ +" Author: John Nduli https://github.com/jnduli +" Description: Rstcheck for reStructuredText files +" + +function! ale_linters#rst#rstcheck#Handle(buffer, lines) abort + " matches: 'bad_rst.rst:1: (SEVERE/4) Title overline & underline + " mismatch.' + let l:pattern = '\v^(.+):(\d*): \(([a-zA-Z]*)/\d*\) (.+)$' + let l:dir = expand('#' . a:buffer . ':p:h') + let l:output = [] + 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': 0, + \ 'type': l:match[3] is# 'SEVERE' ? 'E' : 'W', + \ 'text': l:match[4], + \}) + endfor + + return l:output +endfunction + +function! ale_linters#rst#rstcheck#GetCommand(buffer) abort + return ale#path#BufferCdString(a:buffer) + \ . 'rstcheck' + \ . ' %t' +endfunction + + +call ale#linter#Define('rst', { +\ 'name': 'rstcheck', +\ 'executable': 'rstcheck', +\ 'command_callback': 'ale_linters#rst#rstcheck#GetCommand', +\ 'callback': 'ale_linters#rst#rstcheck#Handle', +\ 'output_stream': 'both', +\}) diff --git a/sources_non_forked/ale/ale_linters/rst/vale.vim b/sources_non_forked/ale/ale_linters/rst/vale.vim new file mode 100644 index 00000000..2e654dc4 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/rst/vale.vim @@ -0,0 +1,9 @@ +" Author: chew-z https://github.com/chew-z +" Description: vale for RST files + +call ale#linter#Define('rst', { +\ 'name': 'vale', +\ 'executable': 'vale', +\ 'command': 'vale --output=JSON %t', +\ 'callback': 'ale#handlers#vale#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/rst/write-good.vim b/sources_non_forked/ale/ale_linters/rst/write-good.vim new file mode 100644 index 00000000..12137dbf --- /dev/null +++ b/sources_non_forked/ale/ale_linters/rst/write-good.vim @@ -0,0 +1,9 @@ +" Author: Sumner Evans +" 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', +\}) diff --git a/sources_non_forked/ale/ale_linters/ruby/brakeman.vim b/sources_non_forked/ale/ale_linters/ruby/brakeman.vim new file mode 100644 index 00000000..85cfc184 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/ruby/brakeman.vim @@ -0,0 +1,47 @@ +" Author: Eddie Lebow https://github.com/elebow +" Description: Brakeman, a static analyzer for Rails security + +let g:ale_ruby_brakeman_options = +\ get(g:, 'ale_ruby_brakeman_options', '') + +function! ale_linters#ruby#brakeman#Handle(buffer, lines) abort + let l:output = [] + let l:json = ale#util#FuzzyJSONDecode(a:lines, {}) + let l:sep = has('win32') ? '\' : '/' + " Brakeman always outputs paths relative to the Rails app root + let l:rails_root = ale#ruby#FindRailsRoot(a:buffer) + + for l:warning in get(l:json, 'warnings', []) + let l:text = l:warning.warning_type . ' ' . l:warning.message . ' (' . l:warning.confidence . ')' + let l:line = l:warning.line != v:null ? l:warning.line : 1 + + call add(l:output, { + \ 'filename': l:rails_root . l:sep . l:warning.file, + \ 'lnum': l:line, + \ 'type': 'W', + \ 'text': l:text, + \}) + endfor + + return l:output +endfunction + +function! ale_linters#ruby#brakeman#GetCommand(buffer) abort + let l:rails_root = ale#ruby#FindRailsRoot(a:buffer) + + if l:rails_root is? '' + return '' + endif + + return 'brakeman -f json -q ' + \ . ale#Var(a:buffer, 'ruby_brakeman_options') + \ . ' -p ' . ale#Escape(l:rails_root) +endfunction + +call ale#linter#Define('ruby', { +\ 'name': 'brakeman', +\ 'executable': 'brakeman', +\ 'command_callback': 'ale_linters#ruby#brakeman#GetCommand', +\ 'callback': 'ale_linters#ruby#brakeman#Handle', +\ 'lint_file': 1, +\}) diff --git a/sources_non_forked/ale/ale_linters/ruby/rails_best_practices.vim b/sources_non_forked/ale/ale_linters/ruby/rails_best_practices.vim new file mode 100644 index 00000000..107753c3 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/ruby/rails_best_practices.vim @@ -0,0 +1,53 @@ +" Author: Eddie Lebow https://github.com/elebow +" Description: rails_best_practices, a code metric tool for rails projects + +let g:ale_ruby_rails_best_practices_options = +\ get(g:, 'ale_ruby_rails_best_practices_options', '') + +function! ale_linters#ruby#rails_best_practices#Handle(buffer, lines) abort + let l:output = [] + + for l:warning in ale#util#FuzzyJSONDecode(a:lines, []) + if !ale#path#IsBufferPath(a:buffer, l:warning.filename) + continue + endif + + call add(l:output, { + \ 'lnum': l:warning.line_number + 0, + \ 'type': 'W', + \ 'text': l:warning.message, + \}) + endfor + + return l:output +endfunction + +function! ale_linters#ruby#rails_best_practices#GetCommand(buffer) abort + let l:executable = ale#handlers#rails_best_practices#GetExecutable(a:buffer) + let l:exec_args = l:executable =~? 'bundle$' + \ ? ' exec rails_best_practices' + \ : '' + + let l:rails_root = ale#ruby#FindRailsRoot(a:buffer) + + if l:rails_root is? '' + return '' + endif + + let l:output_file = ale#Has('win32') ? '%t ' : '/dev/stdout ' + let l:cat_file = ale#Has('win32') ? '; type %t' : '' + + return ale#Escape(l:executable) . l:exec_args + \ . ' --silent -f json --output-file ' . l:output_file + \ . ale#Var(a:buffer, 'ruby_rails_best_practices_options') + \ . ale#Escape(l:rails_root) + \ . l:cat_file +endfunction + +call ale#linter#Define('ruby', { +\ 'name': 'rails_best_practices', +\ 'executable_callback': 'ale#handlers#rails_best_practices#GetExecutable', +\ 'command_callback': 'ale_linters#ruby#rails_best_practices#GetCommand', +\ 'callback': 'ale_linters#ruby#rails_best_practices#Handle', +\ 'lint_file': 1, +\}) diff --git a/sources_non_forked/ale/ale_linters/ruby/reek.vim b/sources_non_forked/ale/ale_linters/ruby/reek.vim new file mode 100644 index 00000000..a11b9cf8 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/ruby/reek.vim @@ -0,0 +1,45 @@ +" Author: Eddie Lebow https://github.com/elebow +" Description: Reek, a code smell detector for Ruby files + +call ale#Set('ruby_reek_show_context', 0) +call ale#Set('ruby_reek_show_wiki_link', 0) + +function! ale_linters#ruby#reek#Handle(buffer, lines) abort + let l:output = [] + + for l:error in ale#util#FuzzyJSONDecode(a:lines, []) + for l:location in l:error.lines + call add(l:output, { + \ 'lnum': l:location, + \ 'type': 'W', + \ 'text': s:BuildText(a:buffer, l:error), + \ 'code': l:error.smell_type, + \}) + endfor + endfor + + return l:output +endfunction + +function! s:BuildText(buffer, error) abort + let l:parts = [] + + if ale#Var(a:buffer, 'ruby_reek_show_context') + call add(l:parts, a:error.context) + endif + + call add(l:parts, a:error.message) + + if ale#Var(a:buffer, 'ruby_reek_show_wiki_link') + call add(l:parts, '[' . a:error.wiki_link . ']') + endif + + return join(l:parts, ' ') +endfunction + +call ale#linter#Define('ruby', { +\ 'name': 'reek', +\ 'executable': 'reek', +\ 'command': 'reek -f json --no-progress --no-color', +\ 'callback': 'ale_linters#ruby#reek#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/ruby/rubocop.vim b/sources_non_forked/ale/ale_linters/ruby/rubocop.vim new file mode 100644 index 00000000..777f457a --- /dev/null +++ b/sources_non_forked/ale/ale_linters/ruby/rubocop.vim @@ -0,0 +1,61 @@ +" Author: ynonp - https://github.com/ynonp, Eddie Lebow https://github.com/elebow +" Description: RuboCop, a code style analyzer for Ruby files + +function! ale_linters#ruby#rubocop#GetCommand(buffer) abort + let l:executable = ale#handlers#rubocop#GetExecutable(a:buffer) + let l:exec_args = l:executable =~? 'bundle$' + \ ? ' exec rubocop' + \ : '' + + return ale#Escape(l:executable) . l:exec_args + \ . ' --format json --force-exclusion ' + \ . ale#Var(a:buffer, 'ruby_rubocop_options') + \ . ' --stdin ' . ale#Escape(expand('#' . a:buffer . ':p')) +endfunction + +function! ale_linters#ruby#rubocop#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#ruby#rubocop#GetType(l:error['severity']), + \}) + endfor + + return l:output +endfunction + +function! ale_linters#ruby#rubocop#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('ruby', { +\ 'name': 'rubocop', +\ 'executable_callback': 'ale#handlers#rubocop#GetExecutable', +\ 'command_callback': 'ale_linters#ruby#rubocop#GetCommand', +\ 'callback': 'ale_linters#ruby#rubocop#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/ruby/ruby.vim b/sources_non_forked/ale/ale_linters/ruby/ruby.vim new file mode 100644 index 00000000..1aa88851 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/ruby/ruby.vim @@ -0,0 +1,22 @@ +" Author: Brandon Roehl - https://github.com/BrandonRoehl +" Description: Ruby MRI for Ruby files + +call ale#Set('ruby_ruby_executable', 'ruby') + +function! ale_linters#ruby#ruby#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'ruby_ruby_executable') +endfunction + +function! ale_linters#ruby#ruby#GetCommand(buffer) abort + let l:executable = ale_linters#ruby#ruby#GetExecutable(a:buffer) + + return ale#Escape(l:executable) . ' -w -c -T1 %t' +endfunction + +call ale#linter#Define('ruby', { +\ 'name': 'ruby', +\ 'executable_callback': 'ale_linters#ruby#ruby#GetExecutable', +\ 'command_callback': 'ale_linters#ruby#ruby#GetCommand', +\ 'output_stream': 'stderr', +\ 'callback': 'ale#handlers#ruby#HandleSyntaxErrors', +\}) diff --git a/sources_non_forked/ale/ale_linters/rust/cargo.vim b/sources_non_forked/ale/ale_linters/rust/cargo.vim new file mode 100644 index 00000000..09f41bbb --- /dev/null +++ b/sources_non_forked/ale/ale_linters/rust/cargo.vim @@ -0,0 +1,68 @@ +" Author: Daniel Schemala , +" Ivan Petkov +" Description: rustc invoked by cargo for rust files + +call ale#Set('rust_cargo_use_check', 1) +call ale#Set('rust_cargo_check_all_targets', 0) +call ale#Set('rust_cargo_default_feature_behavior', 'default') +call ale#Set('rust_cargo_include_features', '') + +function! ale_linters#rust#cargo#GetCargoExecutable(bufnr) abort + if ale#path#FindNearestFile(a:bufnr, 'Cargo.toml') isnot# '' + return 'cargo' + else + " if there is no Cargo.toml file, we don't use cargo even if it exists, + " so we return '', because executable('') apparently always fails + return '' + endif +endfunction + +function! ale_linters#rust#cargo#VersionCheck(buffer) abort + return !ale#semver#HasVersion('cargo') + \ ? 'cargo --version' + \ : '' +endfunction + +function! ale_linters#rust#cargo#GetCommand(buffer, version_output) abort + let l:version = ale#semver#GetVersion('cargo', a:version_output) + + let l:use_check = ale#Var(a:buffer, 'rust_cargo_use_check') + \ && ale#semver#GTE(l:version, [0, 17, 0]) + let l:use_all_targets = l:use_check + \ && ale#Var(a:buffer, 'rust_cargo_check_all_targets') + \ && ale#semver#GTE(l:version, [0, 22, 0]) + + let l:include_features = ale#Var(a:buffer, 'rust_cargo_include_features') + if !empty(l:include_features) + let l:include_features = ' --features ' . ale#Escape(l:include_features) + endif + + let l:default_feature_behavior = ale#Var(a:buffer, 'rust_cargo_default_feature_behavior') + if l:default_feature_behavior is# 'all' + let l:include_features = '' + let l:default_feature = ' --all-features' + elseif l:default_feature_behavior is# 'none' + let l:default_feature = ' --no-default-features' + else + let l:default_feature = '' + endif + + return 'cargo ' + \ . (l:use_check ? 'check' : 'build') + \ . (l:use_all_targets ? ' --all-targets' : '') + \ . ' --frozen --message-format=json -q' + \ . l:default_feature + \ . l:include_features +endfunction + +call ale#linter#Define('rust', { +\ 'name': 'cargo', +\ 'executable_callback': 'ale_linters#rust#cargo#GetCargoExecutable', +\ 'command_chain': [ +\ {'callback': 'ale_linters#rust#cargo#VersionCheck'}, +\ {'callback': 'ale_linters#rust#cargo#GetCommand'}, +\ ], +\ 'callback': 'ale#handlers#rust#HandleRustErrors', +\ 'output_stream': 'both', +\ 'lint_file': 1, +\}) diff --git a/sources_non_forked/ale/ale_linters/rust/rls.vim b/sources_non_forked/ale/ale_linters/rust/rls.vim new file mode 100644 index 00000000..832fe3e2 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/rust/rls.vim @@ -0,0 +1,36 @@ +" Author: w0rp +" Description: A language server for Rust + +call ale#Set('rust_rls_executable', 'rls') +call ale#Set('rust_rls_toolchain', 'nightly') + +function! ale_linters#rust#rls#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'rust_rls_executable') +endfunction + +function! ale_linters#rust#rls#GetCommand(buffer) abort + let l:executable = ale_linters#rust#rls#GetExecutable(a:buffer) + let l:toolchain = ale#Var(a:buffer, 'rust_rls_toolchain') + + return ale#Escape(l:executable) + \ . ' +' . ale#Escape(l:toolchain) +endfunction + +function! ale_linters#rust#rls#GetLanguage(buffer) abort + return 'rust' +endfunction + +function! ale_linters#rust#rls#GetProjectRoot(buffer) abort + let l:cargo_file = ale#path#FindNearestFile(a:buffer, 'Cargo.toml') + + return !empty(l:cargo_file) ? fnamemodify(l:cargo_file, ':h') : '' +endfunction + +call ale#linter#Define('rust', { +\ 'name': 'rls', +\ 'lsp': 'stdio', +\ 'executable_callback': 'ale_linters#rust#rls#GetExecutable', +\ 'command_callback': 'ale_linters#rust#rls#GetCommand', +\ 'language_callback': 'ale_linters#rust#rls#GetLanguage', +\ 'project_root_callback': 'ale_linters#rust#rls#GetProjectRoot', +\}) diff --git a/sources_non_forked/ale/ale_linters/rust/rustc.vim b/sources_non_forked/ale/ale_linters/rust/rustc.vim new file mode 100644 index 00000000..3cd401b3 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/rust/rustc.vim @@ -0,0 +1,33 @@ +" Author: Daniel Schemala +" Description: rustc for rust files + +call ale#Set('rust_rustc_options', '-Z no-trans') + +function! ale_linters#rust#rustc#RustcCommand(buffer) abort + " Try to guess the library search path. If the project is managed by cargo, + " it's usually /target/debug/deps/ or + " /target/release/deps/ + let l:cargo_file = ale#path#FindNearestFile(a:buffer, 'Cargo.toml') + + if l:cargo_file isnot# '' + let l:root = fnamemodify(l:cargo_file, ':h') + let l:dependencies = ' -L ' . ale#Escape(ale#path#GetAbsPath(l:root, 'target/debug/deps')) + \ . ' -L ' . ale#Escape(ale#path#GetAbsPath(l:root, 'target/release/deps')) + else + let l:dependencies = '' + endif + + let l:options = ale#Var(a:buffer, 'rust_rustc_options') + + return 'rustc --error-format=json' + \ . (!empty(l:options) ? ' ' . l:options : '') + \ . l:dependencies . ' -' +endfunction + +call ale#linter#Define('rust', { +\ 'name': 'rustc', +\ 'executable': 'rustc', +\ 'command_callback': 'ale_linters#rust#rustc#RustcCommand', +\ 'callback': 'ale#handlers#rust#HandleRustErrors', +\ 'output_stream': 'stderr', +\}) diff --git a/sources_non_forked/ale/ale_linters/sass/sasslint.vim b/sources_non_forked/ale/ale_linters/sass/sasslint.vim new file mode 100644 index 00000000..bbe71255 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/sass/sasslint.vim @@ -0,0 +1,8 @@ +" Author: KabbAmine - https://github.com/KabbAmine + +call ale#linter#Define('sass', { +\ 'name': 'sasslint', +\ 'executable': 'sass-lint', +\ 'command': 'sass-lint -v -q -f compact %t', +\ 'callback': 'ale#handlers#css#HandleCSSLintFormat', +\}) diff --git a/sources_non_forked/ale/ale_linters/sass/stylelint.vim b/sources_non_forked/ale/ale_linters/sass/stylelint.vim new file mode 100644 index 00000000..98c37257 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/sass/stylelint.vim @@ -0,0 +1,22 @@ +" Author: diartyz + +call ale#Set('sass_stylelint_executable', 'stylelint') +call ale#Set('sass_stylelint_use_global', 0) + +function! ale_linters#sass#stylelint#GetExecutable(buffer) abort + return ale#node#FindExecutable(a:buffer, 'sass_stylelint', [ + \ 'node_modules/.bin/stylelint', + \]) +endfunction + +function! ale_linters#sass#stylelint#GetCommand(buffer) abort + return ale_linters#sass#stylelint#GetExecutable(a:buffer) + \ . ' --stdin-filename %s' +endfunction + +call ale#linter#Define('sass', { +\ 'name': 'stylelint', +\ 'executable_callback': 'ale_linters#sass#stylelint#GetExecutable', +\ 'command_callback': 'ale_linters#sass#stylelint#GetCommand', +\ 'callback': 'ale#handlers#css#HandleStyleLintFormat', +\}) diff --git a/sources_non_forked/ale/ale_linters/scala/scalac.vim b/sources_non_forked/ale/ale_linters/scala/scalac.vim new file mode 100644 index 00000000..584aee74 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/scala/scalac.vim @@ -0,0 +1,65 @@ +" Author: Zoltan Kalmar - https://github.com/kalmiz, +" w0rp +" Description: Basic scala support using scalac + +function! ale_linters#scala#scalac#GetExecutable(buffer) abort + if index(split(getbufvar(a:buffer, '&filetype'), '\.'), 'sbt') >= 0 + " Don't check sbt files with scalac. + return '' + endif + + return 'scalac' +endfunction + +function! ale_linters#scala#scalac#GetCommand(buffer) abort + let l:executable = ale_linters#scala#scalac#GetExecutable(a:buffer) + + if empty(l:executable) + return '' + endif + + return ale#Escape(l:executable) . ' -Ystop-after:parser %t' +endfunction + +function! ale_linters#scala#scalac#Handle(buffer, lines) abort + " Matches patterns line the following: + " + " /var/folders/5q/20rgxx3x1s34g3m14n5bq0x80000gn/T/vv6pSsy/0:26: error: expected class or object definition + let l:pattern = '^.\+:\(\d\+\): \(\w\+\): \(.\+\)' + let l:output = [] + let l:ln = 0 + + for l:line in a:lines + let l:ln = l:ln + 1 + let l:match = matchlist(l:line, l:pattern) + + if len(l:match) == 0 + continue + endif + + let l:text = l:match[3] + let l:type = l:match[2] is# 'error' ? 'E' : 'W' + let l:col = 0 + + if l:ln + 1 < len(a:lines) + let l:col = stridx(a:lines[l:ln + 1], '^') + endif + + call add(l:output, { + \ 'lnum': l:match[1] + 0, + \ 'col': l:col + 1, + \ 'text': l:text, + \ 'type': l:type, + \}) + endfor + + return l:output +endfunction + +call ale#linter#Define('scala', { +\ 'name': 'scalac', +\ 'executable_callback': 'ale_linters#scala#scalac#GetExecutable', +\ 'command_callback': 'ale_linters#scala#scalac#GetCommand', +\ 'callback': 'ale_linters#scala#scalac#Handle', +\ 'output_stream': 'stderr', +\}) diff --git a/sources_non_forked/ale/ale_linters/scala/scalastyle.vim b/sources_non_forked/ale/ale_linters/scala/scalastyle.vim new file mode 100644 index 00000000..f78fd749 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/scala/scalastyle.vim @@ -0,0 +1,94 @@ +" Author: Kevin Kays - https://github.com/okkays +" Description: Support for the scalastyle checker. + +let g:ale_scala_scalastyle_options = +\ get(g:, 'ale_scala_scalastyle_options', '') + +let g:ale_scalastyle_config_loc = +\ get(g:, 'ale_scalastyle_config_loc', '') + +function! ale_linters#scala#scalastyle#Handle(buffer, lines) abort + " Look for help output from scalastyle first, which indicates that no + " configuration file was found. + for l:line in a:lines[:10] + if l:line =~# '-c, --config' + return [{ + \ 'lnum': 1, + \ 'text': '(See :help ale-scala-scalastyle)' + \ . ' No scalastyle configuration file was found.', + \}] + endif + endfor + + " Matches patterns like the following: + " + " warning file=/home/blurble/Doop.scala message=Missing or badly formed ScalaDoc: Extra @param foobles line=190 + let l:patterns = [ + \ '^\(.\+\) .\+ message=\(.\+\) line=\(\d\+\)$', + \ '^\(.\+\) .\+ message=\(.\+\) line=\(\d\+\) column=\(\d\+\)$', + \] + let l:output = [] + + for l:match in ale#util#GetMatches(a:lines, l:patterns) + let l:args = { + \ 'lnum': l:match[3] + 0, + \ 'type': l:match[1] =~? 'error' ? 'E' : 'W', + \ 'text': l:match[2] + \} + + if !empty(l:match[4]) + let l:args['col'] = l:match[4] + 1 + endif + + call add(l:output, l:args) + endfor + + return l:output +endfunction + +function! ale_linters#scala#scalastyle#GetCommand(buffer) abort + " Search for scalastyle config in parent directories. + let l:scalastyle_config = '' + let l:potential_configs = [ + \ 'scalastyle_config.xml', + \ 'scalastyle-config.xml' + \] + for l:config in l:potential_configs + let l:scalastyle_config = ale#path#ResolveLocalPath( + \ a:buffer, + \ l:config, + \ '' + \) + if !empty(l:scalastyle_config) + break + endif + endfor + + " If all else fails, try the global config. + if empty(l:scalastyle_config) + let l:scalastyle_config = get(g:, 'ale_scalastyle_config_loc', '') + endif + + " Build the command using the config file and additional options. + let l:command = 'scalastyle' + + if !empty(l:scalastyle_config) + let l:command .= ' --config ' . ale#Escape(l:scalastyle_config) + endif + + if !empty(g:ale_scala_scalastyle_options) + let l:command .= ' ' . g:ale_scala_scalastyle_options + endif + + let l:command .= ' %t' + + return l:command +endfunction + +call ale#linter#Define('scala', { +\ 'name': 'scalastyle', +\ 'executable': 'scalastyle', +\ 'output_stream': 'stdout', +\ 'command_callback': 'ale_linters#scala#scalastyle#GetCommand', +\ 'callback': 'ale_linters#scala#scalastyle#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/scss/sasslint.vim b/sources_non_forked/ale/ale_linters/scss/sasslint.vim new file mode 100644 index 00000000..bd016465 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/scss/sasslint.vim @@ -0,0 +1,8 @@ +" Author: KabbAmine - https://github.com/KabbAmine + +call ale#linter#Define('scss', { +\ 'name': 'sasslint', +\ 'executable': 'sass-lint', +\ 'command': 'sass-lint -v -q -f compact %t', +\ 'callback': 'ale#handlers#css#HandleCSSLintFormat', +\}) diff --git a/sources_non_forked/ale/ale_linters/scss/scsslint.vim b/sources_non_forked/ale/ale_linters/scss/scsslint.vim new file mode 100644 index 00000000..7ce57241 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/scss/scsslint.vim @@ -0,0 +1,34 @@ +" Author: w0rp +" Description: This file add scsslint support for SCSS support + +function! ale_linters#scss#scsslint#Handle(buffer, lines) abort + " Matches patterns like the following: + " + " test.scss:2:1 [W] Indentation: Line should be indented 2 spaces, but was indented 4 spaces + let l:pattern = '^.*:\(\d\+\):\(\d*\) \[\([^\]]\+\)\] \(.\+\)$' + let l:output = [] + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + if !ale#Var(a:buffer, 'warn_about_trailing_whitespace') + \&& l:match[4] =~# '^TrailingWhitespace' + " Skip trailing whitespace warnings if that option is off. + continue + endif + + call add(l:output, { + \ 'lnum': l:match[1] + 0, + \ 'col': l:match[2] + 0, + \ 'text': l:match[4], + \ 'type': l:match[3] is# 'E' ? 'E' : 'W', + \}) + endfor + + return l:output +endfunction + +call ale#linter#Define('scss', { +\ 'name': 'scsslint', +\ 'executable': 'scss-lint', +\ 'command': 'scss-lint --stdin-file-path=%s', +\ 'callback': 'ale_linters#scss#scsslint#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/scss/stylelint.vim b/sources_non_forked/ale/ale_linters/scss/stylelint.vim new file mode 100644 index 00000000..00189a8b --- /dev/null +++ b/sources_non_forked/ale/ale_linters/scss/stylelint.vim @@ -0,0 +1,22 @@ +" Author: diartyz + +call ale#Set('scss_stylelint_executable', 'stylelint') +call ale#Set('scss_stylelint_use_global', 0) + +function! ale_linters#scss#stylelint#GetExecutable(buffer) abort + return ale#node#FindExecutable(a:buffer, 'scss_stylelint', [ + \ 'node_modules/.bin/stylelint', + \]) +endfunction + +function! ale_linters#scss#stylelint#GetCommand(buffer) abort + return ale_linters#scss#stylelint#GetExecutable(a:buffer) + \ . ' --stdin-filename %s' +endfunction + +call ale#linter#Define('scss', { +\ 'name': 'stylelint', +\ 'executable_callback': 'ale_linters#scss#stylelint#GetExecutable', +\ 'command_callback': 'ale_linters#scss#stylelint#GetCommand', +\ 'callback': 'ale#handlers#css#HandleStyleLintFormat', +\}) diff --git a/sources_non_forked/ale/ale_linters/sh/shell.vim b/sources_non_forked/ale/ale_linters/sh/shell.vim new file mode 100644 index 00000000..cf5e4e6c --- /dev/null +++ b/sources_non_forked/ale/ale_linters/sh/shell.vim @@ -0,0 +1,57 @@ +" Author: w0rp +" Description: Lints sh files using bash -n + +" Backwards compatibility +if exists('g:ale_linters_sh_shell_default_shell') + let g:ale_sh_shell_default_shell = g:ale_linters_sh_shell_default_shell +endif + +" This option can be changed to change the default shell when the shell +" cannot be taken from the hashbang line. +if !exists('g:ale_sh_shell_default_shell') + let g:ale_sh_shell_default_shell = fnamemodify($SHELL, ':t') + + if g:ale_sh_shell_default_shell is# '' || g:ale_sh_shell_default_shell is# 'fish' + let g:ale_sh_shell_default_shell = 'bash' + endif +endif + +function! ale_linters#sh#shell#GetExecutable(buffer) abort + let l:shell_type = ale#handlers#sh#GetShellType(a:buffer) + + if !empty(l:shell_type) + return l:shell_type + endif + + return ale#Var(a:buffer, 'sh_shell_default_shell') +endfunction + +function! ale_linters#sh#shell#GetCommand(buffer) abort + return ale_linters#sh#shell#GetExecutable(a:buffer) . ' -n %t' +endfunction + +function! ale_linters#sh#shell#Handle(buffer, lines) abort + " Matches patterns line the following: + " + " bash: line 13: syntax error near unexpected token `d' + " sh: 11: Syntax error: "(" unexpected + let l:pattern = '\v(line |: ?)(\d+): (.+)$' + let l:output = [] + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + call add(l:output, { + \ 'lnum': str2nr(l:match[2]), + \ 'text': l:match[3], + \}) + endfor + + return l:output +endfunction + +call ale#linter#Define('sh', { +\ 'name': 'shell', +\ 'output_stream': 'stderr', +\ 'executable_callback': 'ale_linters#sh#shell#GetExecutable', +\ 'command_callback': 'ale_linters#sh#shell#GetCommand', +\ 'callback': 'ale_linters#sh#shell#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/sh/shellcheck.vim b/sources_non_forked/ale/ale_linters/sh/shellcheck.vim new file mode 100644 index 00000000..27c74531 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/sh/shellcheck.vim @@ -0,0 +1,117 @@ +" Author: w0rp +" Description: This file adds support for using the shellcheck linter with +" shell scripts. + +" This global variable can be set with a string of comma-separated error +" codes to exclude from shellcheck. For example: +" +" let g:ale_sh_shellcheck_exclusions = 'SC2002,SC2004' +let g:ale_sh_shellcheck_exclusions = +\ get(g:, 'ale_sh_shellcheck_exclusions', get(g:, 'ale_linters_sh_shellcheck_exclusions', '')) + +let g:ale_sh_shellcheck_executable = +\ get(g:, 'ale_sh_shellcheck_executable', 'shellcheck') + +let g:ale_sh_shellcheck_options = +\ get(g:, 'ale_sh_shellcheck_options', '') + +function! ale_linters#sh#shellcheck#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'sh_shellcheck_executable') +endfunction + +function! ale_linters#sh#shellcheck#GetDialectArgument(buffer) abort + let l:shell_type = ale#handlers#sh#GetShellType(a:buffer) + + if !empty(l:shell_type) + " Use the dash dialect for /bin/ash, etc. + if l:shell_type is# 'ash' + return 'dash' + endif + + return l:shell_type + endif + + " If there's no hashbang, try using Vim's buffer variables. + if getbufvar(a:buffer, 'is_bash', 0) + return 'bash' + elseif getbufvar(a:buffer, 'is_sh', 0) + return 'sh' + elseif getbufvar(a:buffer, 'is_kornshell', 0) + return 'ksh' + endif + + return '' +endfunction + +function! ale_linters#sh#shellcheck#VersionCheck(buffer) abort + let l:executable = ale_linters#sh#shellcheck#GetExecutable(a:buffer) + + " Don't check the version again if we've already cached it. + return !ale#semver#HasVersion(l:executable) + \ ? ale#Escape(l:executable) . ' --version' + \ : '' +endfunction + +function! ale_linters#sh#shellcheck#GetCommand(buffer, version_output) abort + let l:executable = ale_linters#sh#shellcheck#GetExecutable(a:buffer) + let l:version = ale#semver#GetVersion(l:executable, a:version_output) + + let l:options = ale#Var(a:buffer, 'sh_shellcheck_options') + let l:exclude_option = ale#Var(a:buffer, 'sh_shellcheck_exclusions') + let l:dialect = ale_linters#sh#shellcheck#GetDialectArgument(a:buffer) + let l:external_option = ale#semver#GTE(l:version, [0, 4, 0]) ? ' -x' : '' + + return ale#path#BufferCdString(a:buffer) + \ . ale#Escape(l:executable) + \ . (!empty(l:dialect) ? ' -s ' . l:dialect : '') + \ . (!empty(l:options) ? ' ' . l:options : '') + \ . (!empty(l:exclude_option) ? ' -e ' . l:exclude_option : '') + \ . l:external_option + \ . ' -f gcc -' +endfunction + +function! ale_linters#sh#shellcheck#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) + if l:match[4] is# 'error' + let l:type = 'E' + elseif l:match[4] is# 'note' + let l:type = 'I' + else + let l:type = 'W' + endif + + let l:item = { + \ 'lnum': str2nr(l:match[2]), + \ 'type': l:type, + \ 'text': l:match[5], + \ 'code': l:match[6], + \} + + if !empty(l:match[3]) + let l:item.col = str2nr(l:match[3]) + endif + + " If the filename is something like , or -, then + " this is an error for the file we checked. + if l:match[1] isnot# '-' && l:match[1][0] isnot# '<' + let l:item['filename'] = l:match[1] + endif + + call add(l:output, l:item) + endfor + + return l:output +endfunction + +call ale#linter#Define('sh', { +\ 'name': 'shellcheck', +\ 'executable_callback': 'ale_linters#sh#shellcheck#GetExecutable', +\ 'command_chain': [ +\ {'callback': 'ale_linters#sh#shellcheck#VersionCheck'}, +\ {'callback': 'ale_linters#sh#shellcheck#GetCommand'}, +\ ], +\ 'callback': 'ale_linters#sh#shellcheck#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/slim/slimlint.vim b/sources_non_forked/ale/ale_linters/slim/slimlint.vim new file mode 100644 index 00000000..00c6b26c --- /dev/null +++ b/sources_non_forked/ale/ale_linters/slim/slimlint.vim @@ -0,0 +1,55 @@ +" Author: Markus Doits - https://github.com/doits +" Description: slim-lint for Slim files + +function! ale_linters#slim#slimlint#GetCommand(buffer) abort + let l:command = 'slim-lint %t' + + let l:rubocop_config = ale#path#FindNearestFile(a:buffer, '.rubocop.yml') + + " Set SLIM_LINT_RUBOCOP_CONF variable as it is needed for slim-lint to + " pick up the rubocop config. + " + " See https://github.com/sds/slim-lint/blob/master/lib/slim_lint/linter/README.md#rubocop + if !empty(l:rubocop_config) + if ale#Has('win32') + let l:command = 'set SLIM_LINT_RUBOCOP_CONF=' . ale#Escape(l:rubocop_config) . ' && ' . l:command + else + let l:command = 'SLIM_LINT_RUBOCOP_CONF=' . ale#Escape(l:rubocop_config) . ' ' . l:command + endif + endif + + return l:command +endfunction + +function! ale_linters#slim#slimlint#Handle(buffer, lines) abort + " Matches patterns like the following: + " :5 [W] LineLength: Line is too long. [150/120] + let l:pattern = '\v^.*:(\d+) \[([EW])\] (.+)$' + let l:output = [] + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + let l:item = { + \ 'lnum': l:match[1] + 0, + \ 'type': l:match[2], + \ 'text': l:match[3] + \} + + let l:code_match = matchlist(l:item.text, '\v^([^:]+): (.+)$') + + if !empty(l:code_match) + let l:item.code = l:code_match[1] + let l:item.text = l:code_match[2] + endif + + call add(l:output, l:item) + endfor + + return l:output +endfunction + +call ale#linter#Define('slim', { +\ 'name': 'slimlint', +\ 'executable': 'slim-lint', +\ 'command_callback': 'ale_linters#slim#slimlint#GetCommand', +\ 'callback': 'ale_linters#slim#slimlint#Handle' +\}) diff --git a/sources_non_forked/ale/ale_linters/sml/smlnj.vim b/sources_non_forked/ale/ale_linters/sml/smlnj.vim new file mode 100644 index 00000000..f15579ea --- /dev/null +++ b/sources_non_forked/ale/ale_linters/sml/smlnj.vim @@ -0,0 +1,9 @@ +" Author: Paulo Alem , Jake Zimmerman +" Description: Single-file SML checking with SML/NJ compiler + +call ale#linter#Define('sml', { +\ 'name': 'smlnj', +\ 'executable_callback': 'ale#handlers#sml#GetExecutableSmlnjFile', +\ 'command': 'sml', +\ 'callback': 'ale#handlers#sml#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/sml/smlnj_cm.vim b/sources_non_forked/ale/ale_linters/sml/smlnj_cm.vim new file mode 100644 index 00000000..96cd7bd9 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/sml/smlnj_cm.vim @@ -0,0 +1,19 @@ +" Author: Jake Zimmerman +" Description: SML checking with SML/NJ Compilation Manager + +function! ale_linters#sml#smlnj_cm#GetCommand(buffer) abort + let l:cmfile = ale#handlers#sml#GetCmFile(a:buffer) + return 'sml -m ' . l:cmfile . ' < /dev/null' +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', +\ 'executable_callback': 'ale#handlers#sml#GetExecutableSmlnjCm', +\ 'lint_file': 1, +\ 'command_callback': 'ale_linters#sml#smlnj_cm#GetCommand', +\ 'callback': 'ale#handlers#sml#Handle', +\}) + +" vim:ts=4:sts=4:sw=4 diff --git a/sources_non_forked/ale/ale_linters/solidity/solhint.vim b/sources_non_forked/ale/ale_linters/solidity/solhint.vim new file mode 100644 index 00000000..519fd49d --- /dev/null +++ b/sources_non_forked/ale/ale_linters/solidity/solhint.vim @@ -0,0 +1,30 @@ +" Author: Franco Victorio - https://github.com/fvictorio +" Description: Report errors in Solidity code with solhint + +function! ale_linters#solidity#solhint#Handle(buffer, lines) abort + " Matches patterns like the following: + " /path/to/file/file.sol: line 1, col 10, Error - 'addOne' is defined but never used. (no-unused-vars) + + let l:pattern = '\v^[^:]+: line (\d+), col (\d+), (Error|Warning) - (.*) \((.*)\)$' + let l:output = [] + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + let l:isError = l:match[3] is? 'error' + call add(l:output, { + \ 'lnum': l:match[1] + 0, + \ 'col': l:match[2] + 0, + \ 'text': l:match[4], + \ 'code': l:match[5], + \ 'type': l:isError ? 'E' : 'W', + \}) + endfor + + return l:output +endfunction + +call ale#linter#Define('solidity', { +\ 'name': 'solhint', +\ 'executable': 'solhint', +\ 'command': 'solhint --formatter compact %t', +\ 'callback': 'ale_linters#solidity#solhint#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/solidity/solium.vim b/sources_non_forked/ale/ale_linters/solidity/solium.vim new file mode 100644 index 00000000..61ab184d --- /dev/null +++ b/sources_non_forked/ale/ale_linters/solidity/solium.vim @@ -0,0 +1,9 @@ +" Author: Jeff Sutherland - https://github.com/jdsutherland +" Description: Report errors in Solidity code with solium + +call ale#linter#Define('solidity', { +\ 'name': 'solium', +\ 'executable': 'solium', +\ 'command': 'solium --reporter gcc --file %t', +\ 'callback': 'ale#handlers#gcc#HandleGCCFormat', +\}) diff --git a/sources_non_forked/ale/ale_linters/spec/rpmlint.vim b/sources_non_forked/ale/ale_linters/spec/rpmlint.vim new file mode 100644 index 00000000..f5308af6 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/spec/rpmlint.vim @@ -0,0 +1,85 @@ +" Author: Jason Tibbitts +" Description: Adds support for checking RPM spec files with rpmlint + +" rpmlint will produce varions types of output: +" +" Lines like the following are output when the file is simply not able to be +" parsed by rpmspec -P: +" apcupsd.spec: E: specfile-error warning: bogus date in %changelog: Mon Oct 1 2005 - Foo +" apcupsd.spec: E: specfile-error error: %changelog not in descending chronological order +" They do not contain a line number, and there's not a whole lot that can be +" done to locate them besides grep for them. rpmlint is just passing the +" output from rpm along with the filename, an error indicator, and an error +" type. +" +" Lines like the following: +" cyrus-imapd.spec:23: W: macro-in-comment %version +" cyrus-imapd.spec:18: E: hardcoded-library-path in %_prefix/lib/%name +" indicate warnings and errors, respectively. No column numbers are provided +" +" Lines like: +" apcupsd.spec: I: checking +" apcupsd.spec: I: checking-url https://downloads.sourceforge.net/apcupsd/apcupsd-3.14.14.tar.gz (timeout 10 seconds) +" are merely informational and are only output when -v is passed. But they +" may be useful in a log to know why things are taking so long. +" +" And this is always output at the end and should just be ignored: +" 0 packages and 1 specfiles checked; 4 errors, 0 warnings. + +let g:ale_spec_rpmlint_executable = +\ get(g:, 'ale_spec_rpmlint_executable', 'rpmlint') + +let g:ale_spec_rpmlint_options = +\ get(g:, 'ale_spec_rpmlint_options', '') + +function! ale_linters#spec#rpmlint#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'spec_rpmlint_executable') +endfunction + +function! ale_linters#spec#rpmlint#GetCommand(buffer) abort + return ale_linters#spec#rpmlint#GetExecutable(a:buffer) + \ . ' ' . ale#Var(a:buffer, 'spec_rpmlint_options') + \ . ' -o "NetworkEnabled False"' + \ . ' -v' + \ . ' %t' +endfunction + +function! ale_linters#spec#rpmlint#Handle(buffer, lines) abort + " let l:pat_inform = '^.\+: I: \(.+\)' + let l:pat_errwarn = '^.\+:\(\d\+\): \([EW]\): \(.\+\)' + let l:pat_baderr = '^.\+: E: \(.\+\)' + let l:output = [] + + for l:line in a:lines + let l:match_errwarn = matchlist(l:line, l:pat_errwarn) + let l:match_baderr = matchlist(l:line, l:pat_baderr) + + if len(l:match_errwarn) > 0 + let l:text = l:match_errwarn[3] + let l:type = l:match_errwarn[2] + let l:lnum = l:match_errwarn[1] + 0 + elseif len(l:match_baderr) > 0 + let l:text = l:match_baderr[1] + let l:type = 'E' + let l:lnum = 1 + else + continue + endif + + call add(l:output, { + \ 'bufnr': a:buffer, + \ 'lnum': l:lnum, + \ 'text': l:text, + \ 'type': l:type, + \}) + endfor + + return l:output +endfunction + +call ale#linter#Define('spec', { +\ 'name': 'rpmlint', +\ 'executable_callback': 'ale_linters#spec#rpmlint#GetExecutable', +\ 'command_callback': 'ale_linters#spec#rpmlint#GetCommand', +\ 'callback': 'ale_linters#spec#rpmlint#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/sql/sqlint.vim b/sources_non_forked/ale/ale_linters/sql/sqlint.vim new file mode 100644 index 00000000..ca893724 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/sql/sqlint.vim @@ -0,0 +1,28 @@ +" Author: Adriaan Zonnenberg +" Description: sqlint for SQL files + +function! ale_linters#sql#sqlint#Handle(buffer, lines) abort + " Matches patterns like the following: + " + " stdin:3:1:ERROR syntax error at or near "WIBBLE" + let l:pattern = '\v^[^:]+:(\d+):(\d+):(\u+) (.*)' + 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, + \ 'type': l:match[3][0], + \ 'text': l:match[4], + \}) + endfor + + return l:output +endfunction + +call ale#linter#Define('sql', { +\ 'name': 'sqlint', +\ 'executable': 'sqlint', +\ 'command': 'sqlint', +\ 'callback': 'ale_linters#sql#sqlint#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/stylus/stylelint.vim b/sources_non_forked/ale/ale_linters/stylus/stylelint.vim new file mode 100644 index 00000000..2721529b --- /dev/null +++ b/sources_non_forked/ale/ale_linters/stylus/stylelint.vim @@ -0,0 +1,24 @@ +" Author: diartyz , w0rp + +call ale#Set('stylus_stylelint_executable', 'stylelint') +call ale#Set('stylus_stylelint_options', '') +call ale#Set('stylus_stylelint_use_global', 0) + +function! ale_linters#stylus#stylelint#GetExecutable(buffer) abort + return ale#node#FindExecutable(a:buffer, 'stylus_stylelint', [ + \ 'node_modules/.bin/stylelint', + \]) +endfunction + +function! ale_linters#stylus#stylelint#GetCommand(buffer) abort + return ale_linters#stylus#stylelint#GetExecutable(a:buffer) + \ . ' ' . ale#Var(a:buffer, 'stylus_stylelint_options') + \ . ' --stdin-filename %s' +endfunction + +call ale#linter#Define('stylus', { +\ 'name': 'stylelint', +\ 'executable_callback': 'ale_linters#stylus#stylelint#GetExecutable', +\ 'command_callback': 'ale_linters#stylus#stylelint#GetCommand', +\ 'callback': 'ale#handlers#css#HandleStyleLintFormat', +\}) diff --git a/sources_non_forked/ale/ale_linters/swift/swiftlint.vim b/sources_non_forked/ale/ale_linters/swift/swiftlint.vim new file mode 100644 index 00000000..697d246b --- /dev/null +++ b/sources_non_forked/ale/ale_linters/swift/swiftlint.vim @@ -0,0 +1,51 @@ +" Author: David Mohundro +" Description: swiftlint for swift files + + +function! ale_linters#swift#swiftlint#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) + let l:item = { + \ 'lnum': str2nr(l:match[2]), + \ 'type': l:match[4] is# 'error' ? 'E' : 'W', + \ 'text': l:match[5], + \} + + if l:match[4] is# 'error' + let l:item.type = 'E' + elseif l:match[4] is# 'note' + let l:item.type = 'I' + endif + + if !empty(l:match[3]) + let l:item.col = str2nr(l:match[3]) + endif + + " If the filename is something like , or -, then + " this is an error for the file we checked. + if l:match[1] isnot# '-' && l:match[1][0] isnot# '<' + let l:item['filename'] = l:match[1] + endif + + " Parse the code if it's there. + let l:code_match = matchlist(l:item.text, '\v^(.+) \(([^ (]+)\)$') + + if !empty(l:code_match) + let l:item.text = l:code_match[1] + let l:item.code = l:code_match[2] + endif + + call add(l:output, l:item) + endfor + + return l:output +endfunction + +call ale#linter#Define('swift', { +\ 'name': 'swiftlint', +\ 'executable': 'swiftlint', +\ 'command': 'swiftlint lint --use-stdin', +\ 'callback': 'ale_linters#swift#swiftlint#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/tcl/nagelfar.vim b/sources_non_forked/ale/ale_linters/tcl/nagelfar.vim new file mode 100644 index 00000000..13b7a549 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/tcl/nagelfar.vim @@ -0,0 +1,46 @@ +" Author: Nick James +" Description: nagelfar linter for tcl files + +call ale#Set('tcl_nagelfar_executable', 'nagelfar.tcl') +call ale#Set('tcl_nagelfar_options', '') + +function! ale_linters#tcl#nagelfar#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'tcl_nagelfar_executable') +endfunction + +function! ale_linters#tcl#nagelfar#GetCommand(buffer) abort + let l:options = ale#Var(a:buffer, 'tcl_nagelfar_options') + + return ale#Escape(ale_linters#tcl#nagelfar#GetExecutable(a:buffer)) + \ . (!empty(l:options) ? ' ' . l:options : '') + \ . ' %s' +endfunction + +function! ale_linters#tcl#nagelfar#Handle(buffer, lines) abort + " Matches patterns like the following: + " Line 5: W Found constant "bepa" which is also a variable. + " Line 13: E Wrong number of arguments (3) to "set" + " Line 93: N Close brace not aligned with line 90 (4 0) + + let l:pattern = '^Line\s\+\([0-9]\+\): \([NEW]\) \(.*\)$' + 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] is# 'N' ? 'W' : l:match[2], + \ 'text': l:match[3], + \}) + endfor + + return l:output +endfunction + +call ale#linter#Define('tcl', { +\ 'name': 'nagelfar', +\ 'output_stream': 'stdout', +\ 'executable_callback': 'ale_linters#tcl#nagelfar#GetExecutable', +\ 'command_callback': 'ale_linters#tcl#nagelfar#GetCommand', +\ 'callback': 'ale_linters#tcl#nagelfar#Handle', +\ 'lint_file': 1, +\}) diff --git a/sources_non_forked/ale/ale_linters/terraform/tflint.vim b/sources_non_forked/ale/ale_linters/terraform/tflint.vim new file mode 100644 index 00000000..93966ff3 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/terraform/tflint.vim @@ -0,0 +1,62 @@ +" Author: Nat Williams +" Description: tflint for Terraform files +" +" See: https://www.terraform.io/ +" https://github.com/wata727/tflint + +call ale#Set('terraform_tflint_options', '') +call ale#Set('terraform_tflint_executable', 'tflint') + +function! ale_linters#terraform#tflint#Handle(buffer, lines) abort + let l:output = [] + + for l:error in ale#util#FuzzyJSONDecode(a:lines, []) + if l:error.type is# 'ERROR' + let l:type = 'E' + elseif l:error.type is# 'NOTICE' + let l:type = 'I' + else + let l:type = 'W' + endif + + call add(l:output, { + \ 'lnum': l:error.line, + \ 'text': l:error.message, + \ 'type': l:type, + \ 'code': l:error.detector, + \}) + endfor + + return l:output +endfunction + +function! ale_linters#terraform#tflint#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'terraform_tflint_executable') +endfunction + +function! ale_linters#terraform#tflint#GetCommand(buffer) abort + let l:cmd = ale#Escape(ale#Var(a:buffer, 'terraform_tflint_executable')) + + let l:config_file = ale#path#FindNearestFile(a:buffer, '.tflint.hcl') + if !empty(l:config_file) + let l:cmd .= ' --config ' . ale#Escape(l:config_file) + endif + + let l:opts = ale#Var(a:buffer, 'terraform_tflint_options') + if !empty(l:opts) + let l:cmd .= ' ' . l:opts + endif + + let l:cmd .= ' -f json %t' + + return l:cmd +endfunction + +call ale#linter#Define('terraform', { +\ 'name': 'tflint', +\ 'executable_callback': 'ale_linters#terraform#tflint#GetExecutable', +\ 'command_callback': 'ale_linters#terraform#tflint#GetCommand', +\ 'callback': 'ale_linters#terraform#tflint#Handle', +\}) + +" vim:sw=4 diff --git a/sources_non_forked/ale/ale_linters/testft/testlinter.vim b/sources_non_forked/ale/ale_linters/testft/testlinter.vim new file mode 100644 index 00000000..65e0b205 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/testft/testlinter.vim @@ -0,0 +1,10 @@ +" Author: neersighted +" Description: dummy linter to use in tests + +call ale#linter#Define('testft', { +\ 'name': 'testlinter', +\ 'output_stream': 'stdout', +\ 'executable': 'testlinter', +\ 'command': 'testlinter', +\ 'callback': 'testCB', +\}) diff --git a/sources_non_forked/ale/ale_linters/tex/alex.vim b/sources_non_forked/ale/ale_linters/tex/alex.vim new file mode 100644 index 00000000..78c530f7 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/tex/alex.vim @@ -0,0 +1,11 @@ +" Author: Johannes Wienke +" Description: alex for TeX files + +call ale#linter#Define('tex', { +\ 'name': 'alex', +\ 'executable': 'alex', +\ 'command': 'alex %s -t', +\ 'output_stream': 'stderr', +\ 'callback': 'ale#handlers#alex#Handle', +\ 'lint_file': 1, +\}) diff --git a/sources_non_forked/ale/ale_linters/tex/chktex.vim b/sources_non_forked/ale/ale_linters/tex/chktex.vim new file mode 100644 index 00000000..7f1b0c72 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/tex/chktex.vim @@ -0,0 +1,54 @@ +" Author: Andrew Balmos - +" Description: chktex for LaTeX files + +let g:ale_tex_chktex_executable = +\ get(g:, 'ale_tex_chktex_executable', 'chktex') + +let g:ale_tex_chktex_options = +\ get(g:, 'ale_tex_chktex_options', '-I') + +function! ale_linters#tex#chktex#GetCommand(buffer) abort + " Check for optional .chktexrc + let l:chktex_config = ale#path#FindNearestFile( + \ a:buffer, + \ '.chktexrc') + + let l:command = ale#Var(a:buffer, 'tex_chktex_executable') + " Avoid bug when used without -p (last warning has gibberish for a filename) + let l:command .= ' -v0 -p stdin -q' + + if !empty(l:chktex_config) + let l:command .= ' -l ' . ale#Escape(l:chktex_config) + endif + + let l:command .= ' ' . ale#Var(a:buffer, 'tex_chktex_options') + + return l:command +endfunction + +function! ale_linters#tex#chktex#Handle(buffer, lines) abort + " Mattes lines like: + " + " stdin:499:2:24:Delete this space to maintain correct pagereferences. + " stdin:507:81:3:You should enclose the previous parenthesis with `{}'. + let l:pattern = '^stdin:\(\d\+\):\(\d\+\):\(\d\+\):\(.\+\)$' + let l:output = [] + + 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] . ' (' . (l:match[3]+0) . ')', + \ 'type': 'W', + \}) + endfor + + return l:output +endfunction + +call ale#linter#Define('tex', { +\ 'name': 'chktex', +\ 'executable': 'chktex', +\ 'command_callback': 'ale_linters#tex#chktex#GetCommand', +\ 'callback': 'ale_linters#tex#chktex#Handle' +\}) diff --git a/sources_non_forked/ale/ale_linters/tex/lacheck.vim b/sources_non_forked/ale/ale_linters/tex/lacheck.vim new file mode 100644 index 00000000..e5a9632b --- /dev/null +++ b/sources_non_forked/ale/ale_linters/tex/lacheck.vim @@ -0,0 +1,47 @@ +" Author: Andrew Balmos - +" Description: lacheck for LaTeX files + +let g:ale_tex_lacheck_executable = +\ get(g:, 'ale_tex_lacheck_executable', 'lacheck') + +function! ale_linters#tex#lacheck#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'tex_lacheck_executable') +endfunction + +function! ale_linters#tex#lacheck#GetCommand(buffer) abort + return ale#Var(a:buffer, 'tex_lacheck_executable') . ' %t' +endfunction + +function! ale_linters#tex#lacheck#Handle(buffer, lines) abort + " Mattes lines like: + " + " "book.tex", line 37: possible unwanted space at "{" + " "book.tex", line 38: missing `\ ' after "etc." + + let l:pattern = '^".\+", line \(\d\+\): \(.\+\)$' + let l:output = [] + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + " lacheck follows `\input{}` commands. If the cwd is not the same as the + " file in the buffer then it will fail to find the inputed items. We do not + " want warnings from those items anyway + if !empty(matchstr(l:match[2], '^Could not open ".\+"$')) + continue + endif + + call add(l:output, { + \ 'lnum': l:match[1] + 0, + \ 'text': l:match[2], + \ 'type': 'W', + \}) + endfor + + return l:output +endfunction + +call ale#linter#Define('tex', { +\ 'name': 'lacheck', +\ 'executable_callback': 'ale_linters#tex#lacheck#GetExecutable', +\ 'command_callback': 'ale_linters#tex#lacheck#GetCommand', +\ 'callback': 'ale_linters#tex#lacheck#Handle' +\}) diff --git a/sources_non_forked/ale/ale_linters/tex/proselint.vim b/sources_non_forked/ale/ale_linters/tex/proselint.vim new file mode 100644 index 00000000..35e764e2 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/tex/proselint.vim @@ -0,0 +1,9 @@ +" Author: poohzrn https://github.com/poohzrn +" Description: proselint for TeX files + +call ale#linter#Define('tex', { +\ 'name': 'proselint', +\ 'executable': 'proselint', +\ 'command': 'proselint %t', +\ 'callback': 'ale#handlers#unix#HandleAsWarning', +\}) diff --git a/sources_non_forked/ale/ale_linters/tex/redpen.vim b/sources_non_forked/ale/ale_linters/tex/redpen.vim new file mode 100644 index 00000000..952a6004 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/tex/redpen.vim @@ -0,0 +1,9 @@ +" Author: rhysd https://rhysd.github.io +" Description: Redpen, a proofreading tool (http://redpen.cc) + +call ale#linter#Define('tex', { +\ 'name': 'redpen', +\ 'executable': 'redpen', +\ 'command': 'redpen -f latex -r json %t', +\ 'callback': 'ale#handlers#redpen#HandleRedpenOutput', +\}) diff --git a/sources_non_forked/ale/ale_linters/tex/vale.vim b/sources_non_forked/ale/ale_linters/tex/vale.vim new file mode 100644 index 00000000..f64e72ac --- /dev/null +++ b/sources_non_forked/ale/ale_linters/tex/vale.vim @@ -0,0 +1,9 @@ +" Author: chew-z https://github.com/chew-z +" Description: vale for LaTeX files + +call ale#linter#Define('tex', { +\ 'name': 'vale', +\ 'executable': 'vale', +\ 'command': 'vale --output=JSON %t', +\ 'callback': 'ale#handlers#vale#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/tex/write-good.vim b/sources_non_forked/ale/ale_linters/tex/write-good.vim new file mode 100644 index 00000000..dc59de2e --- /dev/null +++ b/sources_non_forked/ale/ale_linters/tex/write-good.vim @@ -0,0 +1,9 @@ +" Author: Sumner Evans +" 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', +\}) diff --git a/sources_non_forked/ale/ale_linters/texinfo/alex.vim b/sources_non_forked/ale/ale_linters/texinfo/alex.vim new file mode 100644 index 00000000..4a884579 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/texinfo/alex.vim @@ -0,0 +1,11 @@ +" Author: Johannes Wienke +" Description: alex for texinfo files + +call ale#linter#Define('texinfo', { +\ 'name': 'alex', +\ 'executable': 'alex', +\ 'command': 'alex %s -t', +\ 'output_stream': 'stderr', +\ 'callback': 'ale#handlers#alex#Handle', +\ 'lint_file': 1, +\}) diff --git a/sources_non_forked/ale/ale_linters/texinfo/proselint.vim b/sources_non_forked/ale/ale_linters/texinfo/proselint.vim new file mode 100644 index 00000000..003e3a0f --- /dev/null +++ b/sources_non_forked/ale/ale_linters/texinfo/proselint.vim @@ -0,0 +1,9 @@ +" Author: Daniel M. Capella https://github.com/polyzen +" Description: proselint for Texinfo files + +call ale#linter#Define('texinfo', { +\ 'name': 'proselint', +\ 'executable': 'proselint', +\ 'command': 'proselint %t', +\ 'callback': 'ale#handlers#unix#HandleAsWarning', +\}) diff --git a/sources_non_forked/ale/ale_linters/texinfo/write-good.vim b/sources_non_forked/ale/ale_linters/texinfo/write-good.vim new file mode 100644 index 00000000..8104c634 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/texinfo/write-good.vim @@ -0,0 +1,9 @@ +" Author: Sumner Evans +" 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', +\}) diff --git a/sources_non_forked/ale/ale_linters/text/alex.vim b/sources_non_forked/ale/ale_linters/text/alex.vim new file mode 100644 index 00000000..c696367b --- /dev/null +++ b/sources_non_forked/ale/ale_linters/text/alex.vim @@ -0,0 +1,11 @@ +" Author: Johannes Wienke +" Description: alex for text files + +call ale#linter#Define('text', { +\ 'name': 'alex', +\ 'executable': 'alex', +\ 'command': 'alex %s -t', +\ 'output_stream': 'stderr', +\ 'callback': 'ale#handlers#alex#Handle', +\ 'lint_file': 1, +\}) diff --git a/sources_non_forked/ale/ale_linters/text/proselint.vim b/sources_non_forked/ale/ale_linters/text/proselint.vim new file mode 100644 index 00000000..281b4ffa --- /dev/null +++ b/sources_non_forked/ale/ale_linters/text/proselint.vim @@ -0,0 +1,9 @@ +" Author: poohzrn https://github.com/poohzrn +" Description: proselint for text files + +call ale#linter#Define('text', { +\ 'name': 'proselint', +\ 'executable': 'proselint', +\ 'command': 'proselint %t', +\ 'callback': 'ale#handlers#unix#HandleAsWarning', +\}) diff --git a/sources_non_forked/ale/ale_linters/text/redpen.vim b/sources_non_forked/ale/ale_linters/text/redpen.vim new file mode 100644 index 00000000..ec4433b9 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/text/redpen.vim @@ -0,0 +1,9 @@ +" Author: rhysd https://rhysd.github.io +" Description: Redpen, a proofreading tool (http://redpen.cc) + +call ale#linter#Define('text', { +\ 'name': 'redpen', +\ 'executable': 'redpen', +\ 'command': 'redpen -f plain -r json %t', +\ 'callback': 'ale#handlers#redpen#HandleRedpenOutput', +\}) diff --git a/sources_non_forked/ale/ale_linters/text/textlint.vim b/sources_non_forked/ale/ale_linters/text/textlint.vim new file mode 100644 index 00000000..8fafdd7d --- /dev/null +++ b/sources_non_forked/ale/ale_linters/text/textlint.vim @@ -0,0 +1,9 @@ +" Author: Yasuhiro Kiyota +" Description: textlint, a proofreading tool (https://textlint.github.io/) + +call ale#linter#Define('text', { +\ 'name': 'textlint', +\ 'executable_callback': 'ale#handlers#textlint#GetExecutable', +\ 'command_callback': 'ale#handlers#textlint#GetCommand', +\ 'callback': 'ale#handlers#textlint#HandleTextlintOutput', +\}) diff --git a/sources_non_forked/ale/ale_linters/text/vale.vim b/sources_non_forked/ale/ale_linters/text/vale.vim new file mode 100644 index 00000000..cf37c2f8 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/text/vale.vim @@ -0,0 +1,9 @@ +" Author: chew-z https://github.com/chew-z +" Description: vale for text files + +call ale#linter#Define('text', { +\ 'name': 'vale', +\ 'executable': 'vale', +\ 'command': 'vale --output=JSON %t', +\ 'callback': 'ale#handlers#vale#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/text/write-good.vim b/sources_non_forked/ale/ale_linters/text/write-good.vim new file mode 100644 index 00000000..ff76ce42 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/text/write-good.vim @@ -0,0 +1,9 @@ +" Author: Sumner Evans +" 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', +\}) diff --git a/sources_non_forked/ale/ale_linters/thrift/thrift.vim b/sources_non_forked/ale/ale_linters/thrift/thrift.vim new file mode 100644 index 00000000..2f62570a --- /dev/null +++ b/sources_non_forked/ale/ale_linters/thrift/thrift.vim @@ -0,0 +1,91 @@ +" Author: Jon Parise + +call ale#Set('thrift_thrift_executable', 'thrift') +call ale#Set('thrift_thrift_generators', ['cpp']) +call ale#Set('thrift_thrift_includes', []) +call ale#Set('thrift_thrift_options', '-strict') + +function! ale_linters#thrift#thrift#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'thrift_thrift_executable') +endfunction + +function! ale_linters#thrift#thrift#GetCommand(buffer) abort + let l:generators = ale#Var(a:buffer, 'thrift_thrift_generators') + let l:includes = ale#Var(a:buffer, 'thrift_thrift_includes') + + " The thrift compiler requires at least one generator. If none are set, + " fall back to our default value to avoid silently failing. We could also + " `throw` here, but that seems even less helpful. + if empty(l:generators) + let l:generators = ['cpp'] + endif + + let l:output_dir = tempname() + call mkdir(l:output_dir) + call ale#engine#ManageDirectory(a:buffer, l:output_dir) + + return ale#Escape(ale_linters#thrift#thrift#GetExecutable(a:buffer)) + \ . ' ' . join(map(copy(l:generators), "'--gen ' . v:val")) + \ . ' ' . join(map(copy(l:includes), "'-I ' . v:val")) + \ . ' ' . ale#Var(a:buffer, 'thrift_thrift_options') + \ . ' -out ' . ale#Escape(l:output_dir) + \ . ' %t' +endfunction + +function! ale_linters#thrift#thrift#Handle(buffer, lines) abort + " Matches lines like the following: + " + " [SEVERITY:/path/filename.thrift:31] Message text + " [ERROR:/path/filename.thrift:31] (last token was ';') + let l:pattern = '\v^\[(\u+):(.*):(\d+)\] (.*)$' + + let l:index = 0 + let l:output = [] + + " Roll our own output-matching loop instead of using ale#util#GetMatches + " because we need to support error messages that span multiple lines. + while l:index < len(a:lines) + let l:line = a:lines[l:index] + + let l:match = matchlist(l:line, l:pattern) + if empty(l:match) + let l:index += 1 + continue + endif + + let l:severity = l:match[1] + if l:severity is# 'WARNING' + let l:type = 'W' + else + let l:type = 'E' + endif + + " If our text looks like "(last token was ';')", the *next* line + " should contain a more descriptive error message. + let l:text = l:match[4] + if l:text =~# '\(last token was .*\)' + let l:index += 1 + let l:text = get(a:lines, l:index, 'Unknown error ' . l:text) + endif + + call add(l:output, { + \ 'lnum': l:match[3] + 0, + \ 'col': 0, + \ 'type': l:type, + \ 'text': l:text, + \}) + + let l:index += 1 + endwhile + + return l:output +endfunction + +call ale#linter#Define('thrift', { +\ 'name': 'thrift', +\ 'executable': 'thrift', +\ 'output_stream': 'both', +\ 'executable_callback': 'ale_linters#thrift#thrift#GetExecutable', +\ 'command_callback': 'ale_linters#thrift#thrift#GetCommand', +\ 'callback': 'ale_linters#thrift#thrift#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/typescript/eslint.vim b/sources_non_forked/ale/ale_linters/typescript/eslint.vim new file mode 100644 index 00000000..f1ae54e7 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/typescript/eslint.vim @@ -0,0 +1,9 @@ +" Author: w0rp +" Description: eslint for JavaScript files + +call ale#linter#Define('typescript', { +\ 'name': 'eslint', +\ 'executable_callback': 'ale#handlers#eslint#GetExecutable', +\ 'command_callback': 'ale#handlers#eslint#GetCommand', +\ 'callback': 'ale#handlers#eslint#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/typescript/tslint.vim b/sources_non_forked/ale/ale_linters/typescript/tslint.vim new file mode 100644 index 00000000..6f94fbae --- /dev/null +++ b/sources_non_forked/ale/ale_linters/typescript/tslint.vim @@ -0,0 +1,85 @@ +" Author: Prashanth Chandra , Jonathan Clem +" Description: tslint for TypeScript files + +call ale#Set('typescript_tslint_executable', 'tslint') +call ale#Set('typescript_tslint_config_path', '') +call ale#Set('typescript_tslint_rules_dir', '') +call ale#Set('typescript_tslint_use_global', 0) +call ale#Set('typescript_tslint_ignore_empty_files', 0) + +function! ale_linters#typescript#tslint#GetExecutable(buffer) abort + return ale#node#FindExecutable(a:buffer, 'typescript_tslint', [ + \ 'node_modules/.bin/tslint', + \]) +endfunction + +function! ale_linters#typescript#tslint#Handle(buffer, lines) abort + " Do not output any errors for empty files if the option is on. + if ale#Var(a:buffer, 'typescript_tslint_ignore_empty_files') + \&& getbufline(a:buffer, 1, '$') == [''] + return [] + endif + + let l:dir = expand('#' . a:buffer . ':p:h') + let l:output = [] + + for l:error in ale#util#FuzzyJSONDecode(a:lines, []) + if get(l:error, 'ruleName', '') is# 'no-implicit-dependencies' + continue + endif + + let l:item = { + \ 'type': (get(l:error, 'ruleSeverity', '') is# 'WARNING' ? 'W' : 'E'), + \ 'text': l:error.failure, + \ 'lnum': l:error.startPosition.line + 1, + \ 'col': l:error.startPosition.character + 1, + \ 'end_lnum': l:error.endPosition.line + 1, + \ 'end_col': l:error.endPosition.character + 1, + \} + + let l:filename = ale#path#GetAbsPath(l:dir, l:error.name) + + " Assume temporary files are this file. + if !ale#path#IsTempName(l:filename) + let l:item.filename = l:filename + endif + + if has_key(l:error, 'ruleName') + let l:item.code = l:error.ruleName + endif + + call add(l:output, l:item) + endfor + + return l:output +endfunction + +function! ale_linters#typescript#tslint#GetCommand(buffer) abort + let l:tslint_config_path = ale#path#ResolveLocalPath( + \ a:buffer, + \ 'tslint.json', + \ ale#Var(a:buffer, 'typescript_tslint_config_path') + \) + let l:tslint_config_option = !empty(l:tslint_config_path) + \ ? ' -c ' . ale#Escape(l:tslint_config_path) + \ : '' + + let l:tslint_rules_dir = ale#Var(a:buffer, 'typescript_tslint_rules_dir') + let l:tslint_rules_option = !empty(l:tslint_rules_dir) + \ ? ' -r ' . ale#Escape(l:tslint_rules_dir) + \ : '' + + return ale#path#BufferCdString(a:buffer) + \ . ale#Escape(ale_linters#typescript#tslint#GetExecutable(a:buffer)) + \ . ' --format json' + \ . l:tslint_config_option + \ . l:tslint_rules_option + \ . ' %t' +endfunction + +call ale#linter#Define('typescript', { +\ 'name': 'tslint', +\ 'executable_callback': 'ale_linters#typescript#tslint#GetExecutable', +\ 'command_callback': 'ale_linters#typescript#tslint#GetCommand', +\ 'callback': 'ale_linters#typescript#tslint#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/typescript/tsserver.vim b/sources_non_forked/ale/ale_linters/typescript/tsserver.vim new file mode 100644 index 00000000..7a155bd9 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/typescript/tsserver.vim @@ -0,0 +1,30 @@ +" Author: w0rp +" Description: tsserver integration for ALE + +call ale#Set('typescript_tsserver_executable', 'tsserver') +call ale#Set('typescript_tsserver_config_path', '') +call ale#Set('typescript_tsserver_use_global', 0) + +" These functions need to be defined just to comply with the API for LSP. +function! ale_linters#typescript#tsserver#GetProjectRoot(buffer) abort + return '' +endfunction + +function! ale_linters#typescript#tsserver#GetLanguage(buffer) abort + return '' +endfunction + +function! ale_linters#typescript#tsserver#GetExecutable(buffer) abort + return ale#node#FindExecutable(a:buffer, 'typescript_tsserver', [ + \ 'node_modules/.bin/tsserver', + \]) +endfunction + +call ale#linter#Define('typescript', { +\ 'name': 'tsserver', +\ 'lsp': 'tsserver', +\ 'executable_callback': 'ale_linters#typescript#tsserver#GetExecutable', +\ 'command_callback': 'ale_linters#typescript#tsserver#GetExecutable', +\ 'project_root_callback': 'ale_linters#typescript#tsserver#GetProjectRoot', +\ 'language_callback': 'ale_linters#typescript#tsserver#GetLanguage', +\}) diff --git a/sources_non_forked/ale/ale_linters/typescript/typecheck.vim b/sources_non_forked/ale/ale_linters/typescript/typecheck.vim new file mode 100644 index 00000000..2f18691b --- /dev/null +++ b/sources_non_forked/ale/ale_linters/typescript/typecheck.vim @@ -0,0 +1,33 @@ +" Author: Prashanth Chandra https://github.com/prashcr, Aleh Kashnikau https://github.com/mkusher +" Description: type checker for TypeScript files + +function! ale_linters#typescript#typecheck#Handle(buffer, lines) abort + " Matches patterns like the following: + " + " hello.ts[7, 41]: Property 'a' does not exist on type 'A' + " hello.ts[16, 7]: Type 'A' is not assignable to type 'B' + " + let l:pattern = '.\+\.ts\[\(\d\+\), \(\d\+\)\]: \(.\+\)' + let l:output = [] + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + let l:line = l:match[1] + 0 + let l:column = l:match[2] + 0 + let l:text = l:match[3] + + call add(l:output, { + \ 'lnum': l:line, + \ 'col': l:column, + \ 'text': l:text, + \}) + endfor + + return l:output +endfunction + +call ale#linter#Define('typescript', { +\ 'name': 'typecheck', +\ 'executable': 'typecheck', +\ 'command': 'typecheck %s', +\ 'callback': 'ale_linters#typescript#typecheck#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/verilog/iverilog.vim b/sources_non_forked/ale/ale_linters/verilog/iverilog.vim new file mode 100644 index 00000000..c64a3be6 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/verilog/iverilog.vim @@ -0,0 +1,43 @@ +" Author: Masahiro H https://github.com/mshr-h +" Description: iverilog for verilog files + +call ale#Set('verilog_iverilog_options', '') + +function! ale_linters#verilog#iverilog#GetCommand(buffer) abort + return 'iverilog -t null -Wall ' + \ . ale#Var(a:buffer, 'verilog_iverilog_options') + \ . ' %t' +endfunction + +function! ale_linters#verilog#iverilog#Handle(buffer, lines) abort + " Look for lines like the following. + " + " tb_me_top.v:37: warning: Instantiating module me_top with dangling input port 1 (rst_n) floating. + " tb_me_top.v:17: syntax error + " memory_single_port.v:2: syntax error + " tb_me_top.v:17: error: Invalid module instantiation + let l:pattern = '^[^:]\+:\(\d\+\): \(warning\|error\|syntax error\)\(: \(.\+\)\)\?' + let l:output = [] + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + let l:line = l:match[1] + 0 + let l:type = l:match[2] =~# 'error' ? 'E' : 'W' + let l:text = l:match[2] is# 'syntax error' ? 'syntax error' : l:match[4] + + call add(l:output, { + \ 'lnum': l:line, + \ 'text': l:text, + \ 'type': l:type, + \}) + endfor + + return l:output +endfunction + +call ale#linter#Define('verilog', { +\ 'name': 'iverilog', +\ 'output_stream': 'stderr', +\ 'executable': 'iverilog', +\ 'command_callback': 'ale_linters#verilog#iverilog#GetCommand', +\ 'callback': 'ale_linters#verilog#iverilog#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/verilog/verilator.vim b/sources_non_forked/ale/ale_linters/verilog/verilator.vim new file mode 100644 index 00000000..6053da09 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/verilog/verilator.vim @@ -0,0 +1,59 @@ +" Author: Masahiro H https://github.com/mshr-h +" Description: verilator for verilog files + +" Set this option to change Verilator lint options +if !exists('g:ale_verilog_verilator_options') + let g:ale_verilog_verilator_options = '' +endif + +function! ale_linters#verilog#verilator#GetCommand(buffer) abort + let l:filename = tempname() . '_verilator_linted.v' + + " Create a special filename, so we can detect it in the handler. + call ale#engine#ManageFile(a:buffer, l:filename) + let l:lines = getbufline(a:buffer, 1, '$') + call ale#util#Writefile(a:buffer, l:lines, l:filename) + + return 'verilator --lint-only -Wall -Wno-DECLFILENAME ' + \ . ale#Var(a:buffer, 'verilog_verilator_options') .' ' + \ . ale#Escape(l:filename) +endfunction + +function! ale_linters#verilog#verilator#Handle(buffer, lines) abort + " Look for lines like the following. + " + " %Error: addr_gen.v:3: syntax error, unexpected IDENTIFIER + " %Warning-WIDTH: addr_gen.v:26: Operator ASSIGNDLY expects 12 bits on the Assign RHS, but Assign RHS's CONST '20'h0' generates 20 bits. + " %Warning-UNUSED: test.v:3: Signal is not used: a + " %Warning-UNDRIVEN: test.v:3: Signal is not driven: clk + " %Warning-UNUSED: test.v:4: Signal is not used: dout + " %Warning-BLKSEQ: test.v:10: Blocking assignments (=) in sequential (flop or latch) block; suggest delayed assignments (<=). + let l:pattern = '^%\(Warning\|Error\)[^:]*:\([^:]\+\):\(\d\+\): \(.\+\)$' + let l:output = [] + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + let l:line = l:match[3] + 0 + let l:type = l:match[1] is# 'Error' ? 'E' : 'W' + let l:text = l:match[4] + let l:file = l:match[2] + + if l:file =~# '_verilator_linted.v' + call add(l:output, { + \ 'lnum': l:line, + \ 'text': l:text, + \ 'type': l:type, + \}) + endif + endfor + + return l:output +endfunction + +call ale#linter#Define('verilog', { +\ 'name': 'verilator', +\ 'output_stream': 'stderr', +\ 'executable': 'verilator', +\ 'command_callback': 'ale_linters#verilog#verilator#GetCommand', +\ 'callback': 'ale_linters#verilog#verilator#Handle', +\ 'read_buffer': 0, +\}) diff --git a/sources_non_forked/ale/ale_linters/vim/vint.vim b/sources_non_forked/ale/ale_linters/vim/vint.vim new file mode 100644 index 00000000..dfa00dc0 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/vim/vint.vim @@ -0,0 +1,67 @@ +" Author: w0rp , KabbAmine +" Description: This file adds support for checking Vim code with Vint. + +" This flag can be used to change enable/disable style issues. +let g:ale_vim_vint_show_style_issues = +\ get(g:, 'ale_vim_vint_show_style_issues', 1) +let s:enable_neovim = has('nvim') ? ' --enable-neovim ' : '' +let s:format = '-f "{file_path}:{line_number}:{column_number}: {severity}: {description} (see {reference})"' + +function! ale_linters#vim#vint#VersionCommand(buffer) abort + " Check the Vint version if we haven't checked it already. + return !ale#semver#HasVersion('vint') + \ ? 'vint --version' + \ : '' +endfunction + +function! ale_linters#vim#vint#GetCommand(buffer, version_output) abort + let l:version = ale#semver#GetVersion('vint', a:version_output) + + let l:can_use_no_color_flag = empty(l:version) + \ || ale#semver#GTE(l:version, [0, 3, 7]) + + let l:warning_flag = ale#Var(a:buffer, 'vim_vint_show_style_issues') ? '-s' : '-w' + + return 'vint ' + \ . l:warning_flag . ' ' + \ . (l:can_use_no_color_flag ? '--no-color ' : '') + \ . s:enable_neovim + \ . s:format + \ . ' %t' +endfunction + +let s:word_regex_list = [ +\ '\v^Undefined variable: ([^ ]+)', +\ '\v^Make the scope explicit like ...([^ ]+). ', +\ '\v^.*start with a capital or contain a colon: ([^ ]+)', +\ '\v.*instead of .(\=[=~]).', +\] + +function! ale_linters#vim#vint#Handle(buffer, lines) abort + let l:loclist = ale#handlers#gcc#HandleGCCFormat(a:buffer, a:lines) + + for l:item in l:loclist + let l:match = [] + + for l:regex in s:word_regex_list + let l:match = matchlist(l:item.text, l:regex) + + if !empty(l:match) + let l:item.end_col = l:item.col + len(l:match[1]) - 1 + break + endif + endfor + endfor + + return l:loclist +endfunction + +call ale#linter#Define('vim', { +\ 'name': 'vint', +\ 'executable': 'vint', +\ 'command_chain': [ +\ {'callback': 'ale_linters#vim#vint#VersionCommand', 'output_stream': 'stderr'}, +\ {'callback': 'ale_linters#vim#vint#GetCommand', 'output_stream': 'stdout'}, +\ ], +\ 'callback': 'ale_linters#vim#vint#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/xhtml/alex.vim b/sources_non_forked/ale/ale_linters/xhtml/alex.vim new file mode 100644 index 00000000..60a9a7c9 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/xhtml/alex.vim @@ -0,0 +1,11 @@ +" Author: Johannes Wienke +" Description: alex for XHTML files + +call ale#linter#Define('xhtml', { +\ 'name': 'alex', +\ 'executable': 'alex', +\ 'command': 'alex %s -t', +\ 'output_stream': 'stderr', +\ 'callback': 'ale#handlers#alex#Handle', +\ 'lint_file': 1, +\}) diff --git a/sources_non_forked/ale/ale_linters/xhtml/proselint.vim b/sources_non_forked/ale/ale_linters/xhtml/proselint.vim new file mode 100644 index 00000000..dfad921f --- /dev/null +++ b/sources_non_forked/ale/ale_linters/xhtml/proselint.vim @@ -0,0 +1,9 @@ +" Author: Daniel M. Capella https://github.com/polyzen +" Description: proselint for XHTML files + +call ale#linter#Define('xhtml', { +\ 'name': 'proselint', +\ 'executable': 'proselint', +\ 'command': 'proselint %t', +\ 'callback': 'ale#handlers#unix#HandleAsWarning', +\}) diff --git a/sources_non_forked/ale/ale_linters/xhtml/write-good.vim b/sources_non_forked/ale/ale_linters/xhtml/write-good.vim new file mode 100644 index 00000000..83d1863b --- /dev/null +++ b/sources_non_forked/ale/ale_linters/xhtml/write-good.vim @@ -0,0 +1,9 @@ +" Author: Sumner Evans +" 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', +\}) diff --git a/sources_non_forked/ale/ale_linters/xml/xmllint.vim b/sources_non_forked/ale/ale_linters/xml/xmllint.vim new file mode 100644 index 00000000..63d7f768 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/xml/xmllint.vim @@ -0,0 +1,69 @@ +" Author: q12321q +" Description: This file adds support for checking XML code with xmllint. + +" CLI options +let g:ale_xml_xmllint_executable = get(g:, 'ale_xml_xmllint_executable', 'xmllint') +let g:ale_xml_xmllint_options = get(g:, 'ale_xml_xmllint_options', '') + +function! ale_linters#xml#xmllint#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'xml_xmllint_executable') +endfunction + +function! ale_linters#xml#xmllint#GetCommand(buffer) abort + return ale#Escape(ale_linters#xml#xmllint#GetExecutable(a:buffer)) + \ . ' ' . ale#Var(a:buffer, 'xml_xmllint_options') + \ . ' --noout -' +endfunction + +function! ale_linters#xml#xmllint#Handle(buffer, lines) abort + " Matches patterns lines like the following: + " file/path:123: error level : error message + let l:pattern_message = '\v^([^:]+):(\d+):\s*(([^:]+)\s*:\s+.*)$' + + " parse column token line like that: + " file/path:123: parser error : Opening and ending tag mismatch: foo line 1 and bar + " + " ^ + let l:pattern_column_token = '\v^\s*\^$' + + let l:output = [] + + for l:line in a:lines + + " Parse error/warning lines + let l:match_message = matchlist(l:line, l:pattern_message) + if !empty(l:match_message) + let l:line = l:match_message[2] + 0 + let l:type = l:match_message[4] =~? 'warning' ? 'W' : 'E' + let l:text = l:match_message[3] + + call add(l:output, { + \ 'lnum': l:line, + \ 'text': l:text, + \ 'type': l:type, + \}) + + continue + endif + + " Parse column position + let l:match_column_token = matchlist(l:line, l:pattern_column_token) + if !empty(l:output) && !empty(l:match_column_token) + let l:previous = l:output[len(l:output) - 1] + let l:previous['col'] = len(l:match_column_token[0]) + + continue + endif + + endfor + + return l:output +endfunction + +call ale#linter#Define('xml', { +\ 'name': 'xmllint', +\ 'output_stream': 'stderr', +\ 'executable_callback': 'ale_linters#xml#xmllint#GetExecutable', +\ 'command_callback': 'ale_linters#xml#xmllint#GetCommand', +\ 'callback': 'ale_linters#xml#xmllint#Handle', +\ }) diff --git a/sources_non_forked/ale/ale_linters/yaml/swaglint.vim b/sources_non_forked/ale/ale_linters/yaml/swaglint.vim new file mode 100644 index 00000000..75a496c5 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/yaml/swaglint.vim @@ -0,0 +1,49 @@ +" Author: Matthew Turland +" Description: This file adds support for linting Swagger / OpenAPI documents using swaglint + +call ale#Set('yaml_swaglint_executable', 'swaglint') +call ale#Set('yaml_swaglint_use_global', 0) + +function! ale_linters#yaml#swaglint#GetExecutable(buffer) abort + return ale#node#FindExecutable(a:buffer, 'yaml_swaglint', [ + \ 'node_modules/.bin/swaglint', + \]) +endfunction + +function! ale_linters#yaml#swaglint#GetCommand(buffer) abort + return ale_linters#yaml#swaglint#GetExecutable(a:buffer) + \ . ' -r compact --stdin' +endfunction + +function! ale_linters#yaml#swaglint#Handle(buffer, lines) abort + let l:pattern = ': \([^\s]\+\) @ \(\d\+\):\(\d\+\) - \(.\+\)$' + let l:output = [] + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + let l:obj = { + \ 'type': l:match[1] is# 'error' ? 'E' : 'W', + \ 'lnum': l:match[2] + 0, + \ 'col': l:match[3] + 0, + \ 'text': l:match[4], + \} + + " Parse the code if it's there. + let l:code_match = matchlist(l:obj.text, '\v^(.+) \(([^ (]+)\)$') + + if !empty(l:code_match) + let l:obj.text = l:code_match[1] + let l:obj.code = l:code_match[2] + endif + + call add(l:output, l:obj) + endfor + + return l:output +endfunction + +call ale#linter#Define('yaml', { +\ 'name': 'swaglint', +\ 'executable_callback': 'ale_linters#yaml#swaglint#GetExecutable', +\ 'command_callback': 'ale_linters#yaml#swaglint#GetCommand', +\ 'callback': 'ale_linters#yaml#swaglint#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/yaml/yamllint.vim b/sources_non_forked/ale/ale_linters/yaml/yamllint.vim new file mode 100644 index 00000000..731f8012 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/yaml/yamllint.vim @@ -0,0 +1,48 @@ +" Author: KabbAmine + +let g:ale_yaml_yamllint_executable = +\ get(g:, 'ale_yaml_yamllint_executable', 'yamllint') + +let g:ale_yaml_yamllint_options = +\ get(g:, 'ale_yaml_yamllint_options', '') + +function! ale_linters#yaml#yamllint#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'yaml_yamllint_executable') +endfunction + +function! ale_linters#yaml#yamllint#GetCommand(buffer) abort + return ale_linters#yaml#yamllint#GetExecutable(a:buffer) + \ . ' ' . ale#Var(a:buffer, 'yaml_yamllint_options') + \ . ' -f parsable %t' +endfunction + +function! ale_linters#yaml#yamllint#Handle(buffer, lines) abort + " Matches patterns line the following: + " something.yaml:1:1: [warning] missing document start "---" (document-start) + " something.yml:2:1: [error] syntax error: expected the node content, but found '' + let l:pattern = '^.*:\(\d\+\):\(\d\+\): \[\(error\|warning\)\] \(.\+\)$' + let l:output = [] + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + let l:line = l:match[1] + 0 + let l:col = l:match[2] + 0 + let l:type = l:match[3] + let l:text = l:match[4] + + call add(l:output, { + \ 'lnum': l:line, + \ 'col': l:col, + \ 'text': l:text, + \ 'type': l:type is# 'error' ? 'E' : 'W', + \}) + endfor + + return l:output +endfunction + +call ale#linter#Define('yaml', { +\ 'name': 'yamllint', +\ 'executable_callback': 'ale_linters#yaml#yamllint#GetExecutable', +\ 'command_callback': 'ale_linters#yaml#yamllint#GetCommand', +\ 'callback': 'ale_linters#yaml#yamllint#Handle', +\}) diff --git a/sources_non_forked/ale/autoload/ale.vim b/sources_non_forked/ale/autoload/ale.vim new file mode 100644 index 00000000..f6c06cf1 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale.vim @@ -0,0 +1,287 @@ +" Author: w0rp , David Alexander +" Description: Primary code path for the plugin +" Manages execution of linters when requested by autocommands + +let s:lint_timer = -1 +let s:queued_buffer_number = -1 +let s:should_lint_file_for_buffer = {} +let s:error_delay_ms = 1000 * 60 * 2 + +let s:timestamp_map = {} + +" Given a key for a script variable for tracking the time to wait until +" a given function should be called, a funcref for a function to call, and +" a List of arguments, call the function and return whatever value it returns. +" +" If the function throws an exception, then the function will not be called +" for a while, and 0 will be returned instead. +function! ale#CallWithCooldown(timestamp_key, func, arglist) abort + let l:now = ale#util#ClockMilliseconds() + + if l:now < get(s:timestamp_map, a:timestamp_key, -1) + return 0 + endif + + let s:timestamp_map[a:timestamp_key] = l:now + s:error_delay_ms + + let l:return_value = call(a:func, a:arglist) + + let s:timestamp_map[a:timestamp_key] = -1 + + return l:return_value +endfunction + +" Return 1 if a file is too large for ALE to handle. +function! ale#FileTooLarge() abort + let l:max = ale#Var(bufnr(''), 'maximum_file_size') + + return l:max > 0 ? (line2byte(line('$') + 1) > l:max) : 0 +endfunction + +let s:getcmdwintype_exists = exists('*getcmdwintype') + +" A function for checking various conditions whereby ALE just shouldn't +" attempt to do anything, say if particular buffer types are open in Vim. +function! ale#ShouldDoNothing(buffer) abort + " The checks are split into separate if statements to make it possible to + " profile each check individually with Vim's profiling tools. + + " Don't perform any checks when newer NeoVim versions are exiting. + if get(v:, 'exiting', v:null) isnot v:null + return 1 + endif + + " Do nothing for blacklisted files + if index(g:ale_filetype_blacklist, getbufvar(a:buffer, '&filetype')) >= 0 + return 1 + endif + + " Do nothing if running from command mode + if s:getcmdwintype_exists && !empty(getcmdwintype()) + return 1 + endif + + let l:filename = fnamemodify(bufname(a:buffer), ':t') + + if l:filename is# '.' + return 1 + endif + + " Do nothing if running in the sandbox + if ale#util#InSandbox() + return 1 + endif + + " Do nothing if ALE is disabled. + if !ale#Var(a:buffer, 'enabled') + return 1 + endif + + " Do nothing if the file is too large. + if ale#FileTooLarge() + return 1 + endif + + " Do nothing from CtrlP buffers with CtrlP-funky. + if exists(':CtrlPFunky') is 2 + \&& getbufvar(a:buffer, '&l:statusline') =~# 'CtrlPMode.*funky' + return 1 + endif + + return 0 +endfunction + +" (delay, [linting_flag, buffer_number]) +function! ale#Queue(delay, ...) abort + if a:0 > 2 + throw 'too many arguments!' + endif + + " Default linting_flag to '' + let l:linting_flag = get(a:000, 0, '') + let l:buffer = get(a:000, 1, bufnr('')) + + return ale#CallWithCooldown( + \ 'dont_queue_until', + \ function('s:ALEQueueImpl'), + \ [a:delay, l:linting_flag, l:buffer], + \) +endfunction + +function! s:ALEQueueImpl(delay, linting_flag, buffer) abort + if a:linting_flag isnot# '' && a:linting_flag isnot# 'lint_file' + throw "linting_flag must be either '' or 'lint_file'" + endif + + if type(a:buffer) != type(0) + throw 'buffer_number must be a Number' + endif + + if ale#ShouldDoNothing(a:buffer) + return + endif + + " Remember that we want to check files for this buffer. + " We will remember this until we finally run the linters, via any event. + if a:linting_flag is# 'lint_file' + let s:should_lint_file_for_buffer[a:buffer] = 1 + endif + + if s:lint_timer != -1 + call timer_stop(s:lint_timer) + let s:lint_timer = -1 + endif + + let l:linters = ale#linter#Get(getbufvar(a:buffer, '&filetype')) + + " Don't set up buffer data and so on if there are no linters to run. + if empty(l:linters) + " If we have some previous buffer data, then stop any jobs currently + " running and clear everything. + if has_key(g:ale_buffer_info, a:buffer) + call ale#engine#RunLinters(a:buffer, [], 1) + endif + + return + endif + + if a:delay > 0 + let s:queued_buffer_number = a:buffer + let s:lint_timer = timer_start(a:delay, function('ale#Lint')) + else + call ale#Lint(-1, a:buffer) + endif +endfunction + +function! ale#Lint(...) abort + if a:0 > 1 + " Use the buffer number given as the optional second argument. + let l:buffer = a:2 + elseif a:0 > 0 && a:1 == s:lint_timer + " Use the buffer number for the buffer linting was queued for. + let l:buffer = s:queued_buffer_number + else + " Use the current buffer number. + let l:buffer = bufnr('') + endif + + return ale#CallWithCooldown( + \ 'dont_lint_until', + \ function('s:ALELintImpl'), + \ [l:buffer], + \) +endfunction + +function! s:ALELintImpl(buffer) abort + if ale#ShouldDoNothing(a:buffer) + return + endif + + " Use the filetype from the buffer + let l:linters = ale#linter#Get(getbufvar(a:buffer, '&filetype')) + let l:should_lint_file = 0 + + " Check if we previously requested checking the file. + if has_key(s:should_lint_file_for_buffer, a:buffer) + unlet s:should_lint_file_for_buffer[a:buffer] + " Lint files if they exist. + let l:should_lint_file = filereadable(expand('#' . a:buffer . ':p')) + endif + + call ale#engine#RunLinters(a:buffer, l:linters, l:should_lint_file) +endfunction + +" Reset flags indicating that files should be checked for all buffers. +function! ale#ResetLintFileMarkers() abort + let s:should_lint_file_for_buffer = {} +endfunction + +function! ale#ResetErrorDelays() abort + let s:timestamp_map = {} +endfunction + +let g:ale_has_override = get(g:, 'ale_has_override', {}) + +" Call has(), but check a global Dictionary so we can force flags on or off +" for testing purposes. +function! ale#Has(feature) abort + return get(g:ale_has_override, a:feature, has(a:feature)) +endfunction + +" Given a buffer number and a variable name, look for that variable in the +" buffer scope, then in global scope. If the name does not exist in the global +" scope, an exception will be thrown. +" +" Every variable name will be prefixed with 'ale_'. +function! ale#Var(buffer, variable_name) abort + let l:nr = str2nr(a:buffer) + let l:full_name = 'ale_' . a:variable_name + + if bufexists(l:nr) + let l:vars = getbufvar(l:nr, '') + elseif has_key(g:, 'ale_fix_buffer_data') + let l:vars = get(g:ale_fix_buffer_data, l:nr, {'vars': {}}).vars + else + let l:vars = {} + endif + + return get(l:vars, l:full_name, g:[l:full_name]) +endfunction + +" Initialize a variable with a default value, if it isn't already set. +" +" Every variable name will be prefixed with 'ale_'. +function! ale#Set(variable_name, default) abort + let l:full_name = 'ale_' . a:variable_name + let l:value = get(g:, l:full_name, a:default) + let g:[l:full_name] = l:value + + return l:value +endfunction + +" Escape a string suitably for each platform. +" shellescape does not work on Windows. +function! ale#Escape(str) abort + if fnamemodify(&shell, ':t') is? 'cmd.exe' + " If the string contains spaces, it will be surrounded by quotes. + " Otherwise, special characters will be escaped with carets (^). + return substitute( + \ a:str =~# ' ' + \ ? '"' . substitute(a:str, '"', '""', 'g') . '"' + \ : substitute(a:str, '\v([&|<>^])', '^\1', 'g'), + \ '%', + \ '%%', + \ 'g', + \) + endif + + return shellescape (a:str) +endfunction + +" Get the loclist item message according to a given format string. +" +" See `:help g:ale_loclist_msg_format` and `:help g:ale_echo_msg_format` +function! ale#GetLocItemMessage(item, format_string) abort + let l:msg = a:format_string + let l:severity = g:ale_echo_msg_warning_str + let l:code = get(a:item, 'code', '') + let l:type = get(a:item, 'type', 'E') + let l:linter_name = get(a:item, 'linter_name', '') + let l:code_repl = !empty(l:code) ? '\=submatch(1) . l:code . submatch(2)' : '' + + if l:type is# 'E' + let l:severity = g:ale_echo_msg_error_str + elseif l:type is# 'I' + let l:severity = g:ale_echo_msg_info_str + endif + + " Replace special markers with certain information. + " \=l:variable is used to avoid escaping issues. + let l:msg = substitute(l:msg, '\V%severity%', '\=l:severity', 'g') + let l:msg = substitute(l:msg, '\V%linter%', '\=l:linter_name', 'g') + let l:msg = substitute(l:msg, '\v\%([^\%]*)code([^\%]*)\%', l:code_repl, 'g') + " Replace %s with the text. + let l:msg = substitute(l:msg, '\V%s', '\=a:item.text', 'g') + + return l:msg +endfunction diff --git a/sources_non_forked/ale/autoload/ale/balloon.vim b/sources_non_forked/ale/autoload/ale/balloon.vim new file mode 100644 index 00000000..552ced82 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/balloon.vim @@ -0,0 +1,28 @@ +" Author: w0rp +" Description: balloonexpr support for ALE. + +function! ale#balloon#MessageForPos(bufnr, lnum, col) abort + " Don't show balloons if they are disabled, or linting is disabled. + if !ale#Var(a:bufnr, 'set_balloons') + \|| !g:ale_enabled + \|| !getbufvar(a:bufnr, 'ale_enabled', 1) + return '' + endif + + let l:loclist = get(g:ale_buffer_info, a:bufnr, {'loclist': []}).loclist + let l:index = ale#util#BinarySearch(l:loclist, a:bufnr, a:lnum, a:col) + + return l:index >= 0 ? l:loclist[l:index].text : '' +endfunction + +function! ale#balloon#Expr() abort + return ale#balloon#MessageForPos(v:beval_bufnr, v:beval_lnum, v:beval_col) +endfunction + +function! ale#balloon#Disable() abort + set noballooneval balloonexpr= +endfunction + +function! ale#balloon#Enable() abort + set ballooneval balloonexpr=ale#balloon#Expr() +endfunction diff --git a/sources_non_forked/ale/autoload/ale/c.vim b/sources_non_forked/ale/autoload/ale/c.vim new file mode 100644 index 00000000..5ab10f00 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/c.vim @@ -0,0 +1,176 @@ +" Author: gagbo , w0rp , roel0 +" Description: Functions for integrating with C-family linters. + +call ale#Set('c_parse_makefile', 0) +let s:sep = has('win32') ? '\' : '/' + +function! ale#c#FindProjectRoot(buffer) abort + for l:project_filename in ['.git/HEAD', 'configure', 'Makefile', 'CMakeLists.txt'] + let l:full_path = ale#path#FindNearestFile(a:buffer, l:project_filename) + + if !empty(l:full_path) + let l:path = fnamemodify(l:full_path, ':h') + + " Correct .git path detection. + if fnamemodify(l:path, ':t') is# '.git' + let l:path = fnamemodify(l:path, ':h') + endif + + return l:path + endif + endfor + + return '' +endfunction + +function! ale#c#ParseCFlagsToList(path_prefix, cflags) abort + let l:cflags_list = [] + let l:previous_options = [] + + for l:option in a:cflags + call add(l:previous_options, l:option) + " Check if cflag contained a '-' and should not have been splitted + let l:option_list = split(l:option, '\zs') + if l:option_list[-1] isnot# ' ' + continue + endif + + let l:option = join(l:previous_options, '-') + let l:previous_options = [] + + let l:option = '-' . substitute(l:option, '^\s*\(.\{-}\)\s*$', '\1', '') + + " Fix relative paths if needed + if stridx(l:option, '-I') >= 0 && + \ stridx(l:option, '-I' . s:sep) < 0 + let l:rel_path = join(split(l:option, '\zs')[2:], '') + let l:rel_path = substitute(l:rel_path, '"', '', 'g') + let l:rel_path = substitute(l:rel_path, '''', '', 'g') + let l:option = ale#Escape('-I' . a:path_prefix . + \ s:sep . l:rel_path) + endif + + " Parse the cflag + if stridx(l:option, '-I') >= 0 || + \ stridx(l:option, '-D') >= 0 + if index(l:cflags_list, l:option) < 0 + call add(l:cflags_list, l:option) + endif + endif + endfor + + return l:cflags_list +endfunction + +function! ale#c#ParseCFlags(buffer, stdout_make) abort + if !g:ale_c_parse_makefile + return [] + endif + + let l:buffer_filename = expand('#' . a:buffer . ':t') + let l:cflags = [] + for l:lines in split(a:stdout_make, '\\n') + if stridx(l:lines, l:buffer_filename) >= 0 + let l:cflags = split(l:lines, '-') + break + endif + endfor + + let l:makefile_path = ale#path#FindNearestFile(a:buffer, 'Makefile') + return ale#c#ParseCFlagsToList(fnamemodify(l:makefile_path, ':p:h'), l:cflags) +endfunction + +function! ale#c#GetCFlags(buffer, output) abort + let l:cflags = ' ' + + if g:ale_c_parse_makefile && !empty(a:output) + let l:cflags = join(ale#c#ParseCFlags(a:buffer, join(a:output, '\n')), ' ') . ' ' + endif + + if l:cflags is# ' ' + let l:cflags = ale#c#IncludeOptions(ale#c#FindLocalHeaderPaths(a:buffer)) + endif + + return l:cflags +endfunction + +function! ale#c#GetMakeCommand(buffer) abort + if g:ale_c_parse_makefile + let l:makefile_path = ale#path#FindNearestFile(a:buffer, 'Makefile') + if !empty(l:makefile_path) + return 'cd '. fnamemodify(l:makefile_path, ':p:h') . ' && make -n' + endif + endif + + return '' +endfunction + +" Given a buffer number, search for a project root, and output a List +" of directories to include based on some heuristics. +" +" For projects with headers in the project root, the project root will +" be returned. +" +" For projects with an 'include' directory, that directory will be returned. +function! ale#c#FindLocalHeaderPaths(buffer) abort + let l:project_root = ale#c#FindProjectRoot(a:buffer) + + if empty(l:project_root) + return [] + endif + + " See if we can find .h files directory in the project root. + " If we can, that's our include directory. + if !empty(globpath(l:project_root, '*.h', 0)) + return [l:project_root] + endif + + " Look for .hpp files too. + if !empty(globpath(l:project_root, '*.hpp', 0)) + return [l:project_root] + endif + + " If we find an 'include' directory in the project root, then use that. + if isdirectory(l:project_root . '/include') + return [ale#path#Simplify(l:project_root . s:sep . 'include')] + endif + + return [] +endfunction + +" Given a List of include paths, create a string containing the -I include +" options for those paths, with the paths escaped for use in the shell. +function! ale#c#IncludeOptions(include_paths) abort + let l:option_list = [] + + for l:path in a:include_paths + call add(l:option_list, '-I' . ale#Escape(l:path)) + endfor + + if empty(l:option_list) + return '' + endif + + return ' ' . join(l:option_list) . ' ' +endfunction + +let g:ale_c_build_dir_names = get(g:, 'ale_c_build_dir_names', [ +\ 'build', +\ 'bin', +\]) + +" Given a buffer number, find the build subdirectory with compile commands +" The subdirectory is returned without the trailing / +function! ale#c#FindCompileCommands(buffer) abort + for l:path in ale#path#Upwards(expand('#' . a:buffer . ':p:h')) + for l:dirname in ale#Var(a:buffer, 'c_build_dir_names') + let l:c_build_dir = l:path . s:sep . l:dirname + + if filereadable(l:c_build_dir . '/compile_commands.json') + return l:c_build_dir + endif + endfor + endfor + + return '' +endfunction diff --git a/sources_non_forked/ale/autoload/ale/command.vim b/sources_non_forked/ale/autoload/ale/command.vim new file mode 100644 index 00000000..558fe233 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/command.vim @@ -0,0 +1,57 @@ +" Author: w0rp +" Description: Special command formatting for creating temporary files and +" passing buffer filenames easily. + +function! s:TemporaryFilename(buffer) abort + let l:filename = fnamemodify(bufname(a:buffer), ':t') + + if empty(l:filename) + " If the buffer's filename is empty, create a dummy filename. + let l:ft = getbufvar(a:buffer, '&filetype') + let l:filename = 'file' . ale#filetypes#GuessExtension(l:ft) + endif + + " Create a temporary filename, / + " The file itself will not be created by this function. + return tempname() . (has('win32') ? '\' : '/') . l:filename +endfunction + +" Given a command string, replace every... +" %s -> with the current filename +" %t -> with the name of an unused file in a temporary directory +" %% -> with a literal % +function! ale#command#FormatCommand(buffer, command, pipe_file_if_needed) abort + let l:temporary_file = '' + let l:command = a:command + + " First replace all uses of %%, used for literal percent characters, + " with an ugly string. + let l:command = substitute(l:command, '%%', '<>', 'g') + + " Replace all %s occurrences in the string with the name of the current + " file. + if l:command =~# '%s' + let l:filename = fnamemodify(bufname(a:buffer), ':p') + let l:command = substitute(l:command, '%s', '\=ale#Escape(l:filename)', 'g') + endif + + if l:command =~# '%t' + " Create a temporary filename, / + " The file itself will not be created by this function. + let l:temporary_file = s:TemporaryFilename(a:buffer) + let l:command = substitute(l:command, '%t', '\=ale#Escape(l:temporary_file)', 'g') + endif + + " Finish formatting so %% becomes %. + let l:command = substitute(l:command, '<>', '%', 'g') + + if a:pipe_file_if_needed && empty(l:temporary_file) + " If we are to send the Vim buffer to a command, we'll do it + " in the shell. We'll write out the file to a temporary file, + " and then read it back in, in the shell. + let l:temporary_file = s:TemporaryFilename(a:buffer) + let l:command = l:command . ' < ' . ale#Escape(l:temporary_file) + endif + + return [l:temporary_file, l:command] +endfunction diff --git a/sources_non_forked/ale/autoload/ale/completion.vim b/sources_non_forked/ale/autoload/ale/completion.vim new file mode 100644 index 00000000..7ad7f9da --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/completion.vim @@ -0,0 +1,477 @@ +" Author: w0rp +" Description: Completion support for LSP linters + +let s:timer_id = -1 +let s:last_done_pos = [] + +" CompletionItemKind values from the LSP protocol. +let s:LSP_COMPLETION_TEXT_KIND = 1 +let s:LSP_COMPLETION_METHOD_KIND = 2 +let s:LSP_COMPLETION_FUNCTION_KIND = 3 +let s:LSP_COMPLETION_CONSTRUCTOR_KIND = 4 +let s:LSP_COMPLETION_FIELD_KIND = 5 +let s:LSP_COMPLETION_VARIABLE_KIND = 6 +let s:LSP_COMPLETION_CLASS_KIND = 7 +let s:LSP_COMPLETION_INTERFACE_KIND = 8 +let s:LSP_COMPLETION_MODULE_KIND = 9 +let s:LSP_COMPLETION_PROPERTY_KIND = 10 +let s:LSP_COMPLETION_UNIT_KIND = 11 +let s:LSP_COMPLETION_VALUE_KIND = 12 +let s:LSP_COMPLETION_ENUM_KIND = 13 +let s:LSP_COMPLETION_KEYWORD_KIND = 14 +let s:LSP_COMPLETION_SNIPPET_KIND = 15 +let s:LSP_COMPLETION_COLOR_KIND = 16 +let s:LSP_COMPLETION_FILE_KIND = 17 +let s:LSP_COMPLETION_REFERENCE_KIND = 18 + +" Regular expressions for checking the characters in the line before where +" the insert cursor is. If one of these matches, we'll check for completions. +let s:should_complete_map = { +\ '': '\v[a-zA-Z$_][a-zA-Z$_0-9]*$|\.$', +\} + +" Regular expressions for finding the start column to replace with completion. +let s:omni_start_map = { +\ '': '\v[a-zA-Z$_][a-zA-Z$_0-9]*$', +\} + +" A map of exact characters for triggering LSP completions. +let s:trigger_character_map = { +\ '': ['.'], +\} + +function! s:GetFiletypeValue(map, filetype) abort + for l:part in reverse(split(a:filetype, '\.')) + let l:regex = get(a:map, l:part, []) + + if !empty(l:regex) + return l:regex + endif + endfor + + " Use the default regex for other files. + return a:map[''] +endfunction + +" Check if we should look for completions for a language. +function! ale#completion#GetPrefix(filetype, line, column) abort + let l:regex = s:GetFiletypeValue(s:should_complete_map, a:filetype) + " The column we're using completions for is where we are inserting text, + " like so: + " abc + " ^ + " So we need check the text in the column before that position. + return matchstr(getline(a:line)[: a:column - 2], l:regex) +endfunction + +function! ale#completion#GetTriggerCharacter(filetype, prefix) abort + let l:char_list = s:GetFiletypeValue(s:trigger_character_map, a:filetype) + + if index(l:char_list, a:prefix) >= 0 + return a:prefix + endif + + return '' +endfunction + +function! ale#completion#Filter(suggestions, prefix) abort + " For completing... + " foo. + " ^ + " We need to include all of the given suggestions. + if a:prefix is# '.' + return a:suggestions + endif + + let l:filtered_suggestions = [] + + " Filter suggestions down to those starting with the prefix we used for + " finding suggestions in the first place. + " + " Some completion tools will include suggestions which don't even start + " with the characters we have already typed. + for l:item in a:suggestions + " A List of String values or a List of completion item Dictionaries + " is accepted here. + let l:word = type(l:item) == type('') ? l:item : l:item.word + + " Add suggestions if the suggestion starts with a case-insensitive + " match for the prefix. + if l:word[: len(a:prefix) - 1] is? a:prefix + call add(l:filtered_suggestions, l:item) + endif + endfor + + return l:filtered_suggestions +endfunction + +function! s:ReplaceCompleteopt() abort + if !exists('b:ale_old_completopt') + let b:ale_old_completopt = &l:completeopt + endif + + let &l:completeopt = 'menu,menuone,preview,noselect,noinsert' +endfunction + +function! ale#completion#OmniFunc(findstart, base) abort + if a:findstart + let l:line = b:ale_completion_info.line + let l:column = b:ale_completion_info.column + let l:regex = s:GetFiletypeValue(s:omni_start_map, &filetype) + let l:up_to_column = getline(l:line)[: l:column - 2] + let l:match = matchstr(l:up_to_column, l:regex) + + return l:column - len(l:match) - 1 + else + " Parse a new response if there is one. + if exists('b:ale_completion_response') + \&& exists('b:ale_completion_parser') + let l:response = b:ale_completion_response + let l:parser = b:ale_completion_parser + + unlet b:ale_completion_response + unlet b:ale_completion_parser + + let b:ale_completion_result = function(l:parser)(l:response) + endif + + call s:ReplaceCompleteopt() + + return get(b:, 'ale_completion_result', []) + endif +endfunction + +function! ale#completion#Show(response, completion_parser) abort + " Remember the old omnifunc value, if there is one. + " If we don't store an old one, we'll just never reset the option. + " This will stop some random exceptions from appearing. + if !exists('b:ale_old_omnifunc') && !empty(&l:omnifunc) + let b:ale_old_omnifunc = &l:omnifunc + endif + + " Set the list in the buffer, temporarily replace omnifunc with our + " function, and then start omni-completion. + let b:ale_completion_response = a:response + let b:ale_completion_parser = a:completion_parser + let &l:omnifunc = 'ale#completion#OmniFunc' + call s:ReplaceCompleteopt() + call ale#util#FeedKeys("\\", 'n') +endfunction + +function! s:CompletionStillValid(request_id) abort + let [l:line, l:column] = getcurpos()[1:2] + + return has_key(b:, 'ale_completion_info') + \&& b:ale_completion_info.request_id == a:request_id + \&& b:ale_completion_info.line == l:line + \&& b:ale_completion_info.column == l:column +endfunction + +function! ale#completion#ParseTSServerCompletions(response) abort + let l:names = [] + + for l:suggestion in a:response.body + call add(l:names, l:suggestion.name) + endfor + + return l:names +endfunction + +function! ale#completion#ParseTSServerCompletionEntryDetails(response) abort + let l:results = [] + + for l:suggestion in a:response.body + let l:displayParts = [] + + for l:part in l:suggestion.displayParts + call add(l:displayParts, l:part.text) + endfor + + " Each one of these parts has 'kind' properties + let l:documentationParts = [] + + for l:part in get(l:suggestion, 'documentation', []) + call add(l:documentationParts, l:part.text) + endfor + + if l:suggestion.kind is# 'clasName' + let l:kind = 'f' + elseif l:suggestion.kind is# 'parameterName' + let l:kind = 'f' + else + let l:kind = 'v' + endif + + " See :help complete-items + call add(l:results, { + \ 'word': l:suggestion.name, + \ 'kind': l:kind, + \ 'icase': 1, + \ 'menu': join(l:displayParts, ''), + \ 'info': join(l:documentationParts, ''), + \}) + endfor + + return l:results +endfunction + +function! ale#completion#ParseLSPCompletions(response) abort + let l:item_list = [] + + if type(get(a:response, 'result')) is type([]) + let l:item_list = a:response.result + elseif type(get(a:response, 'result')) is type({}) + \&& type(get(a:response.result, 'items')) is type([]) + let l:item_list = a:response.result.items + endif + + let l:results = [] + + for l:item in l:item_list + " See :help complete-items for Vim completion kinds + if l:item.kind is s:LSP_COMPLETION_METHOD_KIND + let l:kind = 'm' + elseif l:item.kind is s:LSP_COMPLETION_CONSTRUCTOR_KIND + let l:kind = 'm' + elseif l:item.kind is s:LSP_COMPLETION_FUNCTION_KIND + let l:kind = 'f' + elseif l:item.kind is s:LSP_COMPLETION_CLASS_KIND + let l:kind = 'f' + elseif l:item.kind is s:LSP_COMPLETION_INTERFACE_KIND + let l:kind = 'f' + else + let l:kind = 'v' + endif + + call add(l:results, { + \ 'word': l:item.label, + \ 'kind': l:kind, + \ 'icase': 1, + \ 'menu': l:item.detail, + \ 'info': l:item.documentation, + \}) + endfor + + return l:results +endfunction + +function! ale#completion#HandleTSServerResponse(conn_id, response) abort + if !s:CompletionStillValid(get(a:response, 'request_seq')) + return + endif + + if !has_key(a:response, 'body') + return + endif + + let l:command = get(a:response, 'command', '') + + if l:command is# 'completions' + let l:names = ale#completion#Filter( + \ ale#completion#ParseTSServerCompletions(a:response), + \ b:ale_completion_info.prefix, + \)[: g:ale_completion_max_suggestions - 1] + + if !empty(l:names) + let b:ale_completion_info.request_id = ale#lsp#Send( + \ b:ale_completion_info.conn_id, + \ ale#lsp#tsserver_message#CompletionEntryDetails( + \ bufnr(''), + \ b:ale_completion_info.line, + \ b:ale_completion_info.column, + \ l:names, + \ ), + \) + endif + elseif l:command is# 'completionEntryDetails' + call ale#completion#Show( + \ a:response, + \ 'ale#completion#ParseTSServerCompletionEntryDetails', + \) + endif +endfunction + + +function! ale#completion#HandleLSPResponse(conn_id, response) abort + if !s:CompletionStillValid(get(a:response, 'id')) + return + endif + + call ale#completion#Show( + \ a:response, + \ 'ale#completion#ParseLSPCompletions', + \) +endfunction + +function! s:GetLSPCompletions(linter) abort + let l:buffer = bufnr('') + let l:Callback = a:linter.lsp is# 'tsserver' + \ ? function('ale#completion#HandleTSServerResponse') + \ : function('ale#completion#HandleLSPResponse') + + let l:lsp_details = ale#linter#StartLSP(l:buffer, a:linter, l:Callback) + + if empty(l:lsp_details) + return 0 + endif + + let l:id = l:lsp_details.connection_id + let l:root = l:lsp_details.project_root + + if a:linter.lsp is# 'tsserver' + let l:message = ale#lsp#tsserver_message#Completions( + \ l:buffer, + \ b:ale_completion_info.line, + \ b:ale_completion_info.column, + \ b:ale_completion_info.prefix, + \) + else + " Send a message saying the buffer has changed first, otherwise + " completions won't know what text is nearby. + call ale#lsp#Send(l:id, ale#lsp#message#DidChange(l:buffer), l:root) + + " For LSP completions, we need to clamp the column to the length of + " the line. python-language-server and perhaps others do not implement + " this correctly. + let l:message = ale#lsp#message#Completion( + \ l:buffer, + \ b:ale_completion_info.line, + \ min([ + \ b:ale_completion_info.line_length, + \ b:ale_completion_info.column, + \ ]), + \ ale#completion#GetTriggerCharacter(&filetype, b:ale_completion_info.prefix), + \) + endif + + let l:request_id = ale#lsp#Send(l:id, l:message, l:root) + + if l:request_id + let b:ale_completion_info.conn_id = l:id + let b:ale_completion_info.request_id = l:request_id + endif +endfunction + +function! ale#completion#GetCompletions() abort + if !g:ale_completion_enabled + return + endif + + let [l:line, l:column] = getcurpos()[1:2] + + let l:prefix = ale#completion#GetPrefix(&filetype, l:line, l:column) + + if empty(l:prefix) + return + endif + + let l:line_length = len(getline('.')) + + let b:ale_completion_info = { + \ 'line': l:line, + \ 'line_length': l:line_length, + \ 'column': l:column, + \ 'prefix': l:prefix, + \ 'conn_id': 0, + \ 'request_id': 0, + \} + + for l:linter in ale#linter#Get(&filetype) + if !empty(l:linter.lsp) + if l:linter.lsp is# 'tsserver' + \|| get(g:, 'ale_completion_experimental_lsp_support', 0) + call s:GetLSPCompletions(l:linter) + endif + endif + endfor +endfunction + +function! s:TimerHandler(...) abort + let s:timer_id = -1 + + let [l:line, l:column] = getcurpos()[1:2] + + " When running the timer callback, we have to be sure that the cursor + " hasn't moved from where it was when we requested completions by typing. + if s:timer_pos == [l:line, l:column] + call ale#completion#GetCompletions() + endif +endfunction + +" Stop any completion timer that is queued. This is useful for tests. +function! ale#completion#StopTimer() abort + if s:timer_id != -1 + call timer_stop(s:timer_id) + endif + + let s:timer_id = -1 +endfunction + +function! ale#completion#Queue() abort + if !g:ale_completion_enabled + return + endif + + let s:timer_pos = getcurpos()[1:2] + + if s:timer_pos == s:last_done_pos + " Do not ask for completions if the cursor rests on the position we + " last completed on. + return + endif + + " If we changed the text again while we're still waiting for a response, + " then invalidate the requests before the timer ticks again. + if exists('b:ale_completion_info') + let b:ale_completion_info.request_id = 0 + endif + + call ale#completion#StopTimer() + + let s:timer_id = timer_start(g:ale_completion_delay, function('s:TimerHandler')) +endfunction + +function! ale#completion#Done() abort + silent! pclose + + " Reset settings when completion is done. + if exists('b:ale_old_omnifunc') + if b:ale_old_omnifunc isnot# 'pythoncomplete#Complete' + let &l:omnifunc = b:ale_old_omnifunc + endif + + unlet b:ale_old_omnifunc + endif + + if exists('b:ale_old_completopt') + let &l:completeopt = b:ale_old_completopt + unlet b:ale_old_completopt + endif + + let s:last_done_pos = getcurpos()[1:2] +endfunction + +function! s:Setup(enabled) abort + augroup ALECompletionGroup + autocmd! + + if a:enabled + autocmd TextChangedI * call ale#completion#Queue() + autocmd CompleteDone * call ale#completion#Done() + endif + augroup END + + if !a:enabled + augroup! ALECompletionGroup + endif +endfunction + +function! ale#completion#Enable() abort + let g:ale_completion_enabled = 1 + call s:Setup(1) +endfunction + +function! ale#completion#Disable() abort + let g:ale_completion_enabled = 0 + call s:Setup(0) +endfunction diff --git a/sources_non_forked/ale/autoload/ale/cursor.vim b/sources_non_forked/ale/autoload/ale/cursor.vim new file mode 100644 index 00000000..50b1fb50 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/cursor.vim @@ -0,0 +1,136 @@ +" Author: w0rp +" Description: Echoes lint message for the current line, if any + +let s:cursor_timer = -1 +let s:last_pos = [0, 0, 0] + +function! ale#cursor#TruncatedEcho(original_message) abort + let l:message = a:original_message + " Change tabs to spaces. + let l:message = substitute(l:message, "\t", ' ', 'g') + " Remove any newlines in the message. + let l:message = substitute(l:message, "\n", '', 'g') + + " We need to remember the setting for shortmess and reset it again. + let l:shortmess_options = &l:shortmess + + try + let l:cursor_position = getcurpos() + + " The message is truncated and saved to the history. + setlocal shortmess+=T + exec "norm! :echomsg l:message\n" + + " Reset the cursor position if we moved off the end of the line. + " Using :norm and :echomsg can move the cursor off the end of the + " line. + if l:cursor_position != getcurpos() + call setpos('.', l:cursor_position) + endif + finally + let &l:shortmess = l:shortmess_options + endtry +endfunction + +function! s:FindItemAtCursor() abort + let l:buf = bufnr('') + let l:info = get(g:ale_buffer_info, l:buf, {}) + let l:loclist = get(l:info, 'loclist', []) + let l:pos = getcurpos() + let l:index = ale#util#BinarySearch(l:loclist, l:buf, l:pos[1], l:pos[2]) + let l:loc = l:index >= 0 ? l:loclist[l:index] : {} + + return [l:info, l:loc] +endfunction + +function! s:StopCursorTimer() abort + if s:cursor_timer != -1 + call timer_stop(s:cursor_timer) + let s:cursor_timer = -1 + endif +endfunction + +function! ale#cursor#EchoCursorWarning(...) abort + return ale#CallWithCooldown('dont_echo_until', function('s:EchoImpl'), []) +endfunction + +function! s:EchoImpl() abort + if !g:ale_echo_cursor + return + endif + + " Only echo the warnings in normal mode, otherwise we will get problems. + if mode() isnot# 'n' + return + endif + + if ale#ShouldDoNothing(bufnr('')) + return + endif + + let l:buffer = bufnr('') + let [l:info, l:loc] = s:FindItemAtCursor() + + if !empty(l:loc) + let l:format = ale#Var(l:buffer, 'echo_msg_format') + let l:msg = ale#GetLocItemMessage(l:loc, l:format) + call ale#cursor#TruncatedEcho(l:msg) + let l:info.echoed = 1 + elseif get(l:info, 'echoed') + " We'll only clear the echoed message when moving off errors once, + " so we don't continually clear the echo line. + execute 'echo' + let l:info.echoed = 0 + endif +endfunction + +function! ale#cursor#EchoCursorWarningWithDelay() abort + if !g:ale_echo_cursor + return + endif + + " Only echo the warnings in normal mode, otherwise we will get problems. + if mode() isnot# 'n' + return + endif + + call s:StopCursorTimer() + + let l:pos = getcurpos()[0:2] + + " Check the current buffer, line, and column number against the last + " recorded position. If the position has actually changed, *then* + " we should echo something. Otherwise we can end up doing processing + " the echo message far too frequently. + if l:pos != s:last_pos + let l:delay = ale#Var(bufnr(''), 'echo_delay') + + let s:last_pos = l:pos + let s:cursor_timer = timer_start( + \ l:delay, + \ function('ale#cursor#EchoCursorWarning') + \) + endif +endfunction + +function! ale#cursor#ShowCursorDetail() abort + " Only echo the warnings in normal mode, otherwise we will get problems. + if mode() isnot# 'n' + return + endif + + if ale#ShouldDoNothing(bufnr('')) + return + endif + + call s:StopCursorTimer() + + let [l:info, l:loc] = s:FindItemAtCursor() + + if !empty(l:loc) + let l:message = get(l:loc, 'detail', l:loc.text) + + call ale#preview#Show(split(l:message, "\n")) + execute 'echo' + endif +endfunction diff --git a/sources_non_forked/ale/autoload/ale/debugging.vim b/sources_non_forked/ale/autoload/ale/debugging.vim new file mode 100644 index 00000000..cb93ec16 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/debugging.vim @@ -0,0 +1,213 @@ +" Author: w0rp +" Description: This file implements debugging information for ALE + +let s:global_variable_list = [ +\ 'ale_cache_executable_check_failures', +\ 'ale_change_sign_column_color', +\ 'ale_command_wrapper', +\ 'ale_completion_delay', +\ 'ale_completion_enabled', +\ 'ale_completion_max_suggestions', +\ 'ale_echo_cursor', +\ 'ale_echo_msg_error_str', +\ 'ale_echo_msg_format', +\ 'ale_echo_msg_info_str', +\ 'ale_echo_msg_warning_str', +\ 'ale_enabled', +\ 'ale_fix_on_save', +\ 'ale_fixers', +\ 'ale_history_enabled', +\ 'ale_history_log_output', +\ 'ale_keep_list_window_open', +\ 'ale_lint_delay', +\ 'ale_lint_on_enter', +\ 'ale_lint_on_filetype_changed', +\ 'ale_lint_on_save', +\ 'ale_lint_on_text_changed', +\ 'ale_lint_on_insert_leave', +\ 'ale_linter_aliases', +\ 'ale_linters', +\ 'ale_linters_explicit', +\ 'ale_list_window_size', +\ 'ale_list_vertical', +\ 'ale_loclist_msg_format', +\ 'ale_max_buffer_history_size', +\ 'ale_max_signs', +\ 'ale_maximum_file_size', +\ 'ale_open_list', +\ 'ale_pattern_options', +\ 'ale_pattern_options_enabled', +\ 'ale_set_balloons', +\ 'ale_set_highlights', +\ 'ale_set_loclist', +\ 'ale_set_quickfix', +\ 'ale_set_signs', +\ 'ale_sign_column_always', +\ 'ale_sign_error', +\ 'ale_sign_info', +\ 'ale_sign_offset', +\ 'ale_sign_style_error', +\ 'ale_sign_style_warning', +\ 'ale_sign_warning', +\ 'ale_statusline_format', +\ 'ale_type_map', +\ 'ale_warn_about_trailing_blank_lines', +\ 'ale_warn_about_trailing_whitespace', +\] + +function! s:Echo(message) abort + execute 'echo a:message' +endfunction + +function! s:GetLinterVariables(filetype, linter_names) abort + let l:variable_list = [] + let l:filetype_parts = split(a:filetype, '\.') + + for l:key in keys(g:) + " Extract variable names like: 'ale_python_flake8_executable' + let l:match = matchlist(l:key, '\v^ale_([^_]+)_([^_]+)_.+$') + + " Include matching variables. + if !empty(l:match) + \&& index(l:filetype_parts, l:match[1]) >= 0 + \&& index(a:linter_names, l:match[2]) >= 0 + call add(l:variable_list, l:key) + endif + endfor + + call sort(l:variable_list) + + return l:variable_list +endfunction + +function! s:EchoLinterVariables(variable_list) abort + for l:key in a:variable_list + call s:Echo('let g:' . l:key . ' = ' . string(g:[l:key])) + + if has_key(b:, l:key) + call s:Echo('let b:' . l:key . ' = ' . string(b:[l:key])) + endif + endfor +endfunction + +function! s:EchoGlobalVariables() abort + for l:key in s:global_variable_list + call s:Echo('let g:' . l:key . ' = ' . string(get(g:, l:key, v:null))) + + if has_key(b:, l:key) + call s:Echo('let b:' . l:key . ' = ' . string(b:[l:key])) + endif + endfor +endfunction + +" Echo a command that was run. +function! s:EchoCommand(item) abort + let l:status_message = a:item.status + + " Include the exit code in output if we have it. + if a:item.status is# 'finished' + let l:status_message .= ' - exit code ' . a:item.exit_code + endif + + call s:Echo('(' . l:status_message . ') ' . string(a:item.command)) + + if g:ale_history_log_output && has_key(a:item, 'output') + if empty(a:item.output) + call s:Echo('') + call s:Echo('<<>>') + call s:Echo('') + else + call s:Echo('') + call s:Echo('<<>>') + + for l:line in a:item.output + call s:Echo(l:line) + endfor + + call s:Echo('<<>>') + call s:Echo('') + endif + endif +endfunction + +" Echo the results of an executable check. +function! s:EchoExecutable(item) abort + call s:Echo(printf( + \ '(executable check - %s) %s', + \ a:item.status ? 'success' : 'failure', + \ a:item.command, + \)) +endfunction + +function! s:EchoCommandHistory() abort + let l:buffer = bufnr('%') + + for l:item in ale#history#Get(l:buffer) + if l:item.job_id is# 'executable' + call s:EchoExecutable(l:item) + else + call s:EchoCommand(l:item) + endif + endfor +endfunction + +function! s:EchoLinterAliases(all_linters) abort + let l:first = 1 + + for l:linter in a:all_linters + if !empty(l:linter.aliases) + if l:first + call s:Echo(' Linter Aliases:') + endif + + let l:first = 0 + + call s:Echo(string(l:linter.name) . ' -> ' . string(l:linter.aliases)) + endif + endfor +endfunction + +function! ale#debugging#Info() abort + let l:filetype = &filetype + + " We get the list of enabled linters for free by the above function. + let l:enabled_linters = deepcopy(ale#linter#Get(l:filetype)) + + " But have to build the list of available linters ourselves. + let l:all_linters = [] + let l:linter_variable_list = [] + + for l:part in split(l:filetype, '\.') + let l:aliased_filetype = ale#linter#ResolveFiletype(l:part) + call extend(l:all_linters, ale#linter#GetAll(l:aliased_filetype)) + endfor + + let l:all_names = map(copy(l:all_linters), 'v:val[''name'']') + let l:enabled_names = map(copy(l:enabled_linters), 'v:val[''name'']') + + " Load linter variables to display + " This must be done after linters are loaded. + let l:variable_list = s:GetLinterVariables(l:filetype, l:enabled_names) + + call s:Echo(' Current Filetype: ' . l:filetype) + call s:Echo('Available Linters: ' . string(l:all_names)) + call s:EchoLinterAliases(l:all_linters) + call s:Echo(' Enabled Linters: ' . string(l:enabled_names)) + call s:Echo(' Linter Variables:') + call s:Echo('') + call s:EchoLinterVariables(l:variable_list) + call s:Echo(' Global Variables:') + call s:Echo('') + call s:EchoGlobalVariables() + call s:Echo(' Command History:') + call s:Echo('') + call s:EchoCommandHistory() +endfunction + +function! ale#debugging#InfoToClipboard() abort + redir @+> + silent call ale#debugging#Info() + redir END + + call s:Echo('ALEInfo copied to your clipboard') +endfunction diff --git a/sources_non_forked/ale/autoload/ale/definition.vim b/sources_non_forked/ale/autoload/ale/definition.vim new file mode 100644 index 00000000..521cd0b1 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/definition.vim @@ -0,0 +1,125 @@ +" Author: w0rp +" Description: Go to definition support for LSP linters. + +let s:go_to_definition_map = {} + +" Used to get the definition map in tests. +function! ale#definition#GetMap() abort + return deepcopy(s:go_to_definition_map) +endfunction + +" Used to set the definition map in tests. +function! ale#definition#SetMap(map) abort + let s:go_to_definition_map = a:map +endfunction + +" This function is used so we can check the execution of commands without +" running them. +function! ale#definition#Execute(expr) abort + execute a:expr +endfunction + +function! ale#definition#ClearLSPData() abort + let s:go_to_definition_map = {} +endfunction + +function! ale#definition#Open(options, filename, line, column) abort + if a:options.open_in_tab + call ale#definition#Execute('tabedit ' . fnameescape(a:filename)) + else + call ale#definition#Execute('edit ' . fnameescape(a:filename)) + endif + + call cursor(a:line, a:column) +endfunction + +function! ale#definition#HandleTSServerResponse(conn_id, response) abort + if get(a:response, 'command', '') is# 'definition' + \&& has_key(s:go_to_definition_map, a:response.request_seq) + let l:options = remove(s:go_to_definition_map, a:response.request_seq) + + if get(a:response, 'success', v:false) is v:true + let l:filename = a:response.body[0].file + let l:line = a:response.body[0].start.line + let l:column = a:response.body[0].start.offset + + call ale#definition#Open(l:options, l:filename, l:line, l:column) + endif + endif +endfunction + +function! ale#definition#HandleLSPResponse(conn_id, response) abort + if has_key(a:response, 'id') + \&& has_key(s:go_to_definition_map, a:response.id) + let l:options = remove(s:go_to_definition_map, a:response.id) + + " The result can be a Dictionary item, a List of the same, or null. + let l:result = get(a:response, 'result', v:null) + + if type(l:result) is type({}) + let l:result = [l:result] + elseif type(l:result) isnot type([]) + let l:result = [] + endif + + for l:item in l:result + let l:filename = ale#path#FromURI(l:item.uri) + let l:line = l:item.range.start.line + 1 + let l:column = l:item.range.start.character + + call ale#definition#Open(l:options, l:filename, l:line, l:column) + break + endfor + endif +endfunction + +function! s:GoToLSPDefinition(linter, options) abort + let l:buffer = bufnr('') + let [l:line, l:column] = getcurpos()[1:2] + + let l:Callback = a:linter.lsp is# 'tsserver' + \ ? function('ale#definition#HandleTSServerResponse') + \ : function('ale#definition#HandleLSPResponse') + + let l:lsp_details = ale#linter#StartLSP(l:buffer, a:linter, l:Callback) + + if empty(l:lsp_details) + return 0 + endif + + let l:id = l:lsp_details.connection_id + let l:root = l:lsp_details.project_root + + if a:linter.lsp is# 'tsserver' + let l:message = ale#lsp#tsserver_message#Definition( + \ l:buffer, + \ l:line, + \ l:column + \) + else + " Send a message saying the buffer has changed first, or the + " definition position probably won't make sense. + call ale#lsp#Send(l:id, ale#lsp#message#DidChange(l:buffer), l:root) + + let l:column = min([l:column, len(getline(l:line))]) + + " For LSP completions, we need to clamp the column to the length of + " the line. python-language-server and perhaps others do not implement + " this correctly. + let l:message = ale#lsp#message#Definition(l:buffer, l:line, l:column) + endif + + let l:request_id = ale#lsp#Send(l:id, l:message, l:root) + + let s:go_to_definition_map[l:request_id] = { + \ 'open_in_tab': get(a:options, 'open_in_tab', 0), + \} +endfunction + +function! ale#definition#GoTo(options) abort + for l:linter in ale#linter#Get(&filetype) + if !empty(l:linter.lsp) + call s:GoToLSPDefinition(l:linter, a:options) + endif + endfor +endfunction diff --git a/sources_non_forked/ale/autoload/ale/engine.vim b/sources_non_forked/ale/autoload/ale/engine.vim new file mode 100644 index 00000000..dd871c36 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/engine.vim @@ -0,0 +1,950 @@ +" Author: w0rp +" Description: Backend execution and job management +" Executes linters in the background, using NeoVim or Vim 8 jobs + +" Stores information for each job including: +" +" linter: The linter dictionary for the job. +" buffer: The buffer number for the job. +" output: The array of lines for the output of the job. +if !has_key(s:, 'job_info_map') + let s:job_info_map = {} +endif + +" Associates LSP connection IDs with linter names. +if !has_key(s:, 'lsp_linter_map') + let s:lsp_linter_map = {} +endif + +if !has_key(s:, 'executable_cache_map') + let s:executable_cache_map = {} +endif + +function! ale#engine#ResetExecutableCache() abort + let s:executable_cache_map = {} +endfunction + +" Check if files are executable, and if they are, remember that they are +" for subsequent calls. We'll keep checking until programs can be executed. +function! ale#engine#IsExecutable(buffer, executable) abort + if empty(a:executable) + " Don't log the executable check if the executable string is empty. + return 0 + endif + + " Check for a cached executable() check. + let l:result = get(s:executable_cache_map, a:executable, v:null) + + if l:result isnot v:null + return l:result + endif + + " Check if the file is executable, and convert -1 to 1. + let l:result = executable(a:executable) isnot 0 + + " Cache the executable check if we found it, or if the option to cache + " failing checks is on. + if l:result || g:ale_cache_executable_check_failures + let s:executable_cache_map[a:executable] = l:result + endif + + if g:ale_history_enabled + call ale#history#Add(a:buffer, l:result, 'executable', a:executable) + endif + + return l:result +endfunction + +function! ale#engine#InitBufferInfo(buffer) abort + if !has_key(g:ale_buffer_info, a:buffer) + " job_list will hold the list of job IDs + " active_linter_list will hold the list of active linter names + " loclist holds the loclist items after all jobs have completed. + " temporary_file_list holds temporary files to be cleaned up + " temporary_directory_list holds temporary directories to be cleaned up + let g:ale_buffer_info[a:buffer] = { + \ 'job_list': [], + \ 'active_linter_list': [], + \ 'loclist': [], + \ 'temporary_file_list': [], + \ 'temporary_directory_list': [], + \} + + return 1 + endif + + return 0 +endfunction + +" Clear LSP linter data for the linting engine. +function! ale#engine#ClearLSPData() abort + let s:lsp_linter_map = {} +endfunction + +" This function is documented and part of the public API. +" +" Return 1 if ALE is busy checking a given buffer +function! ale#engine#IsCheckingBuffer(buffer) abort + let l:info = get(g:ale_buffer_info, a:buffer, {}) + + return !empty(get(l:info, 'active_linter_list', [])) +endfunction + +" Register a temporary file to be managed with the ALE engine for +" a current job run. +function! ale#engine#ManageFile(buffer, filename) abort + call add(g:ale_buffer_info[a:buffer].temporary_file_list, a:filename) +endfunction + +" Same as the above, but manage an entire directory. +function! ale#engine#ManageDirectory(buffer, directory) abort + call add(g:ale_buffer_info[a:buffer].temporary_directory_list, a:directory) +endfunction + +" Create a new temporary directory and manage it in one go. +function! ale#engine#CreateDirectory(buffer) abort + let l:temporary_directory = tempname() + " Create the temporary directory for the file, unreadable by 'other' + " users. + call mkdir(l:temporary_directory, '', 0750) + call ale#engine#ManageDirectory(a:buffer, l:temporary_directory) + + return l:temporary_directory +endfunction + +function! ale#engine#RemoveManagedFiles(buffer) abort + let l:info = get(g:ale_buffer_info, a:buffer, {}) + + " We can't delete anything in a sandbox, so wait until we escape from + " it to delete temporary files and directories. + if ale#util#InSandbox() + return + endif + + " Delete files with a call akin to a plan `rm` command. + if has_key(l:info, 'temporary_file_list') + for l:filename in l:info.temporary_file_list + call delete(l:filename) + endfor + + let l:info.temporary_file_list = [] + endif + + " Delete directories like `rm -rf`. + " Directories are handled differently from files, so paths that are + " intended to be single files can be set up for automatic deletion without + " accidentally deleting entire directories. + if has_key(l:info, 'temporary_directory_list') + for l:directory in l:info.temporary_directory_list + call delete(l:directory, 'rf') + endfor + + let l:info.temporary_directory_list = [] + endif +endfunction + +function! s:GatherOutput(job_id, line) abort + if has_key(s:job_info_map, a:job_id) + call add(s:job_info_map[a:job_id].output, a:line) + endif +endfunction + +function! ale#engine#HandleLoclist(linter_name, buffer, loclist) abort + let l:info = get(g:ale_buffer_info, a:buffer, {}) + + if empty(l:info) + return + endif + + " Remove this linter from the list of active linters. + " This may have already been done when the job exits. + call filter(l:info.active_linter_list, 'v:val isnot# a:linter_name') + + " Make some adjustments to the loclists to fix common problems, and also + " to set default values for loclist items. + let l:linter_loclist = ale#engine#FixLocList(a:buffer, a:linter_name, a:loclist) + + " Remove previous items for this linter. + call filter(l:info.loclist, 'v:val.linter_name isnot# a:linter_name') + + " We don't need to add items or sort the list when this list is empty. + if !empty(l:linter_loclist) + " Add the new items. + call extend(l:info.loclist, l:linter_loclist) + + " Sort the loclist again. + " We need a sorted list so we can run a binary search against it + " for efficient lookup of the messages in the cursor handler. + call sort(l:info.loclist, 'ale#util#LocItemCompare') + endif + + if ale#ShouldDoNothing(a:buffer) + return + endif + + call ale#engine#SetResults(a:buffer, l:info.loclist) +endfunction + +function! s:HandleExit(job_id, exit_code) abort + if !has_key(s:job_info_map, a:job_id) + return + endif + + let l:job_info = s:job_info_map[a:job_id] + let l:linter = l:job_info.linter + let l:output = l:job_info.output + let l:buffer = l:job_info.buffer + let l:next_chain_index = l:job_info.next_chain_index + + if g:ale_history_enabled + call ale#history#SetExitCode(l:buffer, a:job_id, a:exit_code) + endif + + " Remove this job from the list. + call ale#job#Stop(a:job_id) + call remove(s:job_info_map, a:job_id) + call filter(g:ale_buffer_info[l:buffer].job_list, 'v:val isnot# a:job_id') + call filter(g:ale_buffer_info[l:buffer].active_linter_list, 'v:val isnot# l:linter.name') + + " Stop here if we land in the handle for a job completing if we're in + " a sandbox. + if ale#util#InSandbox() + return + endif + + if has('nvim') && !empty(l:output) && empty(l:output[-1]) + call remove(l:output, -1) + endif + + if l:next_chain_index < len(get(l:linter, 'command_chain', [])) + call s:InvokeChain(l:buffer, l:linter, l:next_chain_index, l:output) + return + endif + + " Log the output of the command for ALEInfo if we should. + if g:ale_history_enabled && g:ale_history_log_output + call ale#history#RememberOutput(l:buffer, a:job_id, l:output[:]) + endif + + let l:loclist = ale#util#GetFunction(l:linter.callback)(l:buffer, l:output) + + call ale#engine#HandleLoclist(l:linter.name, l:buffer, l:loclist) +endfunction + +function! s:HandleLSPDiagnostics(conn_id, response) abort + let l:linter_name = s:lsp_linter_map[a:conn_id] + let l:filename = ale#path#FromURI(a:response.params.uri) + let l:buffer = bufnr(l:filename) + + if l:buffer <= 0 + return + endif + + let l:loclist = ale#lsp#response#ReadDiagnostics(a:response) + + call ale#engine#HandleLoclist(l:linter_name, l:buffer, l:loclist) +endfunction + +function! s:HandleTSServerDiagnostics(response, error_type) abort + let l:buffer = bufnr(a:response.body.file) + let l:info = get(g:ale_buffer_info, l:buffer, {}) + + if empty(l:info) + return + endif + + let l:thislist = ale#lsp#response#ReadTSServerDiagnostics(a:response) + + " tsserver sends syntax and semantic errors in separate messages, so we + " have to collect the messages separately for each buffer and join them + " back together again. + if a:error_type is# 'syntax' + let l:info.syntax_loclist = l:thislist + else + let l:info.semantic_loclist = l:thislist + endif + + let l:loclist = get(l:info, 'semantic_loclist', []) + \ + get(l:info, 'syntax_loclist', []) + + call ale#engine#HandleLoclist('tsserver', l:buffer, l:loclist) +endfunction + +function! s:HandleLSPErrorMessage(error_message) abort + execute 'echoerr ''Error from LSP:''' + + for l:line in split(a:error_message, "\n") + execute 'echoerr l:line' + endfor +endfunction + +function! ale#engine#HandleLSPResponse(conn_id, response) abort + let l:method = get(a:response, 'method', '') + + if get(a:response, 'jsonrpc', '') is# '2.0' && has_key(a:response, 'error') + " Uncomment this line to print LSP error messages. + " call s:HandleLSPErrorMessage(a:response.error.message) + elseif l:method is# 'textDocument/publishDiagnostics' + call s:HandleLSPDiagnostics(a:conn_id, a:response) + elseif get(a:response, 'type', '') is# 'event' + \&& get(a:response, 'event', '') is# 'semanticDiag' + call s:HandleTSServerDiagnostics(a:response, 'semantic') + elseif get(a:response, 'type', '') is# 'event' + \&& get(a:response, 'event', '') is# 'syntaxDiag' + call s:HandleTSServerDiagnostics(a:response, 'syntax') + endif +endfunction + +function! ale#engine#SetResults(buffer, loclist) abort + let l:linting_is_done = !ale#engine#IsCheckingBuffer(a:buffer) + + " Set signs first. This could potentially fix some line numbers. + " The List could be sorted again here by SetSigns. + if g:ale_set_signs + call ale#sign#SetSigns(a:buffer, a:loclist) + endif + + if g:ale_set_quickfix || g:ale_set_loclist + call ale#list#SetLists(a:buffer, a:loclist) + endif + + if exists('*ale#statusline#Update') + " Don't load/run if not already loaded. + call ale#statusline#Update(a:buffer, a:loclist) + endif + + if g:ale_set_highlights + call ale#highlight#SetHighlights(a:buffer, a:loclist) + endif + + if l:linting_is_done + if g:ale_echo_cursor + " Try and echo the warning now. + " This will only do something meaningful if we're in normal mode. + call ale#cursor#EchoCursorWarning() + endif + + " Reset the save event marker, used for opening windows, etc. + call setbufvar(a:buffer, 'ale_save_event_fired', 0) + " Set a marker showing how many times a buffer has been checked. + call setbufvar( + \ a:buffer, + \ 'ale_linted', + \ getbufvar(a:buffer, 'ale_linted', 0) + 1 + \) + + " Automatically remove all managed temporary files and directories + " now that all jobs have completed. + call ale#engine#RemoveManagedFiles(a:buffer) + + " Call user autocommands. This allows users to hook into ALE's lint cycle. + silent doautocmd User ALELintPost + " Old DEPRECATED name; call it for backwards compatibility. + silent doautocmd User ALELint + endif +endfunction + +function! s:RemapItemTypes(type_map, loclist) abort + for l:item in a:loclist + let l:key = l:item.type + \ . (get(l:item, 'sub_type', '') is# 'style' ? 'S' : '') + let l:new_key = get(a:type_map, l:key, '') + + if l:new_key is# 'E' + \|| l:new_key is# 'ES' + \|| l:new_key is# 'W' + \|| l:new_key is# 'WS' + \|| l:new_key is# 'I' + let l:item.type = l:new_key[0] + + if l:new_key is# 'ES' || l:new_key is# 'WS' + let l:item.sub_type = 'style' + elseif has_key(l:item, 'sub_type') + call remove(l:item, 'sub_type') + endif + endif + endfor +endfunction + +function! ale#engine#FixLocList(buffer, linter_name, loclist) abort + let l:bufnr_map = {} + let l:new_loclist = [] + + " Some errors have line numbers beyond the end of the file, + " so we need to adjust them so they set the error at the last line + " of the file instead. + let l:last_line_number = ale#util#GetLineCount(a:buffer) + + for l:old_item in a:loclist + " Copy the loclist item with some default values and corrections. + " + " line and column numbers will be converted to numbers. + " The buffer will default to the buffer being checked. + " The vcol setting will default to 0, a byte index. + " The error type will default to 'E' for errors. + " The error number will default to -1. + " + " The line number and text are the only required keys. + " + " The linter_name will be set on the errors so it can be used in + " output, filtering, etc.. + let l:item = { + \ 'bufnr': a:buffer, + \ 'text': l:old_item.text, + \ 'lnum': str2nr(l:old_item.lnum), + \ 'col': str2nr(get(l:old_item, 'col', 0)), + \ 'vcol': get(l:old_item, 'vcol', 0), + \ 'type': get(l:old_item, 'type', 'E'), + \ 'nr': get(l:old_item, 'nr', -1), + \ 'linter_name': a:linter_name, + \} + + if has_key(l:old_item, 'code') + let l:item.code = l:old_item.code + endif + + if has_key(l:old_item, 'filename') + \&& !ale#path#IsTempName(l:old_item.filename) + " Use the filename given. + " Temporary files are assumed to be for this buffer, + " and the filename is not included then, because it looks bad + " in the loclist window. + let l:filename = l:old_item.filename + let l:item.filename = l:filename + + if has_key(l:old_item, 'bufnr') + " If a buffer number is also given, include that too. + " If Vim detects that he buffer number is valid, it will + " be used instead of the filename. + let l:item.bufnr = l:old_item.bufnr + elseif has_key(l:bufnr_map, l:filename) + " Get the buffer number from the map, which can be faster. + let l:item.bufnr = l:bufnr_map[l:filename] + else + " Look up the buffer number. + let l:item.bufnr = bufnr(l:filename) + let l:bufnr_map[l:filename] = l:item.bufnr + endif + elseif has_key(l:old_item, 'bufnr') + let l:item.bufnr = l:old_item.bufnr + endif + + if has_key(l:old_item, 'detail') + let l:item.detail = l:old_item.detail + endif + + " Pass on a end_col key if set, used for highlights. + if has_key(l:old_item, 'end_col') + let l:item.end_col = str2nr(l:old_item.end_col) + endif + + if has_key(l:old_item, 'end_lnum') + let l:item.end_lnum = str2nr(l:old_item.end_lnum) + endif + + if has_key(l:old_item, 'sub_type') + let l:item.sub_type = l:old_item.sub_type + endif + + if l:item.lnum < 1 + " When errors appear before line 1, put them at line 1. + let l:item.lnum = 1 + elseif l:item.bufnr == a:buffer && l:item.lnum > l:last_line_number + " When errors go beyond the end of the file, put them at the end. + " This is only done for the current buffer. + let l:item.lnum = l:last_line_number + endif + + call add(l:new_loclist, l:item) + endfor + + let l:type_map = get(ale#Var(a:buffer, 'type_map'), a:linter_name, {}) + + if !empty(l:type_map) + call s:RemapItemTypes(l:type_map, l:new_loclist) + endif + + return l:new_loclist +endfunction + +" Given part of a command, replace any % with %%, so that no characters in +" the string will be replaced with filenames, etc. +function! ale#engine#EscapeCommandPart(command_part) abort + return substitute(a:command_part, '%', '%%', 'g') +endfunction + +function! s:CreateTemporaryFileForJob(buffer, temporary_file) abort + if empty(a:temporary_file) + " There is no file, so we didn't create anything. + return 0 + endif + + let l:temporary_directory = fnamemodify(a:temporary_file, ':h') + " Create the temporary directory for the file, unreadable by 'other' + " users. + call mkdir(l:temporary_directory, '', 0750) + " Automatically delete the directory later. + call ale#engine#ManageDirectory(a:buffer, l:temporary_directory) + " Write the buffer out to a file. + let l:lines = getbufline(a:buffer, 1, '$') + call ale#util#Writefile(a:buffer, l:lines, a:temporary_file) + + return 1 +endfunction + +" Run a job. +" +" Returns 1 when the job was started successfully. +function! s:RunJob(options) abort + let l:command = a:options.command + let l:buffer = a:options.buffer + let l:linter = a:options.linter + let l:output_stream = a:options.output_stream + let l:next_chain_index = a:options.next_chain_index + let l:read_buffer = a:options.read_buffer + let l:info = g:ale_buffer_info[l:buffer] + + if empty(l:command) + return 0 + endif + + let [l:temporary_file, l:command] = ale#command#FormatCommand(l:buffer, l:command, l:read_buffer) + + if s:CreateTemporaryFileForJob(l:buffer, l:temporary_file) + " If a temporary filename has been formatted in to the command, then + " we do not need to send the Vim buffer to the command. + let l:read_buffer = 0 + endif + + " Add a newline to commands which need it. + " This is only used for Flow for now, and is not documented. + if l:linter.add_newline + if has('win32') + let l:command = l:command . '; echo.' + else + let l:command = l:command . '; echo' + endif + endif + + let l:command = ale#job#PrepareCommand(l:buffer, l:command) + let l:job_options = { + \ 'mode': 'nl', + \ 'exit_cb': function('s:HandleExit'), + \} + + if l:output_stream is# 'stderr' + let l:job_options.err_cb = function('s:GatherOutput') + elseif l:output_stream is# 'both' + let l:job_options.out_cb = function('s:GatherOutput') + let l:job_options.err_cb = function('s:GatherOutput') + else + let l:job_options.out_cb = function('s:GatherOutput') + endif + + if get(g:, 'ale_run_synchronously') == 1 + " Find a unique Job value to use, which will be the same as the ID for + " running commands synchronously. This is only for test code. + let l:job_id = len(s:job_info_map) + 1 + + while has_key(s:job_info_map, l:job_id) + let l:job_id += 1 + endwhile + else + let l:job_id = ale#job#Start(l:command, l:job_options) + endif + + let l:status = 'failed' + + " Only proceed if the job is being run. + if l:job_id + " Add the job to the list of jobs, so we can track them. + call add(l:info.job_list, l:job_id) + + if index(l:info.active_linter_list, l:linter.name) < 0 + call add(l:info.active_linter_list, l:linter.name) + endif + + let l:status = 'started' + " Store the ID for the job in the map to read back again. + let s:job_info_map[l:job_id] = { + \ 'linter': l:linter, + \ 'buffer': l:buffer, + \ 'output': [], + \ 'next_chain_index': l:next_chain_index, + \} + endif + + if g:ale_history_enabled + call ale#history#Add(l:buffer, l:status, l:job_id, l:command) + endif + + if get(g:, 'ale_run_synchronously') == 1 + " Run a command synchronously if this test option is set. + let s:job_info_map[l:job_id].output = systemlist( + \ type(l:command) == type([]) + \ ? join(l:command[0:1]) . ' ' . ale#Escape(l:command[2]) + \ : l:command + \) + + call l:job_options.exit_cb(l:job_id, v:shell_error) + endif + + return l:job_id != 0 +endfunction + +" Determine which commands to run for a link in a command chain, or +" just a regular command. +function! ale#engine#ProcessChain(buffer, linter, chain_index, input) abort + let l:output_stream = get(a:linter, 'output_stream', 'stdout') + let l:read_buffer = a:linter.read_buffer + let l:chain_index = a:chain_index + let l:input = a:input + + if has_key(a:linter, 'command_chain') + while l:chain_index < len(a:linter.command_chain) + " Run a chain of commands, one asynchronous command after the other, + " so that many programs can be run in a sequence. + let l:chain_item = a:linter.command_chain[l:chain_index] + + if l:chain_index == 0 + " The first callback in the chain takes only a buffer number. + let l:command = ale#util#GetFunction(l:chain_item.callback)( + \ a:buffer + \) + else + " The second callback in the chain takes some input too. + let l:command = ale#util#GetFunction(l:chain_item.callback)( + \ a:buffer, + \ l:input + \) + endif + + if !empty(l:command) + " We hit a command to run, so we'll execute that + + " The chain item can override the output_stream option. + if has_key(l:chain_item, 'output_stream') + let l:output_stream = l:chain_item.output_stream + endif + + " The chain item can override the read_buffer option. + if has_key(l:chain_item, 'read_buffer') + let l:read_buffer = l:chain_item.read_buffer + elseif l:chain_index != len(a:linter.command_chain) - 1 + " Don't read the buffer for commands besides the last one + " in the chain by default. + let l:read_buffer = 0 + endif + + break + endif + + " Command chain items can return an empty string to indicate that + " a command should be skipped, so we should try the next item + " with no input. + let l:input = [] + let l:chain_index += 1 + endwhile + else + let l:command = ale#linter#GetCommand(a:buffer, a:linter) + endif + + return { + \ 'command': l:command, + \ 'buffer': a:buffer, + \ 'linter': a:linter, + \ 'output_stream': l:output_stream, + \ 'next_chain_index': l:chain_index + 1, + \ 'read_buffer': l:read_buffer, + \} +endfunction + +function! s:InvokeChain(buffer, linter, chain_index, input) abort + let l:options = ale#engine#ProcessChain(a:buffer, a:linter, a:chain_index, a:input) + + return s:RunJob(l:options) +endfunction + +function! s:StopCurrentJobs(buffer, include_lint_file_jobs) abort + let l:info = get(g:ale_buffer_info, a:buffer, {}) + let l:new_job_list = [] + let l:new_active_linter_list = [] + + for l:job_id in get(l:info, 'job_list', []) + let l:job_info = get(s:job_info_map, l:job_id, {}) + + if !empty(l:job_info) + if a:include_lint_file_jobs || !l:job_info.linter.lint_file + call ale#job#Stop(l:job_id) + call remove(s:job_info_map, l:job_id) + else + call add(l:new_job_list, l:job_id) + " Linters with jobs still running are still active. + call add(l:new_active_linter_list, l:job_info.linter.name) + endif + endif + endfor + + " Remove duplicates from the active linter list. + call uniq(sort(l:new_active_linter_list)) + + " Update the List, so it includes only the jobs we still need. + let l:info.job_list = l:new_job_list + " Update the active linter list, clearing out anything not running. + let l:info.active_linter_list = l:new_active_linter_list +endfunction + +function! s:CheckWithLSP(buffer, linter) abort + let l:info = g:ale_buffer_info[a:buffer] + let l:lsp_details = ale#linter#StartLSP( + \ a:buffer, + \ a:linter, + \ function('ale#engine#HandleLSPResponse'), + \) + + if empty(l:lsp_details) + return 0 + endif + + let l:id = l:lsp_details.connection_id + let l:root = l:lsp_details.project_root + + " Remember the linter this connection is for. + let s:lsp_linter_map[l:id] = a:linter.name + + let l:change_message = a:linter.lsp is# 'tsserver' + \ ? ale#lsp#tsserver_message#Geterr(a:buffer) + \ : ale#lsp#message#DidChange(a:buffer) + let l:request_id = ale#lsp#Send(l:id, l:change_message, l:root) + + " If this was a file save event, also notify the server of that. + if a:linter.lsp isnot# 'tsserver' + \&& getbufvar(a:buffer, 'ale_save_event_fired', 0) + let l:save_message = ale#lsp#message#DidSave(a:buffer) + let l:request_id = ale#lsp#Send(l:id, l:save_message, l:root) + endif + + if l:request_id != 0 + if index(l:info.active_linter_list, a:linter.name) < 0 + call add(l:info.active_linter_list, a:linter.name) + endif + endif + + return l:request_id != 0 +endfunction + +function! s:RemoveProblemsForDisabledLinters(buffer, linters) abort + " Figure out which linters are still enabled, and remove + " problems for linters which are no longer enabled. + let l:name_map = {} + + for l:linter in a:linters + let l:name_map[l:linter.name] = 1 + endfor + + call filter( + \ get(g:ale_buffer_info[a:buffer], 'loclist', []), + \ 'get(l:name_map, get(v:val, ''linter_name''))', + \) +endfunction + +function! s:AddProblemsFromOtherBuffers(buffer, linters) abort + let l:filename = expand('#' . a:buffer . ':p') + let l:loclist = [] + let l:name_map = {} + + " Build a map of the active linters. + for l:linter in a:linters + let l:name_map[l:linter.name] = 1 + endfor + + " Find the items from other buffers, for the linters that are enabled. + for l:info in values(g:ale_buffer_info) + for l:item in l:info.loclist + if has_key(l:item, 'filename') + \&& l:item.filename is# l:filename + \&& has_key(l:name_map, l:item.linter_name) + " Copy the items and set the buffer numbers to this one. + let l:new_item = copy(l:item) + let l:new_item.bufnr = a:buffer + call add(l:loclist, l:new_item) + endif + endfor + endfor + + if !empty(l:loclist) + call sort(l:loclist, function('ale#util#LocItemCompareWithText')) + call uniq(l:loclist, function('ale#util#LocItemCompareWithText')) + + " Set the loclist variable, used by some parts of ALE. + let g:ale_buffer_info[a:buffer].loclist = l:loclist + call ale#engine#SetResults(a:buffer, l:loclist) + endif +endfunction + +" Run a linter for a buffer. +" +" Returns 1 if the linter was successfully run. +function! s:RunLinter(buffer, linter) abort + if !empty(a:linter.lsp) + return s:CheckWithLSP(a:buffer, a:linter) + else + let l:executable = ale#linter#GetExecutable(a:buffer, a:linter) + + if ale#engine#IsExecutable(a:buffer, l:executable) + return s:InvokeChain(a:buffer, a:linter, 0, []) + endif + endif + + return 0 +endfunction + +function! ale#engine#RunLinters(buffer, linters, should_lint_file) abort + " Initialise the buffer information if needed. + let l:new_buffer = ale#engine#InitBufferInfo(a:buffer) + call s:StopCurrentJobs(a:buffer, a:should_lint_file) + call s:RemoveProblemsForDisabledLinters(a:buffer, a:linters) + + " We can only clear the results if we aren't checking the buffer. + let l:can_clear_results = !ale#engine#IsCheckingBuffer(a:buffer) + + silent doautocmd User ALELintPre + + for l:linter in a:linters + " Only run lint_file linters if we should. + if !l:linter.lint_file || a:should_lint_file + if s:RunLinter(a:buffer, l:linter) + " If a single linter ran, we shouldn't clear everything. + let l:can_clear_results = 0 + endif + else + " If we skipped running a lint_file linter still in the list, + " we shouldn't clear everything. + let l:can_clear_results = 0 + endif + endfor + + " Clear the results if we can. This needs to be done when linters are + " disabled, or ALE itself is disabled. + if l:can_clear_results + call ale#engine#SetResults(a:buffer, []) + elseif l:new_buffer + call s:AddProblemsFromOtherBuffers(a:buffer, a:linters) + endif +endfunction + +" Clean up a buffer. +" +" This function will stop all current jobs for the buffer, +" clear the state of everything, and remove the Dictionary for managing +" the buffer. +function! ale#engine#Cleanup(buffer) abort + " Don't bother with cleanup code when newer NeoVim versions are exiting. + if get(v:, 'exiting', v:null) isnot v:null + return + endif + + if !has_key(g:ale_buffer_info, a:buffer) + return + endif + + call ale#engine#RunLinters(a:buffer, [], 1) + + call remove(g:ale_buffer_info, a:buffer) +endfunction + +" Given a buffer number, return the warnings and errors for a given buffer. +function! ale#engine#GetLoclist(buffer) abort + if !has_key(g:ale_buffer_info, a:buffer) + return [] + endif + + return g:ale_buffer_info[a:buffer].loclist +endfunction + +" This function can be called with a timeout to wait for all jobs to finish. +" If the jobs to not finish in the given number of milliseconds, +" an exception will be thrown. +" +" The time taken will be a very rough approximation, and more time may be +" permitted than is specified. +function! ale#engine#WaitForJobs(deadline) abort + let l:start_time = ale#util#ClockMilliseconds() + + if l:start_time == 0 + throw 'Failed to read milliseconds from the clock!' + endif + + let l:job_list = [] + + " Gather all of the jobs from every buffer. + for l:info in values(g:ale_buffer_info) + call extend(l:job_list, get(l:info, 'job_list', [])) + endfor + + " NeoVim has a built-in API for this, so use that. + if has('nvim') + let l:nvim_code_list = jobwait(l:job_list, a:deadline) + + if index(l:nvim_code_list, -1) >= 0 + throw 'Jobs did not complete on time!' + endif + + return + endif + + let l:should_wait_more = 1 + + while l:should_wait_more + let l:should_wait_more = 0 + + for l:job_id in l:job_list + if ale#job#IsRunning(l:job_id) + let l:now = ale#util#ClockMilliseconds() + + if l:now - l:start_time > a:deadline + " Stop waiting after a timeout, so we don't wait forever. + throw 'Jobs did not complete on time!' + endif + + " Wait another 10 milliseconds + let l:should_wait_more = 1 + sleep 10ms + break + endif + endfor + endwhile + + " Sleep for a small amount of time after all jobs finish. + " This seems to be enough to let handlers after jobs end run, and + " prevents the occasional failure where this function exits after jobs + " end, but before handlers are run. + sleep 10ms + + " We must check the buffer data again to see if new jobs started + " for command_chain linters. + let l:has_new_jobs = 0 + + " Check again to see if any jobs are running. + for l:info in values(g:ale_buffer_info) + for l:job_id in get(l:info, 'job_list', []) + if ale#job#IsRunning(l:job_id) + let l:has_new_jobs = 1 + break + endif + endfor + endfor + + if l:has_new_jobs + " We have to wait more. Offset the timeout by the time taken so far. + let l:now = ale#util#ClockMilliseconds() + let l:new_deadline = a:deadline - (l:now - l:start_time) + + if l:new_deadline <= 0 + " Enough time passed already, so stop immediately. + throw 'Jobs did not complete on time!' + endif + + call ale#engine#WaitForJobs(l:new_deadline) + endif +endfunction diff --git a/sources_non_forked/ale/autoload/ale/events.vim b/sources_non_forked/ale/autoload/ale/events.vim new file mode 100644 index 00000000..c7d17ea5 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/events.vim @@ -0,0 +1,69 @@ +" Author: w0rp + +function! ale#events#QuitEvent(buffer) abort + " Remember when ALE is quitting for BufWrite, etc. + call setbufvar(a:buffer, 'ale_quitting', ale#util#ClockMilliseconds()) +endfunction + +function! ale#events#QuitRecently(buffer) abort + let l:time = getbufvar(a:buffer, 'ale_quitting', 0) + + return l:time && ale#util#ClockMilliseconds() - l:time < 1000 +endfunction + +function! ale#events#SaveEvent(buffer) abort + let l:should_lint = ale#Var(a:buffer, 'enabled') && g:ale_lint_on_save + + if l:should_lint + call setbufvar(a:buffer, 'ale_save_event_fired', 1) + endif + + if ale#Var(a:buffer, 'fix_on_save') + let l:will_fix = ale#fix#Fix('save_file') + let l:should_lint = l:should_lint && !l:will_fix + endif + + if l:should_lint && !ale#events#QuitRecently(a:buffer) + call ale#Queue(0, 'lint_file', a:buffer) + endif +endfunction + +function! s:LintOnEnter(buffer) abort + if ale#Var(a:buffer, 'enabled') + \&& g:ale_lint_on_enter + \&& has_key(b:, 'ale_file_changed') + call remove(b:, 'ale_file_changed') + call ale#Queue(0, 'lint_file', a:buffer) + endif +endfunction + +function! ale#events#EnterEvent(buffer) abort + " When entering a buffer, we are no longer quitting it. + call setbufvar(a:buffer, 'ale_quitting', 0) + let l:filetype = getbufvar(a:buffer, '&filetype') + call setbufvar(a:buffer, 'ale_original_filetype', l:filetype) + + call s:LintOnEnter(a:buffer) +endfunction + +function! ale#events#FileTypeEvent(buffer, new_filetype) abort + let l:filetype = getbufvar(a:buffer, 'ale_original_filetype', '') + + " If we're setting the filetype for the first time after it was blank, + " and the option for linting on enter is off, then we should set this + " filetype as the original filetype. Otherwise ALE will still appear to + " lint files because of the BufEnter event, etc. + if empty(l:filetype) && !ale#Var(a:buffer, 'lint_on_enter') + call setbufvar(a:buffer, 'ale_original_filetype', a:new_filetype) + elseif a:new_filetype isnot# l:filetype + call ale#Queue(300, 'lint_file', a:buffer) + endif +endfunction + +function! ale#events#FileChangedEvent(buffer) abort + call setbufvar(a:buffer, 'ale_file_changed', 1) + + if bufnr('') == a:buffer + call s:LintOnEnter(a:buffer) + endif +endfunction diff --git a/sources_non_forked/ale/autoload/ale/filetypes.vim b/sources_non_forked/ale/autoload/ale/filetypes.vim new file mode 100644 index 00000000..6174aa0e --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/filetypes.vim @@ -0,0 +1,60 @@ +" Author: w0rp +" Description: This file handles guessing file extensions for filetypes, etc. + +function! ale#filetypes#LoadExtensionMap() abort + " Output includes: + " '*.erl setf erlang' + redir => l:output + silent exec 'autocmd' + redir end + + let l:map = {} + + for l:line in split(l:output, "\n") + " Parse filetypes, like so: + " + " *.erl setf erlang + " *.md set filetype=markdown + " *.snippet setlocal filetype=snippets + let l:match = matchlist(l:line, '\v^ *\*(\.[^ ]+).*set(f *| *filetype=|local *filetype=)([^ ]+)') + + if !empty(l:match) + let l:map[substitute(l:match[3], '^=', '', '')] = l:match[1] + endif + endfor + + return l:map +endfunction + +let s:cached_map = {} + +function! s:GetCachedExtensionMap() abort + if empty(s:cached_map) + let s:cached_map = ale#filetypes#LoadExtensionMap() + endif + + return s:cached_map +endfunction + +function! ale#filetypes#GuessExtension(filetype) abort + let l:map = s:GetCachedExtensionMap() + let l:ext = get(l:map, a:filetype, '') + + " If we have an exact match, like something for javascript.jsx, use that. + if !empty(l:ext) + return l:ext + endif + + " If we don't have an exact match, use the first filetype in the compound + " filetype. + for l:part in split(a:filetype, '\.') + let l:ext = get(l:map, l:part, '') + + if !empty(l:ext) + return l:ext + endif + endfor + + " Return an empty string if we don't find anything. + return '' +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fix.vim b/sources_non_forked/ale/autoload/ale/fix.vim new file mode 100644 index 00000000..398f57d0 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fix.vim @@ -0,0 +1,484 @@ +" This global Dictionary tracks the ALE fix data for jobs, etc. +" This Dictionary should not be accessed outside of the plugin. It is only +" global so it can be modified in Vader tests. +if !has_key(g:, 'ale_fix_buffer_data') + let g:ale_fix_buffer_data = {} +endif + +if !has_key(s:, 'job_info_map') + let s:job_info_map = {} +endif + +function! s:GatherOutput(job_id, line) abort + if has_key(s:job_info_map, a:job_id) + call add(s:job_info_map[a:job_id].output, a:line) + endif +endfunction + +" Apply fixes queued up for buffers which may be hidden. +" Vim doesn't let you modify hidden buffers. +function! ale#fix#ApplyQueuedFixes() abort + let l:buffer = bufnr('') + let l:data = get(g:ale_fix_buffer_data, l:buffer, {'done': 0}) + + if !l:data.done + return + endif + + call remove(g:ale_fix_buffer_data, l:buffer) + + if l:data.changes_made + call setline(1, l:data.output) + + let l:start_line = len(l:data.output) + 1 + let l:end_line = len(l:data.lines_before) + + if l:end_line >= l:start_line + let l:save = winsaveview() + silent execute l:start_line . ',' . l:end_line . 'd_' + call winrestview(l:save) + endif + + if l:data.should_save + if empty(&buftype) + noautocmd :w! + else + set nomodified + endif + endif + endif + + if l:data.should_save + let l:should_lint = g:ale_fix_on_save + else + let l:should_lint = l:data.changes_made + endif + + silent doautocmd User ALEFixPost + + " If ALE linting is enabled, check for problems with the file again after + " fixing problems. + if g:ale_enabled + \&& l:should_lint + \&& !ale#events#QuitRecently(l:buffer) + call ale#Queue(0, l:data.should_save ? 'lint_file' : '') + endif +endfunction + +function! ale#fix#ApplyFixes(buffer, output) abort + call ale#fix#RemoveManagedFiles(a:buffer) + + let l:data = g:ale_fix_buffer_data[a:buffer] + let l:data.output = a:output + let l:data.changes_made = l:data.lines_before != l:data.output + + if l:data.changes_made && bufexists(a:buffer) + let l:lines = getbufline(a:buffer, 1, '$') + + if l:data.lines_before != l:lines + call remove(g:ale_fix_buffer_data, a:buffer) + execute 'echoerr ''The file was changed before fixing finished''' + return + endif + endif + + if !bufexists(a:buffer) + " Remove the buffer data when it doesn't exist. + call remove(g:ale_fix_buffer_data, a:buffer) + endif + + let l:data.done = 1 + + " We can only change the lines of a buffer which is currently open, + " so try and apply the fixes to the current buffer. + call ale#fix#ApplyQueuedFixes() +endfunction + +function! s:HandleExit(job_id, exit_code) abort + if !has_key(s:job_info_map, a:job_id) + return + endif + + let l:job_info = remove(s:job_info_map, a:job_id) + let l:buffer = l:job_info.buffer + + if g:ale_history_enabled + call ale#history#SetExitCode(l:buffer, a:job_id, a:exit_code) + endif + + if has_key(l:job_info, 'file_to_read') + let l:job_info.output = readfile(l:job_info.file_to_read) + endif + + let l:ChainCallback = get(l:job_info, 'chain_with', v:null) + let l:ProcessWith = get(l:job_info, 'process_with', v:null) + + " Post-process the output with a function if we have one. + if l:ProcessWith isnot v:null + let l:job_info.output = call( + \ ale#util#GetFunction(l:ProcessWith), + \ [l:buffer, l:job_info.output] + \) + endif + + " Use the output of the job for changing the file if it isn't empty, + " otherwise skip this job and use the input from before. + " + " We'll use the input from before for chained commands. + if l:ChainCallback is v:null && !empty(split(join(l:job_info.output))) + let l:input = l:job_info.output + else + let l:input = l:job_info.input + endif + + let l:next_index = l:ChainCallback is v:null + \ ? l:job_info.callback_index + 1 + \ : l:job_info.callback_index + + call s:RunFixer({ + \ 'buffer': l:buffer, + \ 'input': l:input, + \ 'output': l:job_info.output, + \ 'callback_list': l:job_info.callback_list, + \ 'callback_index': l:next_index, + \ 'chain_callback': l:ChainCallback, + \}) +endfunction + +function! ale#fix#ManageDirectory(buffer, directory) abort + call add(g:ale_fix_buffer_data[a:buffer].temporary_directory_list, a:directory) +endfunction + +function! ale#fix#RemoveManagedFiles(buffer) abort + if !has_key(g:ale_fix_buffer_data, a:buffer) + return + endif + + " We can't delete anything in a sandbox, so wait until we escape from + " it to delete temporary files and directories. + if ale#util#InSandbox() + return + endif + + " Delete directories like `rm -rf`. + " Directories are handled differently from files, so paths that are + " intended to be single files can be set up for automatic deletion without + " accidentally deleting entire directories. + for l:directory in g:ale_fix_buffer_data[a:buffer].temporary_directory_list + call delete(l:directory, 'rf') + endfor + + let g:ale_fix_buffer_data[a:buffer].temporary_directory_list = [] +endfunction + +function! s:CreateTemporaryFileForJob(buffer, temporary_file, input) abort + if empty(a:temporary_file) + " There is no file, so we didn't create anything. + return 0 + endif + + let l:temporary_directory = fnamemodify(a:temporary_file, ':h') + " Create the temporary directory for the file, unreadable by 'other' + " users. + call mkdir(l:temporary_directory, '', 0750) + " Automatically delete the directory later. + call ale#fix#ManageDirectory(a:buffer, l:temporary_directory) + " Write the buffer out to a file. + call ale#util#Writefile(a:buffer, a:input, a:temporary_file) + + return 1 +endfunction + +function! s:RunJob(options) abort + let l:buffer = a:options.buffer + let l:command = a:options.command + let l:input = a:options.input + let l:output_stream = a:options.output_stream + let l:read_temporary_file = a:options.read_temporary_file + let l:ChainWith = a:options.chain_with + let l:read_buffer = a:options.read_buffer + + if empty(l:command) + " If there's nothing further to chain the command with, stop here. + if l:ChainWith is v:null + return 0 + endif + + " If there's another chained callback to run, then run that. + call s:RunFixer({ + \ 'buffer': l:buffer, + \ 'input': l:input, + \ 'callback_index': a:options.callback_index, + \ 'callback_list': a:options.callback_list, + \ 'chain_callback': l:ChainWith, + \ 'output': [], + \}) + + return 1 + endif + + let [l:temporary_file, l:command] = ale#command#FormatCommand( + \ l:buffer, + \ l:command, + \ l:read_buffer, + \) + call s:CreateTemporaryFileForJob(l:buffer, l:temporary_file, l:input) + + let l:command = ale#job#PrepareCommand(l:buffer, l:command) + let l:job_options = { + \ 'mode': 'nl', + \ 'exit_cb': function('s:HandleExit'), + \} + + let l:job_info = { + \ 'buffer': l:buffer, + \ 'input': l:input, + \ 'output': [], + \ 'chain_with': l:ChainWith, + \ 'callback_index': a:options.callback_index, + \ 'callback_list': a:options.callback_list, + \ 'process_with': a:options.process_with, + \} + + if l:read_temporary_file + " TODO: Check that a temporary file is set here. + let l:job_info.file_to_read = l:temporary_file + elseif l:output_stream is# 'stderr' + let l:job_options.err_cb = function('s:GatherOutput') + elseif l:output_stream is# 'both' + let l:job_options.out_cb = function('s:GatherOutput') + let l:job_options.err_cb = function('s:GatherOutput') + else + let l:job_options.out_cb = function('s:GatherOutput') + endif + + if get(g:, 'ale_emulate_job_failure') == 1 + let l:job_id = 0 + elseif get(g:, 'ale_run_synchronously') == 1 + " Find a unique Job value to use, which will be the same as the ID for + " running commands synchronously. This is only for test code. + let l:job_id = len(s:job_info_map) + 1 + + while has_key(s:job_info_map, l:job_id) + let l:job_id += 1 + endwhile + else + let l:job_id = ale#job#Start(l:command, l:job_options) + endif + + let l:status = l:job_id ? 'started' : 'failed' + + if g:ale_history_enabled + call ale#history#Add(l:buffer, l:status, l:job_id, l:command) + endif + + if l:job_id == 0 + return 0 + endif + + let s:job_info_map[l:job_id] = l:job_info + + if get(g:, 'ale_run_synchronously') == 1 + " Run a command synchronously if this test option is set. + let l:output = systemlist( + \ type(l:command) == type([]) + \ ? join(l:command[0:1]) . ' ' . ale#Escape(l:command[2]) + \ : l:command + \) + + if !l:read_temporary_file + let s:job_info_map[l:job_id].output = l:output + endif + + call l:job_options.exit_cb(l:job_id, v:shell_error) + endif + + return 1 +endfunction + +function! s:RunFixer(options) abort + let l:buffer = a:options.buffer + let l:input = a:options.input + let l:index = a:options.callback_index + let l:ChainCallback = get(a:options, 'chain_callback', v:null) + + while len(a:options.callback_list) > l:index + let l:Function = l:ChainCallback isnot v:null + \ ? ale#util#GetFunction(l:ChainCallback) + \ : a:options.callback_list[l:index] + + if l:ChainCallback isnot v:null + " Chained commands accept (buffer, output, [input]) + let l:result = ale#util#FunctionArgCount(l:Function) == 2 + \ ? call(l:Function, [l:buffer, a:options.output]) + \ : call(l:Function, [l:buffer, a:options.output, copy(l:input)]) + else + " Chained commands accept (buffer, [input]) + let l:result = ale#util#FunctionArgCount(l:Function) == 1 + \ ? call(l:Function, [l:buffer]) + \ : call(l:Function, [l:buffer, copy(l:input)]) + endif + + if type(l:result) == type(0) && l:result == 0 + " When `0` is returned, skip this item. + let l:index += 1 + elseif type(l:result) == type([]) + let l:input = l:result + let l:index += 1 + else + let l:ChainWith = get(l:result, 'chain_with', v:null) + " Default to piping the buffer for the last fixer in the chain. + let l:read_buffer = get(l:result, 'read_buffer', l:ChainWith is v:null) + + let l:job_ran = s:RunJob({ + \ 'buffer': l:buffer, + \ 'command': l:result.command, + \ 'input': l:input, + \ 'output_stream': get(l:result, 'output_stream', 'stdout'), + \ 'read_temporary_file': get(l:result, 'read_temporary_file', 0), + \ 'read_buffer': l:read_buffer, + \ 'chain_with': l:ChainWith, + \ 'callback_list': a:options.callback_list, + \ 'callback_index': l:index, + \ 'process_with': get(l:result, 'process_with', v:null), + \}) + + if !l:job_ran + " The job failed to run, so skip to the next item. + let l:index += 1 + else + " Stop here, we will handle exit later on. + return + endif + endif + endwhile + + call ale#fix#ApplyFixes(l:buffer, l:input) +endfunction + +function! s:GetCallbacks() abort + if type(get(b:, 'ale_fixers')) is type([]) + " Lists can be used for buffer-local variables only + let l:callback_list = b:ale_fixers + else + " buffer and global options can use dictionaries mapping filetypes to + " callbacks to run. + let l:fixers = ale#Var(bufnr(''), 'fixers') + let l:callback_list = [] + + for l:sub_type in split(&filetype, '\.') + let l:sub_type_callacks = get(l:fixers, l:sub_type, []) + + if type(l:sub_type_callacks) == type('') + call add(l:callback_list, l:sub_type_callacks) + else + call extend(l:callback_list, l:sub_type_callacks) + endif + endfor + endif + + if empty(l:callback_list) + return [] + endif + + let l:corrected_list = [] + + " Variables with capital characters are needed, or Vim will complain about + " funcref variables. + for l:Item in l:callback_list + if type(l:Item) == type('') + let l:Func = ale#fix#registry#GetFunc(l:Item) + + if !empty(l:Func) + let l:Item = l:Func + endif + endif + + try + call add(l:corrected_list, ale#util#GetFunction(l:Item)) + catch /E475/ + " Rethrow exceptions for failing to get a function so we can print + " a friendly message about it. + throw 'BADNAME ' . v:exception + endtry + endfor + + return l:corrected_list +endfunction + +function! ale#fix#InitBufferData(buffer, fixing_flag) abort + " The 'done' flag tells the function for applying changes when fixing + " is complete. + let g:ale_fix_buffer_data[a:buffer] = { + \ 'vars': getbufvar(a:buffer, ''), + \ 'lines_before': getbufline(a:buffer, 1, '$'), + \ 'filename': expand('#' . a:buffer . ':p'), + \ 'done': 0, + \ 'should_save': a:fixing_flag is# 'save_file', + \ 'temporary_directory_list': [], + \} +endfunction + +" Accepts an optional argument for what to do when fixing. +" +" Returns 0 if no fixes can be applied, and 1 if fixing can be done. +function! ale#fix#Fix(...) abort + if len(a:0) > 1 + throw 'too many arguments!' + endif + + let l:fixing_flag = get(a:000, 0, '') + + if l:fixing_flag isnot# '' && l:fixing_flag isnot# 'save_file' + throw "fixing_flag must be either '' or 'save_file'" + endif + + try + let l:callback_list = s:GetCallbacks() + catch /E700\|BADNAME/ + let l:function_name = join(split(split(v:exception, ':')[3])) + let l:echo_message = printf( + \ 'There is no fixer named `%s`. Check :ALEFixSuggest', + \ l:function_name, + \) + execute 'echom l:echo_message' + + return 0 + endtry + + if empty(l:callback_list) + if l:fixing_flag is# '' + execute 'echom ''No fixers have been defined. Try :ALEFixSuggest''' + endif + + return 0 + endif + + let l:buffer = bufnr('') + + for l:job_id in keys(s:job_info_map) + call remove(s:job_info_map, l:job_id) + call ale#job#Stop(l:job_id) + endfor + + " Clean up any files we might have left behind from a previous run. + call ale#fix#RemoveManagedFiles(l:buffer) + call ale#fix#InitBufferData(l:buffer, l:fixing_flag) + + silent doautocmd User ALEFixPre + + call s:RunFixer({ + \ 'buffer': l:buffer, + \ 'input': g:ale_fix_buffer_data[l:buffer].lines_before, + \ 'callback_index': 0, + \ 'callback_list': l:callback_list, + \}) + + return 1 +endfunction + +" Set up an autocmd command to try and apply buffer fixes when available. +augroup ALEBufferFixGroup + autocmd! + autocmd BufEnter * call ale#fix#ApplyQueuedFixes() +augroup END diff --git a/sources_non_forked/ale/autoload/ale/fix/registry.vim b/sources_non_forked/ale/autoload/ale/fix/registry.vim new file mode 100644 index 00000000..4c0703a5 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fix/registry.vim @@ -0,0 +1,349 @@ +" Author: w0rp +" Description: A registry of functions for fixing things. + +let s:default_registry = { +\ 'add_blank_lines_for_python_control_statements': { +\ 'function': 'ale#fixers#generic_python#AddLinesBeforeControlStatements', +\ 'suggested_filetypes': ['python'], +\ 'description': 'Add blank lines before control statements.', +\ }, +\ 'align_help_tags': { +\ 'function': 'ale#fixers#help#AlignTags', +\ 'suggested_filetypes': ['help'], +\ 'description': 'Align help tags to the right margin', +\ }, +\ 'autopep8': { +\ 'function': 'ale#fixers#autopep8#Fix', +\ 'suggested_filetypes': ['python'], +\ 'description': 'Fix PEP8 issues with autopep8.', +\ }, +\ 'prettier_standard': { +\ 'function': 'ale#fixers#prettier_standard#Fix', +\ 'suggested_filetypes': ['javascript'], +\ 'description': 'Apply prettier-standard to a file.', +\ 'aliases': ['prettier-standard'], +\ }, +\ 'elm-format': { +\ 'function': 'ale#fixers#elm_format#Fix', +\ 'suggested_filetypes': ['elm'], +\ 'description': 'Apply elm-format to a file.', +\ 'aliases': ['format'], +\ }, +\ 'eslint': { +\ 'function': 'ale#fixers#eslint#Fix', +\ 'suggested_filetypes': ['javascript', 'typescript'], +\ 'description': 'Apply eslint --fix to a file.', +\ }, +\ 'mix_format': { +\ 'function': 'ale#fixers#mix_format#Fix', +\ 'suggested_filetypes': ['elixir'], +\ 'description': 'Apply mix format to a file.', +\ }, +\ 'isort': { +\ 'function': 'ale#fixers#isort#Fix', +\ 'suggested_filetypes': ['python'], +\ 'description': 'Sort Python imports with isort.', +\ }, +\ 'prettier': { +\ 'function': 'ale#fixers#prettier#Fix', +\ 'suggested_filetypes': ['javascript', 'typescript', 'json', 'css', 'scss', 'less', 'markdown', 'graphql', 'vue'], +\ 'description': 'Apply prettier to a file.', +\ }, +\ 'prettier_eslint': { +\ 'function': 'ale#fixers#prettier_eslint#Fix', +\ 'suggested_filetypes': ['javascript'], +\ 'description': 'Apply prettier-eslint to a file.', +\ 'aliases': ['prettier-eslint'], +\ }, +\ 'importjs': { +\ 'function': 'ale#fixers#importjs#Fix', +\ 'suggested_filetypes': ['javascript'], +\ 'description': 'automatic imports for javascript', +\ }, +\ 'puppetlint': { +\ 'function': 'ale#fixers#puppetlint#Fix', +\ 'suggested_filetypes': ['puppet'], +\ 'description': 'Run puppet-lint -f on a file.', +\ }, +\ 'remove_trailing_lines': { +\ 'function': 'ale#fixers#generic#RemoveTrailingBlankLines', +\ 'suggested_filetypes': [], +\ 'description': 'Remove all blank lines at the end of a file.', +\ }, +\ 'trim_whitespace': { +\ 'function': 'ale#fixers#generic#TrimWhitespace', +\ 'suggested_filetypes': [], +\ 'description': 'Remove all trailing whitespace characters at the end of every line.', +\ }, +\ 'yapf': { +\ 'function': 'ale#fixers#yapf#Fix', +\ 'suggested_filetypes': ['python'], +\ 'description': 'Fix Python files with yapf.', +\ }, +\ 'rubocop': { +\ 'function': 'ale#fixers#rubocop#Fix', +\ 'suggested_filetypes': ['ruby'], +\ 'description': 'Fix ruby files with rubocop --auto-correct.', +\ }, +\ 'rufo': { +\ 'function': 'ale#fixers#rufo#Fix', +\ 'suggested_filetypes': ['ruby'], +\ 'description': 'Fix ruby files with rufo', +\ }, +\ 'standard': { +\ 'function': 'ale#fixers#standard#Fix', +\ 'suggested_filetypes': ['javascript'], +\ 'description': 'Fix JavaScript files using standard --fix', +\ }, +\ 'stylelint': { +\ 'function': 'ale#fixers#stylelint#Fix', +\ 'suggested_filetypes': ['css', 'sass', 'scss', 'stylus'], +\ 'description': 'Fix stylesheet files using stylelint --fix.', +\ }, +\ 'swiftformat': { +\ 'function': 'ale#fixers#swiftformat#Fix', +\ 'suggested_filetypes': ['swift'], +\ 'description': 'Apply SwiftFormat to a file.', +\ }, +\ 'phpcbf': { +\ 'function': 'ale#fixers#phpcbf#Fix', +\ 'suggested_filetypes': ['php'], +\ 'description': 'Fix PHP files with phpcbf.', +\ }, +\ 'php_cs_fixer': { +\ 'function': 'ale#fixers#php_cs_fixer#Fix', +\ 'suggested_filetypes': ['php'], +\ 'description': 'Fix PHP files with php-cs-fixer.', +\ }, +\ 'clang-format': { +\ 'function': 'ale#fixers#clangformat#Fix', +\ 'suggested_filetypes': ['c', 'cpp'], +\ 'description': 'Fix C/C++ files with clang-format.', +\ }, +\ 'gofmt': { +\ 'function': 'ale#fixers#gofmt#Fix', +\ 'suggested_filetypes': ['go'], +\ 'description': 'Fix Go files with go fmt.', +\ }, +\ 'goimports': { +\ 'function': 'ale#fixers#goimports#Fix', +\ 'suggested_filetypes': ['go'], +\ 'description': 'Fix Go files imports with goimports.', +\ }, +\ 'tslint': { +\ 'function': 'ale#fixers#tslint#Fix', +\ 'suggested_filetypes': ['typescript'], +\ 'description': 'Fix typescript files with tslint --fix.', +\ }, +\ 'rustfmt': { +\ 'function': 'ale#fixers#rustfmt#Fix', +\ 'suggested_filetypes': ['rust'], +\ 'description': 'Fix Rust files with Rustfmt.', +\ }, +\ 'hackfmt': { +\ 'function': 'ale#fixers#hackfmt#Fix', +\ 'suggested_filetypes': ['php'], +\ 'description': 'Fix Hack files with hackfmt.', +\ }, +\ 'hfmt': { +\ 'function': 'ale#fixers#hfmt#Fix', +\ 'suggested_filetypes': ['haskell'], +\ 'description': 'Fix Haskell files with hfmt.', +\ }, +\ 'brittany': { +\ 'function': 'ale#fixers#brittany#Fix', +\ 'suggested_filetypes': ['haskell'], +\ 'description': 'Fix Haskell files with brittany.', +\ }, +\ 'refmt': { +\ 'function': 'ale#fixers#refmt#Fix', +\ 'suggested_filetypes': ['reason'], +\ 'description': 'Fix ReasonML files with refmt.', +\ }, +\ 'shfmt': { +\ 'function': 'ale#fixers#shfmt#Fix', +\ 'suggested_filetypes': ['sh'], +\ 'description': 'Fix sh files with shfmt.', +\ }, +\ 'google_java_format': { +\ 'function': 'ale#fixers#google_java_format#Fix', +\ 'suggested_filetypes': ['java'], +\ 'description': 'Fix Java files with google-java-format.', +\ }, +\ 'fixjson': { +\ 'function': 'ale#fixers#fixjson#Fix', +\ 'suggested_filetypes': ['json'], +\ 'description': 'Fix JSON files with fixjson.', +\ }, +\ 'jq': { +\ 'function': 'ale#fixers#jq#Fix', +\ 'suggested_filetypes': ['json'], +\ 'description': 'Fix JSON files with jq.', +\ }, +\} + +" Reset the function registry to the default entries. +function! ale#fix#registry#ResetToDefaults() abort + let s:entries = deepcopy(s:default_registry) + let s:aliases = {} + + " Set up aliases for fixers too. + for [l:key, l:entry] in items(s:entries) + for l:alias in get(l:entry, 'aliases', []) + let s:aliases[l:alias] = l:key + endfor + endfor +endfunction + +" Set up entries now. +call ale#fix#registry#ResetToDefaults() + +" Remove everything from the registry, useful for tests. +function! ale#fix#registry#Clear() abort + let s:entries = {} + let s:aliases = {} +endfunction + +" Add a function for fixing problems to the registry. +" (name, func, filetypes, desc, aliases) +function! ale#fix#registry#Add(name, func, filetypes, desc, ...) abort + if type(a:name) != type('') + throw '''name'' must be a String' + endif + + if type(a:func) != type('') + throw '''func'' must be a String' + endif + + if type(a:filetypes) != type([]) + throw '''filetypes'' must be a List' + endif + + for l:type in a:filetypes + if type(l:type) != type('') + throw 'Each entry of ''filetypes'' must be a String' + endif + endfor + + if type(a:desc) != type('') + throw '''desc'' must be a String' + endif + + let l:aliases = get(a:000, 0, []) + + if type(l:aliases) != type([]) + \|| !empty(filter(copy(l:aliases), 'type(v:val) != type('''')')) + throw '''aliases'' must be a List of String values' + endif + + let s:entries[a:name] = { + \ 'function': a:func, + \ 'suggested_filetypes': a:filetypes, + \ 'description': a:desc, + \} + + " Set up aliases for the fixer. + if !empty(l:aliases) + let s:entries[a:name].aliases = l:aliases + + for l:alias in l:aliases + let s:aliases[l:alias] = a:name + endfor + endif +endfunction + +" Get a function from the registry by its short name. +function! ale#fix#registry#GetFunc(name) abort + " Use the exact name, or an alias. + let l:resolved_name = !has_key(s:entries, a:name) + \ ? get(s:aliases, a:name, a:name) + \ : a:name + + return get(s:entries, l:resolved_name, {'function': ''}).function +endfunction + +function! s:ShouldSuggestForType(suggested_filetypes, type_list) abort + for l:type in a:type_list + if index(a:suggested_filetypes, l:type) >= 0 + return 1 + endif + endfor + + return 0 +endfunction + +function! s:FormatEntry(key, entry) abort + let l:aliases_str = '' + + " Show aliases in :ALEFixSuggest if they are there. + if !empty(get(a:entry, 'aliases', [])) + let l:aliases_str = ', ' . join( + \ map(copy(a:entry.aliases), 'string(v:val)'), + \ ',' + \) + endif + + return printf( + \ '%s%s - %s', + \ string(a:key), + \ l:aliases_str, + \ a:entry.description, + \) +endfunction + +" Suggest functions to use from the registry. +function! ale#fix#registry#Suggest(filetype) abort + let l:type_list = split(a:filetype, '\.') + let l:filetype_fixer_list = [] + + for l:key in sort(keys(s:entries)) + let l:suggested_filetypes = s:entries[l:key].suggested_filetypes + + if s:ShouldSuggestForType(l:suggested_filetypes, l:type_list) + call add( + \ l:filetype_fixer_list, + \ s:FormatEntry(l:key, s:entries[l:key]), + \) + endif + endfor + + let l:generic_fixer_list = [] + + for l:key in sort(keys(s:entries)) + if empty(s:entries[l:key].suggested_filetypes) + call add( + \ l:generic_fixer_list, + \ s:FormatEntry(l:key, s:entries[l:key]), + \) + endif + endfor + + let l:filetype_fixer_header = !empty(l:filetype_fixer_list) + \ ? ['Try the following fixers appropriate for the filetype:', ''] + \ : [] + let l:generic_fixer_header = !empty(l:generic_fixer_list) + \ ? ['Try the following generic fixers:', ''] + \ : [] + + let l:has_both_lists = !empty(l:filetype_fixer_list) && !empty(l:generic_fixer_list) + + let l:lines = + \ l:filetype_fixer_header + \ + l:filetype_fixer_list + \ + (l:has_both_lists ? [''] : []) + \ + l:generic_fixer_header + \ + l:generic_fixer_list + + if empty(l:lines) + let l:lines = ['There is nothing in the registry to suggest.'] + else + let l:lines += ['', 'See :help ale-fix-configuration'] + endif + + let l:lines += ['', 'Press q to close this window'] + + new +set\ filetype=ale-fix-suggest + call setline(1, l:lines) + setlocal nomodified + setlocal nomodifiable +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/autopep8.vim b/sources_non_forked/ale/autoload/ale/fixers/autopep8.vim new file mode 100644 index 00000000..e2dd7bfe --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/autopep8.vim @@ -0,0 +1,26 @@ +" Author: w0rp +" Description: Fixing files with autopep8. + +call ale#Set('python_autopep8_executable', 'autopep8') +call ale#Set('python_autopep8_use_global', 0) +call ale#Set('python_autopep8_options', '') + +function! ale#fixers#autopep8#Fix(buffer) abort + let l:executable = ale#python#FindExecutable( + \ a:buffer, + \ 'python_autopep8', + \ ['autopep8'], + \) + + if !executable(l:executable) + return 0 + endif + + let l:options = ale#Var(a:buffer, 'python_autopep8_options') + + return { + \ 'command': ale#Escape(l:executable) + \ . (!empty(l:options) ? ' ' . l:options : '') + \ . ' -', + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/brittany.vim b/sources_non_forked/ale/autoload/ale/fixers/brittany.vim new file mode 100644 index 00000000..fed5eb8b --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/brittany.vim @@ -0,0 +1,15 @@ +" Author: eborden +" Description: Integration of brittany with ALE. + +call ale#Set('haskell_brittany_executable', 'brittany') + +function! ale#fixers#brittany#Fix(buffer) abort + let l:executable = ale#Var(a:buffer, 'haskell_brittany_executable') + + return { + \ 'command': ale#Escape(l:executable) + \ . ' %t', + \ 'read_temporary_file': 1, + \} +endfunction + diff --git a/sources_non_forked/ale/autoload/ale/fixers/clangformat.vim b/sources_non_forked/ale/autoload/ale/fixers/clangformat.vim new file mode 100644 index 00000000..b50b7047 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/clangformat.vim @@ -0,0 +1,22 @@ +scriptencoding utf-8 +" Author: Peter Renström +" Description: Fixing C/C++ files with clang-format. + +call ale#Set('c_clangformat_executable', 'clang-format') +call ale#Set('c_clangformat_use_global', 0) +call ale#Set('c_clangformat_options', '') + +function! ale#fixers#clangformat#GetExecutable(buffer) abort + return ale#node#FindExecutable(a:buffer, 'c_clangformat', [ + \ 'clang-format', + \]) +endfunction + +function! ale#fixers#clangformat#Fix(buffer) abort + let l:options = ale#Var(a:buffer, 'c_clangformat_options') + + return { + \ 'command': ale#Escape(ale#fixers#clangformat#GetExecutable(a:buffer)) + \ . ' ' . l:options, + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/elm_format.vim b/sources_non_forked/ale/autoload/ale/fixers/elm_format.vim new file mode 100644 index 00000000..b2119d2c --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/elm_format.vim @@ -0,0 +1,23 @@ +" Author: soywod +" Description: Integration of elm-format with ALE. + +call ale#Set('elm_format_executable', 'elm-format') +call ale#Set('elm_format_use_global', 0) +call ale#Set('elm_format_options', '--yes') + +function! ale#fixers#elm_format#GetExecutable(buffer) abort + return ale#node#FindExecutable(a:buffer, 'elm_format', [ + \ 'node_modules/.bin/elm-format', + \]) +endfunction + +function! ale#fixers#elm_format#Fix(buffer) abort + let l:options = ale#Var(a:buffer, 'elm_format_options') + + return { + \ 'command': ale#Escape(ale#fixers#elm_format#GetExecutable(a:buffer)) + \ . ' %t' + \ . (empty(l:options) ? '' : ' ' . l:options), + \ 'read_temporary_file': 1, + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/eslint.vim b/sources_non_forked/ale/autoload/ale/fixers/eslint.vim new file mode 100644 index 00000000..36f47510 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/eslint.vim @@ -0,0 +1,70 @@ +" Author: w0rp +" Description: Fixing files with eslint. + +function! ale#fixers#eslint#Fix(buffer) abort + let l:executable = ale#handlers#eslint#GetExecutable(a:buffer) + + let l:command = ale#semver#HasVersion(l:executable) + \ ? '' + \ : ale#node#Executable(a:buffer, l:executable) . ' --version' + + return { + \ 'command': l:command, + \ 'chain_with': 'ale#fixers#eslint#ApplyFixForVersion', + \} +endfunction + +function! ale#fixers#eslint#ProcessFixDryRunOutput(buffer, output) abort + for l:item in ale#util#FuzzyJSONDecode(a:output, []) + return split(get(l:item, 'output', ''), "\n") + endfor + + return [] +endfunction + +function! ale#fixers#eslint#ProcessEslintDOutput(buffer, output) abort + " If the output is an error message, don't use it. + for l:line in a:output[:10] + if l:line =~# '^Error:' + return [] + endif + endfor + + return a:output +endfunction + +function! ale#fixers#eslint#ApplyFixForVersion(buffer, version_output) abort + let l:executable = ale#handlers#eslint#GetExecutable(a:buffer) + let l:version = ale#semver#GetVersion(l:executable, a:version_output) + + let l:config = ale#handlers#eslint#FindConfig(a:buffer) + + if empty(l:config) + return 0 + endif + + " Use --fix-to-stdout with eslint_d + if l:executable =~# 'eslint_d$' && ale#semver#GTE(l:version, [3, 19, 0]) + return { + \ 'command': ale#node#Executable(a:buffer, l:executable) + \ . ' --stdin-filename %s --stdin --fix-to-stdout', + \ 'process_with': 'ale#fixers#eslint#ProcessEslintDOutput', + \} + endif + + " 4.9.0 is the first version with --fix-dry-run + if ale#semver#GTE(l:version, [4, 9, 0]) + return { + \ 'command': ale#node#Executable(a:buffer, l:executable) + \ . ' --stdin-filename %s --stdin --fix-dry-run --format=json', + \ 'process_with': 'ale#fixers#eslint#ProcessFixDryRunOutput', + \} + endif + + return { + \ 'command': ale#node#Executable(a:buffer, l:executable) + \ . ' -c ' . ale#Escape(l:config) + \ . ' --fix %t', + \ 'read_temporary_file': 1, + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/fixjson.vim b/sources_non_forked/ale/autoload/ale/fixers/fixjson.vim new file mode 100644 index 00000000..43eb0632 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/fixjson.vim @@ -0,0 +1,27 @@ +" Author: rhysd +" Description: Integration of fixjson with ALE. + +call ale#Set('json_fixjson_executable', 'fixjson') +call ale#Set('json_fixjson_options', '') +call ale#Set('json_fixjson_use_global', 0) + +function! ale#fixers#fixjson#GetExecutable(buffer) abort + return ale#node#FindExecutable(a:buffer, 'json_fixjson', [ + \ 'node_modules/.bin/fixjson', + \]) +endfunction + +function! ale#fixers#fixjson#Fix(buffer) abort + let l:executable = ale#Escape(ale#fixers#fixjson#GetExecutable(a:buffer)) + let l:filename = ale#Escape(bufname(a:buffer)) + let l:command = l:executable . ' --stdin-filename ' . l:filename + + let l:options = ale#Var(a:buffer, 'json_fixjson_options') + if l:options isnot# '' + let l:command .= ' ' . l:options + endif + + return { + \ 'command': l:command + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/generic.vim b/sources_non_forked/ale/autoload/ale/fixers/generic.vim new file mode 100644 index 00000000..cb8865b4 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/generic.vim @@ -0,0 +1,25 @@ +" Author: w0rp +" Description: Generic functions for fixing files with. + +function! ale#fixers#generic#RemoveTrailingBlankLines(buffer, lines) abort + let l:end_index = len(a:lines) - 1 + + while l:end_index > 0 && empty(a:lines[l:end_index]) + let l:end_index -= 1 + endwhile + + return a:lines[:l:end_index] +endfunction + +" Remove all whitespaces at the end of lines +function! ale#fixers#generic#TrimWhitespace(buffer, lines) abort + let l:index = 0 + let l:lines_new = range(len(a:lines)) + + for l:line in a:lines + let l:lines_new[l:index] = substitute(l:line, '\s\+$', '', 'g') + let l:index = l:index + 1 + endfor + + return l:lines_new +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/generic_python.vim b/sources_non_forked/ale/autoload/ale/fixers/generic_python.vim new file mode 100644 index 00000000..124146be --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/generic_python.vim @@ -0,0 +1,60 @@ +" Author: w0rp +" Description: Generic fixer functions for Python. + +" Add blank lines before control statements. +function! ale#fixers#generic_python#AddLinesBeforeControlStatements(buffer, lines) abort + let l:new_lines = [] + let l:last_indent_size = 0 + let l:last_line_is_blank = 0 + + for l:line in a:lines + let l:indent_size = len(matchstr(l:line, '^ *')) + + if !l:last_line_is_blank + \&& l:indent_size <= l:last_indent_size + \&& match(l:line, '\v^ *(return|if|for|while|break|continue)') >= 0 + call add(l:new_lines, '') + endif + + call add(l:new_lines, l:line) + let l:last_indent_size = l:indent_size + let l:last_line_is_blank = empty(split(l:line)) + endfor + + return l:new_lines +endfunction + +" This function breaks up long lines so that autopep8 or other tools can +" fix the badly-indented code which is produced as a result. +function! ale#fixers#generic_python#BreakUpLongLines(buffer, lines) abort + " Default to a maximum line length of 79 + let l:max_line_length = 79 + let l:conf = ale#path#FindNearestFile(a:buffer, 'setup.cfg') + + " Read the maximum line length from setup.cfg + if !empty(l:conf) + for l:match in ale#util#GetMatches( + \ readfile(l:conf), + \ '\v^ *max-line-length *\= *(\d+)', + \) + let l:max_line_length = str2nr(l:match[1]) + endfor + endif + + let l:new_list = [] + + for l:line in a:lines + if len(l:line) > l:max_line_length && l:line !~# '# *noqa' + let l:line = substitute(l:line, '\v([(,])([^)])', '\1\n\2', 'g') + let l:line = substitute(l:line, '\v([^(])([)])', '\1,\n\2', 'g') + + for l:split_line in split(l:line, "\n") + call add(l:new_list, l:split_line) + endfor + else + call add(l:new_list, l:line) + endif + endfor + + return l:new_list +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/gofmt.vim b/sources_non_forked/ale/autoload/ale/fixers/gofmt.vim new file mode 100644 index 00000000..66b67a9e --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/gofmt.vim @@ -0,0 +1,18 @@ +" Author: aliou +" Description: Integration of gofmt with ALE. + +call ale#Set('go_gofmt_executable', 'gofmt') +call ale#Set('go_gofmt_options', '') + +function! ale#fixers#gofmt#Fix(buffer) abort + let l:executable = ale#Var(a:buffer, 'go_gofmt_executable') + let l:options = ale#Var(a:buffer, 'go_gofmt_options') + + return { + \ 'command': ale#Escape(l:executable) + \ . ' -l -w' + \ . (empty(l:options) ? '' : ' ' . l:options) + \ . ' %t', + \ 'read_temporary_file': 1, + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/goimports.vim b/sources_non_forked/ale/autoload/ale/fixers/goimports.vim new file mode 100644 index 00000000..783d0206 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/goimports.vim @@ -0,0 +1,22 @@ +" Author: Jeff Willette +" Description: Integration of goimports with ALE. + +call ale#Set('go_goimports_executable', 'goimports') +call ale#Set('go_goimports_options', '') + +function! ale#fixers#goimports#Fix(buffer) abort + let l:executable = ale#Var(a:buffer, 'go_goimports_executable') + let l:options = ale#Var(a:buffer, 'go_goimports_options') + + if !executable(l:executable) + return 0 + endif + + return { + \ 'command': ale#Escape(l:executable) + \ . ' -l -w -srcdir %s' + \ . (empty(l:options) ? '' : ' ' . l:options) + \ . ' %t', + \ 'read_temporary_file': 1, + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/google_java_format.vim b/sources_non_forked/ale/autoload/ale/fixers/google_java_format.vim new file mode 100644 index 00000000..92632e84 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/google_java_format.vim @@ -0,0 +1,23 @@ +" Author: butlerx +" Description: Integration of Google-java-format with ALE. + +call ale#Set('google_java_format_executable', 'google-java-format') +call ale#Set('google_java_format_use_global', 0) +call ale#Set('google_java_format_options', '') + +function! ale#fixers#google_java_format#Fix(buffer) abort + let l:options = ale#Var(a:buffer, 'google_java_format_options') + let l:executable = ale#Var(a:buffer, 'google_java_format_executable') + + if !executable(l:executable) + return 0 + endif + + return { + \ 'command': ale#Escape(l:executable) + \ . ' ' . (empty(l:options) ? '' : ' ' . l:options) + \ . ' --replace' + \ . ' %t', + \ 'read_temporary_file': 1, + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/hackfmt.vim b/sources_non_forked/ale/autoload/ale/fixers/hackfmt.vim new file mode 100644 index 00000000..b5bf0dc5 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/hackfmt.vim @@ -0,0 +1,18 @@ +" Author: Sam Howie +" Description: Integration of hackfmt with ALE. + +call ale#Set('php_hackfmt_executable', 'hackfmt') +call ale#Set('php_hackfmt_options', '') + +function! ale#fixers#hackfmt#Fix(buffer) abort + let l:executable = ale#Var(a:buffer, 'php_hackfmt_executable') + let l:options = ale#Var(a:buffer, 'php_hackfmt_options') + + return { + \ 'command': ale#Escape(l:executable) + \ . ' -i' + \ . (empty(l:options) ? '' : ' ' . l:options) + \ . ' %t', + \ 'read_temporary_file': 1, + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/help.vim b/sources_non_forked/ale/autoload/ale/fixers/help.vim new file mode 100644 index 00000000..b20740fe --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/help.vim @@ -0,0 +1,24 @@ +" Author: w0rp +" Description: Generic fixer functions for Vim help documents. + +function! ale#fixers#help#AlignTags(buffer, lines) abort + let l:new_lines = [] + + for l:line in a:lines + if len(l:line) != 79 + let l:match = matchlist(l:line, '\v +(\*[^*]+\*)$') + + if !empty(l:match) + let l:start = l:line[:-len(l:match[0]) - 1] + let l:tag = l:match[1] + let l:spaces = repeat(' ', 79 - len(l:start) - len(l:tag)) + + let l:line = l:start . l:spaces . l:tag + endif + endif + + call add(l:new_lines, l:line) + endfor + + return l:new_lines +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/hfmt.vim b/sources_non_forked/ale/autoload/ale/fixers/hfmt.vim new file mode 100644 index 00000000..ea061da4 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/hfmt.vim @@ -0,0 +1,16 @@ +" Author: zack +" Description: Integration of hfmt with ALE. + +call ale#Set('haskell_hfmt_executable', 'hfmt') + +function! ale#fixers#hfmt#Fix(buffer) abort + let l:executable = ale#Var(a:buffer, 'haskell_hfmt_executable') + + return { + \ 'command': ale#Escape(l:executable) + \ . ' -w' + \ . ' %t', + \ 'read_temporary_file': 1, + \} +endfunction + diff --git a/sources_non_forked/ale/autoload/ale/fixers/importjs.vim b/sources_non_forked/ale/autoload/ale/fixers/importjs.vim new file mode 100644 index 00000000..e8eedb12 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/importjs.vim @@ -0,0 +1,24 @@ +" Author: Jeff Willette +" Description: Integration of importjs with ALE. + +call ale#Set('js_importjs_executable', 'importjs') + +function! ale#fixers#importjs#ProcessOutput(buffer, output) abort + let l:result = ale#util#FuzzyJSONDecode(a:output, []) + return split(get(l:result, 'fileContent', ''), "\n") +endfunction + +function! ale#fixers#importjs#Fix(buffer) abort + let l:executable = ale#Var(a:buffer, 'js_importjs_executable') + + if !executable(l:executable) + return 0 + endif + + return { + \ 'command': ale#Escape(l:executable) + \ . ' fix' + \ . ' %s', + \ 'process_with': 'ale#fixers#importjs#ProcessOutput', + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/isort.vim b/sources_non_forked/ale/autoload/ale/fixers/isort.vim new file mode 100644 index 00000000..b6318221 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/isort.vim @@ -0,0 +1,22 @@ +" Author: w0rp +" Description: Fixing Python imports with isort. + +call ale#Set('python_isort_executable', 'isort') +call ale#Set('python_isort_use_global', 0) + +function! ale#fixers#isort#Fix(buffer) abort + let l:executable = ale#python#FindExecutable( + \ a:buffer, + \ 'python_isort', + \ ['isort'], + \) + + if !executable(l:executable) + return 0 + endif + + return { + \ 'command': ale#path#BufferCdString(a:buffer) + \ . ale#Escape(l:executable) . ' -', + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/jq.vim b/sources_non_forked/ale/autoload/ale/fixers/jq.vim new file mode 100644 index 00000000..b0a43fe2 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/jq.vim @@ -0,0 +1,15 @@ +call ale#Set('json_jq_executable', 'jq') +call ale#Set('json_jq_options', '') + +function! ale#fixers#jq#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'json_jq_executable') +endfunction + +function! ale#fixers#jq#Fix(buffer) abort + let l:options = ale#Var(a:buffer, 'json_jq_options') + + return { + \ 'command': ale#Escape(ale#fixers#jq#GetExecutable(a:buffer)) + \ . ' . ' . l:options, + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/mix_format.vim b/sources_non_forked/ale/autoload/ale/fixers/mix_format.vim new file mode 100644 index 00000000..7a091701 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/mix_format.vim @@ -0,0 +1,25 @@ +" Author: carakan , Fernando Mendes +" Description: Fixing files with elixir formatter 'mix format'. + +call ale#Set('elixir_mix_executable', 'mix') +call ale#Set('elixir_mix_format_options', '') + +function! ale#fixers#mix_format#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'elixir_mix_executable') +endfunction + +function! ale#fixers#mix_format#GetCommand(buffer) abort + let l:executable = ale#Escape(ale#fixers#mix_format#GetExecutable(a:buffer)) + let l:options = ale#Var(a:buffer, 'elixir_mix_format_options') + + return l:executable . ' format' + \ . (!empty(l:options) ? ' ' . l:options : '') + \ . ' %t' +endfunction + +function! ale#fixers#mix_format#Fix(buffer) abort + return { + \ 'command': ale#fixers#mix_format#GetCommand(a:buffer), + \ 'read_temporary_file': 1, + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/php_cs_fixer.vim b/sources_non_forked/ale/autoload/ale/fixers/php_cs_fixer.vim new file mode 100644 index 00000000..56aa9150 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/php_cs_fixer.vim @@ -0,0 +1,23 @@ +" Author: Julien Deniau +" Description: Fixing files with php-cs-fixer. + +call ale#Set('php_cs_fixer_executable', 'php-cs-fixer') +call ale#Set('php_cs_fixer_use_global', 0) + +function! ale#fixers#php_cs_fixer#GetExecutable(buffer) abort + return ale#node#FindExecutable(a:buffer, 'php_cs_fixer', [ + \ 'vendor/bin/php-cs-fixer', + \ 'php-cs-fixer' + \]) +endfunction + +function! ale#fixers#php_cs_fixer#Fix(buffer) abort + let l:executable = ale#fixers#php_cs_fixer#GetExecutable(a:buffer) + return { + \ 'command': ale#Escape(l:executable) . ' fix %t', + \ 'read_temporary_file': 1, + \} +endfunction + + + diff --git a/sources_non_forked/ale/autoload/ale/fixers/phpcbf.vim b/sources_non_forked/ale/autoload/ale/fixers/phpcbf.vim new file mode 100644 index 00000000..649e17d3 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/phpcbf.vim @@ -0,0 +1,24 @@ +" Author: notomo +" Description: Fixing files with phpcbf. + +call ale#Set('php_phpcbf_standard', '') +call ale#Set('php_phpcbf_executable', 'phpcbf') +call ale#Set('php_phpcbf_use_global', 0) + +function! ale#fixers#phpcbf#GetExecutable(buffer) abort + return ale#node#FindExecutable(a:buffer, 'php_phpcbf', [ + \ 'vendor/bin/phpcbf', + \ 'phpcbf' + \]) +endfunction + +function! ale#fixers#phpcbf#Fix(buffer) abort + let l:executable = ale#fixers#phpcbf#GetExecutable(a:buffer) + let l:standard = ale#Var(a:buffer, 'php_phpcbf_standard') + let l:standard_option = !empty(l:standard) + \ ? '--standard=' . l:standard + \ : '' + return { + \ 'command': ale#Escape(l:executable) . ' --stdin-path=%s ' . l:standard_option . ' -' + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/prettier.vim b/sources_non_forked/ale/autoload/ale/fixers/prettier.vim new file mode 100644 index 00000000..d75299eb --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/prettier.vim @@ -0,0 +1,53 @@ +" Author: tunnckoCore (Charlike Mike Reagent) , +" w0rp , morhetz (Pavel Pertsev) +" Description: Integration of Prettier with ALE. + +call ale#Set('javascript_prettier_executable', 'prettier') +call ale#Set('javascript_prettier_use_global', 0) +call ale#Set('javascript_prettier_options', '') + +function! ale#fixers#prettier#GetExecutable(buffer) abort + return ale#node#FindExecutable(a:buffer, 'javascript_prettier', [ + \ 'node_modules/.bin/prettier_d', + \ 'node_modules/prettier-cli/index.js', + \ 'node_modules/.bin/prettier', + \]) +endfunction + +function! ale#fixers#prettier#Fix(buffer) abort + let l:executable = ale#fixers#prettier#GetExecutable(a:buffer) + + let l:command = ale#semver#HasVersion(l:executable) + \ ? '' + \ : ale#Escape(l:executable) . ' --version' + + return { + \ 'command': l:command, + \ 'chain_with': 'ale#fixers#prettier#ApplyFixForVersion', + \} +endfunction + +function! ale#fixers#prettier#ApplyFixForVersion(buffer, version_output) abort + let l:executable = ale#fixers#prettier#GetExecutable(a:buffer) + let l:options = ale#Var(a:buffer, 'javascript_prettier_options') + + let l:version = ale#semver#GetVersion(l:executable, a:version_output) + + " 1.4.0 is the first version with --stdin-filepath + if ale#semver#GTE(l:version, [1, 4, 0]) + return { + \ 'command': ale#path#BufferCdString(a:buffer) + \ . ale#Escape(l:executable) + \ . (!empty(l:options) ? ' ' . l:options : '') + \ . ' --stdin-filepath %s --stdin', + \} + endif + + return { + \ 'command': ale#Escape(l:executable) + \ . ' %t' + \ . (!empty(l:options) ? ' ' . l:options : '') + \ . ' --write', + \ 'read_temporary_file': 1, + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/prettier_eslint.vim b/sources_non_forked/ale/autoload/ale/fixers/prettier_eslint.vim new file mode 100644 index 00000000..5dd9102e --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/prettier_eslint.vim @@ -0,0 +1,66 @@ +" Author: tunnckoCore (Charlike Mike Reagent) , +" w0rp , morhetz (Pavel Pertsev) +" Description: Integration between Prettier and ESLint. + +function! ale#fixers#prettier_eslint#SetOptionDefaults() abort + call ale#Set('javascript_prettier_eslint_executable', 'prettier-eslint') + call ale#Set('javascript_prettier_eslint_use_global', 0) + call ale#Set('javascript_prettier_eslint_options', '') +endfunction + +call ale#fixers#prettier_eslint#SetOptionDefaults() + +function! ale#fixers#prettier_eslint#GetExecutable(buffer) abort + return ale#node#FindExecutable(a:buffer, 'javascript_prettier_eslint', [ + \ 'node_modules/prettier-eslint-cli/dist/index.js', + \ 'node_modules/.bin/prettier-eslint', + \]) +endfunction + +function! ale#fixers#prettier_eslint#Fix(buffer) abort + let l:executable = ale#fixers#prettier_eslint#GetExecutable(a:buffer) + + let l:command = ale#semver#HasVersion(l:executable) + \ ? '' + \ : ale#Escape(l:executable) . ' --version' + + return { + \ 'command': l:command, + \ 'chain_with': 'ale#fixers#prettier_eslint#ApplyFixForVersion', + \} +endfunction + +function! ale#fixers#prettier_eslint#ApplyFixForVersion(buffer, version_output) abort + let l:options = ale#Var(a:buffer, 'javascript_prettier_eslint_options') + let l:executable = ale#fixers#prettier_eslint#GetExecutable(a:buffer) + + let l:version = ale#semver#GetVersion(l:executable, a:version_output) + + " 4.2.0 is the first version with --eslint-config-path + let l:config = ale#semver#GTE(l:version, [4, 2, 0]) + \ ? ale#handlers#eslint#FindConfig(a:buffer) + \ : '' + let l:eslint_config_option = !empty(l:config) + \ ? ' --eslint-config-path ' . ale#Escape(l:config) + \ : '' + + " 4.4.0 is the first version with --stdin-filepath + if ale#semver#GTE(l:version, [4, 4, 0]) + return { + \ 'command': ale#path#BufferCdString(a:buffer) + \ . ale#Escape(l:executable) + \ . l:eslint_config_option + \ . (!empty(l:options) ? ' ' . l:options : '') + \ . ' --stdin-filepath %s --stdin', + \} + endif + + return { + \ 'command': ale#Escape(l:executable) + \ . ' %t' + \ . l:eslint_config_option + \ . (!empty(l:options) ? ' ' . l:options : '') + \ . ' --write', + \ 'read_temporary_file': 1, + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/prettier_standard.vim b/sources_non_forked/ale/autoload/ale/fixers/prettier_standard.vim new file mode 100644 index 00000000..7d938e19 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/prettier_standard.vim @@ -0,0 +1,24 @@ +" Author: sheerun (Adam Stankiewicz) +" Description: Integration of Prettier Standard with ALE. + +call ale#Set('javascript_prettier_standard_executable', 'prettier-standard') +call ale#Set('javascript_prettier_standard_use_global', 0) +call ale#Set('javascript_prettier_standard_options', '') + +function! ale#fixers#prettier_standard#GetExecutable(buffer) abort + return ale#node#FindExecutable(a:buffer, 'javascript_prettier_standard', [ + \ 'node_modules/prettier-standard/lib/index.js', + \ 'node_modules/.bin/prettier-standard', + \]) +endfunction + +function! ale#fixers#prettier_standard#Fix(buffer) abort + let l:options = ale#Var(a:buffer, 'javascript_prettier_standard_options') + + return { + \ 'command': ale#Escape(ale#fixers#prettier_standard#GetExecutable(a:buffer)) + \ . ' %t' + \ . ' ' . l:options, + \ 'read_temporary_file': 1, + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/puppetlint.vim b/sources_non_forked/ale/autoload/ale/fixers/puppetlint.vim new file mode 100644 index 00000000..81f34e89 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/puppetlint.vim @@ -0,0 +1,21 @@ +" Author: Alexander Olofsson +" Description: puppet-lint fixer + +if !exists('g:ale_puppet_puppetlint_executable') + let g:ale_puppet_puppetlint_executable = 'puppet-lint' +endif +if !exists('g:ale_puppet_puppetlint_options') + let g:ale_puppet_puppetlint_options = '' +endif + +function! ale#fixers#puppetlint#Fix(buffer) abort + let l:executable = ale#Var(a:buffer, 'puppet_puppetlint_executable') + + return { + \ 'command': ale#Escape(l:executable) + \ . ' ' . ale#Var(a:buffer, 'puppet_puppetlint_options') + \ . ' --fix' + \ . ' %t', + \ 'read_temporary_file': 1, + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/refmt.vim b/sources_non_forked/ale/autoload/ale/fixers/refmt.vim new file mode 100644 index 00000000..514f950a --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/refmt.vim @@ -0,0 +1,18 @@ +" Author: Ahmed El Gabri <@ahmedelgabri> +" Description: Integration of refmt with ALE. + +call ale#Set('reasonml_refmt_executable', 'refmt') +call ale#Set('reasonml_refmt_options', '') + +function! ale#fixers#refmt#Fix(buffer) abort + let l:executable = ale#Var(a:buffer, 'reasonml_refmt_executable') + let l:options = ale#Var(a:buffer, 'reasonml_refmt_options') + + return { + \ 'command': ale#Escape(l:executable) + \ . (empty(l:options) ? '' : ' ' . l:options) + \ . ' --in-place' + \ . ' %t', + \ 'read_temporary_file': 1, + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/rubocop.vim b/sources_non_forked/ale/autoload/ale/fixers/rubocop.vim new file mode 100644 index 00000000..35569b19 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/rubocop.vim @@ -0,0 +1,21 @@ +function! ale#fixers#rubocop#GetCommand(buffer) abort + let l:executable = ale#handlers#rubocop#GetExecutable(a:buffer) + let l:exec_args = l:executable =~? 'bundle$' + \ ? ' exec rubocop' + \ : '' + let l:config = ale#path#FindNearestFile(a:buffer, '.rubocop.yml') + let l:options = ale#Var(a:buffer, 'ruby_rubocop_options') + + return ale#Escape(l:executable) . l:exec_args + \ . (!empty(l:config) ? ' --config ' . ale#Escape(l:config) : '') + \ . (!empty(l:options) ? ' ' . l:options : '') + \ . ' --auto-correct %t' + +endfunction + +function! ale#fixers#rubocop#Fix(buffer) abort + return { + \ 'command': ale#fixers#rubocop#GetCommand(a:buffer), + \ 'read_temporary_file': 1, + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/rufo.vim b/sources_non_forked/ale/autoload/ale/fixers/rufo.vim new file mode 100644 index 00000000..01d537a9 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/rufo.vim @@ -0,0 +1,20 @@ +" Author: Fohte (Hayato Kawai) https://github.com/fohte +" Description: Integration of Rufo with ALE. + +call ale#Set('ruby_rufo_executable', 'rufo') + +function! ale#fixers#rufo#GetCommand(buffer) abort + let l:executable = ale#Var(a:buffer, 'ruby_rufo_executable') + let l:exec_args = l:executable =~? 'bundle$' + \ ? ' exec rufo' + \ : '' + + return ale#Escape(l:executable) . l:exec_args . ' %t' +endfunction + +function! ale#fixers#rufo#Fix(buffer) abort + return { + \ 'command': ale#fixers#rufo#GetCommand(a:buffer), + \ 'read_temporary_file': 1, + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/rustfmt.vim b/sources_non_forked/ale/autoload/ale/fixers/rustfmt.vim new file mode 100644 index 00000000..38882fbf --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/rustfmt.vim @@ -0,0 +1,15 @@ +" Author: Kelly Fox +" Description: Integration of rustfmt with ALE. + +call ale#Set('rust_rustfmt_executable', 'rustfmt') +call ale#Set('rust_rustfmt_options', '') + +function! ale#fixers#rustfmt#Fix(buffer) abort + let l:executable = ale#Var(a:buffer, 'rust_rustfmt_executable') + let l:options = ale#Var(a:buffer, 'rust_rustfmt_options') + + return { + \ 'command': ale#Escape(l:executable) + \ . (empty(l:options) ? '' : ' ' . l:options), + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/shfmt.vim b/sources_non_forked/ale/autoload/ale/fixers/shfmt.vim new file mode 100644 index 00000000..882cf3a4 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/shfmt.vim @@ -0,0 +1,17 @@ +scriptencoding utf-8 +" Author: Simon Bugert +" Description: Fix sh files with shfmt. + +call ale#Set('sh_shfmt_executable', 'shfmt') +call ale#Set('sh_shfmt_options', '') + +function! ale#fixers#shfmt#Fix(buffer) abort + let l:executable = ale#Var(a:buffer, 'sh_shfmt_executable') + let l:options = ale#Var(a:buffer, 'sh_shfmt_options') + + return { + \ 'command': ale#Escape(l:executable) + \ . (empty(l:options) ? '' : ' ' . l:options) + \} + +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/standard.vim b/sources_non_forked/ale/autoload/ale/fixers/standard.vim new file mode 100644 index 00000000..c998cfd0 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/standard.vim @@ -0,0 +1,23 @@ +" Author: Sumner Evans +" Description: Fixing files with Standard. + +call ale#Set('javascript_standard_executable', 'standard') +call ale#Set('javascript_standard_use_global', 0) +call ale#Set('javascript_standard_options', '') + +function! ale#fixers#standard#GetExecutable(buffer) abort + return ale#node#FindExecutable(a:buffer, 'javascript_standard', [ + \ 'node_modules/standard/bin/cmd.js', + \ 'node_modules/.bin/standard', + \]) +endfunction + +function! ale#fixers#standard#Fix(buffer) abort + let l:executable = ale#fixers#standard#GetExecutable(a:buffer) + + return { + \ 'command': ale#node#Executable(a:buffer, l:executable) + \ . ' --fix %t', + \ 'read_temporary_file': 1, + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/stylelint.vim b/sources_non_forked/ale/autoload/ale/fixers/stylelint.vim new file mode 100644 index 00000000..899fcf4e --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/stylelint.vim @@ -0,0 +1,23 @@ +" Author: Mahmoud Mostafa +" Description: Fixing files with stylelint. + +call ale#Set('stylelint_executable', 'stylelint') +call ale#Set('stylelint_use_global', 0) + +function! ale#fixers#stylelint#GetExecutable(buffer) abort + return ale#node#FindExecutable(a:buffer, 'stylelint', [ + \ 'node_modules/stylelint/bin/stylelint.js', + \ 'node_modules/.bin/stylelint', + \]) +endfunction + + +function! ale#fixers#stylelint#Fix(buffer) abort + let l:executable = ale#fixers#stylelint#GetExecutable(a:buffer) + + return { + \ 'command': ale#node#Executable(a:buffer, l:executable) + \ . ' --fix %t', + \ 'read_temporary_file': 1, + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/swiftformat.vim b/sources_non_forked/ale/autoload/ale/fixers/swiftformat.vim new file mode 100644 index 00000000..dcc204b1 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/swiftformat.vim @@ -0,0 +1,25 @@ +" Author: gfontenot (Gordon Fontenot) +" Description: Integration of SwiftFormat with ALE. + +call ale#Set('swift_swiftformat_executable', 'swiftformat') +call ale#Set('swift_swiftformat_use_global', 0) +call ale#Set('swift_swiftformat_options', '') + +function! ale#fixers#swiftformat#GetExecutable(buffer) abort + return ale#node#FindExecutable(a:buffer, 'swift_swiftformat', [ + \ 'Pods/SwiftFormat/CommandLineTool/swiftformat', + \ 'ios/Pods/SwiftFormat/CommandLineTool/swiftformat', + \ 'swiftformat', + \]) +endfunction + +function! ale#fixers#swiftformat#Fix(buffer) abort + let l:options = ale#Var(a:buffer, 'swift_swiftformat_options') + + return { + \ 'read_temporary_file': 1, + \ 'command': ale#Escape(ale#fixers#swiftformat#GetExecutable(a:buffer)) + \ . ' %t' + \ . ' ' . l:options, + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/tslint.vim b/sources_non_forked/ale/autoload/ale/fixers/tslint.vim new file mode 100644 index 00000000..4d905a08 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/tslint.vim @@ -0,0 +1,22 @@ +" Author: carakan +" Description: Fixing files with tslint. + +function! ale#fixers#tslint#Fix(buffer) abort + let l:executable = ale_linters#typescript#tslint#GetExecutable(a:buffer) + + let l:tslint_config_path = ale#path#ResolveLocalPath( + \ a:buffer, + \ 'tslint.json', + \ ale#Var(a:buffer, 'typescript_tslint_config_path') + \) + let l:tslint_config_option = !empty(l:tslint_config_path) + \ ? ' -c ' . ale#Escape(l:tslint_config_path) + \ : '' + + return { + \ 'command': ale#node#Executable(a:buffer, l:executable) + \ . l:tslint_config_option + \ . ' --fix %t', + \ 'read_temporary_file': 1, + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/yapf.vim b/sources_non_forked/ale/autoload/ale/fixers/yapf.vim new file mode 100644 index 00000000..ba7453b8 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/yapf.vim @@ -0,0 +1,26 @@ +" Author: w0rp +" Description: Fixing Python files with yapf. + +call ale#Set('python_yapf_executable', 'yapf') +call ale#Set('python_yapf_use_global', 0) + +function! ale#fixers#yapf#Fix(buffer) abort + let l:executable = ale#python#FindExecutable( + \ a:buffer, + \ 'python_yapf', + \ ['yapf'], + \) + + if !executable(l:executable) + return 0 + endif + + let l:config = ale#path#FindNearestFile(a:buffer, '.style.yapf') + let l:config_options = !empty(l:config) + \ ? ' --no-local-style --style ' . ale#Escape(l:config) + \ : '' + + return { + \ 'command': ale#Escape(l:executable) . l:config_options, + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/gradle.vim b/sources_non_forked/ale/autoload/ale/gradle.vim new file mode 100644 index 00000000..dc377fb9 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/gradle.vim @@ -0,0 +1,67 @@ +" Author: Michael Pardo +" Description: Functions for working with Gradle projects. + +let s:script_path = fnamemodify(resolve(expand(':p')), ':h') +let s:init_path = has('win32') +\ ? s:script_path . '\gradle\init.gradle' +\ : s:script_path . '/gradle/init.gradle' + +function! ale#gradle#GetInitPath() abort + return s:init_path +endfunction + +" Given a buffer number, find a Gradle project root. +function! ale#gradle#FindProjectRoot(buffer) abort + let l:gradlew_path = ale#path#FindNearestFile(a:buffer, 'gradlew') + + if !empty(l:gradlew_path) + return fnamemodify(l:gradlew_path, ':h') + endif + + let l:settings_path = ale#path#FindNearestFile(a:buffer, 'settings.gradle') + + if !empty(l:settings_path) + return fnamemodify(l:settings_path, ':h') + endif + + let l:build_path = ale#path#FindNearestFile(a:buffer, 'build.gradle') + + if !empty(l:build_path) + return fnamemodify(l:build_path, ':h') + endif + + return '' +endfunction + +" Given a buffer number, find the path to the executable. +" First search on the path for 'gradlew', if nothing is found, try the global +" command. Returns an empty string if cannot find the executable. +function! ale#gradle#FindExecutable(buffer) abort + let l:gradlew_path = ale#path#FindNearestFile(a:buffer, 'gradlew') + + if !empty(l:gradlew_path) + return l:gradlew_path + endif + + if executable('gradle') + return 'gradle' + endif + + return '' +endfunction + +" Given a buffer number, build a command to print the classpath of the root +" project. Returns an empty string if cannot build the command. +function! ale#gradle#BuildClasspathCommand(buffer) abort + let l:executable = ale#gradle#FindExecutable(a:buffer) + let l:project_root = ale#gradle#FindProjectRoot(a:buffer) + + if !empty(l:executable) && !empty(l:project_root) + return ale#path#CdString(l:project_root) + \ . ale#Escape(l:executable) + \ . ' -I ' . ale#Escape(s:init_path) + \ . ' -q printClasspath' + endif + + return '' +endfunction diff --git a/sources_non_forked/ale/autoload/ale/gradle/init.gradle b/sources_non_forked/ale/autoload/ale/gradle/init.gradle new file mode 100644 index 00000000..fb1db9ee --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/gradle/init.gradle @@ -0,0 +1,23 @@ +class ClasspathPlugin implements Plugin { + void apply(Project project) { + project.task('printClasspath') { + doLast { + project + .rootProject + .allprojects + .configurations + .flatten() + .findAll { it.name.endsWith('Classpath') } + .collect { it.resolve() } + .flatten() + .unique() + .findAll { it.exists() } + .each { println it } + } + } + } +} + +rootProject { + apply plugin: ClasspathPlugin +} diff --git a/sources_non_forked/ale/autoload/ale/handlers/alex.vim b/sources_non_forked/ale/autoload/ale/handlers/alex.vim new file mode 100644 index 00000000..853d3137 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/handlers/alex.vim @@ -0,0 +1,22 @@ +" Author: Johannes Wienke +" Description: Error handling for errors in alex output format + +function! ale#handlers#alex#Handle(buffer, lines) abort + " Example output: + " 6:256-6:262 warning Be careful with “killed”, it’s profane in some cases killed retext-profanities + let l:pattern = '^ *\(\d\+\):\(\d\+\)-\(\d\+\):\(\d\+\) \+warning \+\(.\{-\}\) \+\(.\{-\}\) \+\(.\{-\}\)$' + 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, + \ 'end_lnum': l:match[3] + 0, + \ 'end_col': l:match[4] - 1, + \ 'text': l:match[5] . ' (' . (l:match[7]) . ')', + \ 'type': 'W', + \}) + endfor + + return l:output +endfunction diff --git a/sources_non_forked/ale/autoload/ale/handlers/cppcheck.vim b/sources_non_forked/ale/autoload/ale/handlers/cppcheck.vim new file mode 100644 index 00000000..dc56cd0b --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/handlers/cppcheck.vim @@ -0,0 +1,21 @@ +" Description: Handle errors for cppcheck. + +function! ale#handlers#cppcheck#HandleCppCheckFormat(buffer, lines) abort + " Look for lines like the following. + " + " [test.cpp:5]: (error) Array 'a[10]' accessed at index 10, which is out of bounds + let l:pattern = '\v^\[(.+):(\d+)\]: \(([a-z]+)\) (.+)$' + let l:output = [] + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + if ale#path#IsBufferPath(a:buffer, l:match[1]) + call add(l:output, { + \ 'lnum': str2nr(l:match[2]), + \ 'type': l:match[3] is# 'error' ? 'E' : 'W', + \ 'text': l:match[4], + \}) + endif + endfor + + return l:output +endfunction diff --git a/sources_non_forked/ale/autoload/ale/handlers/cpplint.vim b/sources_non_forked/ale/autoload/ale/handlers/cpplint.vim new file mode 100644 index 00000000..5c475a5c --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/handlers/cpplint.vim @@ -0,0 +1,21 @@ +" Author: Dawid Kurek https://github.com/dawikur +" Description: Handle errors for cpplint. + +function! ale#handlers#cpplint#HandleCppLintFormat(buffer, lines) abort + " Look for lines like the following. + " test.cpp:5: Estra space after ( in function call [whitespace/parents] [4] + 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, + \ 'col': 0, + \ 'text': join(split(l:match[2])), + \ 'code': l:match[3], + \ 'type': 'W', + \}) + endfor + + return l:output +endfunction diff --git a/sources_non_forked/ale/autoload/ale/handlers/css.vim b/sources_non_forked/ale/autoload/ale/handlers/css.vim new file mode 100644 index 00000000..de9eadcc --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/handlers/css.vim @@ -0,0 +1,70 @@ +scriptencoding utf-8 +" Author: w0rp +" Description: Error handling for CSS linters. + +function! ale#handlers#css#HandleCSSLintFormat(buffer, lines) abort + " Matches patterns line the following: + " + " something.css: line 2, col 1, Error - Expected RBRACE at line 2, col 1. (errors) + " something.css: line 2, col 5, Warning - Expected (inline | block | list-item | inline-block | table | inline-table | table-row-group | table-header-group | table-footer-group | table-row | table-column-group | table-column | table-cell | table-caption | grid | inline-grid | run-in | ruby | ruby-base | ruby-text | ruby-base-container | ruby-text-container | contents | none | -moz-box | -moz-inline-block | -moz-inline-box | -moz-inline-grid | -moz-inline-stack | -moz-inline-table | -moz-grid | -moz-grid-group | -moz-grid-line | -moz-groupbox | -moz-deck | -moz-popup | -moz-stack | -moz-marker | -webkit-box | -webkit-inline-box | -ms-flexbox | -ms-inline-flexbox | flex | -webkit-flex | inline-flex | -webkit-inline-flex) but found 'wat'. (known-properties) + " + " These errors can be very massive, so the type will be moved to the front + " so you can actually read the error type. + let l:pattern = '\v^.*: line (\d+), col (\d+), (Error|Warning) - (.+)$' + let l:output = [] + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + let l:item = { + \ 'lnum': l:match[1] + 0, + \ 'col': l:match[2] + 0, + \ 'type': l:match[3] is# 'Warning' ? 'W' : 'E', + \ 'text': l:match[4], + \} + + let l:code_match = matchlist(l:match[4], '\v(.+) \(([^(]+)\)$') + + " Split up the error code and the text if we find one. + if !empty(l:code_match) + let l:item.text = l:code_match[1] + let l:item.code = l:code_match[2] + endif + + call add(l:output, l:item) + endfor + + return l:output +endfunction + +function! ale#handlers#css#HandleStyleLintFormat(buffer, lines) abort + let l:exception_pattern = '\v^Error:' + + for l:line in a:lines[:10] + if len(matchlist(l:line, l:exception_pattern)) > 0 + return [{ + \ 'lnum': 1, + \ 'text': 'stylelint exception thrown (type :ALEDetail for more information)', + \ 'detail': join(a:lines, "\n"), + \}] + endif + endfor + + " Matches patterns line the following: + " + " src/main.css + " 108:10 ✖ Unexpected leading zero number-leading-zero + " 116:20 ✖ Expected a trailing semicolon declaration-block-trailing-semicolon + let l:pattern = '\v^.* (\d+):(\d+) \s+(\S+)\s+ (.*[^ ])\s+([^ ]+)\s*$' + 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, + \ 'type': l:match[3] is# '✖' ? 'E' : 'W', + \ 'text': l:match[4], + \ 'code': l:match[5], + \}) + endfor + + return l:output +endfunction diff --git a/sources_non_forked/ale/autoload/ale/handlers/eslint.vim b/sources_non_forked/ale/autoload/ale/handlers/eslint.vim new file mode 100644 index 00000000..ff590162 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/handlers/eslint.vim @@ -0,0 +1,153 @@ +" Author: w0rp +" Description: Functions for working with eslint, for checking or fixing files. + +let s:sep = has('win32') ? '\' : '/' + +call ale#Set('javascript_eslint_options', '') +call ale#Set('javascript_eslint_executable', 'eslint') +call ale#Set('javascript_eslint_use_global', 0) +call ale#Set('javascript_eslint_suppress_eslintignore', 0) +call ale#Set('javascript_eslint_suppress_missing_config', 0) + +function! ale#handlers#eslint#FindConfig(buffer) abort + for l:path in ale#path#Upwards(expand('#' . a:buffer . ':p:h')) + for l:basename in [ + \ '.eslintrc.js', + \ '.eslintrc.yaml', + \ '.eslintrc.yml', + \ '.eslintrc.json', + \ '.eslintrc', + \] + let l:config = ale#path#Simplify(join([l:path, l:basename], s:sep)) + + if filereadable(l:config) + return l:config + endif + endfor + endfor + + return ale#path#FindNearestFile(a:buffer, 'package.json') +endfunction + +function! ale#handlers#eslint#GetExecutable(buffer) abort + return ale#node#FindExecutable(a:buffer, 'javascript_eslint', [ + \ 'node_modules/.bin/eslint_d', + \ 'node_modules/eslint/bin/eslint.js', + \ 'node_modules/.bin/eslint', + \]) +endfunction + +function! ale#handlers#eslint#GetCommand(buffer) abort + let l:executable = ale#handlers#eslint#GetExecutable(a:buffer) + + let l:options = ale#Var(a:buffer, 'javascript_eslint_options') + + return ale#node#Executable(a:buffer, l:executable) + \ . (!empty(l:options) ? ' ' . l:options : '') + \ . ' -f unix --stdin --stdin-filename %s' +endfunction + +let s:col_end_patterns = [ +\ '\vParsing error: Unexpected token (.+) ?', +\ '\v''(.+)'' is not defined.', +\ '\v%(Unexpected|Redundant use of) [''`](.+)[''`]', +\ '\vUnexpected (console) statement', +\] + +function! s:AddHintsForTypeScriptParsingErrors(output) abort + for l:item in a:output + let l:item.text = substitute( + \ l:item.text, + \ '^\(Parsing error\)', + \ '\1 (You may need configure typescript-eslint-parser)', + \ '', + \) + endfor +endfunction + +function! s:CheckForBadConfig(buffer, lines) abort + let l:config_error_pattern = '\v^ESLint couldn''t find a configuration file' + \ . '|^Cannot read config file' + \ . '|^.*Configuration for rule .* is invalid' + \ . '|^ImportDeclaration should appear' + + " Look for a message in the first few lines which indicates that + " a configuration file couldn't be found. + for l:line in a:lines[:10] + let l:match = matchlist(l:line, l:config_error_pattern) + + if len(l:match) > 0 + " Don't show the missing config error if we've disabled it. + if ale#Var(a:buffer, 'javascript_eslint_suppress_missing_config') + \&& l:match[0] is# 'ESLint couldn''t find a configuration file' + return 0 + endif + + return 1 + endif + endfor + + return 0 +endfunction + +function! ale#handlers#eslint#Handle(buffer, lines) abort + if s:CheckForBadConfig(a:buffer, a:lines) + return [{ + \ 'lnum': 1, + \ 'text': 'eslint configuration error (type :ALEDetail for more information)', + \ 'detail': join(a:lines, "\n"), + \}] + endif + + " Matches patterns line the following: + " + " /path/to/some-filename.js:47:14: Missing trailing comma. [Warning/comma-dangle] + " /path/to/some-filename.js:56:41: Missing semicolon. [Error/semi] + let l:pattern = '^.*:\(\d\+\):\(\d\+\): \(.\+\) \[\(.\+\)\]$' + " This second pattern matches lines like the following: + " + " /path/to/some-filename.js:13:3: Parsing error: Unexpected token + let l:parsing_pattern = '^.*:\(\d\+\):\(\d\+\): \(.\+\)$' + let l:output = [] + + for l:match in ale#util#GetMatches(a:lines, [l:pattern, l:parsing_pattern]) + let l:text = l:match[3] + + if ale#Var(a:buffer, 'javascript_eslint_suppress_eslintignore') + if l:text is# 'File ignored because of a matching ignore pattern. Use "--no-ignore" to override.' + continue + endif + endif + + let l:obj = { + \ 'lnum': l:match[1] + 0, + \ 'col': l:match[2] + 0, + \ 'text': l:text, + \ 'type': 'E', + \} + + " Take the error type from the output if available. + let l:split_code = split(l:match[4], '/') + + if get(l:split_code, 0, '') is# 'Warning' + let l:obj.type = 'W' + endif + + " The code can be something like 'Error/foo/bar', or just 'Error' + if !empty(get(l:split_code, 1)) + let l:obj.code = join(l:split_code[1:], '/') + endif + + for l:col_match in ale#util#GetMatches(l:text, s:col_end_patterns) + let l:obj.end_col = l:obj.col + len(l:col_match[1]) - 1 + endfor + + call add(l:output, l:obj) + endfor + + if expand('#' . a:buffer . ':t') =~? '\.tsx\?$' + call s:AddHintsForTypeScriptParsingErrors(l:output) + endif + + return l:output +endfunction diff --git a/sources_non_forked/ale/autoload/ale/handlers/flawfinder.vim b/sources_non_forked/ale/autoload/ale/handlers/flawfinder.vim new file mode 100644 index 00000000..a650d6dd --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/handlers/flawfinder.vim @@ -0,0 +1,47 @@ +" Author: Christian Gibbons +" Description: This file defines a handler function that should work for the +" flawfinder format with the -CDQS flags. + +" Swiped this function from the GCC handler. Not sure if needed, but doesn't +" hurt to have it. +function! s:RemoveUnicodeQuotes(text) abort + let l:text = a:text + let l:text = substitute(l:text, '[`´‘’]', '''', 'g') + let l:text = substitute(l:text, '\v\\u2018([^\\]+)\\u2019', '''\1''', 'g') + let l:text = substitute(l:text, '[“”]', '"', 'g') + + return l:text +endfunction + +function! ale#handlers#flawfinder#HandleFlawfinderFormat(buffer, lines) abort + " Look for lines like the following. + " + " :12:4: [2] (buffer) char:Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. + " :31:4: [1] (buffer) strncpy:Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). + let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):(\d+)?:? ( \[[0-5]\] [^:]+):(.+)$' + let l:output = [] + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + " Use severity level to determine if it should be considered a warning + " or error. + let l:severity = str2nr(matchstr(split(l:match[4])[0], '[0-5]')) + + let l:item = { + \ 'lnum': str2nr(l:match[2]), + \ 'col': str2nr(l:match[3]), + \ 'type': (l:severity < ale#Var(a:buffer, 'c_flawfinder_error_severity')) + \ ? 'W' : 'E', + \ 'text': s:RemoveUnicodeQuotes(join(split(l:match[4])[1:]) . ': ' . l:match[5]), + \} + + " If the filename is something like , or -, then + " this is an error for the file we checked. + if l:match[1] isnot# '-' && l:match[1][0] isnot# '<' + let l:item['filename'] = l:match[1] + endif + + call add(l:output, l:item) + endfor + + return l:output +endfunction diff --git a/sources_non_forked/ale/autoload/ale/handlers/gawk.vim b/sources_non_forked/ale/autoload/ale/handlers/gawk.vim new file mode 100644 index 00000000..942bc2b2 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/handlers/gawk.vim @@ -0,0 +1,25 @@ +" Author: Anthony DeDominic +" Description: Handle output from gawk's --lint option + +function! ale#handlers#gawk#HandleGawkFormat(buffer, lines) abort + " Look for lines like the following: + " gawk: /tmp/v0fddXz/1/something.awk:1: ^ invalid char ''' in expression + let l:pattern = '^.\{-}:\(\d\+\):\s\+\(warning:\|\^\)\s*\(.*\)' + let l:output = [] + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + let l:ecode = 'E' + if l:match[2] is? 'warning:' + let l:ecode = 'W' + endif + call add(l:output, { + \ 'lnum': l:match[1] + 0, + \ 'col': 0, + \ 'text': l:match[3], + \ 'code': 0, + \ 'type': l:ecode, + \}) + endfor + + return l:output +endfunction diff --git a/sources_non_forked/ale/autoload/ale/handlers/gcc.vim b/sources_non_forked/ale/autoload/ale/handlers/gcc.vim new file mode 100644 index 00000000..9ec7b110 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/handlers/gcc.vim @@ -0,0 +1,69 @@ +scriptencoding utf-8 +" Author: w0rp +" Description: This file defines a handler function which ought to work for +" any program which outputs errors in the format that GCC uses. + +let s:pragma_error = '#pragma once in main file' + +function! s:IsHeaderFile(filename) abort + return a:filename =~? '\v\.(h|hpp)$' +endfunction + +function! s:RemoveUnicodeQuotes(text) abort + let l:text = a:text + let l:text = substitute(l:text, '[`´‘’]', '''', 'g') + let l:text = substitute(l:text, '\v\\u2018([^\\]+)\\u2019', '''\1''', 'g') + let l:text = substitute(l:text, '[“”]', '"', 'g') + + return l:text +endfunction + +function! ale#handlers#gcc#HandleGCCFormat(buffer, lines) abort + " Look for lines like the following. + " + " :8:5: warning: conversion lacks type at end of format [-Wformat=] + " :10:27: error: invalid operands to binary - (have ‘int’ and ‘char *’) + " -:189:7: note: $/${} is unnecessary on arithmetic variables. [SC2004] + let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):(\d+)?:? ([^:]+): (.+)$' + let l:output = [] + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + " Filter out the pragma errors + if s:IsHeaderFile(bufname(bufnr(''))) + \&& l:match[5][:len(s:pragma_error) - 1] is# s:pragma_error + continue + endif + + " If the 'error type' is a note, make it detail related to + " the previous error parsed in output + if l:match[4] is# 'note' + if !empty(l:output) + let l:output[-1]['detail'] = + \ get(l:output[-1], 'detail', '') + \ . s:RemoveUnicodeQuotes(l:match[0]) . "\n" + endif + + continue + endif + + let l:item = { + \ 'lnum': str2nr(l:match[2]), + \ 'type': l:match[4] is# 'error' ? 'E' : 'W', + \ 'text': s:RemoveUnicodeQuotes(l:match[5]), + \} + + if !empty(l:match[3]) + let l:item.col = str2nr(l:match[3]) + endif + + " If the filename is something like , or -, then + " this is an error for the file we checked. + if l:match[1] isnot# '-' && l:match[1][0] isnot# '<' + let l:item['filename'] = l:match[1] + endif + + call add(l:output, l:item) + endfor + + return l:output +endfunction diff --git a/sources_non_forked/ale/autoload/ale/handlers/go.vim b/sources_non_forked/ale/autoload/ale/handlers/go.vim new file mode 100644 index 00000000..224df664 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/handlers/go.vim @@ -0,0 +1,25 @@ +" Author: neersighted +" Description: go vet for Go files +" +" Author: John Eikenberry +" Description: updated to work with go1.10 +" +" Author: Ben Paxton +" Description: moved to generic Golang file from govet + +function! ale#handlers#go#Handler(buffer, lines) abort + let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):?(\d+)?:? ?(.+)$' + let l:output = [] + let l:dir = expand('#' . a:buffer . ':p:h') + + 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, + \ 'text': l:match[4], + \ 'type': 'E', + \}) + endfor + return l:output +endfunction diff --git a/sources_non_forked/ale/autoload/ale/handlers/haskell.vim b/sources_non_forked/ale/autoload/ale/handlers/haskell.vim new file mode 100644 index 00000000..8a0d0013 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/handlers/haskell.vim @@ -0,0 +1,91 @@ +" Author: w0rp +" Description: Error handling for the format GHC outputs. + +" Remember the directory used for temporary files for Vim. +let s:temp_dir = fnamemodify(tempname(), ':h') +" Build part of a regular expression for matching ALE temporary filenames. +let s:temp_regex_prefix = +\ '\M' +\ . substitute(s:temp_dir, '\\', '\\\\', 'g') +\ . '\.\{-}' + +function! ale#handlers#haskell#HandleGHCFormat(buffer, lines) abort + " Look for lines like the following. + " + "Appoint/Lib.hs:8:1: warning: + "Appoint/Lib.hs:8:1: + let l:basename = expand('#' . a:buffer . ':t') + " Build a complete regular expression for replacing temporary filenames + " in Haskell error messages with the basename for this file. + let l:temp_filename_regex = s:temp_regex_prefix . l:basename + + let l:pattern = '\v^\s*([a-zA-Z]?:?[^:]+):(\d+):(\d+):(.*)?$' + let l:output = [] + + let l:corrected_lines = [] + + " Group the lines into smaller lists. + for l:line in a:lines + if len(matchlist(l:line, l:pattern)) > 0 + call add(l:corrected_lines, [l:line]) + elseif l:line is# '' + call add(l:corrected_lines, [l:line]) + elseif len(l:corrected_lines) > 0 + call add(l:corrected_lines[-1], l:line) + endif + endfor + + for l:line_list in l:corrected_lines + " Join the smaller lists into one large line to parse. + let l:line = l:line_list[0] + + for l:extra_line in l:line_list[1:] + let l:line .= substitute(l:extra_line, '\v^\s+', ' ', '') + endfor + + let l:match = matchlist(l:line, l:pattern) + + if len(l:match) == 0 + continue + endif + + if !ale#path#IsBufferPath(a:buffer, l:match[1]) + continue + endif + + let l:errors = matchlist(l:match[4], '\v([wW]arning|[eE]rror): ?(.*)') + + if len(l:errors) > 0 + let l:ghc_type = l:errors[1] + let l:text = l:errors[2] + else + let l:ghc_type = '' + let l:text = l:match[4][:0] is# ' ' ? l:match[4][1:] : l:match[4] + endif + + if l:ghc_type is? 'Warning' + let l:type = 'W' + else + let l:type = 'E' + endif + + " Replace temporary filenames in problem messages with the basename + let l:text = substitute(l:text, l:temp_filename_regex, l:basename, 'g') + + let l:item = { + \ 'lnum': l:match[2] + 0, + \ 'col': l:match[3] + 0, + \ 'text': l:text, + \ 'type': l:type, + \} + + " Include extra lines as details if they are there. + if len(l:line_list) > 1 + let l:item.detail = join(l:line_list[1:], "\n") + endif + + call add(l:output, l:item) + endfor + + return l:output +endfunction diff --git a/sources_non_forked/ale/autoload/ale/handlers/markdownlint.vim b/sources_non_forked/ale/autoload/ale/handlers/markdownlint.vim new file mode 100644 index 00000000..12fc501c --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/handlers/markdownlint.vim @@ -0,0 +1,17 @@ +" Author: Ty-Lucas Kelley +" Description: Adds support for markdownlint + +function! ale#handlers#markdownlint#Handle(buffer, lines) abort + let l:pattern=': \(\d*\): \(MD\d\{3}\)\(\/\)\([A-Za-z0-9-]\+\)\(.*\)$' + let l:output=[] + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + call add(l:output, { + \ 'lnum': l:match[1] + 0, + \ 'text': '(' . l:match[2] . l:match[3] . l:match[4] . ')' . l:match[5], + \ 'type': 'W', + \ }) + endfor + + return l:output +endfunction diff --git a/sources_non_forked/ale/autoload/ale/handlers/ols.vim b/sources_non_forked/ale/autoload/ale/handlers/ols.vim new file mode 100644 index 00000000..1dda7f92 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/handlers/ols.vim @@ -0,0 +1,25 @@ +" Author: Michael Jungo +" Description: Handlers for the OCaml language server + +function! ale#handlers#ols#GetExecutable(buffer) abort + let l:ols_setting = ale#handlers#ols#GetLanguage(a:buffer) . '_ols' + return ale#node#FindExecutable(a:buffer, l:ols_setting, [ + \ 'node_modules/.bin/ocaml-language-server', + \]) +endfunction + +function! ale#handlers#ols#GetCommand(buffer) abort + let l:executable = ale#handlers#ols#GetExecutable(a:buffer) + + return ale#node#Executable(a:buffer, l:executable) . ' --stdio' +endfunction + +function! ale#handlers#ols#GetLanguage(buffer) abort + return getbufvar(a:buffer, '&filetype') +endfunction + +function! ale#handlers#ols#GetProjectRoot(buffer) abort + let l:merlin_file = ale#path#FindNearestFile(a:buffer, '.merlin') + + return !empty(l:merlin_file) ? fnamemodify(l:merlin_file, ':h') : '' +endfunction diff --git a/sources_non_forked/ale/autoload/ale/handlers/pony.vim b/sources_non_forked/ale/autoload/ale/handlers/pony.vim new file mode 100644 index 00000000..0ac18e76 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/handlers/pony.vim @@ -0,0 +1,34 @@ +scriptencoding utf-8 +" Description: This file defines a handler function which ought to work for +" any program which outputs errors in the format that ponyc uses. + +function! s:RemoveUnicodeQuotes(text) abort + let l:text = a:text + let l:text = substitute(l:text, '[`´‘’]', '''', 'g') + let l:text = substitute(l:text, '\v\\u2018([^\\]+)\\u2019', '''\1''', 'g') + let l:text = substitute(l:text, '[“”]', '"', 'g') + + return l:text +endfunction + +function! ale#handlers#pony#HandlePonycFormat(buffer, lines) abort + " Look for lines like the following. + " /home/code/pony/classes/Wombat.pony:22:30: can't lookup private fields from outside the type + + let l:pattern = '\v^([^:]+):(\d+):(\d+)?:? (.+)$' + let l:output = [] + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + let l:item = { + \ 'filename': l:match[1], + \ 'lnum': str2nr(l:match[2]), + \ 'col': str2nr(l:match[3]), + \ 'type': 'E', + \ 'text': s:RemoveUnicodeQuotes(l:match[4]), + \} + + call add(l:output, l:item) + endfor + + return l:output +endfunction diff --git a/sources_non_forked/ale/autoload/ale/handlers/rails_best_practices.vim b/sources_non_forked/ale/autoload/ale/handlers/rails_best_practices.vim new file mode 100644 index 00000000..51bafbb0 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/handlers/rails_best_practices.vim @@ -0,0 +1,6 @@ +call ale#Set('ruby_rails_best_practices_options', '') +call ale#Set('ruby_rails_best_practices_executable', 'rails_best_practices') + +function! ale#handlers#rails_best_practices#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'ruby_rails_best_practices_executable') +endfunction diff --git a/sources_non_forked/ale/autoload/ale/handlers/redpen.vim b/sources_non_forked/ale/autoload/ale/handlers/redpen.vim new file mode 100644 index 00000000..c136789c --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/handlers/redpen.vim @@ -0,0 +1,56 @@ +" Author: rhysd https://rhysd.github.io +" Description: Redpen, a proofreading tool (http://redpen.cc) + +function! ale#handlers#redpen#HandleRedpenOutput(buffer, lines) abort + " Only one file was passed to redpen. So response array has only one + " element. + let l:res = json_decode(join(a:lines))[0] + let l:output = [] + for l:err in l:res.errors + let l:item = { + \ 'text': l:err.message, + \ 'type': 'W', + \ 'code': l:err.validator, + \} + if has_key(l:err, 'startPosition') + let l:item.lnum = l:err.startPosition.lineNum + let l:item.col = l:err.startPosition.offset + 1 + if has_key(l:err, 'endPosition') + let l:item.end_lnum = l:err.endPosition.lineNum + let l:item.end_col = l:err.endPosition.offset + endif + else + " Fallback to a whole sentence region when a region is not + " specified by the error. + let l:item.lnum = l:err.lineNum + let l:item.col = l:err.sentenceStartColumnNum + 1 + endif + + " Adjust column number for multibyte string + let l:line = getline(l:item.lnum) + if l:line is# '' + let l:line = l:err.sentence + endif + let l:line = split(l:line, '\zs') + + if l:item.col >= 2 + let l:col = 0 + for l:strlen in map(l:line[0:(l:item.col - 2)], 'strlen(v:val)') + let l:col = l:col + l:strlen + endfor + let l:item.col = l:col + 1 + endif + + if has_key(l:item, 'end_col') + let l:col = 0 + for l:strlen in map(l:line[0:(l:item.end_col - 1)], 'strlen(v:val)') + let l:col = l:col + l:strlen + endfor + let l:item.end_col = l:col + endif + + call add(l:output, l:item) + endfor + return l:output +endfunction + diff --git a/sources_non_forked/ale/autoload/ale/handlers/rubocop.vim b/sources_non_forked/ale/autoload/ale/handlers/rubocop.vim new file mode 100644 index 00000000..f6367cf5 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/handlers/rubocop.vim @@ -0,0 +1,6 @@ +call ale#Set('ruby_rubocop_options', '') +call ale#Set('ruby_rubocop_executable', 'rubocop') + +function! ale#handlers#rubocop#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'ruby_rubocop_executable') +endfunction diff --git a/sources_non_forked/ale/autoload/ale/handlers/ruby.vim b/sources_non_forked/ale/autoload/ale/handlers/ruby.vim new file mode 100644 index 00000000..555c13b1 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/handlers/ruby.vim @@ -0,0 +1,37 @@ +" Author: Brandon Roehl - https://github.com/BrandonRoehl, Matthias Guenther https://wikimatze.de +" +" Description: This file implements handlers specific to Ruby. + +function! s:HandleSyntaxError(buffer, lines) abort + " Matches patterns line the following: + " + " test.rb:3: warning: parentheses after method name is interpreted as an argument list, not a decomposed argument + " test.rb:8: syntax error, unexpected keyword_end, expecting end-of-input + let l:pattern = '\v^.+:(\d+): (warning: )?(.+)$' + let l:column = '\v^(\s+)\^$' + let l:output = [] + + for l:line in a:lines + let l:match = matchlist(l:line, l:pattern) + if len(l:match) == 0 + let l:match = matchlist(l:line, l:column) + if len(l:match) != 0 + let l:output[len(l:output) - 1]['col'] = len(l:match[1]) + endif + else + call add(l:output, { + \ 'lnum': l:match[1] + 0, + \ 'col': 0, + \ 'text': l:match[2] . l:match[3], + \ 'type': empty(l:match[2]) ? 'E' : 'W', + \}) + endif + endfor + + return l:output +endfunction + +function! ale#handlers#ruby#HandleSyntaxErrors(buffer, lines) abort + return s:HandleSyntaxError(a:buffer, a:lines) +endfunction + diff --git a/sources_non_forked/ale/autoload/ale/handlers/rust.vim b/sources_non_forked/ale/autoload/ale/handlers/rust.vim new file mode 100644 index 00000000..537bc731 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/handlers/rust.vim @@ -0,0 +1,64 @@ +" Author: Daniel Schemala , +" w0rp +" +" Description: This file implements handlers specific to Rust. + +if !exists('g:ale_rust_ignore_error_codes') + let g:ale_rust_ignore_error_codes = [] +endif + +function! s:FindSpan(buffer, span) abort + if ale#path#IsBufferPath(a:buffer, a:span.file_name) || a:span.file_name is# '' + return a:span + endif + + " Search inside the expansion of an error, as the problem for this buffer + " could lie inside a nested object. + if !empty(get(a:span, 'expansion', v:null)) + return s:FindSpan(a:buffer, a:span.expansion.span) + endif + + return {} +endfunction + +function! ale#handlers#rust#HandleRustErrors(buffer, lines) abort + let l:output = [] + + for l:errorline in a:lines + " ignore everything that is not JSON + if l:errorline !~# '^{' + continue + endif + + let l:error = json_decode(l:errorline) + + if has_key(l:error, 'message') && type(l:error.message) == type({}) + let l:error = l:error.message + endif + + if !has_key(l:error, 'code') + continue + endif + + if !empty(l:error.code) && index(g:ale_rust_ignore_error_codes, l:error.code.code) > -1 + continue + endif + + for l:root_span in l:error.spans + let l:span = s:FindSpan(a:buffer, l:root_span) + + if !empty(l:span) + call add(l:output, { + \ 'lnum': l:span.line_start, + \ 'end_lnum': l:span.line_end, + \ 'col': l:span.column_start, + \ 'end_col': l:span.column_end, + \ 'text': empty(l:span.label) ? l:error.message : printf('%s: %s', l:error.message, l:span.label), + \ 'type': toupper(l:error.level[0]), + \}) + endif + endfor + endfor + + return l:output +endfunction diff --git a/sources_non_forked/ale/autoload/ale/handlers/sh.vim b/sources_non_forked/ale/autoload/ale/handlers/sh.vim new file mode 100644 index 00000000..e96dd3ce --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/handlers/sh.vim @@ -0,0 +1,20 @@ +" Author: w0rp + +" Get the shell type for a buffer, based on the hashbang line. +function! ale#handlers#sh#GetShellType(buffer) abort + let l:bang_line = get(getbufline(a:buffer, 1), 0, '') + + " Take the shell executable from the hashbang, if we can. + if l:bang_line[:1] is# '#!' + " Remove options like -e, etc. + let l:command = substitute(l:bang_line, ' --\?[a-zA-Z0-9]\+', '', 'g') + + for l:possible_shell in ['bash', 'dash', 'ash', 'tcsh', 'csh', 'zsh', 'sh'] + if l:command =~# l:possible_shell . '\s*$' + return l:possible_shell + endif + endfor + endif + + return '' +endfunction diff --git a/sources_non_forked/ale/autoload/ale/handlers/sml.vim b/sources_non_forked/ale/autoload/ale/handlers/sml.vim new file mode 100644 index 00000000..377eade5 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/handlers/sml.vim @@ -0,0 +1,92 @@ +" Author: Jake Zimmerman +" Description: Shared functions for SML linters + +" The glob to use for finding the .cm file. +" +" See :help ale-sml-smlnj for more information. +call ale#Set('sml_smlnj_cm_file', '*.cm') + +function! ale#handlers#sml#GetCmFile(buffer) abort + let l:pattern = ale#Var(a:buffer, 'sml_smlnj_cm_file') + let l:as_list = 1 + + let l:cmfile = '' + for l:path in ale#path#Upwards(expand('#' . a:buffer . ':p:h')) + let l:results = glob(l:path . '/' . l:pattern, 0, l:as_list) + if len(l:results) > 0 + " If there is more than one CM file, we take the first one + " See :help ale-sml-smlnj for how to configure this. + let l:cmfile = l:results[0] + endif + endfor + + return l:cmfile +endfunction + +" Only one of smlnj or smlnj-cm can be enabled at a time. +" executable_callback is called before *every* lint attempt +function! s:GetExecutable(buffer, source) abort + if ale#handlers#sml#GetCmFile(a:buffer) is# '' + " No CM file found; only allow single-file mode to be enabled + if a:source is# 'smlnj-file' + return 'sml' + elseif a:source is# 'smlnj-cm' + return '' + endif + else + " Found a CM file; only allow cm-file mode to be enabled + if a:source is# 'smlnj-file' + return '' + elseif a:source is# 'smlnj-cm' + return 'sml' + endif + endif +endfunction + +function! ale#handlers#sml#GetExecutableSmlnjCm(buffer) abort + return s:GetExecutable(a:buffer, 'smlnj-cm') +endfunction +function! ale#handlers#sml#GetExecutableSmlnjFile(buffer) abort + return s:GetExecutable(a:buffer, 'smlnj-file') +endfunction + +function! ale#handlers#sml#Handle(buffer, lines) abort + " Try to match basic sml errors + " TODO(jez) We can get better errorfmt strings from Syntastic + + let l:out = [] + let l:pattern = '^.*\:\([0-9\.]\+\)\ \(\w\+\)\:\ \(.*\)' + let l:pattern2 = '^.*\:\([0-9]\+\)\.\?\([0-9]\+\).* \(\(Warning\|Error\): .*\)' + + for l:line in a:lines + let l:match2 = matchlist(l:line, l:pattern2) + + if len(l:match2) != 0 + call add(l:out, { + \ 'bufnr': a:buffer, + \ 'lnum': l:match2[1] + 0, + \ 'col' : l:match2[2] - 1, + \ 'text': l:match2[3], + \ 'type': l:match2[3] =~# '^Warning' ? 'W' : 'E', + \}) + continue + endif + + let l:match = matchlist(l:line, l:pattern) + + if len(l:match) != 0 + call add(l:out, { + \ 'bufnr': a:buffer, + \ 'lnum': l:match[1] + 0, + \ 'text': l:match[2] . ': ' . l:match[3], + \ 'type': l:match[2] is# 'error' ? 'E' : 'W', + \}) + continue + endif + + endfor + + return l:out +endfunction + +" vim:ts=4:sts=4:sw=4 diff --git a/sources_non_forked/ale/autoload/ale/handlers/textlint.vim b/sources_non_forked/ale/autoload/ale/handlers/textlint.vim new file mode 100644 index 00000000..4e56e127 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/handlers/textlint.vim @@ -0,0 +1,39 @@ +" Author: tokida https://rouger.info, Yasuhiro Kiyota +" Description: textlint, a proofreading tool (https://textlint.github.io/) + +call ale#Set('textlint_executable', 'textlint') +call ale#Set('textlint_use_global', 0) +call ale#Set('textlint_options', '') + +function! ale#handlers#textlint#GetExecutable(buffer) abort + return ale#node#FindExecutable(a:buffer, 'textlint', [ + \ 'node_modules/.bin/textlint', + \ 'node_modules/textlint/bin/textlint.js', + \]) +endfunction + +function! ale#handlers#textlint#GetCommand(buffer) abort + let l:executable = ale#handlers#textlint#GetExecutable(a:buffer) + let l:options = ale#Var(a:buffer, 'textlint_options') + + return ale#node#Executable(a:buffer, l:executable) + \ . (!empty(l:options) ? ' ' . l:options : '') + \ . ' -f json --stdin --stdin-filename %s' +endfunction + +function! ale#handlers#textlint#HandleTextlintOutput(buffer, lines) abort + let l:res = get(ale#util#FuzzyJSONDecode(a:lines, []), 0, {'messages': []}) + let l:output = [] + + for l:err in l:res.messages + call add(l:output, { + \ 'text': l:err.message, + \ 'type': 'W', + \ 'code': l:err.ruleId, + \ 'lnum': l:err.line, + \ 'col' : l:err.column + \}) + endfor + + return l:output +endfunction diff --git a/sources_non_forked/ale/autoload/ale/handlers/unix.vim b/sources_non_forked/ale/autoload/ale/handlers/unix.vim new file mode 100644 index 00000000..f90fd591 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/handlers/unix.vim @@ -0,0 +1,26 @@ +" Author: w0rp +" Description: Error handling for errors in a Unix format. + +function! s:HandleUnixFormat(buffer, lines, type) 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[1] + 0, + \ 'col': l:match[2] + 0, + \ 'text': l:match[3], + \ 'type': a:type, + \}) + endfor + + return l:output +endfunction + +function! ale#handlers#unix#HandleAsError(buffer, lines) abort + return s:HandleUnixFormat(a:buffer, a:lines, 'E') +endfunction + +function! ale#handlers#unix#HandleAsWarning(buffer, lines) abort + return s:HandleUnixFormat(a:buffer, a:lines, 'W') +endfunction diff --git a/sources_non_forked/ale/autoload/ale/handlers/vale.vim b/sources_non_forked/ale/autoload/ale/handlers/vale.vim new file mode 100644 index 00000000..9dc0872f --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/handlers/vale.vim @@ -0,0 +1,38 @@ +" Author: Johannes Wienke +" Description: output handler for the vale JSON format + +function! ale#handlers#vale#GetType(severity) abort + if a:severity is? 'warning' + return 'W' + elseif a:severity is? 'suggestion' + return 'I' + endif + + return 'E' +endfunction + +function! ale#handlers#vale#Handle(buffer, lines) abort + try + let l:errors = json_decode(join(a:lines, '')) + catch + return [] + endtry + + if empty(l:errors) + return [] + endif + + let l:output = [] + for l:error in l:errors[keys(l:errors)[0]] + call add(l:output, { + \ 'lnum': l:error['Line'], + \ 'col': l:error['Span'][0], + \ 'end_col': l:error['Span'][1], + \ 'code': l:error['Check'], + \ 'text': l:error['Message'], + \ 'type': ale#handlers#vale#GetType(l:error['Severity']), + \}) + endfor + + return l:output +endfunction diff --git a/sources_non_forked/ale/autoload/ale/handlers/writegood.vim b/sources_non_forked/ale/autoload/ale/handlers/writegood.vim new file mode 100644 index 00000000..f9d452ea --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/handlers/writegood.vim @@ -0,0 +1,61 @@ +" Author: Sumner Evans +" Description: Error handling for errors in the write-good format. + +function! ale#handlers#writegood#ResetOptions() abort + call ale#Set('writegood_options', '') + call ale#Set('writegood_executable', 'write-good') + call ale#Set('writegood_use_global', 0) +endfunction + +" Reset the options so the tests can test how they are set. +call ale#handlers#writegood#ResetOptions() + +function! ale#handlers#writegood#GetExecutable(buffer) abort + return ale#node#FindExecutable(a:buffer, 'writegood', [ + \ 'node_modules/.bin/write-good', + \ 'node_modules/write-good/bin/write-good.js', + \]) +endfunction + +function! ale#handlers#writegood#GetCommand(buffer) abort + let l:executable = ale#handlers#writegood#GetExecutable(a:buffer) + let l:options = ale#Var(a:buffer, 'writegood_options') + + return ale#node#Executable(a:buffer, l:executable) + \ . (!empty(l:options) ? ' ' . l:options : '') + \ . ' %t' +endfunction + +function! ale#handlers#writegood#Handle(buffer, lines) abort + " Look for lines like the following. + " + " "it is" is wordy or unneeded on line 20 at column 53 + " "easily" can weaken meaning on line 154 at column 29 + let l:marks_pattern = '\v^ *(\^+) *$' + let l:pattern = '\v^(".*"\s.*)\son\sline\s(\d+)\sat\scolumn\s(\d+)$' + let l:output = [] + let l:last_len = 0 + + for l:match in ale#util#GetMatches(a:lines, [l:marks_pattern, l:pattern]) + if empty(l:match[2]) + let l:last_len = len(l:match[1]) + else + let l:col = l:match[3] + 1 + + " Add the linter error. Note that we need to add 1 to the col because + " write-good reports the column corresponding to the space before the + " offending word or phrase. + call add(l:output, { + \ 'text': l:match[1], + \ 'lnum': l:match[2] + 0, + \ 'col': l:col, + \ 'end_col': l:last_len ? (l:col + l:last_len - 1) : l:col, + \ 'type': 'W', + \}) + + let l:last_len = 0 + endif + endfor + + return l:output +endfunction diff --git a/sources_non_forked/ale/autoload/ale/highlight.vim b/sources_non_forked/ale/autoload/ale/highlight.vim new file mode 100644 index 00000000..ae1f3e7d --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/highlight.vim @@ -0,0 +1,143 @@ +scriptencoding utf8 +" Author: w0rp +" Description: This module implements error/warning highlighting. + +if !hlexists('ALEError') + highlight link ALEError SpellBad +endif + +if !hlexists('ALEStyleError') + highlight link ALEStyleError ALEError +endif + +if !hlexists('ALEWarning') + highlight link ALEWarning SpellCap +endif + +if !hlexists('ALEStyleWarning') + highlight link ALEStyleWarning ALEWarning +endif + +if !hlexists('ALEInfo') + highlight link ALEInfo ALEWarning +endif + +" The maximum number of items for the second argument of matchaddpos() +let s:MAX_POS_VALUES = 8 +let s:MAX_COL_SIZE = 1073741824 " pow(2, 30) + +function! ale#highlight#CreatePositions(line, col, end_line, end_col) abort + if a:line >= a:end_line + " For single lines, just return the one position. + return [[[a:line, a:col, a:end_col - a:col + 1]]] + endif + + " Get positions from the first line at the first column, up to a large + " integer for highlighting up to the end of the line, followed by + " the lines in-between, for highlighting entire lines, and + " a highlight for the last line, up to the end column. + let l:all_positions = + \ [[a:line, a:col, s:MAX_COL_SIZE]] + \ + range(a:line + 1, a:end_line - 1) + \ + [[a:end_line, 1, a:end_col]] + + return map( + \ range(0, len(l:all_positions) - 1, s:MAX_POS_VALUES), + \ 'l:all_positions[v:val : v:val + s:MAX_POS_VALUES - 1]', + \) +endfunction + +" Given a loclist for current items to highlight, remove all highlights +" except these which have matching loclist item entries. +function! ale#highlight#RemoveHighlights() abort + for l:match in getmatches() + if l:match.group =~# '^ALE' + call matchdelete(l:match.id) + endif + endfor +endfunction + +function! ale#highlight#UpdateHighlights() abort + let l:item_list = get(b:, 'ale_enabled', 1) && g:ale_enabled + \ ? get(b:, 'ale_highlight_items', []) + \ : [] + + call ale#highlight#RemoveHighlights() + + for l:item in l:item_list + if l:item.type is# 'W' + if get(l:item, 'sub_type', '') is# 'style' + let l:group = 'ALEStyleWarning' + else + let l:group = 'ALEWarning' + endif + elseif l:item.type is# 'I' + let l:group = 'ALEInfo' + elseif get(l:item, 'sub_type', '') is# 'style' + let l:group = 'ALEStyleError' + else + let l:group = 'ALEError' + endif + + let l:line = l:item.lnum + let l:col = l:item.col + let l:end_line = get(l:item, 'end_lnum', l:line) + let l:end_col = get(l:item, 'end_col', l:col) + + " Set all of the positions, which are chunked into Lists which + " are as large as will be accepted by matchaddpos. + call map( + \ ale#highlight#CreatePositions(l:line, l:col, l:end_line, l:end_col), + \ 'matchaddpos(l:group, v:val)' + \) + endfor + + " If highlights are enabled and signs are not enabled, we should still + " offer line highlights by adding a separate set of highlights. + if !g:ale_set_signs + let l:available_groups = { + \ 'ALEWarningLine': hlexists('ALEWarningLine'), + \ 'ALEInfoLine': hlexists('ALEInfoLine'), + \ 'ALEErrorLine': hlexists('ALEErrorLine'), + \} + + for l:item in l:item_list + if l:item.type is# 'W' + let l:group = 'ALEWarningLine' + elseif l:item.type is# 'I' + let l:group = 'ALEInfoLine' + else + let l:group = 'ALEErrorLine' + endif + + if l:available_groups[l:group] + call matchaddpos(l:group, [l:item.lnum]) + endif + endfor + endif +endfunction + +function! ale#highlight#BufferHidden(buffer) abort + " Remove highlights right away when buffers are hidden. + " They will be restored later when buffers are entered. + call ale#highlight#RemoveHighlights() +endfunction + +augroup ALEHighlightBufferGroup + autocmd! + autocmd BufEnter * call ale#highlight#UpdateHighlights() + autocmd BufHidden * call ale#highlight#BufferHidden(expand('')) +augroup END + +function! ale#highlight#SetHighlights(buffer, loclist) abort + let l:new_list = getbufvar(a:buffer, 'ale_enabled', 1) && g:ale_enabled + \ ? filter(copy(a:loclist), 'v:val.bufnr == a:buffer && v:val.col > 0') + \ : [] + + " Set the list in the buffer variable. + call setbufvar(str2nr(a:buffer), 'ale_highlight_items', l:new_list) + + " Update highlights for the current buffer, which may or may not + " be the buffer we just set highlights for. + call ale#highlight#UpdateHighlights() +endfunction diff --git a/sources_non_forked/ale/autoload/ale/history.vim b/sources_non_forked/ale/autoload/ale/history.vim new file mode 100644 index 00000000..a6282ea5 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/history.vim @@ -0,0 +1,59 @@ +" Author: w0rp +" Description: Tools for managing command history + +" Return a shallow copy of the command history for a given buffer number. +function! ale#history#Get(buffer) abort + return copy(getbufvar(a:buffer, 'ale_history', [])) +endfunction + +function! ale#history#Add(buffer, status, job_id, command) abort + if g:ale_max_buffer_history_size <= 0 + " Don't save anything if the history isn't a positive number. + call setbufvar(a:buffer, 'ale_history', []) + + return + endif + + let l:history = getbufvar(a:buffer, 'ale_history', []) + + " Remove the first item if we hit the max history size. + if len(l:history) >= g:ale_max_buffer_history_size + let l:history = l:history[1:] + endif + + call add(l:history, { + \ 'status': a:status, + \ 'job_id': a:job_id, + \ 'command': a:command, + \}) + + call setbufvar(a:buffer, 'ale_history', l:history) +endfunction + +function! s:FindHistoryItem(buffer, job_id) abort + " Search backwards to find a matching job ID. IDs might be recycled, + " so finding the last one should be good enough. + for l:obj in reverse(ale#history#Get(a:buffer)) + if l:obj.job_id == a:job_id + return l:obj + endif + endfor + + return {} +endfunction + +" Set an exit code for a command which finished. +function! ale#history#SetExitCode(buffer, job_id, exit_code) abort + let l:obj = s:FindHistoryItem(a:buffer, a:job_id) + + " If we find a match, then set the code and status. + let l:obj.exit_code = a:exit_code + let l:obj.status = 'finished' +endfunction + +" Set the output for a command which finished. +function! ale#history#RememberOutput(buffer, job_id, output) abort + let l:obj = s:FindHistoryItem(a:buffer, a:job_id) + + let l:obj.output = a:output +endfunction diff --git a/sources_non_forked/ale/autoload/ale/job.vim b/sources_non_forked/ale/autoload/ale/job.vim new file mode 100644 index 00000000..2909dab4 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/job.vim @@ -0,0 +1,341 @@ +" Author: w0rp +" Description: APIs for working with Asynchronous jobs, with an API normalised +" between Vim 8 and NeoVim. +" +" Important functions are described below. They are: +" +" ale#job#Start(command, options) -> job_id +" ale#job#IsRunning(job_id) -> 1 if running, 0 otherwise. +" ale#job#Stop(job_id) + +if !has_key(s:, 'job_map') + let s:job_map = {} +endif + +" A map from timer IDs to jobs, for tracking jobs that need to be killed +" with SIGKILL if they don't terminate right away. +if !has_key(s:, 'job_kill_timers') + let s:job_kill_timers = {} +endif + +function! s:KillHandler(timer) abort + let l:job = remove(s:job_kill_timers, a:timer) + call job_stop(l:job, 'kill') +endfunction + +" Note that jobs and IDs are the same thing on NeoVim. +function! ale#job#JoinNeovimOutput(job, last_line, data, mode, callback) abort + if a:mode is# 'raw' + call a:callback(a:job, join(a:data, "\n")) + return '' + endif + + let l:lines = a:data[:-2] + + if len(a:data) > 1 + let l:lines[0] = a:last_line . l:lines[0] + let l:new_last_line = a:data[-1] + else + let l:new_last_line = a:last_line . get(a:data, 0, '') + endif + + for l:line in l:lines + call a:callback(a:job, l:line) + endfor + + return l:new_last_line +endfunction + +function! s:NeoVimCallback(job, data, event) abort + let l:info = s:job_map[a:job] + + if a:event is# 'stdout' + let l:info.out_cb_line = ale#job#JoinNeovimOutput( + \ a:job, + \ l:info.out_cb_line, + \ a:data, + \ l:info.mode, + \ ale#util#GetFunction(l:info.out_cb), + \) + elseif a:event is# 'stderr' + let l:info.err_cb_line = ale#job#JoinNeovimOutput( + \ a:job, + \ l:info.err_cb_line, + \ a:data, + \ l:info.mode, + \ ale#util#GetFunction(l:info.err_cb), + \) + else + if has_key(l:info, 'out_cb') && !empty(l:info.out_cb_line) + call ale#util#GetFunction(l:info.out_cb)(a:job, l:info.out_cb_line) + endif + + if has_key(l:info, 'err_cb') && !empty(l:info.err_cb_line) + call ale#util#GetFunction(l:info.err_cb)(a:job, l:info.err_cb_line) + endif + + try + call ale#util#GetFunction(l:info.exit_cb)(a:job, a:data) + finally + " Automatically forget about the job after it's done. + if has_key(s:job_map, a:job) + call remove(s:job_map, a:job) + endif + endtry + endif +endfunction + +function! s:VimOutputCallback(channel, data) abort + let l:job = ch_getjob(a:channel) + let l:job_id = ale#job#ParseVim8ProcessID(string(l:job)) + + " Only call the callbacks for jobs which are valid. + if l:job_id > 0 && has_key(s:job_map, l:job_id) + call ale#util#GetFunction(s:job_map[l:job_id].out_cb)(l:job_id, a:data) + endif +endfunction + +function! s:VimErrorCallback(channel, data) abort + let l:job = ch_getjob(a:channel) + let l:job_id = ale#job#ParseVim8ProcessID(string(l:job)) + + " Only call the callbacks for jobs which are valid. + if l:job_id > 0 && has_key(s:job_map, l:job_id) + call ale#util#GetFunction(s:job_map[l:job_id].err_cb)(l:job_id, a:data) + endif +endfunction + +function! s:VimCloseCallback(channel) abort + let l:job = ch_getjob(a:channel) + let l:job_id = ale#job#ParseVim8ProcessID(string(l:job)) + let l:info = get(s:job_map, l:job_id, {}) + + if empty(l:info) + return + endif + + " job_status() can trigger the exit handler. + " The channel can close before the job has exited. + if job_status(l:job) is# 'dead' + try + if !empty(l:info) && has_key(l:info, 'exit_cb') + call ale#util#GetFunction(l:info.exit_cb)(l:job_id, l:info.exit_code) + endif + finally + " Automatically forget about the job after it's done. + if has_key(s:job_map, l:job_id) + call remove(s:job_map, l:job_id) + endif + endtry + endif +endfunction + +function! s:VimExitCallback(job, exit_code) abort + let l:job_id = ale#job#ParseVim8ProcessID(string(a:job)) + let l:info = get(s:job_map, l:job_id, {}) + + if empty(l:info) + return + endif + + let l:info.exit_code = a:exit_code + + " The program can exit before the data has finished being read. + if ch_status(job_getchannel(a:job)) is# 'closed' + try + if !empty(l:info) && has_key(l:info, 'exit_cb') + call ale#util#GetFunction(l:info.exit_cb)(l:job_id, a:exit_code) + endif + finally + " Automatically forget about the job after it's done. + if has_key(s:job_map, l:job_id) + call remove(s:job_map, l:job_id) + endif + endtry + endif +endfunction + +function! ale#job#ParseVim8ProcessID(job_string) abort + return matchstr(a:job_string, '\d\+') + 0 +endfunction + +function! ale#job#ValidateArguments(command, options) abort + if a:options.mode isnot# 'nl' && a:options.mode isnot# 'raw' + throw 'Invalid mode: ' . a:options.mode + endif +endfunction + +function! s:PrepareWrappedCommand(original_wrapper, command) abort + let l:match = matchlist(a:command, '\v^(.*(\&\&|;)) *(.*)$') + let l:prefix = '' + let l:command = a:command + + if !empty(l:match) + let l:prefix = l:match[1] . ' ' + let l:command = l:match[3] + endif + + let l:format = a:original_wrapper + + if l:format =~# '%@' + let l:wrapped = substitute(l:format, '%@', ale#Escape(l:command), '') + else + if l:format !~# '%\*' + let l:format .= ' %*' + endif + + let l:wrapped = substitute(l:format, '%\*', l:command, '') + endif + + return l:prefix . l:wrapped +endfunction + +function! ale#job#PrepareCommand(buffer, command) abort + let l:wrapper = ale#Var(a:buffer, 'command_wrapper') + + let l:command = !empty(l:wrapper) + \ ? s:PrepareWrappedCommand(l:wrapper, a:command) + \ : a:command + + " The command will be executed in a subshell. This fixes a number of + " issues, including reading the PATH variables correctly, %PATHEXT% + " expansion on Windows, etc. + " + " NeoVim handles this issue automatically if the command is a String, + " but we'll do this explicitly, so we use the same exact command for both + " versions. + if has('win32') + return 'cmd /s/c "' . l:command . '"' + endif + + if &shell =~? 'fish$' + return ['/bin/sh', '-c', l:command] + endif + + return split(&shell) + split(&shellcmdflag) + [l:command] +endfunction + +" Start a job with options which are agnostic to Vim and NeoVim. +" +" The following options are accepted: +" +" out_cb - A callback for receiving stdin. Arguments: (job_id, data) +" err_cb - A callback for receiving stderr. Arguments: (job_id, data) +" exit_cb - A callback for program exit. Arguments: (job_id, status_code) +" mode - A mode for I/O. Can be 'nl' for split lines or 'raw'. +function! ale#job#Start(command, options) abort + call ale#job#ValidateArguments(a:command, a:options) + + let l:job_info = copy(a:options) + let l:job_options = {} + + if has('nvim') + if has_key(a:options, 'out_cb') + let l:job_options.on_stdout = function('s:NeoVimCallback') + let l:job_info.out_cb_line = '' + endif + + if has_key(a:options, 'err_cb') + let l:job_options.on_stderr = function('s:NeoVimCallback') + let l:job_info.err_cb_line = '' + endif + + if has_key(a:options, 'exit_cb') + let l:job_options.on_exit = function('s:NeoVimCallback') + endif + + let l:job_info.job = jobstart(a:command, l:job_options) + let l:job_id = l:job_info.job + else + let l:job_options = { + \ 'in_mode': l:job_info.mode, + \ 'out_mode': l:job_info.mode, + \ 'err_mode': l:job_info.mode, + \} + + if has_key(a:options, 'out_cb') + let l:job_options.out_cb = function('s:VimOutputCallback') + endif + + if has_key(a:options, 'err_cb') + let l:job_options.err_cb = function('s:VimErrorCallback') + endif + + if has_key(a:options, 'exit_cb') + " Set a close callback to which simply calls job_status() + " when the channel is closed, which can trigger the exit callback + " earlier on. + let l:job_options.close_cb = function('s:VimCloseCallback') + let l:job_options.exit_cb = function('s:VimExitCallback') + endif + + " Vim 8 will read the stdin from the file's buffer. + let l:job_info.job = job_start(a:command, l:job_options) + let l:job_id = ale#job#ParseVim8ProcessID(string(l:job_info.job)) + endif + + if l:job_id > 0 + " Store the job in the map for later only if we can get the ID. + let s:job_map[l:job_id] = l:job_info + endif + + return l:job_id +endfunction + +" Send raw data to the job. +function! ale#job#SendRaw(job_id, string) abort + if has('nvim') + call jobsend(a:job_id, a:string) + else + call ch_sendraw(job_getchannel(s:job_map[a:job_id].job), a:string) + endif +endfunction + +" Given a job ID, return 1 if the job is currently running. +" Invalid job IDs will be ignored. +function! ale#job#IsRunning(job_id) abort + if has('nvim') + try + " In NeoVim, if the job isn't running, jobpid() will throw. + call jobpid(a:job_id) + return 1 + catch + endtry + elseif has_key(s:job_map, a:job_id) + let l:job = s:job_map[a:job_id].job + return job_status(l:job) is# 'run' + endif + + return 0 +endfunction + +" Given a Job ID, stop that job. +" Invalid job IDs will be ignored. +function! ale#job#Stop(job_id) abort + if !has_key(s:job_map, a:job_id) + return + endif + + if has('nvim') + " FIXME: NeoVim kills jobs on a timer, but will not kill any processes + " which are child processes on Unix. Some work needs to be done to + " kill child processes to stop long-running processes like pylint. + silent! call jobstop(a:job_id) + else + let l:job = s:job_map[a:job_id].job + + " We must close the channel for reading the buffer if it is open + " when stopping a job. Otherwise, we will get errors in the status line. + if ch_status(job_getchannel(l:job)) is# 'open' + call ch_close_in(job_getchannel(l:job)) + endif + + " Ask nicely for the job to stop. + call job_stop(l:job) + + if ale#job#IsRunning(l:job) + " Set a 100ms delay for killing the job with SIGKILL. + let s:job_kill_timers[timer_start(100, function('s:KillHandler'))] = l:job + endif + endif +endfunction diff --git a/sources_non_forked/ale/autoload/ale/linter.vim b/sources_non_forked/ale/autoload/ale/linter.vim new file mode 100644 index 00000000..d059a12d --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/linter.vim @@ -0,0 +1,474 @@ +call ale#Set('wrap_command_as_one_argument', 0) +" Author: w0rp +" Description: Linter registration and lazy-loading +" Retrieves linters as requested by the engine, loading them if needed. + +let s:linters = {} + +" Default filetype aliases. +" The user defined aliases will be merged with this Dictionary. +let s:default_ale_linter_aliases = { +\ 'Dockerfile': 'dockerfile', +\ 'csh': 'sh', +\ 'plaintex': 'tex', +\ 'systemverilog': 'verilog', +\ 'zsh': 'sh', +\} + +" Default linters to run for particular filetypes. +" The user defined linter selections will be merged with this Dictionary. +" +" No linters are used for plaintext files by default. +" +" Only cargo is enabled for Rust by default. +" rpmlint is disabled by default because it can result in code execution. +" +" NOTE: Update the g:ale_linters documentation when modifying this. +let s:default_ale_linters = { +\ 'csh': ['shell'], +\ 'go': ['gofmt', 'golint', 'go vet'], +\ 'help': [], +\ 'perl': ['perlcritic'], +\ 'python': ['flake8', 'mypy', 'pylint'], +\ 'rust': ['cargo'], +\ 'spec': [], +\ 'text': [], +\ 'zsh': ['shell'], +\} + +" Testing/debugging helper to unload all linters. +function! ale#linter#Reset() abort + let s:linters = {} +endfunction + +function! s:IsCallback(value) abort + return type(a:value) == type('') || type(a:value) == type(function('type')) +endfunction + +function! s:IsBoolean(value) abort + return type(a:value) == type(0) && (a:value == 0 || a:value == 1) +endfunction + +function! ale#linter#PreProcess(linter) abort + if type(a:linter) != type({}) + throw 'The linter object must be a Dictionary' + endif + + let l:obj = { + \ 'add_newline': get(a:linter, 'add_newline', 0), + \ 'name': get(a:linter, 'name'), + \ 'lsp': get(a:linter, 'lsp', ''), + \} + + if type(l:obj.name) != type('') + throw '`name` must be defined to name the linter' + endif + + let l:needs_address = l:obj.lsp is# 'socket' + let l:needs_executable = l:obj.lsp isnot# 'socket' + let l:needs_command = l:obj.lsp isnot# 'socket' + let l:needs_lsp_details = !empty(l:obj.lsp) + + if empty(l:obj.lsp) + let l:obj.callback = get(a:linter, 'callback') + + if !s:IsCallback(l:obj.callback) + throw '`callback` must be defined with a callback to accept output' + endif + endif + + if index(['', 'socket', 'stdio', 'tsserver'], l:obj.lsp) < 0 + throw '`lsp` must be either `''lsp''` or `''tsserver''` if defined' + endif + + if !l:needs_executable + if has_key(a:linter, 'executable') + \|| has_key(a:linter, 'executable_callback') + throw '`executable` and `executable_callback` cannot be used when lsp == ''socket''' + endif + elseif has_key(a:linter, 'executable_callback') + let l:obj.executable_callback = a:linter.executable_callback + + if !s:IsCallback(l:obj.executable_callback) + throw '`executable_callback` must be a callback if defined' + endif + elseif has_key(a:linter, 'executable') + let l:obj.executable = a:linter.executable + + if type(l:obj.executable) != type('') + throw '`executable` must be a string if defined' + endif + else + throw 'Either `executable` or `executable_callback` must be defined' + endif + + if !l:needs_command + if has_key(a:linter, 'command') + \|| has_key(a:linter, 'command_callback') + \|| has_key(a:linter, 'command_chain') + throw '`command` and `command_callback` and `command_chain` cannot be used when lsp == ''socket''' + endif + elseif has_key(a:linter, 'command_chain') + let l:obj.command_chain = a:linter.command_chain + + if type(l:obj.command_chain) != type([]) + throw '`command_chain` must be a List' + endif + + if empty(l:obj.command_chain) + throw '`command_chain` must contain at least one item' + endif + + let l:link_index = 0 + + for l:link in l:obj.command_chain + let l:err_prefix = 'The `command_chain` item ' . l:link_index . ' ' + + if !s:IsCallback(get(l:link, 'callback')) + throw l:err_prefix . 'must define a `callback` function' + endif + + if has_key(l:link, 'output_stream') + if type(l:link.output_stream) != type('') + \|| index(['stdout', 'stderr', 'both'], l:link.output_stream) < 0 + throw l:err_prefix . '`output_stream` flag must be ' + \ . "'stdout', 'stderr', or 'both'" + endif + endif + + if has_key(l:link, 'read_buffer') && !s:IsBoolean(l:link.read_buffer) + throw l:err_prefix . 'value for `read_buffer` must be `0` or `1`' + endif + + let l:link_index += 1 + endfor + elseif has_key(a:linter, 'command_callback') + let l:obj.command_callback = a:linter.command_callback + + if !s:IsCallback(l:obj.command_callback) + throw '`command_callback` must be a callback if defined' + endif + elseif has_key(a:linter, 'command') + let l:obj.command = a:linter.command + + if type(l:obj.command) != type('') + throw '`command` must be a string if defined' + endif + else + throw 'Either `command`, `executable_callback`, `command_chain` ' + \ . 'must be defined' + endif + + if ( + \ has_key(a:linter, 'command') + \ + has_key(a:linter, 'command_chain') + \ + has_key(a:linter, 'command_callback') + \) > 1 + throw 'Only one of `command`, `command_callback`, or `command_chain` ' + \ . 'should be set' + endif + + if !l:needs_address + if has_key(a:linter, 'address_callback') + throw '`address_callback` cannot be used when lsp != ''socket''' + endif + elseif has_key(a:linter, 'address_callback') + let l:obj.address_callback = a:linter.address_callback + + if !s:IsCallback(l:obj.address_callback) + throw '`address_callback` must be a callback if defined' + endif + else + throw '`address_callback` must be defined for getting the LSP address' + endif + + if l:needs_lsp_details + let l:obj.language_callback = get(a:linter, 'language_callback') + + if !s:IsCallback(l:obj.language_callback) + throw '`language_callback` must be a callback for LSP linters' + endif + + let l:obj.project_root_callback = get(a:linter, 'project_root_callback') + + if !s:IsCallback(l:obj.project_root_callback) + throw '`project_root_callback` must be a callback for LSP linters' + endif + endif + + let l:obj.output_stream = get(a:linter, 'output_stream', 'stdout') + + if type(l:obj.output_stream) != type('') + \|| index(['stdout', 'stderr', 'both'], l:obj.output_stream) < 0 + throw "`output_stream` must be 'stdout', 'stderr', or 'both'" + endif + + " An option indicating that this linter should only be run against the + " file on disk. + let l:obj.lint_file = get(a:linter, 'lint_file', 0) + + if !s:IsBoolean(l:obj.lint_file) + throw '`lint_file` must be `0` or `1`' + endif + + " An option indicating that the buffer should be read. + let l:obj.read_buffer = get(a:linter, 'read_buffer', !l:obj.lint_file) + + if !s:IsBoolean(l:obj.read_buffer) + throw '`read_buffer` must be `0` or `1`' + endif + + if l:obj.lint_file && l:obj.read_buffer + throw 'Only one of `lint_file` or `read_buffer` can be `1`' + endif + + let l:obj.aliases = get(a:linter, 'aliases', []) + + if type(l:obj.aliases) != type([]) + \|| len(filter(copy(l:obj.aliases), 'type(v:val) != type('''')')) > 0 + throw '`aliases` must be a List of String values' + endif + + return l:obj +endfunction + +function! ale#linter#Define(filetype, linter) abort + if !has_key(s:linters, a:filetype) + let s:linters[a:filetype] = [] + endif + + let l:new_linter = ale#linter#PreProcess(a:linter) + + call add(s:linters[a:filetype], l:new_linter) +endfunction + +function! ale#linter#GetAll(filetypes) abort + let l:combined_linters = [] + + for l:filetype in a:filetypes + " Load linter defintions from files if we haven't loaded them yet. + if !has_key(s:linters, l:filetype) + execute 'silent! runtime! ale_linters/' . l:filetype . '/*.vim' + + " Always set an empty List for the loaded linters if we don't find + " any. This will prevent us from executing the runtime command + " many times, redundantly. + if !has_key(s:linters, l:filetype) + let s:linters[l:filetype] = [] + endif + endif + + call extend(l:combined_linters, get(s:linters, l:filetype, [])) + endfor + + return l:combined_linters +endfunction + +function! s:GetAliasedFiletype(original_filetype) abort + let l:buffer_aliases = get(b:, 'ale_linter_aliases', {}) + + " b:ale_linter_aliases can be set to a List. + if type(l:buffer_aliases) is type([]) + return l:buffer_aliases + endif + + " Check for aliased filetypes first in a buffer variable, + " then the global variable, + " then in the default mapping, + " otherwise use the original filetype. + for l:dict in [ + \ l:buffer_aliases, + \ g:ale_linter_aliases, + \ s:default_ale_linter_aliases, + \] + if has_key(l:dict, a:original_filetype) + return l:dict[a:original_filetype] + endif + endfor + + return a:original_filetype +endfunction + +function! ale#linter#ResolveFiletype(original_filetype) abort + let l:filetype = s:GetAliasedFiletype(a:original_filetype) + + if type(l:filetype) != type([]) + return [l:filetype] + endif + + return l:filetype +endfunction + +function! s:GetLinterNames(original_filetype) abort + let l:buffer_ale_linters = get(b:, 'ale_linters', {}) + + " b:ale_linters can be set to 'all' + if l:buffer_ale_linters is# 'all' + return 'all' + endif + + " b:ale_linters can be set to a List. + if type(l:buffer_ale_linters) is type([]) + return l:buffer_ale_linters + endif + + " Try to get a buffer-local setting for the filetype + if has_key(l:buffer_ale_linters, a:original_filetype) + return l:buffer_ale_linters[a:original_filetype] + endif + + " Try to get a global setting for the filetype + if has_key(g:ale_linters, a:original_filetype) + return g:ale_linters[a:original_filetype] + endif + + " If the user has configured ALE to only enable linters explicitly, then + " don't enable any linters by default. + if g:ale_linters_explicit + return [] + endif + + " Try to get a default setting for the filetype + if has_key(s:default_ale_linters, a:original_filetype) + return s:default_ale_linters[a:original_filetype] + endif + + return 'all' +endfunction + +function! ale#linter#Get(original_filetypes) abort + let l:possibly_duplicated_linters = [] + + " Handle dot-separated filetypes. + for l:original_filetype in split(a:original_filetypes, '\.') + let l:filetype = ale#linter#ResolveFiletype(l:original_filetype) + let l:linter_names = s:GetLinterNames(l:original_filetype) + let l:all_linters = ale#linter#GetAll(l:filetype) + let l:filetype_linters = [] + + if type(l:linter_names) == type('') && l:linter_names is# 'all' + let l:filetype_linters = l:all_linters + elseif type(l:linter_names) == type([]) + " Select only the linters we or the user has specified. + for l:linter in l:all_linters + let l:name_list = [l:linter.name] + l:linter.aliases + + for l:name in l:name_list + if index(l:linter_names, l:name) >= 0 + call add(l:filetype_linters, l:linter) + break + endif + endfor + endfor + endif + + call extend(l:possibly_duplicated_linters, l:filetype_linters) + endfor + + let l:name_list = [] + let l:combined_linters = [] + + " Make sure we override linters so we don't get two with the same name, + " like 'eslint' for both 'javascript' and 'typescript' + " + " Note that the reverse calls here modify the List variables. + for l:linter in reverse(l:possibly_duplicated_linters) + if index(l:name_list, l:linter.name) < 0 + call add(l:name_list, l:linter.name) + call add(l:combined_linters, l:linter) + endif + endfor + + return reverse(l:combined_linters) +endfunction + +" Given a buffer and linter, get the executable String for the linter. +function! ale#linter#GetExecutable(buffer, linter) abort + return has_key(a:linter, 'executable_callback') + \ ? ale#util#GetFunction(a:linter.executable_callback)(a:buffer) + \ : a:linter.executable +endfunction + +" Given a buffer and linter, get the command String for the linter. +" The command_chain key is not supported. +function! ale#linter#GetCommand(buffer, linter) abort + return has_key(a:linter, 'command_callback') + \ ? ale#util#GetFunction(a:linter.command_callback)(a:buffer) + \ : a:linter.command +endfunction + +" Given a buffer and linter, get the address for connecting to the server. +function! ale#linter#GetAddress(buffer, linter) abort + return has_key(a:linter, 'address_callback') + \ ? ale#util#GetFunction(a:linter.address_callback)(a:buffer) + \ : a:linter.address +endfunction + +" Given a buffer, an LSP linter, and a callback to register for handling +" messages, start up an LSP linter and get ready to receive errors or +" completions. +function! ale#linter#StartLSP(buffer, linter, callback) abort + let l:command = '' + let l:address = '' + let l:root = ale#util#GetFunction(a:linter.project_root_callback)(a:buffer) + + if empty(l:root) && a:linter.lsp isnot# 'tsserver' + " If there's no project root, then we can't check files with LSP, + " unless we are using tsserver, which doesn't use project roots. + return {} + endif + + if a:linter.lsp is# 'socket' + let l:address = ale#linter#GetAddress(a:buffer, a:linter) + let l:conn_id = ale#lsp#ConnectToAddress( + \ l:address, + \ l:root, + \ a:callback, + \) + else + let l:executable = ale#linter#GetExecutable(a:buffer, a:linter) + + if !executable(l:executable) + return {} + endif + + let l:command = ale#job#PrepareCommand( + \ a:buffer, + \ ale#linter#GetCommand(a:buffer, a:linter), + \) + let l:conn_id = ale#lsp#StartProgram( + \ l:executable, + \ l:command, + \ l:root, + \ a:callback, + \) + endif + + let l:language_id = ale#util#GetFunction(a:linter.language_callback)(a:buffer) + + if !l:conn_id + if g:ale_history_enabled && !empty(l:command) + call ale#history#Add(a:buffer, 'failed', l:conn_id, l:command) + endif + + return {} + endif + + if ale#lsp#OpenDocumentIfNeeded(l:conn_id, a:buffer, l:root, l:language_id) + if g:ale_history_enabled && !empty(l:command) + call ale#history#Add(a:buffer, 'started', l:conn_id, l:command) + endif + endif + + " The change message needs to be sent for tsserver before doing anything. + if a:linter.lsp is# 'tsserver' + call ale#lsp#Send(l:conn_id, ale#lsp#tsserver_message#Change(a:buffer)) + endif + + return { + \ 'connection_id': l:conn_id, + \ 'command': l:command, + \ 'project_root': l:root, + \ 'language_id': l:language_id, + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/list.vim b/sources_non_forked/ale/autoload/ale/list.vim new file mode 100644 index 00000000..30b8f5cf --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/list.vim @@ -0,0 +1,177 @@ +" Author: Bjorn Neergaard , modified by Yann fery +" Description: Manages the loclist and quickfix lists + +if !exists('s:timer_args') + let s:timer_args = {} +endif + +" Return 1 if there is a buffer with buftype == 'quickfix' in bufffer list +function! ale#list#IsQuickfixOpen() abort + for l:buf in range(1, bufnr('$')) + if getbufvar(l:buf, '&buftype') is# 'quickfix' + return 1 + endif + endfor + return 0 +endfunction + +" Check if we should open the list, based on the save event being fired, and +" that setting being on, or the setting just being set to `1`. +function! s:ShouldOpen(buffer) abort + let l:val = ale#Var(a:buffer, 'open_list') + let l:saved = getbufvar(a:buffer, 'ale_save_event_fired', 0) + + return l:val is 1 || (l:val is# 'on_save' && l:saved) +endfunction + +function! ale#list#GetCombinedList() abort + let l:list = [] + + for l:info in values(g:ale_buffer_info) + call extend(l:list, l:info.loclist) + endfor + + call sort(l:list, function('ale#util#LocItemCompareWithText')) + call uniq(l:list, function('ale#util#LocItemCompareWithText')) + + return l:list +endfunction + +function! s:FixList(buffer, list) abort + let l:format = ale#Var(a:buffer, 'loclist_msg_format') + let l:new_list = [] + + for l:item in a:list + let l:fixed_item = copy(l:item) + + let l:fixed_item.text = ale#GetLocItemMessage(l:item, l:format) + + if l:item.bufnr == -1 + " If the buffer number is invalid, remove it. + call remove(l:fixed_item, 'bufnr') + endif + + call add(l:new_list, l:fixed_item) + endfor + + return l:new_list +endfunction + +function! s:BufWinId(buffer) abort + return exists('*bufwinid') ? bufwinid(str2nr(a:buffer)) : 0 +endfunction + +function! s:SetListsImpl(timer_id, buffer, loclist) abort + let l:title = expand('#' . a:buffer . ':p') + + if g:ale_set_quickfix + let l:quickfix_list = ale#list#GetCombinedList() + + if has('nvim') + call setqflist(s:FixList(a:buffer, l:quickfix_list), ' ', l:title) + else + call setqflist(s:FixList(a:buffer, l:quickfix_list)) + call setqflist([], 'r', {'title': l:title}) + endif + elseif g:ale_set_loclist + " If windows support is off, bufwinid() may not exist. + " We'll set result in the current window, which might not be correct, + " but it's better than nothing. + let l:id = s:BufWinId(a:buffer) + + if has('nvim') + call setloclist(l:id, s:FixList(a:buffer, a:loclist), ' ', l:title) + else + call setloclist(l:id, s:FixList(a:buffer, a:loclist)) + call setloclist(l:id, [], 'r', {'title': l:title}) + endif + endif + + " Open a window to show the problems if we need to. + " + " We'll check if the current buffer's List is not empty here, so the + " window will only be opened if the current buffer has problems. + if s:ShouldOpen(a:buffer) && !empty(a:loclist) + let l:winnr = winnr() + let l:mode = mode() + let l:reset_visual_selection = l:mode is? 'v' || l:mode is# "\" + let l:reset_character_selection = l:mode is? 's' || l:mode is# "\" + + " open windows vertically instead of default horizontally + let l:open_type = '' + if ale#Var(a:buffer, 'list_vertical') == 1 + let l:open_type = 'vert ' + endif + if g:ale_set_quickfix + if !ale#list#IsQuickfixOpen() + silent! execute l:open_type . 'copen ' . str2nr(ale#Var(a:buffer, 'list_window_size')) + endif + elseif g:ale_set_loclist + silent! execute l:open_type . 'lopen ' . str2nr(ale#Var(a:buffer, 'list_window_size')) + endif + + " If focus changed, restore it (jump to the last window). + if l:winnr isnot# winnr() + wincmd p + endif + + if l:reset_visual_selection || l:reset_character_selection + " If we were in a selection mode before, select the last selection. + normal! gv + + if l:reset_character_selection + " Switch back to Select mode, if we were in that. + normal! "\" + endif + endif + endif + + " If ALE isn't currently checking for more problems, close the window if + " needed now. This check happens inside of this timer function, so + " the window can be closed reliably. + if !ale#engine#IsCheckingBuffer(a:buffer) + call s:CloseWindowIfNeeded(a:buffer) + endif +endfunction + +function! ale#list#SetLists(buffer, loclist) abort + if get(g:, 'ale_set_lists_synchronously') == 1 + \|| getbufvar(a:buffer, 'ale_save_event_fired', 0) + " Update lists immediately if running a test synchronously, or if the + " buffer was saved. + " + " The lists need to be updated immediately when saving a buffer so + " that we can reliably close window automatically, if so configured. + call s:SetListsImpl(-1, a:buffer, a:loclist) + else + call ale#util#StartPartialTimer( + \ 0, + \ function('s:SetListsImpl'), + \ [a:buffer, a:loclist], + \) + endif +endfunction + +function! s:CloseWindowIfNeeded(buffer) abort + if ale#Var(a:buffer, 'keep_list_window_open') || !s:ShouldOpen(a:buffer) + return + endif + + try + " Only close windows if the quickfix list or loclist is completely empty, + " including errors set through other means. + if g:ale_set_quickfix + if empty(getqflist()) + cclose + endif + else + let l:win_id = s:BufWinId(a:buffer) + + if g:ale_set_loclist && empty(getloclist(l:win_id)) + lclose + endif + endif + " Ignore 'Cannot close last window' errors. + catch /E444/ + endtry +endfunction diff --git a/sources_non_forked/ale/autoload/ale/loclist_jumping.vim b/sources_non_forked/ale/autoload/ale/loclist_jumping.vim new file mode 100644 index 00000000..7ed9e6ba --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/loclist_jumping.vim @@ -0,0 +1,87 @@ +" Author: w0rp +" Description: This file implements functions for jumping around in a file +" based on ALE's internal loclist. + +" Search for the nearest line either before or after the current position +" in the loclist. The argument 'wrap' can be passed to enable wrapping +" around the end of the list. +" +" If there are no items or we have hit the end with wrapping off, an empty +" List will be returned, otherwise a pair of [line_number, column_number] will +" be returned. +function! ale#loclist_jumping#FindNearest(direction, wrap) abort + let l:buffer = bufnr('') + let l:pos = getcurpos() + let l:info = get(g:ale_buffer_info, bufnr('%'), {'loclist': []}) + " Copy the list and filter to only the items in this buffer. + let l:loclist = filter(copy(l:info.loclist), 'v:val.bufnr == l:buffer') + let l:search_item = {'bufnr': l:buffer, 'lnum': l:pos[1], 'col': l:pos[2]} + + " When searching backwards, so we can find the next smallest match. + if a:direction is# 'before' + call reverse(l:loclist) + endif + + " Look for items before or after the current position. + for l:item in l:loclist + " Compare the cursor with a item where the column number is bounded, + " such that it's possible for the cursor to actually be on the given + " column number, without modifying the cursor number we return. This + " will allow us to move through matches, but still let us move the + " cursor to a line without changing the column, in some cases. + let l:cmp_value = ale#util#LocItemCompare( + \ { + \ 'bufnr': l:buffer, + \ 'lnum': l:item.lnum, + \ 'col': min([ + \ max([l:item.col, 1]), + \ max([len(getline(l:item.lnum)), 1]), + \ ]), + \ }, + \ l:search_item + \) + + if a:direction is# 'before' && l:cmp_value < 0 + return [l:item.lnum, l:item.col] + endif + + if a:direction is# 'after' && l:cmp_value > 0 + return [l:item.lnum, l:item.col] + endif + endfor + + " If we found nothing, and the wrap option is set to 1, then we should + " wrap around the list of warnings/errors + if a:wrap && !empty(l:loclist) + let l:item = l:loclist[0] + + return [l:item.lnum, l:item.col] + endif + + return [] +endfunction + +" As before, find the nearest match, but position the cursor at it. +function! ale#loclist_jumping#Jump(direction, wrap) abort + let l:nearest = ale#loclist_jumping#FindNearest(a:direction, a:wrap) + + if !empty(l:nearest) + call cursor(l:nearest) + endif +endfunction + +function! ale#loclist_jumping#JumpToIndex(index) abort + let l:buffer = bufnr('') + let l:info = get(g:ale_buffer_info, l:buffer, {'loclist': []}) + let l:loclist = filter(copy(l:info.loclist), 'v:val.bufnr == l:buffer') + + if empty(l:loclist) + return + endif + + let l:item = l:loclist[a:index] + + if !empty(l:item) + call cursor([l:item.lnum, l:item.col]) + endif +endfunction diff --git a/sources_non_forked/ale/autoload/ale/lsp.vim b/sources_non_forked/ale/autoload/ale/lsp.vim new file mode 100644 index 00000000..8db9348f --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/lsp.vim @@ -0,0 +1,420 @@ +" Author: w0rp +" Description: Language Server Protocol client code + +" A List of connections, used for tracking servers which have been connected +" to, and programs which are run. +let s:connections = [] +let g:ale_lsp_next_message_id = 1 + +function! s:NewConnection() abort + " id: The job ID as a Number, or the server address as a string. + " data: The message data received so far. + " executable: An executable only set for program connections. + " open_documents: A list of buffers we told the server we opened. + " callback_list: A list of callbacks for handling LSP responses. + let l:conn = { + \ 'id': '', + \ 'data': '', + \ 'projects': {}, + \ 'open_documents': [], + \ 'callback_list': [], + \} + + call add(s:connections, l:conn) + + return l:conn +endfunction + +function! s:FindConnection(key, value) abort + for l:conn in s:connections + if has_key(l:conn, a:key) && get(l:conn, a:key) == a:value + return l:conn + endif + endfor + + return {} +endfunction + +function! ale#lsp#GetNextMessageID() abort + " Use the current ID + let l:id = g:ale_lsp_next_message_id + + " Increment the ID variable. + let g:ale_lsp_next_message_id += 1 + + " When the ID overflows, reset it to 1. By the time we hit the initial ID + " again, the messages will be long gone. + if g:ale_lsp_next_message_id < 1 + let g:ale_lsp_next_message_id = 1 + endif + + return l:id +endfunction + +" TypeScript messages use a different format. +function! s:CreateTSServerMessageData(message) abort + let l:is_notification = a:message[0] + + let l:obj = { + \ 'seq': v:null, + \ 'type': 'request', + \ 'command': a:message[1][3:], + \} + + if !l:is_notification + let l:obj.seq = ale#lsp#GetNextMessageID() + endif + + if len(a:message) > 2 + let l:obj.arguments = a:message[2] + endif + + let l:data = json_encode(l:obj) . "\n" + return [l:is_notification ? 0 : l:obj.seq, l:data] +endfunction + +" Given a List of one or two items, [method_name] or [method_name, params], +" return a List containing [message_id, message_data] +function! ale#lsp#CreateMessageData(message) abort + if a:message[1] =~# '^ts@' + return s:CreateTSServerMessageData(a:message) + endif + + let l:is_notification = a:message[0] + + let l:obj = { + \ 'method': a:message[1], + \ 'jsonrpc': '2.0', + \} + + if !l:is_notification + let l:obj.id = ale#lsp#GetNextMessageID() + endif + + if len(a:message) > 2 + let l:obj.params = a:message[2] + endif + + let l:body = json_encode(l:obj) + let l:data = 'Content-Length: ' . strlen(l:body) . "\r\n\r\n" . l:body + + return [l:is_notification ? 0 : l:obj.id, l:data] +endfunction + +function! ale#lsp#ReadMessageData(data) abort + let l:response_list = [] + let l:remainder = a:data + + while 1 + " Look for the end of the HTTP headers + let l:body_start_index = matchend(l:remainder, "\r\n\r\n") + + if l:body_start_index < 0 + " No header end was found yet. + break + endif + + " Parse the Content-Length header. + let l:header_data = l:remainder[:l:body_start_index - 4] + let l:length_match = matchlist( + \ l:header_data, + \ '\vContent-Length: *(\d+)' + \) + + if empty(l:length_match) + throw "Invalid JSON-RPC header:\n" . l:header_data + endif + + " Split the body and the remainder of the text. + let l:remainder_start_index = l:body_start_index + str2nr(l:length_match[1]) + + if len(l:remainder) < l:remainder_start_index + " We don't have enough data yet. + break + endif + + let l:body = l:remainder[l:body_start_index : l:remainder_start_index - 1] + let l:remainder = l:remainder[l:remainder_start_index :] + + " Parse the JSON object and add it to the list. + call add(l:response_list, json_decode(l:body)) + endwhile + + return [l:remainder, l:response_list] +endfunction + +function! s:FindProjectWithInitRequestID(conn, init_request_id) abort + for l:project_root in keys(a:conn.projects) + let l:project = a:conn.projects[l:project_root] + + if l:project.init_request_id == a:init_request_id + return l:project + endif + endfor + + return {} +endfunction + +function! s:MarkProjectAsInitialized(conn, project) abort + let a:project.initialized = 1 + + " After the server starts, send messages we had queued previously. + for l:message_data in a:project.message_queue + call s:SendMessageData(a:conn, l:message_data) + endfor + + " Remove the messages now. + let a:conn.message_queue = [] +endfunction + +function! s:HandleInitializeResponse(conn, response) abort + let l:request_id = a:response.request_id + let l:project = s:FindProjectWithInitRequestID(a:conn, l:request_id) + + if !empty(l:project) + call s:MarkProjectAsInitialized(a:conn, l:project) + endif +endfunction + +function! ale#lsp#HandleOtherInitializeResponses(conn, response) abort + let l:uninitialized_projects = [] + + for [l:key, l:value] in items(a:conn.projects) + if l:value.initialized == 0 + call add(l:uninitialized_projects, [l:key, l:value]) + endif + endfor + + if empty(l:uninitialized_projects) + return + endif + + if get(a:response, 'method', '') is# '' + if has_key(get(a:response, 'result', {}), 'capabilities') + for [l:dir, l:project] in l:uninitialized_projects + call s:MarkProjectAsInitialized(a:conn, l:project) + endfor + endif + elseif get(a:response, 'method', '') is# 'textDocument/publishDiagnostics' + let l:filename = ale#path#FromURI(a:response.params.uri) + + for [l:dir, l:project] in l:uninitialized_projects + if l:filename[:len(l:dir) - 1] is# l:dir + call s:MarkProjectAsInitialized(a:conn, l:project) + endif + endfor + endif +endfunction + +function! ale#lsp#HandleMessage(conn, message) abort + let a:conn.data .= a:message + + " Parse the objects now if we can, and keep the remaining text. + let [a:conn.data, l:response_list] = ale#lsp#ReadMessageData(a:conn.data) + + " Call our callbacks. + for l:response in l:response_list + if get(l:response, 'method', '') is# 'initialize' + call s:HandleInitializeResponse(a:conn, l:response) + else + call ale#lsp#HandleOtherInitializeResponses(a:conn, l:response) + + " Call all of the registered handlers with the response. + for l:Callback in a:conn.callback_list + call ale#util#GetFunction(l:Callback)(a:conn.id, l:response) + endfor + endif + endfor +endfunction + +function! s:HandleChannelMessage(channel, message) abort + let l:info = ch_info(a:channel) + let l:address = l:info.hostname . l:info.address + let l:conn = s:FindConnection('id', l:address) + + call ale#lsp#HandleMessage(l:conn, a:message) +endfunction + +function! s:HandleCommandMessage(job_id, message) abort + let l:conn = s:FindConnection('id', a:job_id) + + call ale#lsp#HandleMessage(l:conn, a:message) +endfunction + +function! ale#lsp#RegisterProject(conn, project_root) abort + " Empty strings can't be used for Dictionary keys in NeoVim, due to E713. + " This appears to be a nonsensical bug in NeoVim. + let l:key = empty(a:project_root) ? '<>' : a:project_root + + if !has_key(a:conn.projects, l:key) + " Tools without project roots are ready right away, like tsserver. + let a:conn.projects[l:key] = { + \ 'initialized': empty(a:project_root), + \ 'init_request_id': 0, + \ 'message_queue': [], + \} + endif +endfunction + +function! ale#lsp#GetProject(conn, project_root) abort + let l:key = empty(a:project_root) ? '<>' : a:project_root + + return get(a:conn.projects, l:key, {}) +endfunction + +" Start a program for LSP servers which run with executables. +" +" The job ID will be returned for for the program if it ran, otherwise +" 0 will be returned. +function! ale#lsp#StartProgram(executable, command, project_root, callback) abort + if !executable(a:executable) + return 0 + endif + + let l:conn = s:FindConnection('executable', a:executable) + + " Get the current connection or a new one. + let l:conn = !empty(l:conn) ? l:conn : s:NewConnection() + let l:conn.executable = a:executable + + if !has_key(l:conn, 'id') || !ale#job#IsRunning(l:conn.id) + let l:options = { + \ 'mode': 'raw', + \ 'out_cb': function('s:HandleCommandMessage'), + \} + let l:job_id = ale#job#Start(a:command, l:options) + else + let l:job_id = l:conn.id + endif + + if l:job_id <= 0 + return 0 + endif + + let l:conn.id = l:job_id + " Add the callback to the List if it's not there already. + call uniq(sort(add(l:conn.callback_list, a:callback))) + call ale#lsp#RegisterProject(l:conn, a:project_root) + + return l:job_id +endfunction + +" Connect to an address and set up a callback for handling responses. +function! ale#lsp#ConnectToAddress(address, project_root, callback) abort + let l:conn = s:FindConnection('id', a:address) + " Get the current connection or a new one. + let l:conn = !empty(l:conn) ? l:conn : s:NewConnection() + + if !has_key(l:conn, 'channel') || ch_status(l:conn.channel) isnot# 'open' + let l:conn.channnel = ch_open(a:address, { + \ 'mode': 'raw', + \ 'waittime': 0, + \ 'callback': function('s:HandleChannelMessage'), + \}) + endif + + if ch_status(l:conn.channnel) is# 'fail' + return 0 + endif + + let l:conn.id = a:address + " Add the callback to the List if it's not there already. + call uniq(sort(add(l:conn.callback_list, a:callback))) + call ale#lsp#RegisterProject(l:conn, a:project_root) + + return 1 +endfunction + +" Stop all LSP connections, closing all jobs and channels, and removing any +" queued messages. +function! ale#lsp#StopAll() abort + for l:conn in s:connections + if has_key(l:conn, 'channel') + call ch_close(l:conn.channel) + else + call ale#job#Stop(l:conn.id) + endif + endfor + + let s:connections = [] +endfunction + +function! s:SendMessageData(conn, data) abort + if has_key(a:conn, 'executable') + call ale#job#SendRaw(a:conn.id, a:data) + elseif has_key(a:conn, 'channel') && ch_status(a:conn.channnel) is# 'open' + " Send the message to the server + call ch_sendraw(a:conn.channel, a:data) + else + return 0 + endif + + return 1 +endfunction + +" Send a message to an LSP server. +" Notifications do not need to be handled. +" +" Returns -1 when a message is sent, but no response is expected +" 0 when the message is not sent and +" >= 1 with the message ID when a response is expected. +function! ale#lsp#Send(conn_id, message, ...) abort + let l:project_root = get(a:000, 0, '') + + let l:conn = s:FindConnection('id', a:conn_id) + + if empty(l:conn) + return 0 + endif + + let l:project = ale#lsp#GetProject(l:conn, l:project_root) + + if empty(l:project) + return 0 + endif + + " If we haven't initialized the server yet, then send the message for it. + if !l:project.initialized + " Only send the init message once. + if !l:project.init_request_id + let [l:init_id, l:init_data] = ale#lsp#CreateMessageData( + \ ale#lsp#message#Initialize(l:project_root), + \) + + let l:project.init_request_id = l:init_id + + call s:SendMessageData(l:conn, l:init_data) + endif + endif + + let [l:id, l:data] = ale#lsp#CreateMessageData(a:message) + + if l:project.initialized + " Send the message now. + call s:SendMessageData(l:conn, l:data) + else + " Add the message we wanted to send to a List to send later. + call add(l:project.message_queue, l:data) + endif + + return l:id == 0 ? -1 : l:id +endfunction + +function! ale#lsp#OpenDocumentIfNeeded(conn_id, buffer, project_root, language_id) abort + let l:conn = s:FindConnection('id', a:conn_id) + let l:opened = 0 + + if !empty(l:conn) && index(l:conn.open_documents, a:buffer) < 0 + if empty(a:language_id) + let l:message = ale#lsp#tsserver_message#Open(a:buffer) + else + let l:message = ale#lsp#message#DidOpen(a:buffer, a:language_id) + endif + + call ale#lsp#Send(a:conn_id, l:message, a:project_root) + call add(l:conn.open_documents, a:buffer) + let l:opened = 1 + endif + + return l:opened +endfunction diff --git a/sources_non_forked/ale/autoload/ale/lsp/message.vim b/sources_non_forked/ale/autoload/ale/lsp/message.vim new file mode 100644 index 00000000..0b73cfc2 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/lsp/message.vim @@ -0,0 +1,118 @@ +" Author: w0rp +" Description: Language Server Protocol message implementations +" +" Messages in this movie will be returned in the format +" [is_notification, method_name, params?] +let g:ale_lsp_next_version_id = 1 + +" The LSP protocols demands that we send every change to a document, including +" undo, with incrementing version numbers, so we'll just use one incrementing +" ID for everything. +function! ale#lsp#message#GetNextVersionID() abort + " Use the current ID + let l:id = g:ale_lsp_next_version_id + + " Increment the ID variable. + let g:ale_lsp_next_version_id += 1 + + " When the ID overflows, reset it to 1. By the time we hit the initial ID + " again, the messages will be long gone. + if g:ale_lsp_next_version_id < 1 + let g:ale_lsp_next_version_id = 1 + endif + + return l:id +endfunction + +function! ale#lsp#message#Initialize(root_path) abort + " TODO: Define needed capabilities. + return [0, 'initialize', { + \ 'processId': getpid(), + \ 'rootPath': a:root_path, + \ 'capabilities': {}, + \}] +endfunction + +function! ale#lsp#message#Initialized() abort + return [1, 'initialized'] +endfunction + +function! ale#lsp#message#Shutdown() abort + return [0, 'shutdown'] +endfunction + +function! ale#lsp#message#Exit() abort + return [1, 'exit'] +endfunction + +function! ale#lsp#message#DidOpen(buffer, language_id) abort + let l:lines = getbufline(a:buffer, 1, '$') + + return [1, 'textDocument/didOpen', { + \ 'textDocument': { + \ 'uri': ale#path#ToURI(expand('#' . a:buffer . ':p')), + \ 'languageId': a:language_id, + \ 'version': ale#lsp#message#GetNextVersionID(), + \ 'text': join(l:lines, "\n") . "\n", + \ }, + \}] +endfunction + +function! ale#lsp#message#DidChange(buffer) abort + let l:lines = getbufline(a:buffer, 1, '$') + + " For changes, we simply send the full text of the document to the server. + return [1, 'textDocument/didChange', { + \ 'textDocument': { + \ 'uri': ale#path#ToURI(expand('#' . a:buffer . ':p')), + \ 'version': ale#lsp#message#GetNextVersionID(), + \ }, + \ 'contentChanges': [{'text': join(l:lines, "\n") . "\n"}] + \}] +endfunction + +function! ale#lsp#message#DidSave(buffer) abort + return [1, 'textDocument/didSave', { + \ 'textDocument': { + \ 'uri': ale#path#ToURI(expand('#' . a:buffer . ':p')), + \ }, + \}] +endfunction + +function! ale#lsp#message#DidClose(buffer) abort + return [1, 'textDocument/didClose', { + \ 'textDocument': { + \ 'uri': ale#path#ToURI(expand('#' . a:buffer . ':p')), + \ }, + \}] +endfunction + +let s:COMPLETION_TRIGGER_INVOKED = 1 +let s:COMPLETION_TRIGGER_CHARACTER = 2 + +function! ale#lsp#message#Completion(buffer, line, column, trigger_character) abort + let l:message = [0, 'textDocument/completion', { + \ 'textDocument': { + \ 'uri': ale#path#ToURI(expand('#' . a:buffer . ':p')), + \ }, + \ 'position': {'line': a:line - 1, 'character': a:column}, + \}] + + if !empty(a:trigger_character) + let l:message[2].context = { + \ 'triggerKind': s:COMPLETION_TRIGGER_CHARACTER, + \ 'triggerCharacter': a:trigger_character, + \} + endif + + return l:message +endfunction + +function! ale#lsp#message#Definition(buffer, line, column) abort + return [0, 'textDocument/definition', { + \ 'textDocument': { + \ 'uri': ale#path#ToURI(expand('#' . a:buffer . ':p')), + \ }, + \ 'position': {'line': a:line - 1, 'character': a:column}, + \}] +endfunction diff --git a/sources_non_forked/ale/autoload/ale/lsp/reset.vim b/sources_non_forked/ale/autoload/ale/lsp/reset.vim new file mode 100644 index 00000000..c206ed08 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/lsp/reset.vim @@ -0,0 +1,25 @@ +" Stop all LSPs and remove all of the data for them. +function! ale#lsp#reset#StopAllLSPs() abort + call ale#lsp#StopAll() + + if exists('*ale#definition#ClearLSPData') + " Clear the mapping for connections, etc. + call ale#definition#ClearLSPData() + endif + + if exists('*ale#engine#ClearLSPData') + " Clear the mapping for connections, etc. + call ale#engine#ClearLSPData() + + " Remove the problems for all of the LSP linters in every buffer. + for l:buffer_string in keys(g:ale_buffer_info) + let l:buffer = str2nr(l:buffer_string) + + for l:linter in ale#linter#Get(getbufvar(l:buffer, '&filetype')) + if !empty(l:linter.lsp) + call ale#engine#HandleLoclist(l:linter.name, l:buffer, []) + endif + endfor + endfor + endif +endfunction diff --git a/sources_non_forked/ale/autoload/ale/lsp/response.vim b/sources_non_forked/ale/autoload/ale/lsp/response.vim new file mode 100644 index 00000000..5a431287 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/lsp/response.vim @@ -0,0 +1,74 @@ +" Author: w0rp +" Description: Parsing and transforming of LSP server responses. + +" Constants for message severity codes. +let s:SEVERITY_ERROR = 1 +let s:SEVERITY_WARNING = 2 +let s:SEVERITY_INFORMATION = 3 +let s:SEVERITY_HINT = 4 + +" Parse the message for textDocument/publishDiagnostics +function! ale#lsp#response#ReadDiagnostics(response) abort + let l:loclist = [] + + for l:diagnostic in a:response.params.diagnostics + let l:severity = get(l:diagnostic, 'severity', 0) + let l:loclist_item = { + \ 'text': l:diagnostic.message, + \ 'type': 'E', + \ 'lnum': l:diagnostic.range.start.line + 1, + \ 'col': l:diagnostic.range.start.character + 1, + \ 'end_lnum': l:diagnostic.range.end.line + 1, + \ 'end_col': l:diagnostic.range.end.character + 1, + \} + + if l:severity == s:SEVERITY_WARNING + let l:loclist_item.type = 'W' + elseif l:severity == s:SEVERITY_INFORMATION + " TODO: Use 'I' here in future. + let l:loclist_item.type = 'W' + elseif l:severity == s:SEVERITY_HINT + " TODO: Use 'H' here in future + let l:loclist_item.type = 'W' + endif + + if has_key(l:diagnostic, 'code') + let l:loclist_item.nr = l:diagnostic.code + endif + + call add(l:loclist, l:loclist_item) + endfor + + return l:loclist +endfunction + +function! ale#lsp#response#ReadTSServerDiagnostics(response) abort + let l:loclist = [] + + for l:diagnostic in a:response.body.diagnostics + let l:loclist_item = { + \ 'text': l:diagnostic.text, + \ 'type': 'E', + \ 'lnum': l:diagnostic.start.line, + \ 'col': l:diagnostic.start.offset, + \ 'end_lnum': l:diagnostic.end.line, + \ 'end_col': l:diagnostic.end.offset, + \} + + if has_key(l:diagnostic, 'code') + let l:loclist_item.nr = l:diagnostic.code + endif + + if get(l:diagnostic, 'category') is# 'warning' + let l:loclist_item.type = 'W' + endif + + if get(l:diagnostic, 'category') is# 'suggestion' + let l:loclist_item.type = 'I' + endif + + call add(l:loclist, l:loclist_item) + endfor + + return l:loclist +endfunction diff --git a/sources_non_forked/ale/autoload/ale/lsp/tsserver_message.vim b/sources_non_forked/ale/autoload/ale/lsp/tsserver_message.vim new file mode 100644 index 00000000..b9bd7a01 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/lsp/tsserver_message.vim @@ -0,0 +1,63 @@ +" Author: w0rp +" Description: tsserver message implementations +" +" Messages in this movie will be returned in the format +" [is_notification, command_name, params?] +" +" Every command must begin with the string 'ts@', which will be used to +" detect the different message format for tsserver, and this string will +" be removed from the actual command name, + +function! ale#lsp#tsserver_message#Open(buffer) abort + return [1, 'ts@open', {'file': expand('#' . a:buffer . ':p')}] +endfunction + +function! ale#lsp#tsserver_message#Close(buffer) abort + return [1, 'ts@close', {'file': expand('#' . a:buffer . ':p')}] +endfunction + +function! ale#lsp#tsserver_message#Change(buffer) abort + let l:lines = getbufline(a:buffer, 1, '$') + + " We will always use a very high endLine number, so we can delete + " lines from files. tsserver will gladly accept line numbers beyond the + " end. + return [1, 'ts@change', { + \ 'file': expand('#' . a:buffer . ':p'), + \ 'line': 1, + \ 'offset': 1, + \ 'endLine': 1073741824, + \ 'endOffset': 1, + \ 'insertString': join(l:lines, "\n") . "\n", + \}] +endfunction + +function! ale#lsp#tsserver_message#Geterr(buffer) abort + return [1, 'ts@geterr', {'files': [expand('#' . a:buffer . ':p')]}] +endfunction + +function! ale#lsp#tsserver_message#Completions(buffer, line, column, prefix) abort + return [0, 'ts@completions', { + \ 'line': a:line, + \ 'offset': a:column, + \ 'file': expand('#' . a:buffer . ':p'), + \ 'prefix': a:prefix, + \}] +endfunction + +function! ale#lsp#tsserver_message#CompletionEntryDetails(buffer, line, column, entry_names) abort + return [0, 'ts@completionEntryDetails', { + \ 'line': a:line, + \ 'offset': a:column, + \ 'file': expand('#' . a:buffer . ':p'), + \ 'entryNames': a:entry_names, + \}] +endfunction + +function! ale#lsp#tsserver_message#Definition(buffer, line, column) abort + return [0, 'ts@definition', { + \ 'line': a:line, + \ 'offset': a:column, + \ 'file': expand('#' . a:buffer . ':p'), + \}] +endfunction diff --git a/sources_non_forked/ale/autoload/ale/node.vim b/sources_non_forked/ale/autoload/ale/node.vim new file mode 100644 index 00000000..f75280b7 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/node.vim @@ -0,0 +1,42 @@ +" Author: w0rp +" Description: Functions for working with Node executables. + +call ale#Set('windows_node_executable_path', 'node.exe') + +" Given a buffer number, a base variable name, and a list of paths to search +" for in ancestor directories, detect the executable path for a Node program. +" +" The use_global and executable options for the relevant program will be used. +function! ale#node#FindExecutable(buffer, base_var_name, path_list) abort + if ale#Var(a:buffer, a:base_var_name . '_use_global') + return ale#Var(a:buffer, a:base_var_name . '_executable') + endif + + for l:path in a:path_list + let l:executable = ale#path#FindNearestFile(a:buffer, l:path) + + if !empty(l:executable) + return l:executable + endif + endfor + + return ale#Var(a:buffer, a:base_var_name . '_executable') +endfunction + +" Create a executable string which executes a Node.js script command with a +" Node.js executable if needed. +" +" The executable string should not be escaped before passing it to this +" function, the executable string will be escaped when returned by this +" function. +" +" The executable is only prefixed for Windows machines +function! ale#node#Executable(buffer, executable) abort + if ale#Has('win32') && a:executable =~? '\.js$' + let l:node = ale#Var(a:buffer, 'windows_node_executable_path') + + return ale#Escape(l:node) . ' ' . ale#Escape(a:executable) + endif + + return ale#Escape(a:executable) +endfunction diff --git a/sources_non_forked/ale/autoload/ale/path.vim b/sources_non_forked/ale/autoload/ale/path.vim new file mode 100644 index 00000000..91832b35 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/path.vim @@ -0,0 +1,192 @@ +" Author: w0rp +" Description: Functions for working with paths in the filesystem. + +" simplify a path, and fix annoying issues with paths on Windows. +" +" Forward slashes are changed to back slashes so path equality works better. +" +" Paths starting with more than one forward slash are changed to only one +" forward slash, to prevent the paths being treated as special MSYS paths. +function! ale#path#Simplify(path) abort + if has('unix') + return substitute(simplify(a:path), '^//\+', '/', 'g') " no-custom-checks + endif + + let l:win_path = substitute(a:path, '/', '\\', 'g') + + return substitute(simplify(l:win_path), '^\\\+', '\', 'g') " no-custom-checks +endfunction + +" Given a buffer and a filename, find the nearest file by searching upwards +" through the paths relative to the given buffer. +function! ale#path#FindNearestFile(buffer, filename) abort + let l:buffer_filename = fnamemodify(bufname(a:buffer), ':p') + let l:buffer_filename = fnameescape(l:buffer_filename) + + let l:relative_path = findfile(a:filename, l:buffer_filename . ';') + + if !empty(l:relative_path) + return fnamemodify(l:relative_path, ':p') + endif + + return '' +endfunction + +" Given a buffer and a directory name, find the nearest directory by searching upwards +" through the paths relative to the given buffer. +function! ale#path#FindNearestDirectory(buffer, directory_name) abort + let l:buffer_filename = fnamemodify(bufname(a:buffer), ':p') + let l:buffer_filename = fnameescape(l:buffer_filename) + + let l:relative_path = finddir(a:directory_name, l:buffer_filename . ';') + + if !empty(l:relative_path) + return fnamemodify(l:relative_path, ':p') + endif + + return '' +endfunction + +" Given a buffer, a string to search for, an a global fallback for when +" the search fails, look for a file in parent paths, and if that fails, +" use the global fallback path instead. +function! ale#path#ResolveLocalPath(buffer, search_string, global_fallback) abort + " Search for a locally installed file first. + let l:path = ale#path#FindNearestFile(a:buffer, a:search_string) + + " If the serach fails, try the global executable instead. + if empty(l:path) + let l:path = a:global_fallback + endif + + return l:path +endfunction + +" Output 'cd && ' +" This function can be used changing the directory for a linter command. +function! ale#path#CdString(directory) abort + return 'cd ' . ale#Escape(a:directory) . ' && ' +endfunction + +" Output 'cd && ' +" This function can be used changing the directory for a linter command. +function! ale#path#BufferCdString(buffer) abort + return ale#path#CdString(fnamemodify(bufname(a:buffer), ':p:h')) +endfunction + +" Return 1 if a path is an absolute path. +function! ale#path#IsAbsolute(filename) abort + if has('win32') && a:filename[:0] is# '\' + return 1 + endif + + " Check for /foo and C:\foo, etc. + return a:filename[:0] is# '/' || a:filename[1:2] is# ':\' +endfunction + +let s:temp_dir = ale#path#Simplify(fnamemodify(tempname(), ':h')) + +" Given a filename, return 1 if the file represents some temporary file +" created by Vim. +function! ale#path#IsTempName(filename) abort + return ale#path#Simplify(a:filename)[:len(s:temp_dir) - 1] is# s:temp_dir +endfunction + +" Given a base directory, which must not have a trailing slash, and a +" filename, which may have an absolute path a path relative to the base +" directory, return the absolute path to the file. +function! ale#path#GetAbsPath(base_directory, filename) abort + if ale#path#IsAbsolute(a:filename) + return ale#path#Simplify(a:filename) + endif + + let l:sep = has('win32') ? '\' : '/' + + return ale#path#Simplify(a:base_directory . l:sep . a:filename) +endfunction + +" Given a buffer number and a relative or absolute path, return 1 if the +" two paths represent the same file on disk. +function! ale#path#IsBufferPath(buffer, complex_filename) abort + " If the path is one of many different names for stdin, we have a match. + if a:complex_filename is# '-' + \|| a:complex_filename is# 'stdin' + \|| a:complex_filename[:0] is# '<' + return 1 + endif + + let l:test_filename = ale#path#Simplify(a:complex_filename) + + if l:test_filename[:1] is# './' + let l:test_filename = l:test_filename[2:] + endif + + if l:test_filename[:1] is# '..' + " Remove ../../ etc. from the front of the path. + let l:test_filename = substitute(l:test_filename, '\v^(\.\.[/\\])+', '/', '') + endif + + " Use the basename for temporary files, as they are likely our files. + if ale#path#IsTempName(l:test_filename) + let l:test_filename = fnamemodify(l:test_filename, ':t') + endif + + let l:buffer_filename = expand('#' . a:buffer . ':p') + + return l:buffer_filename is# l:test_filename + \ || l:buffer_filename[-len(l:test_filename):] is# l:test_filename +endfunction + +" Given a path, return every component of the path, moving upwards. +function! ale#path#Upwards(path) abort + let l:pattern = has('win32') ? '\v/+|\\+' : '\v/+' + let l:sep = has('win32') ? '\' : '/' + let l:parts = split(ale#path#Simplify(a:path), l:pattern) + let l:path_list = [] + + while !empty(l:parts) + call add(l:path_list, join(l:parts, l:sep)) + let l:parts = l:parts[:-2] + endwhile + + if has('win32') && a:path =~# '^[a-zA-z]:\' + " Add \ to C: for C:\, etc. + let l:path_list[-1] .= '\' + elseif a:path[0] is# '/' + " If the path starts with /, even on Windows, add / and / to all paths. + call map(l:path_list, '''/'' . v:val') + call add(l:path_list, '/') + endif + + return l:path_list +endfunction + +" Convert a filesystem path to a file:// URI +" relatives paths will not be prefixed with the protocol. +" For Windows paths, the `:` in C:\ etc. will not be percent-encoded. +function! ale#path#ToURI(path) abort + let l:has_drive_letter = a:path[1:2] is# ':\' + + return substitute( + \ ((l:has_drive_letter || a:path[:0] is# '/') ? 'file://' : '') + \ . (l:has_drive_letter ? '/' . a:path[:2] : '') + \ . ale#uri#Encode(l:has_drive_letter ? a:path[3:] : a:path), + \ '\\', + \ '/', + \ 'g', + \) +endfunction + +function! ale#path#FromURI(uri) abort + let l:i = len('file://') + let l:encoded_path = a:uri[: l:i - 1] is# 'file://' ? a:uri[l:i :] : a:uri + + let l:path = ale#uri#Decode(l:encoded_path) + + " If the path is like /C:/foo/bar, it should be C:\foo\bar instead. + if l:path =~# '^/[a-zA-Z]:' + let l:path = substitute(l:path[1:], '/', '\\', 'g') + endif + + return l:path +endfunction diff --git a/sources_non_forked/ale/autoload/ale/pattern_options.vim b/sources_non_forked/ale/autoload/ale/pattern_options.vim new file mode 100644 index 00000000..e58b8cf2 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/pattern_options.vim @@ -0,0 +1,44 @@ +" Author: w0rp +" Description: Set options in files based on regex patterns. + +" These variables are used to cache the sorting of patterns below. +let s:last_pattern_options = {} +let s:sorted_items = [] + +function! s:CmpPatterns(left_item, right_item) abort + if a:left_item[0] < a:right_item[0] + return -1 + endif + + if a:left_item[0] > a:right_item[0] + return 1 + endif + + return 0 +endfunction + +function! ale#pattern_options#SetOptions(buffer) abort + if !g:ale_pattern_options_enabled || empty(g:ale_pattern_options) + return + endif + + " The items will only be sorted whenever the patterns change. + if g:ale_pattern_options != s:last_pattern_options + let s:last_pattern_options = deepcopy(g:ale_pattern_options) + " The patterns are sorted, so they are applied consistently. + let s:sorted_items = sort( + \ items(g:ale_pattern_options), + \ function('s:CmpPatterns') + \) + endif + + let l:filename = expand('#' . a:buffer . ':p') + + for [l:pattern, l:options] in s:sorted_items + if match(l:filename, l:pattern) >= 0 + for [l:key, l:value] in items(l:options) + call setbufvar(a:buffer, l:key, l:value) + endfor + endif + endfor +endfunction diff --git a/sources_non_forked/ale/autoload/ale/preview.vim b/sources_non_forked/ale/autoload/ale/preview.vim new file mode 100644 index 00000000..3b1c16a6 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/preview.vim @@ -0,0 +1,18 @@ +" Author: w0rp +" Description: Preview windows for showing whatever information in. + +" Open a preview window and show some lines in it. +function! ale#preview#Show(lines) abort + silent pedit ALEPreviewWindow + wincmd P + setlocal modifiable + setlocal noreadonly + setlocal nobuflisted + setlocal filetype=ale-preview + setlocal buftype=nofile + setlocal bufhidden=wipe + :%d + call setline(1, a:lines) + setlocal nomodifiable + setlocal readonly +endfunction diff --git a/sources_non_forked/ale/autoload/ale/python.vim b/sources_non_forked/ale/autoload/ale/python.vim new file mode 100644 index 00000000..82dd9d7c --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/python.vim @@ -0,0 +1,104 @@ +" Author: w0rp +" Description: Functions for integrating with Python linters. + +let s:sep = has('win32') ? '\' : '/' +" bin is used for Unix virtualenv directories, and Scripts is for Windows. +let s:bin_dir = has('unix') ? 'bin' : 'Scripts' +let g:ale_virtualenv_dir_names = get(g:, 'ale_virtualenv_dir_names', [ +\ '.env', +\ 'env', +\ 've-py3', +\ 've', +\ 'virtualenv', +\ 'venv', +\]) + +function! ale#python#FindProjectRootIni(buffer) abort + for l:path in ale#path#Upwards(expand('#' . a:buffer . ':p:h')) + if filereadable(l:path . '/MANIFEST.in') + \|| filereadable(l:path . '/setup.cfg') + \|| filereadable(l:path . '/pytest.ini') + \|| filereadable(l:path . '/tox.ini') + \|| filereadable(l:path . '/mypy.ini') + \|| filereadable(l:path . '/pycodestyle.cfg') + \|| filereadable(l:path . '/flake8.cfg') + return l:path + endif + endfor + + return '' +endfunction + +" Given a buffer number, find the project root directory for Python. +" The root directory is defined as the first directory found while searching +" upwards through paths, including the current directory, until a path +" containing an init file (one from MANIFEST.in, setup.cfg, pytest.ini, +" tox.ini) is found. If it is not possible to find the project root directory +" via init file, then it will be defined as the first directory found +" searching upwards through paths, including the current directory, until no +" __init__.py files is found. +function! ale#python#FindProjectRoot(buffer) abort + let l:ini_root = ale#python#FindProjectRootIni(a:buffer) + + if !empty(l:ini_root) + return l:ini_root + endif + + for l:path in ale#path#Upwards(expand('#' . a:buffer . ':p:h')) + if !filereadable(l:path . '/__init__.py') + return l:path + endif + endfor + + return '' +endfunction + +" Given a buffer number, find a virtualenv path for Python. +function! ale#python#FindVirtualenv(buffer) abort + for l:path in ale#path#Upwards(expand('#' . a:buffer . ':p:h')) + " Skip empty path components returned in MSYS. + if empty(l:path) + continue + endif + + for l:dirname in ale#Var(a:buffer, 'virtualenv_dir_names') + let l:venv_dir = ale#path#Simplify( + \ join([l:path, l:dirname], s:sep) + \) + let l:script_filename = ale#path#Simplify( + \ join([l:venv_dir, s:bin_dir, 'activate'], s:sep) + \) + + if filereadable(l:script_filename) + return l:venv_dir + endif + endfor + endfor + + return $VIRTUAL_ENV +endfunction + +" Given a buffer number and a command name, find the path to the executable. +" First search on a virtualenv for Python, if nothing is found, try the global +" command. Returns an empty string if cannot find the executable +function! ale#python#FindExecutable(buffer, base_var_name, path_list) abort + if ale#Var(a:buffer, a:base_var_name . '_use_global') + return ale#Var(a:buffer, a:base_var_name . '_executable') + endif + + let l:virtualenv = ale#python#FindVirtualenv(a:buffer) + + if !empty(l:virtualenv) + for l:path in a:path_list + let l:ve_executable = ale#path#Simplify( + \ join([l:virtualenv, s:bin_dir, l:path], s:sep) + \) + + if executable(l:ve_executable) + return l:ve_executable + endif + endfor + endif + + return ale#Var(a:buffer, a:base_var_name . '_executable') +endfunction diff --git a/sources_non_forked/ale/autoload/ale/ruby.vim b/sources_non_forked/ale/autoload/ale/ruby.vim new file mode 100644 index 00000000..b981ded6 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/ruby.vim @@ -0,0 +1,22 @@ +" Author: Eddie Lebow https://github.com/elebow +" Description: Functions for integrating with Ruby tools + +" Find the nearest dir contining "app", "db", and "config", and assume it is +" the root of a Rails app. +function! ale#ruby#FindRailsRoot(buffer) abort + for l:name in ['app', 'config', 'db'] + let l:dir = fnamemodify( + \ ale#path#FindNearestDirectory(a:buffer, l:name), + \ ':h:h' + \) + + if l:dir isnot# '.' + \&& isdirectory(l:dir . '/app') + \&& isdirectory(l:dir . '/config') + \&& isdirectory(l:dir . '/db') + return l:dir + endif + endfor + + return '' +endfunction diff --git a/sources_non_forked/ale/autoload/ale/semver.vim b/sources_non_forked/ale/autoload/ale/semver.vim new file mode 100644 index 00000000..6b0fd34a --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/semver.vim @@ -0,0 +1,57 @@ +let s:version_cache = {} + +" Reset the version cache used for parsing the version. +function! ale#semver#ResetVersionCache() abort + let s:version_cache = {} +endfunction + +" Given an executable name and some lines of output, which can be empty, +" parse the version from the lines of output, or return the cached version +" triple [major, minor, patch] +" +" If the version cannot be found, an empty List will be returned instead. +function! ale#semver#GetVersion(executable, version_lines) abort + let l:version = get(s:version_cache, a:executable, []) + + for l:line in a:version_lines + let l:match = matchlist(l:line, '\v(\d+)\.(\d+)\.(\d+)') + + if !empty(l:match) + let l:version = [l:match[1] + 0, l:match[2] + 0, l:match[3] + 0] + let s:version_cache[a:executable] = l:version + + break + endif + endfor + + return l:version +endfunction + +" Return 1 if the semver version has been cached for a given executable. +function! ale#semver#HasVersion(executable) abort + return has_key(s:version_cache, a:executable) +endfunction + +" Given two triples of integers [major, minor, patch], compare the triples +" and return 1 if the LHS is greater than or equal to the RHS. +" +" Pairs of [major, minor] can also be used for either argument. +" +" 0 will be returned if the LHS is an empty List. +function! ale#semver#GTE(lhs, rhs) abort + if empty(a:lhs) + return 0 + endif + + if a:lhs[0] > a:rhs[0] + return 1 + elseif a:lhs[0] == a:rhs[0] + if a:lhs[1] > a:rhs[1] + return 1 + elseif a:lhs[1] == a:rhs[1] + return get(a:lhs, 2) >= get(a:rhs, 2) + endif + endif + + return 0 +endfunction diff --git a/sources_non_forked/ale/autoload/ale/sign.vim b/sources_non_forked/ale/autoload/ale/sign.vim new file mode 100644 index 00000000..1c439bc8 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/sign.vim @@ -0,0 +1,386 @@ +scriptencoding utf8 +" Author: w0rp +" Description: Draws error and warning signs into signcolumn + +if !hlexists('ALEErrorSign') + highlight link ALEErrorSign error +endif + +if !hlexists('ALEStyleErrorSign') + highlight link ALEStyleErrorSign ALEErrorSign +endif + +if !hlexists('ALEWarningSign') + highlight link ALEWarningSign todo +endif + +if !hlexists('ALEStyleWarningSign') + highlight link ALEStyleWarningSign ALEWarningSign +endif + +if !hlexists('ALEInfoSign') + highlight link ALEInfoSign ALEWarningSign +endif + +if !hlexists('ALESignColumnWithErrors') + highlight link ALESignColumnWithErrors error +endif + +if !hlexists('ALESignColumnWithoutErrors') + function! s:SetSignColumnWithoutErrorsHighlight() abort + redir => l:output + silent highlight SignColumn + redir end + + let l:highlight_syntax = join(split(l:output)[2:]) + + let l:match = matchlist(l:highlight_syntax, '\vlinks to (.+)$') + + if !empty(l:match) + execute 'highlight link ALESignColumnWithoutErrors ' . l:match[1] + elseif l:highlight_syntax isnot# 'cleared' + execute 'highlight ALESignColumnWithoutErrors ' . l:highlight_syntax + endif + endfunction + + call s:SetSignColumnWithoutErrorsHighlight() + delfunction s:SetSignColumnWithoutErrorsHighlight +endif + +" Signs show up on the left for error markers. +execute 'sign define ALEErrorSign text=' . g:ale_sign_error +\ . ' texthl=ALEErrorSign linehl=ALEErrorLine' +execute 'sign define ALEStyleErrorSign text=' . g:ale_sign_style_error +\ . ' texthl=ALEStyleErrorSign linehl=ALEErrorLine' +execute 'sign define ALEWarningSign text=' . g:ale_sign_warning +\ . ' texthl=ALEWarningSign linehl=ALEWarningLine' +execute 'sign define ALEStyleWarningSign text=' . g:ale_sign_style_warning +\ . ' texthl=ALEStyleWarningSign linehl=ALEWarningLine' +execute 'sign define ALEInfoSign text=' . g:ale_sign_info +\ . ' texthl=ALEInfoSign linehl=ALEInfoLine' +sign define ALEDummySign + +let s:error_priority = 1 +let s:warning_priority = 2 +let s:info_priority = 3 +let s:style_error_priority = 4 +let s:style_warning_priority = 5 + +function! ale#sign#GetSignName(sublist) abort + let l:priority = s:style_warning_priority + + " Determine the highest priority item for the line. + for l:item in a:sublist + if l:item.type is# 'I' + let l:item_priority = s:info_priority + elseif l:item.type is# 'W' + if get(l:item, 'sub_type', '') is# 'style' + let l:item_priority = s:style_warning_priority + else + let l:item_priority = s:warning_priority + endif + else + if get(l:item, 'sub_type', '') is# 'style' + let l:item_priority = s:style_error_priority + else + let l:item_priority = s:error_priority + endif + endif + + if l:item_priority < l:priority + let l:priority = l:item_priority + endif + endfor + + if l:priority is# s:error_priority + return 'ALEErrorSign' + endif + + if l:priority is# s:warning_priority + return 'ALEWarningSign' + endif + + if l:priority is# s:style_error_priority + return 'ALEStyleErrorSign' + endif + + if l:priority is# s:style_warning_priority + return 'ALEStyleWarningSign' + endif + + if l:priority is# s:info_priority + return 'ALEInfoSign' + endif + + " Use the error sign for invalid severities. + return 'ALEErrorSign' +endfunction + +" Read sign data for a buffer to a list of lines. +function! ale#sign#ReadSigns(buffer) abort + redir => l:output + silent execute 'sign place buffer=' . a:buffer + redir end + + return split(l:output, "\n") +endfunction + +" Given a list of lines for sign output, return a List of [line, id, group] +function! ale#sign#ParseSigns(line_list) abort + " Matches output like : + " line=4 id=1 name=ALEErrorSign + " строка=1 id=1000001 имя=ALEErrorSign + " 行=1 識別子=1000001 名前=ALEWarningSign + " línea=12 id=1000001 nombre=ALEWarningSign + " riga=1 id=1000001, nome=ALEWarningSign + let l:pattern = '\v^.*\=(\d+).*\=(\d+).*\=(ALE[a-zA-Z]+Sign)' + let l:result = [] + let l:is_dummy_sign_set = 0 + + for l:line in a:line_list + let l:match = matchlist(l:line, l:pattern) + + if len(l:match) > 0 + if l:match[3] is# 'ALEDummySign' + let l:is_dummy_sign_set = 1 + else + call add(l:result, [ + \ str2nr(l:match[1]), + \ str2nr(l:match[2]), + \ l:match[3], + \]) + endif + endif + endfor + + return [l:is_dummy_sign_set, l:result] +endfunction + +function! ale#sign#FindCurrentSigns(buffer) abort + let l:line_list = ale#sign#ReadSigns(a:buffer) + + return ale#sign#ParseSigns(l:line_list) +endfunction + +" Given a loclist, group the List into with one List per line. +function! s:GroupLoclistItems(buffer, loclist) abort + let l:grouped_items = [] + let l:last_lnum = -1 + + for l:obj in a:loclist + if l:obj.bufnr != a:buffer + continue + endif + + " Create a new sub-List when we hit a new line. + if l:obj.lnum != l:last_lnum + call add(l:grouped_items, []) + endif + + call add(l:grouped_items[-1], l:obj) + let l:last_lnum = l:obj.lnum + endfor + + return l:grouped_items +endfunction + +function! s:UpdateLineNumbers(buffer, current_sign_list, loclist) abort + let l:line_map = {} + let l:line_numbers_changed = 0 + + for [l:line, l:sign_id, l:name] in a:current_sign_list + let l:line_map[l:sign_id] = l:line + endfor + + for l:item in a:loclist + if l:item.bufnr == a:buffer + let l:lnum = get(l:line_map, get(l:item, 'sign_id', 0), 0) + + if l:lnum && l:item.lnum != l:lnum + let l:item.lnum = l:lnum + let l:line_numbers_changed = 1 + endif + endif + endfor + + " When the line numbers change, sort the list again + if l:line_numbers_changed + call sort(a:loclist, 'ale#util#LocItemCompare') + endif +endfunction + +function! s:BuildSignMap(buffer, current_sign_list, grouped_items) abort + let l:max_signs = ale#Var(a:buffer, 'max_signs') + + if l:max_signs is 0 + let l:selected_grouped_items = [] + elseif type(l:max_signs) is type(0) && l:max_signs > 0 + let l:selected_grouped_items = a:grouped_items[:l:max_signs - 1] + else + let l:selected_grouped_items = a:grouped_items + endif + + let l:sign_map = {} + let l:sign_offset = g:ale_sign_offset + + for [l:line, l:sign_id, l:name] in a:current_sign_list + let l:sign_info = get(l:sign_map, l:line, { + \ 'current_id_list': [], + \ 'current_name_list': [], + \ 'new_id': 0, + \ 'new_name': '', + \ 'items': [], + \}) + + " Increment the sign offset for new signs, by the maximum sign ID. + if l:sign_id > l:sign_offset + let l:sign_offset = l:sign_id + endif + + " Remember the sign names and IDs in separate Lists, so they are easy + " to work with. + call add(l:sign_info.current_id_list, l:sign_id) + call add(l:sign_info.current_name_list, l:name) + + let l:sign_map[l:line] = l:sign_info + endfor + + for l:group in l:selected_grouped_items + let l:line = l:group[0].lnum + let l:sign_info = get(l:sign_map, l:line, { + \ 'current_id_list': [], + \ 'current_name_list': [], + \ 'new_id': 0, + \ 'new_name': '', + \ 'items': [], + \}) + + let l:sign_info.new_name = ale#sign#GetSignName(l:group) + let l:sign_info.items = l:group + + let l:index = index( + \ l:sign_info.current_name_list, + \ l:sign_info.new_name + \) + + if l:index >= 0 + " We have a sign with this name already, so use the same ID. + let l:sign_info.new_id = l:sign_info.current_id_list[l:index] + else + " This sign name replaces the previous name, so use a new ID. + let l:sign_info.new_id = l:sign_offset + 1 + let l:sign_offset += 1 + endif + + let l:sign_map[l:line] = l:sign_info + endfor + + return l:sign_map +endfunction + +function! ale#sign#GetSignCommands(buffer, was_sign_set, sign_map) abort + let l:command_list = [] + let l:is_dummy_sign_set = a:was_sign_set + + " Set the dummy sign if we need to. + " The dummy sign is needed to keep the sign column open while we add + " and remove signs. + if !l:is_dummy_sign_set && (!empty(a:sign_map) || g:ale_sign_column_always) + call add(l:command_list, 'sign place ' + \ . g:ale_sign_offset + \ . ' line=1 name=ALEDummySign buffer=' + \ . a:buffer + \) + let l:is_dummy_sign_set = 1 + endif + + " Place new items first. + for [l:line_str, l:info] in items(a:sign_map) + if l:info.new_id + " Save the sign IDs we are setting back on our loclist objects. + " These IDs will be used to preserve items which are set many times. + for l:item in l:info.items + let l:item.sign_id = l:info.new_id + endfor + + if index(l:info.current_id_list, l:info.new_id) < 0 + call add(l:command_list, 'sign place ' + \ . (l:info.new_id) + \ . ' line=' . l:line_str + \ . ' name=' . (l:info.new_name) + \ . ' buffer=' . a:buffer + \) + endif + endif + endfor + + " Remove signs without new IDs. + for l:info in values(a:sign_map) + for l:current_id in l:info.current_id_list + if l:current_id isnot l:info.new_id + call add(l:command_list, 'sign unplace ' + \ . l:current_id + \ . ' buffer=' . a:buffer + \) + endif + endfor + endfor + + " Remove the dummy sign to close the sign column if we need to. + if l:is_dummy_sign_set && !g:ale_sign_column_always + call add(l:command_list, 'sign unplace ' + \ . g:ale_sign_offset + \ . ' buffer=' . a:buffer + \) + endif + + return l:command_list +endfunction + +" This function will set the signs which show up on the left. +function! ale#sign#SetSigns(buffer, loclist) abort + if !bufexists(str2nr(a:buffer)) + " Stop immediately when attempting to set signs for a buffer which + " does not exist. + return + endif + + " Find the current markers + let [l:is_dummy_sign_set, l:current_sign_list] = + \ ale#sign#FindCurrentSigns(a:buffer) + + " Update the line numbers for items from before which may have moved. + call s:UpdateLineNumbers(a:buffer, l:current_sign_list, a:loclist) + + " Group items after updating the line numbers. + let l:grouped_items = s:GroupLoclistItems(a:buffer, a:loclist) + + " Build a map of current and new signs, with the lines as the keys. + let l:sign_map = s:BuildSignMap( + \ a:buffer, + \ l:current_sign_list, + \ l:grouped_items, + \) + + let l:command_list = ale#sign#GetSignCommands( + \ a:buffer, + \ l:is_dummy_sign_set, + \ l:sign_map, + \) + + " Change the sign column color if the option is on. + if g:ale_change_sign_column_color && !empty(a:loclist) + highlight clear SignColumn + highlight link SignColumn ALESignColumnWithErrors + endif + + for l:command in l:command_list + silent! execute l:command + endfor + + " Reset the sign column color when there are no more errors. + if g:ale_change_sign_column_color && empty(a:loclist) + highlight clear SignColumn + highlight link SignColumn ALESignColumnWithoutErrors + endif +endfunction diff --git a/sources_non_forked/ale/autoload/ale/statusline.vim b/sources_non_forked/ale/autoload/ale/statusline.vim new file mode 100644 index 00000000..3f53368b --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/statusline.vim @@ -0,0 +1,112 @@ +" Author: KabbAmine +" Description: Statusline related function(s) + +function! s:CreateCountDict() abort + " Keys 0 and 1 are for backwards compatibility. + " The count object used to be a List of [error_count, warning_count]. + return { + \ '0': 0, + \ '1': 0, + \ 'error': 0, + \ 'warning': 0, + \ 'info': 0, + \ 'style_error': 0, + \ 'style_warning': 0, + \ 'total': 0, + \} +endfunction + +" Update the buffer error/warning count with data from loclist. +function! ale#statusline#Update(buffer, loclist) abort + if !exists('g:ale_buffer_info') || !has_key(g:ale_buffer_info, a:buffer) + return + endif + + let l:loclist = filter(copy(a:loclist), 'v:val.bufnr == a:buffer') + let l:count = s:CreateCountDict() + let l:count.total = len(l:loclist) + + for l:entry in l:loclist + if l:entry.type is# 'W' + if get(l:entry, 'sub_type', '') is# 'style' + let l:count.style_warning += 1 + else + let l:count.warning += 1 + endif + elseif l:entry.type is# 'I' + let l:count.info += 1 + elseif get(l:entry, 'sub_type', '') is# 'style' + let l:count.style_error += 1 + else + let l:count.error += 1 + endif + endfor + + " Set keys for backwards compatibility. + let l:count[0] = l:count.error + l:count.style_error + let l:count[1] = l:count.total - l:count[0] + + let g:ale_buffer_info[a:buffer].count = l:count +endfunction + +" Get the counts for the buffer, and update the counts if needed. +function! s:GetCounts(buffer) abort + if !exists('g:ale_buffer_info') || !has_key(g:ale_buffer_info, a:buffer) + return s:CreateCountDict() + endif + + " Cache is cold, so manually ask for an update. + if !has_key(g:ale_buffer_info[a:buffer], 'count') + call ale#statusline#Update(a:buffer, g:ale_buffer_info[a:buffer].loclist) + endif + + return g:ale_buffer_info[a:buffer].count +endfunction + +" Returns a Dictionary with counts for use in third party integrations. +function! ale#statusline#Count(buffer) abort + " The Dictionary is copied here before exposing it to other plugins. + return copy(s:GetCounts(a:buffer)) +endfunction + +" This is the historical format setting which could be configured before. +function! s:StatusForListFormat() abort + let [l:error_format, l:warning_format, l:no_errors] = g:ale_statusline_format + let l:counts = s:GetCounts(bufnr('')) + + " Build strings based on user formatting preferences. + let l:errors = l:counts[0] ? printf(l:error_format, l:counts[0]) : '' + let l:warnings = l:counts[1] ? printf(l:warning_format, l:counts[1]) : '' + + " Different formats based on the combination of errors and warnings. + if empty(l:errors) && empty(l:warnings) + let l:res = l:no_errors + elseif !empty(l:errors) && !empty(l:warnings) + let l:res = printf('%s %s', l:errors, l:warnings) + else + let l:res = empty(l:errors) ? l:warnings : l:errors + endif + + return l:res +endfunction + +" Returns a formatted string that can be integrated in the statusline. +" +" This function is deprecated, and should not be used. Use the airline plugin +" instead, or write your own status function with ale#statusline#Count() +function! ale#statusline#Status() abort + if !get(g:, 'ale_deprecation_ale_statusline_status', 0) + execute 'echom ''ale#statusline#Status() is deprecated, use ale#statusline#Count() to write your own function.''' + let g:ale_deprecation_ale_statusline_status = 1 + endif + + if !exists('g:ale_statusline_format') + return 'OK' + endif + + if type(g:ale_statusline_format) == type([]) + return s:StatusForListFormat() + endif + + return '' +endfunction diff --git a/sources_non_forked/ale/autoload/ale/test.vim b/sources_non_forked/ale/autoload/ale/test.vim new file mode 100644 index 00000000..bea10c53 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/test.vim @@ -0,0 +1,54 @@ +" Author: w0rp +" Description: Functions for making testing ALE easier. +" +" This file should not typically be loaded during the normal execution of ALE. + +" Change the directory for checking things in particular test directories +" +" This function will set the g:dir variable, which represents the working +" directory after changing the path. This variable allows a test to change +" directories, and then switch back to a directory at the start of the test +" run. +" +" This function should be run in a Vader Before: block. +function! ale#test#SetDirectory(docker_path) abort + if a:docker_path[:len('/testplugin/') - 1] isnot# '/testplugin/' + throw 'docker_path must start with /testplugin/!' + endif + + " Try to switch directory, which will fail when running tests directly, + " and not through the Docker image. + silent! execute 'cd ' . fnameescape(a:docker_path) + let g:dir = getcwd() " no-custom-checks +endfunction + +" When g:dir is defined, switch back to the directory we saved, and then +" delete that variable. +" +" The filename will be reset to dummy.txt +" +" This function should be run in a Vader After: block. +function! ale#test#RestoreDirectory() abort + call ale#test#SetFilename('dummy.txt') + silent execute 'cd ' . fnameescape(g:dir) + unlet! g:dir +endfunction + +" Change the filename for the current buffer using a relative path to +" the script without running autocmd commands. +" +" If a g:dir variable is set, it will be used as the path to the directory +" containing the test file. +function! ale#test#SetFilename(path) abort + let l:dir = get(g:, 'dir', '') + + if empty(l:dir) + let l:dir = getcwd() " no-custom-checks + endif + + let l:full_path = ale#path#IsAbsolute(a:path) + \ ? a:path + \ : l:dir . '/' . a:path + + silent! noautocmd execute 'file ' . fnameescape(ale#path#Simplify(l:full_path)) +endfunction diff --git a/sources_non_forked/ale/autoload/ale/toggle.vim b/sources_non_forked/ale/autoload/ale/toggle.vim new file mode 100644 index 00000000..2fa98b4a --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/toggle.vim @@ -0,0 +1,193 @@ +function! ale#toggle#InitAuGroups() abort + " This value used to be a Boolean as a Number, and is now a String. + let l:text_changed = '' . g:ale_lint_on_text_changed + + augroup ALEPatternOptionsGroup + autocmd! + autocmd BufEnter,BufRead * call ale#pattern_options#SetOptions(str2nr(expand(''))) + augroup END + + augroup ALERunOnTextChangedGroup + autocmd! + if g:ale_enabled + if l:text_changed is? 'always' || l:text_changed is# '1' + autocmd TextChanged,TextChangedI * call ale#Queue(g:ale_lint_delay) + elseif l:text_changed is? 'normal' + autocmd TextChanged * call ale#Queue(g:ale_lint_delay) + elseif l:text_changed is? 'insert' + autocmd TextChangedI * call ale#Queue(g:ale_lint_delay) + endif + endif + augroup END + + augroup ALERunOnEnterGroup + autocmd! + if g:ale_enabled + " Handle everything that needs to happen when buffers are entered. + autocmd BufEnter * call ale#events#EnterEvent(str2nr(expand(''))) + endif + if g:ale_enabled && g:ale_lint_on_enter + autocmd BufWinEnter,BufRead * call ale#Queue(0, 'lint_file', str2nr(expand(''))) + " Track when the file is changed outside of Vim. + autocmd FileChangedShellPost * call ale#events#FileChangedEvent(str2nr(expand(''))) + endif + augroup END + + augroup ALERunOnFiletypeChangeGroup + autocmd! + if g:ale_enabled && g:ale_lint_on_filetype_changed + " Only start linting if the FileType actually changes after + " opening a buffer. The FileType will fire when buffers are opened. + autocmd FileType * call ale#events#FileTypeEvent( + \ str2nr(expand('')), + \ expand('') + \) + endif + augroup END + + augroup ALERunOnSaveGroup + autocmd! + autocmd BufWritePost * call ale#events#SaveEvent(str2nr(expand(''))) + augroup END + + augroup ALERunOnInsertLeave + autocmd! + if g:ale_enabled && g:ale_lint_on_insert_leave + autocmd InsertLeave * call ale#Queue(0) + endif + augroup END + + augroup ALECursorGroup + autocmd! + if g:ale_enabled && g:ale_echo_cursor + autocmd CursorMoved,CursorHold * call ale#cursor#EchoCursorWarningWithDelay() + " Look for a warning to echo as soon as we leave Insert mode. + " The script's position variable used when moving the cursor will + " not be changed here. + autocmd InsertLeave * call ale#cursor#EchoCursorWarning() + endif + augroup END + + if !g:ale_enabled + augroup! ALERunOnTextChangedGroup + augroup! ALERunOnEnterGroup + augroup! ALERunOnInsertLeave + augroup! ALECursorGroup + endif +endfunction + +function! s:EnablePreamble() abort + " Set pattern options again, if enabled. + if g:ale_pattern_options_enabled + call ale#pattern_options#SetOptions(bufnr('')) + endif + + " Lint immediately, including running linters against the file. + call ale#Queue(0, 'lint_file') +endfunction + +function! s:DisablePostamble() abort + " Remove highlights for the current buffer now. + if g:ale_set_highlights + call ale#highlight#UpdateHighlights() + endif +endfunction + +function! s:CleanupEveryBuffer() abort + for l:key in keys(g:ale_buffer_info) + " The key could be a filename or a buffer number, so try and + " convert it to a number. We need a number for the other + " functions. + let l:buffer = str2nr(l:key) + + if l:buffer > 0 + " Stop all jobs and clear the results for everything, and delete + " all of the data we stored for the buffer. + call ale#engine#Cleanup(l:buffer) + endif + endfor +endfunction + +function! ale#toggle#Toggle() abort + let g:ale_enabled = !get(g:, 'ale_enabled') + + if g:ale_enabled + call s:EnablePreamble() + + if g:ale_set_balloons + call ale#balloon#Enable() + endif + else + call s:CleanupEveryBuffer() + call s:DisablePostamble() + + if has('balloon_eval') + call ale#balloon#Disable() + endif + endif + + call ale#toggle#InitAuGroups() +endfunction + +function! ale#toggle#Enable() abort + if !g:ale_enabled + " Set pattern options again, if enabled. + if g:ale_pattern_options_enabled + call ale#pattern_options#SetOptions(bufnr('')) + endif + + call ale#toggle#Toggle() + endif +endfunction + +function! ale#toggle#Disable() abort + if g:ale_enabled + call ale#toggle#Toggle() + endif +endfunction + +function! ale#toggle#Reset() abort + call s:CleanupEveryBuffer() + call ale#highlight#UpdateHighlights() +endfunction + +function! ale#toggle#ToggleBuffer(buffer) abort + " Get the new value for the toggle. + let l:enabled = !getbufvar(a:buffer, 'ale_enabled', 1) + + " Disabling ALE globally removes autocmd events, so we cannot enable + " linting locally when linting is disabled globally + if l:enabled && !g:ale_enabled + execute 'echom ''ALE cannot be enabled locally when disabled globally''' + return + endif + + call setbufvar(a:buffer, 'ale_enabled', l:enabled) + + if l:enabled + call s:EnablePreamble() + else + " Stop all jobs and clear the results for everything, and delete + " all of the data we stored for the buffer. + call ale#engine#Cleanup(a:buffer) + call s:DisablePostamble() + endif +endfunction + +function! ale#toggle#EnableBuffer(buffer) abort + " ALE is enabled by default for all buffers. + if !getbufvar(a:buffer, 'ale_enabled', 1) + call ale#toggle#ToggleBuffer(a:buffer) + endif +endfunction + +function! ale#toggle#DisableBuffer(buffer) abort + if getbufvar(a:buffer, 'ale_enabled', 1) + call ale#toggle#ToggleBuffer(a:buffer) + endif +endfunction + +function! ale#toggle#ResetBuffer(buffer) abort + call ale#engine#Cleanup(a:buffer) + call ale#highlight#UpdateHighlights() +endfunction diff --git a/sources_non_forked/ale/autoload/ale/uri.vim b/sources_non_forked/ale/autoload/ale/uri.vim new file mode 100644 index 00000000..934637d9 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/uri.vim @@ -0,0 +1,18 @@ +" This probably doesn't handle Unicode characters well. +function! ale#uri#Encode(value) abort + return substitute( + \ a:value, + \ '\([^a-zA-Z0-9\\/$\-_.!*''(),]\)', + \ '\=printf(''%%%02x'', char2nr(submatch(1)))', + \ 'g' + \) +endfunction + +function! ale#uri#Decode(value) abort + return substitute( + \ a:value, + \ '%\(\x\x\)', + \ '\=nr2char(''0x'' . submatch(1))', + \ 'g' + \) +endfunction diff --git a/sources_non_forked/ale/autoload/ale/util.vim b/sources_non_forked/ale/autoload/ale/util.vim new file mode 100644 index 00000000..b94a11b7 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/util.vim @@ -0,0 +1,313 @@ +" Author: w0rp +" Description: Contains miscellaneous functions + +" A wrapper function for mode() so we can test calls for it. +function! ale#util#Mode(...) abort + return call('mode', a:000) +endfunction + +" A wrapper function for feedkeys so we can test calls for it. +function! ale#util#FeedKeys(...) abort + return call('feedkeys', a:000) +endfunction + +if !exists('g:ale#util#nul_file') + " A null file for sending output to nothing. + let g:ale#util#nul_file = '/dev/null' + + if has('win32') + let g:ale#util#nul_file = 'nul' + endif +endif + +" Return the number of lines for a given buffer. +function! ale#util#GetLineCount(buffer) abort + return len(getbufline(a:buffer, 1, '$')) +endfunction + +function! ale#util#GetFunction(string_or_ref) abort + if type(a:string_or_ref) == type('') + return function(a:string_or_ref) + endif + + return a:string_or_ref +endfunction + +" Compare two loclist items for ALE, sorted by their buffers, filenames, and +" line numbers and column numbers. +function! ale#util#LocItemCompare(left, right) abort + if a:left.bufnr < a:right.bufnr + return -1 + endif + + if a:left.bufnr > a:right.bufnr + return 1 + endif + + if a:left.bufnr == -1 + if a:left.filename < a:right.filename + return -1 + endif + + if a:left.filename > a:right.filename + return 1 + endif + endif + + if a:left.lnum < a:right.lnum + return -1 + endif + + if a:left.lnum > a:right.lnum + return 1 + endif + + if a:left.col < a:right.col + return -1 + endif + + if a:left.col > a:right.col + return 1 + endif + + return 0 +endfunction + +" Compare two loclist items, including the text for the items. +" +" This function can be used for de-duplicating lists. +function! ale#util#LocItemCompareWithText(left, right) abort + let l:cmp_value = ale#util#LocItemCompare(a:left, a:right) + + if l:cmp_value + return l:cmp_value + endif + + if a:left.text < a:right.text + return -1 + endif + + if a:left.text > a:right.text + return 1 + endif + + return 0 +endfunction + +" This function will perform a binary search and a small sequential search +" on the list to find the last problem in the buffer and line which is +" on or before the column. The index of the problem will be returned. +" +" -1 will be returned if nothing can be found. +function! ale#util#BinarySearch(loclist, buffer, line, column) abort + let l:min = 0 + let l:max = len(a:loclist) - 1 + + while 1 + if l:max < l:min + return -1 + endif + + let l:mid = (l:min + l:max) / 2 + let l:item = a:loclist[l:mid] + + " Binary search for equal buffers, equal lines, then near columns. + if l:item.bufnr < a:buffer + let l:min = l:mid + 1 + elseif l:item.bufnr > a:buffer + let l:max = l:mid - 1 + elseif l:item.lnum < a:line + let l:min = l:mid + 1 + elseif l:item.lnum > a:line + let l:max = l:mid - 1 + else + " This part is a small sequential search. + let l:index = l:mid + + " Search backwards to find the first problem on the line. + while l:index > 0 + \&& a:loclist[l:index - 1].bufnr == a:buffer + \&& a:loclist[l:index - 1].lnum == a:line + let l:index -= 1 + endwhile + + " Find the last problem on or before this column. + while l:index < l:max + \&& a:loclist[l:index + 1].bufnr == a:buffer + \&& a:loclist[l:index + 1].lnum == a:line + \&& a:loclist[l:index + 1].col <= a:column + let l:index += 1 + endwhile + + return l:index + endif + endwhile +endfunction + +" A function for testing if a function is running inside a sandbox. +" See :help sandbox +function! ale#util#InSandbox() abort + try + function! s:SandboxCheck() abort + endfunction + catch /^Vim\%((\a\+)\)\=:E48/ + " E48 is the sandbox error. + return 1 + endtry + + return 0 +endfunction + +" Get the number of milliseconds since some vague, but consistent, point in +" the past. +" +" This function can be used for timing execution, etc. +" +" The time will be returned as a Number. +function! ale#util#ClockMilliseconds() abort + return float2nr(reltimefloat(reltime()) * 1000) +endfunction + +" Given a single line, or a List of lines, and a single pattern, or a List +" of patterns, return all of the matches for the lines(s) from the given +" patterns, using matchlist(). +" +" Only the first pattern which matches a line will be returned. +function! ale#util#GetMatches(lines, patterns) abort + let l:matches = [] + let l:lines = type(a:lines) == type([]) ? a:lines : [a:lines] + let l:patterns = type(a:patterns) == type([]) ? a:patterns : [a:patterns] + + for l:line in l:lines + for l:pattern in l:patterns + let l:match = matchlist(l:line, l:pattern) + + if !empty(l:match) + call add(l:matches, l:match) + break + endif + endfor + endfor + + return l:matches +endfunction + +function! s:LoadArgCount(function) abort + let l:Function = a:function + + redir => l:output + silent! function Function + redir END + + if !exists('l:output') + return 0 + endif + + let l:match = matchstr(split(l:output, "\n")[0], '\v\([^)]+\)')[1:-2] + let l:arg_list = filter(split(l:match, ', '), 'v:val isnot# ''...''') + + return len(l:arg_list) +endfunction + +" Given the name of a function, a Funcref, or a lambda, return the number +" of named arguments for a function. +function! ale#util#FunctionArgCount(function) abort + let l:Function = ale#util#GetFunction(a:function) + let l:count = s:LoadArgCount(l:Function) + + " If we failed to get the count, forcibly load the autoload file, if the + " function is an autoload function. autoload functions aren't normally + " defined until they are called. + if l:count == 0 + let l:function_name = matchlist(string(l:Function), 'function([''"]\(.\+\)[''"])')[1] + + if l:function_name =~# '#' + execute 'runtime autoload/' . join(split(l:function_name, '#')[:-2], '/') . '.vim' + let l:count = s:LoadArgCount(l:Function) + endif + endif + + return l:count +endfunction + +" Escape a string so the characters in it will be safe for use inside of PCRE +" or RE2 regular expressions without characters having special meanings. +function! ale#util#EscapePCRE(unsafe_string) abort + return substitute(a:unsafe_string, '\([\-\[\]{}()*+?.^$|]\)', '\\\1', 'g') +endfunction + +" Escape a string so that it can be used as a literal string inside an evaled +" vim command. +function! ale#util#EscapeVim(unsafe_string) abort + return "'" . substitute(a:unsafe_string, "'", "''", 'g') . "'" +endfunction + + +" Given a String or a List of String values, try and decode the string(s) +" as a JSON value which can be decoded with json_decode. If the JSON string +" is invalid, the default argument value will be returned instead. +" +" This function is useful in code where the data can't be trusted to be valid +" JSON, and where throwing exceptions is mostly just irritating. +function! ale#util#FuzzyJSONDecode(data, default) abort + if empty(a:data) + return a:default + endif + + let l:str = type(a:data) == type('') ? a:data : join(a:data, '') + + try + let l:result = json_decode(l:str) + + " Vim 8 only uses the value v:none for decoding blank strings. + if !has('nvim') && l:result is v:none + return a:default + endif + + return l:result + catch /E474/ + return a:default + endtry +endfunction + +" Write a file, including carriage return characters for DOS files. +" +" The buffer number is required for determining the fileformat setting for +" the buffer. +function! ale#util#Writefile(buffer, lines, filename) abort + let l:corrected_lines = getbufvar(a:buffer, '&fileformat') is# 'dos' + \ ? map(copy(a:lines), 'v:val . "\r"') + \ : a:lines + + call writefile(l:corrected_lines, a:filename) " no-custom-checks +endfunction + +if !exists('s:patial_timers') + let s:partial_timers = {} +endif + +function! s:ApplyPartialTimer(timer_id) abort + let [l:Callback, l:args] = remove(s:partial_timers, a:timer_id) + call call(l:Callback, [a:timer_id] + l:args) +endfunction + +" Given a delay, a callback, a List of arguments, start a timer with +" timer_start() and call the callback provided with [timer_id] + args. +" +" The timer must not be stopped with timer_stop(). +" Use ale#util#StopPartialTimer() instead, which can stop any timer, and will +" clear any arguments saved for executing callbacks later. +function! ale#util#StartPartialTimer(delay, callback, args) abort + let l:timer_id = timer_start(a:delay, function('s:ApplyPartialTimer')) + let s:partial_timers[l:timer_id] = [a:callback, a:args] + + return l:timer_id +endfunction + +function! ale#util#StopPartialTimer(timer_id) abort + call timer_stop(a:timer_id) + + if has_key(s:partial_timers, a:timer_id) + call remove(s:partial_timers, a:timer_id) + endif +endfunction diff --git a/sources_non_forked/ale/doc/ale-asciidoc.txt b/sources_non_forked/ale/doc/ale-asciidoc.txt new file mode 100644 index 00000000..b6b64fd3 --- /dev/null +++ b/sources_non_forked/ale/doc/ale-asciidoc.txt @@ -0,0 +1,12 @@ +=============================================================================== +ALE AsciiDoc Integration *ale-asciidoc-options* + + +=============================================================================== +write-good *ale-asciidoc-write-good* + +See |ale-write-good-options| + + +=============================================================================== +vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-asm.txt b/sources_non_forked/ale/doc/ale-asm.txt new file mode 100644 index 00000000..a97c6d00 --- /dev/null +++ b/sources_non_forked/ale/doc/ale-asm.txt @@ -0,0 +1,25 @@ +=============================================================================== +ALE ASM Integration *ale-asm-options* + + +=============================================================================== +gcc *ale-asm-gcc* + +g:ale_asm_gcc_executable *g:ale_asm_gcc_executable* + *b:ale_asm_gcc_executable* + Type: |String| + Default: `'gcc'` + +This variable can be changed to use a different executable for gcc. + + +g:ale_asm_gcc_options *g:ale_asm_gcc_options* + *b:ale_asm_gcc_options* + Type: |String| + Default: `'-Wall'` + + This variable can be set to pass additional options to gcc. + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-awk.txt b/sources_non_forked/ale/doc/ale-awk.txt new file mode 100644 index 00000000..b9c5c34e --- /dev/null +++ b/sources_non_forked/ale/doc/ale-awk.txt @@ -0,0 +1,25 @@ +=============================================================================== +ALE Awk Integration *ale-awk-options* + + +=============================================================================== +gawk *ale-awk-gawk* + +g:ale_awk_gawk_executable *g:ale_awk_gawk_executable* + *b:ale_awk_gawk_executable* + Type: |String| + Default: `'gawk'` + + This variable sets executable used for gawk. + + +g:ale_awk_gawk_options *g:ale_awk_gawk_options* + *b:ale_awk_gawk_options* + Type: |String| + Default: `''` + + With this variable we are able to pass extra arguments for gawk + for invocation. + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-c.txt b/sources_non_forked/ale/doc/ale-c.txt new file mode 100644 index 00000000..c41f3bc8 --- /dev/null +++ b/sources_non_forked/ale/doc/ale-c.txt @@ -0,0 +1,212 @@ +=============================================================================== +ALE C Integration *ale-c-options* + + +=============================================================================== +Global Options + +g:ale_c_build_dir_names *g:ale_c_build_dir_names* + *b:ale_c_build_dir_names* + + Type: |List| + Default: `['build', 'bin']` + + A list of directory names to be used when searching upwards from cpp + files to discover compilation databases with. For directory named `'foo'`, + ALE will search for `'foo/compile_commands.json'` in all directories on and above + the directory containing the cpp file to find path to compilation database. + This feature is useful for the clang tools wrapped around LibTooling (namely + here, clang-tidy) + + +g:ale_c_build_dir *g:ale_c_build_dir* + *b:ale_c_build_dir* + + Type: |String| + Default: `''` + + A path to the directory containing the `compile_commands.json` file to use + with c-family linters. Usually setting this option to a non-empty string + will override the |g:ale_c_build_dir_names| option to impose a compilation + database (it can be useful if multiple builds are in multiple build + subdirectories in the project tree). + This feature is also most useful for the clang tools linters, wrapped + around LibTooling (namely clang-tidy here) + + +g:ale_c_parse_makefile *g:ale_c_parse_makefile* + *b:ale_c_parse_makefile* + Type: |Number| + Default: `0` + + If set to `1`, ALE will run `make -n` to automatically determine flags to + set for C or C++ compilers. This can make it easier to determine the correct + build flags to use for different files. + + +=============================================================================== +clang *ale-c-clang* + +g:ale_c_clang_executable *g:ale_c_clang_executable* + *b:ale_c_clang_executable* + Type: |String| + Default: `'clang'` + + This variable can be changed to use a different executable for clang. + + +g:ale_c_clang_options *g:ale_c_clang_options* + *b:ale_c_clang_options* + Type: |String| + Default: `'-std=c11 -Wall'` + + This variable can be changed to modify flags given to clang. + + +=============================================================================== +clang-format *ale-c-clangformat* + +g:ale_c_clangformat_executable *g:ale_c_clangformat_executable* + *b:ale_c_clangformat_executable* + Type: |String| + Default: `'clang-format'` + + This variable can be changed to use a different executable for clang-format. + + +g:ale_c_clangformat_options *g:ale_c_clangformat_options* + *b:ale_c_clangformat_options* + Type: |String| + Default: `''` + + This variable can be change to modify flags given to clang-format. + + +=============================================================================== +clangtidy *ale-c-clangtidy* + +`clang-tidy` will be run only when files are saved to disk, so that +`compile_commands.json` files can be used. It is recommended to use this +linter in combination with `compile_commands.json` files. +Therefore, `clang-tidy` linter reads the options |g:ale_c_build_dir| and +|g:ale_c_build_dir_names|. Also, setting |g:ale_c_build_dir| actually +overrides |g:ale_c_build_dir_names|. + + +g:ale_c_clangtidy_checks *g:ale_c_clangtidy_checks* + *b:ale_c_clangtidy_checks* + Type: |List| + Default: `['*']` + + The checks to enable for clang-tidy with the `-checks` argument. + + All options will be joined with commas, and escaped appropriately for + the shell. The `-checks` flag can be removed entirely by setting this + option to an empty List. + + Not all of clangtidy checks are applicable for C. You should consult the + clang documentation for an up-to-date list of compatible checks: + http://clang.llvm.org/extra/clang-tidy/checks/list.html + + +g:ale_c_clangtidy_executable *g:ale_c_clangtidy_executable* + *b:ale_c_clangtidy_executable* + Type: |String| + Default: `'clang-tidy'` + + This variable can be changed to use a different executable for clangtidy. + + +g:ale_c_clangtidy_options *g:ale_c_clangtidy_options* + *b:ale_c_clangtidy_options* + Type: |String| + Default: `''` + + This variable can be changed to modify flags given to clang-tidy. + + - Setting this variable to a non-empty string, + - and working in a buffer where no compilation database is found using + |g:ale_c_build_dir_names| or |g:ale_c_build_dir|, + will cause the `--` argument to be passed to `clang-tidy`, which will mean + that detection of `compile_commands.json` files for compile command + databases will be disabled. + Only set this option if you want to control compiler flags + entirely manually, and no `compile_commands.json` file is in one + of the |g:ale_c_build_dir_names| directories of the project tree. + + +=============================================================================== +cppcheck *ale-c-cppcheck* + +g:ale_c_cppcheck_executable *g:ale_c_cppcheck_executable* + *b:ale_c_cppcheck_executable* + Type: |String| + Default: `'cppcheck'` + + This variable can be changed to use a different executable for cppcheck. + + +g:ale_c_cppcheck_options *g:ale_c_cppcheck_options* + *b:ale_c_cppcheck_options* + Type: |String| + Default: `'--enable=style'` + + This variable can be changed to modify flags given to cppcheck. + + +=============================================================================== +flawfinder *ale-c-flawfinder* + +g:ale_c_flawfinder_executable *g:ale_c_flawfinder_executable* + *b:ale_c_flawfinder_executable* + Type: |String| + Default: `'flawfinder'` + + This variable can be changed to use a different executable for flawfinder. + + +g:ale_c_flawfinder_minlevel *g:ale_c_flawfinder_minlevel* + *b:ale_c_flawfinder_minlevel* + Type: |Number| + Default: `1` + + This variable can be changed to ignore risks under the given risk threshold. + + +g:ale_c_flawfinder_options *g:ale-c-flawfinder* + *b:ale-c-flawfinder* + Type: |String| + Default: `''` + + This variable can be used to pass extra options into the flawfinder command. + +g:ale_c_flawfinder_error_severity *g:ale_c_flawfinder_error_severity* + *b:ale_c_flawfinder_error_severity* + Type: |Number| + Default: `6` + + This variable can be changed to set the minimum severity to be treated as an + error. This setting also applies to flawfinder for c++. + + +=============================================================================== +gcc *ale-c-gcc* + +g:ale_c_gcc_executable *g:ale_c_gcc_executable* + *b:ale_c_gcc_executable* + Type: |String| + Default: `'gcc'` + + This variable can be changed to use a different executable for gcc. + + +g:ale_c_gcc_options *g:ale_c_gcc_options* + *b:ale_c_gcc_options* + Type: |String| + Default: `'-std=c11 -Wall'` + + This variable can be change to modify flags given to gcc. + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-chef.txt b/sources_non_forked/ale/doc/ale-chef.txt new file mode 100644 index 00000000..5024e279 --- /dev/null +++ b/sources_non_forked/ale/doc/ale-chef.txt @@ -0,0 +1,26 @@ +=============================================================================== +ALE Chef Integration *ale-chef-options* + + +=============================================================================== +foodcritic *ale-chef-foodcritic* + +g:ale_chef_foodcritic_options *g:ale_chef_foodcritic_options* + *b:ale_chef_foodcritic_options* + Type: |String| + Default: `''` + + This variable can be changed to modify flags given to foodcritic. + + +g:ale_chef_foodcritic_executable *g:ale_chef_foodcritic_executable* + *b:ale_chef_foodcritic_executable* + Type: |String| + Default: `'foodcritic'` + + This variable can be changed to point to the foodcritic binary in case it's + not on the $PATH or a specific version/path must be used. + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-clojure.txt b/sources_non_forked/ale/doc/ale-clojure.txt new file mode 100644 index 00000000..a83e336f --- /dev/null +++ b/sources_non_forked/ale/doc/ale-clojure.txt @@ -0,0 +1,21 @@ +=============================================================================== +ALE Clojure Integration *ale-clojure-options* + + +=============================================================================== +joker *ale-clojure-joker* + +Joker is a small Clojure interpreter and linter written in Go. + +https://github.com/candid82/joker + +Linting options are not configurable by ale, but instead are controlled by a +`.joker` file in same directory as the file (or current working directory if +linting stdin), a parent directory relative to the file, or the users home +directory. + +see https://github.com/candid82/joker#linter-mode for more information. + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: + diff --git a/sources_non_forked/ale/doc/ale-cmake.txt b/sources_non_forked/ale/doc/ale-cmake.txt new file mode 100644 index 00000000..fb46336f --- /dev/null +++ b/sources_non_forked/ale/doc/ale-cmake.txt @@ -0,0 +1,25 @@ +=============================================================================== +ALE CMake Integration *ale-cmake-options* + + +=============================================================================== +cmakelint *ale-cmake-cmakelint* + +g:ale_cmake_cmakelint_executable *g:ale_cmake_cmakelint_executable* + *b:ale_cmake_cmakelint_executable* + Type: |String| + Default: `'cmakelint'` + + This variable can be set to change the path the cmakelint. + + +g:ale_cmake_cmakelint_options *g:ale_cmake_cmakelint_options* + *b:ale_cmake_cmakelint_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to cmakelint. + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-cpp.txt b/sources_non_forked/ale/doc/ale-cpp.txt new file mode 100644 index 00000000..05e54799 --- /dev/null +++ b/sources_non_forked/ale/doc/ale-cpp.txt @@ -0,0 +1,206 @@ +=============================================================================== +ALE C++ Integration *ale-cpp-options* + + +=============================================================================== +Global Options + +The following C options also apply to some C++ linters too. + +* |g:ale_c_build_dir_names| +* |g:ale_c_build_dir| +* |g:ale_c_parse_makefile| + + +=============================================================================== +clang *ale-cpp-clang* + +g:ale_cpp_clang_executable *g:ale_cpp_clang_executable* + *b:ale_cpp_clang_executable* + Type: |String| + Default: `'clang++'` + + This variable can be changed to use a different executable for clang. + + +g:ale_cpp_clang_options *g:ale_cpp_clang_options* + *b:ale_cpp_clang_options* + Type: |String| + Default: `'-std=c++14 -Wall'` + + This variable can be changed to modify flags given to clang. + + +=============================================================================== +clangcheck *ale-cpp-clangcheck* + +`clang-check` will be run only when files are saved to disk, so that +`compile_commands.json` files can be used. It is recommended to use this +linter in combination with `compile_commands.json` files. +Therefore, `clang-check` linter reads the options |g:ale_c_build_dir| and +|g:ale_c_build_dir_names|. Also, setting |g:ale_c_build_dir| actually +overrides |g:ale_c_build_dir_names|. + + +g:ale_cpp_clangcheck_executable *g:ale_cpp_clangcheck_executable* + *b:ale_cpp_clangcheck_executable* + Type: |String| + Default: `'clang-check'` + + This variable can be changed to use a different executable for clangcheck. + + +g:ale_cpp_clangcheck_options *g:ale_cpp_clangcheck_options* + *b:ale_cpp_clangcheck_options* + Type: |String| + Default: `''` + + This variable can be changed to modify flags given to clang-check. + + This variable should not be set to point to build subdirectory with + `-p path/to/build` option, as it is handled by the |g:ale_c_build_dir| + option. + + +=============================================================================== +clang-format *ale-cpp-clangformat* + +See |ale-c-clangformat| for information about the available options. +Note that the C options are also used for C++. + + +=============================================================================== +clangtidy *ale-cpp-clangtidy* + +`clang-tidy` will be run only when files are saved to disk, so that +`compile_commands.json` files can be used. It is recommended to use this +linter in combination with `compile_commands.json` files. +Therefore, `clang-tidy` linter reads the options |g:ale_c_build_dir| and +|g:ale_c_build_dir_names|. Also, setting |g:ale_c_build_dir| actually +overrides |g:ale_c_build_dir_names|. + + +g:ale_cpp_clangtidy_checks *g:ale_cpp_clangtidy_checks* + *b:ale_cpp_clangtidy_checks* + Type: |List| + Default: `['*']` + + The checks to enable for clang-tidy with the `-checks` argument. + + All options will be joined with commas, and escaped appropriately for + the shell. The `-checks` flag can be removed entirely by setting this + option to an empty List. + + +g:ale_cpp_clangtidy_executable *g:ale_cpp_clangtidy_executable* + *b:ale_cpp_clangtidy_executable* + Type: |String| + Default: `'clang-tidy'` + + This variable can be changed to use a different executable for clangtidy. + + +g:ale_cpp_clangtidy_options *g:ale_cpp_clangtidy_options* + *b:ale_cpp_clangtidy_options* + Type: |String| + Default: `''` + + This variable can be changed to modify flags given to clang-tidy. + + - Setting this variable to a non-empty string, + - and working in a buffer where no compilation database is found using + |g:ale_c_build_dir_names| or |g:ale_c_build_dir|, + will cause the `--` argument to be passed to `clang-tidy`, which will mean + that detection of `compile_commands.json` files for compile command + databases will be disabled. + Only set this option if you want to control compiler flags + entirely manually, and no `compile_commands.json` file is in one + of the |g:ale_c_build_dir_names| directories of the project tree. + + +=============================================================================== +cppcheck *ale-cpp-cppcheck* + +g:ale_cpp_cppcheck_executable *g:ale_cpp_cppcheck_executable* + *b:ale_cpp_cppcheck_executable* + Type: |String| + Default: `'cppcheck'` + + This variable can be changed to use a different executable for cppcheck. + + +g:ale_cpp_cppcheck_options *g:ale_cpp_cppcheck_options* + *b:ale_cpp_cppcheck_options* + Type: |String| + Default: `'--enable=style'` + + This variable can be changed to modify flags given to cppcheck. + + +=============================================================================== +cpplint *ale-cpp-cpplint* + +g:ale_cpp_cpplint_executable *g:ale_cpp_cpplint_executable* + *b:ale_cpp_cpplint_executable* + Type: |String| + Default: `'cpplint'` + + This variable can be changed to use a different executable for cpplint. + + +g:ale_cpp_cpplint_options *g:ale_cpp_cpplint_options* + *b:ale_cpp_cpplint_options* + Type: |String| + Default: `''` + + This variable can be changed to modify flags given to cpplint. + + +=============================================================================== +flawfinder *ale-cpp-flawfinder* + +g:ale_cpp_flawfinder_executable *g:ale_cpp_flawfinder_executable* + *b:ale_cpp_flawfinder_executable* + Type: |String| + Default: `'flawfinder'` + + This variable can be changed to use a different executable for flawfinder. + + +g:ale_cpp_flawfinder_minlevel *g:ale_cpp_flawfinder_minlevel* + *b:ale_cpp_flawfinder_minlevel* + Type: |Number| + Default: `1` + + This variable can be changed to ignore risks under the given risk threshold. + + +g:ale_cpp_flawfinder_options *g:ale-cpp-flawfinder* + *b:ale-cpp-flawfinder* + Type: |String| + Default: `''` + + This variable can be used to pass extra options into the flawfinder command. + + +=============================================================================== +gcc *ale-cpp-gcc* + +g:ale_cpp_gcc_executable *g:ale_cpp_gcc_executable* + *b:ale_cpp_gcc_executable* + Type: |String| + Default: `'gcc'` + + This variable can be changed to use a different executable for gcc. + + +g:ale_cpp_gcc_options *g:ale_cpp_gcc_options* + *b:ale_cpp_gcc_options* + Type: |String| + Default: `'-std=c++14 -Wall'` + + This variable can be changed to modify flags given to gcc. + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-cs.txt b/sources_non_forked/ale/doc/ale-cs.txt new file mode 100644 index 00000000..f65b9f39 --- /dev/null +++ b/sources_non_forked/ale/doc/ale-cs.txt @@ -0,0 +1,102 @@ +=============================================================================== +ALE C# Integration *ale-cs-options* + + +=============================================================================== +mcs *ale-cs-mcs* + + The `mcs` linter looks only for syntax errors while you type. See |ale-cs-mcsc| + for the separately configured linter for checking for semantic errors. + + +g:ale_cs_mcs_options *g:ale_cs_mcs_options* + *b:ale_cs_mcs_options* + + Type: String + Default: `''` + + This variable can be changed to pass additional flags given to mcs. + + NOTE: The -unsafe flag is selected implicitly and thus does not need to be + explicitly included in the |g:ale_cs_mcs_options| or |b:ale_cs_mcs_options| + parameter. + + +=============================================================================== +mcsc *ale-cs-mcsc* + + The mcsc linter checks for semantic errors when files are opened or saved + See |ale-lint-file-linters| for more information on linters which do not + check for problems while you type. + + The mcsc linter uses the mono mcs compiler to generate a temporary module + target file (-t:module). The module includes including all '*.cs' files + contained in the directory tree rooted at the path defined by the + |g:ale_cs_mcsc_source| or |b:ale_cs_mcsc_source| variable. + variable and all sub directories. + + The paths to search for additional assembly files can be specified using the + |g:ale_cs_mcsc_assembly_path| or |b:ale_cs_mcsc_assembly_path| variables. + + NOTE: ALE will not find any errors in files apart from syntax errors if any + one of the source files contains a syntax error. Syntax errors must be fixed + first before other errors will be shown. + + +g:ale_cs_mcsc_options *g:ale_cs_mcsc_options* + *b:ale_cs_mcsc_options* + Type: |String| + Default: `''` + + This option can be set to pass additional arguments to the `mcs` compiler. + + For example, to add the dotnet package which is not added per default: > + + let g:ale_cs_mcs_options = '-pkg:dotnet' +< + NOTE: the `-unsafe` option is always passed to `mcs`. + + +g:ale_cs_mcsc_source *g:ale_cs_mcsc_source* + *b:ale_cs_mcsc_source* + Type: |String| + Default: `''` + + This variable defines the root path of the directory tree searched for the + '*.cs' files to be linted. If this option is empty, the source file's + directory will be used. + + NOTE: Currently it is not possible to specify sub directories and + directory sub trees which shall not be searched for *.cs files. + + +g:ale_cs_mcsc_assembly_path *g:ale_cs_mcsc_assembly_path* + *b:ale_cs_mcsc_assembly_path* + Type: |List| + Default: `[]` + + This variable defines a list of path strings to be searched for external + assembly files. The list is passed to the mcs compiler using the `-lib:` + flag. + + +g:ale_cs_mcsc_assemblies *g:ale_cs_mcsc_assemblies* + *b:ale_cs_mcsc_assemblies* + Type: |List| + Default: `[]` + + This variable defines a list of external assembly (*.dll) files required + by the mono mcs compiler to generate a valid module target. The list is + passed the mcs compiler using the `-r:` flag. + + For example: > + + " Compile C# programs with the Unity engine DLL file on Mac. + let g:ale_cs_mcsc_assemblies = [ + \ '/Applications/Unity/Unity.app/Contents/Frameworks/Managed/UnityEngine.dll', + \ 'path-to-unityproject/obj/Debug', + \] +< + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-css.txt b/sources_non_forked/ale/doc/ale-css.txt new file mode 100644 index 00000000..474445b8 --- /dev/null +++ b/sources_non_forked/ale/doc/ale-css.txt @@ -0,0 +1,39 @@ +=============================================================================== +ALE CSS Integration *ale-css-options* + + +=============================================================================== +prettier *ale-css-prettier* + +See |ale-javascript-prettier| for information about the available options. + + +=============================================================================== +stylelint *ale-css-stylelint* + +g:ale_css_stylelint_executable *g:ale_css_stylelint_executable* + *b:ale_css_stylelint_executable* + Type: |String| + Default: `'stylelint'` + + See |ale-integrations-local-executables| + + +g:ale_css_stylelint_options *g:ale_css_stylelint_options* + *b:ale_css_stylelint_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to stylelint. + + +g:ale_css_stylelint_use_global *g:ale_css_stylelint_use_global* + *b:ale_css_stylelint_use_global* + Type: |String| + Default: `0` + + See |ale-integrations-local-executables| + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-cuda.txt b/sources_non_forked/ale/doc/ale-cuda.txt new file mode 100644 index 00000000..052b3363 --- /dev/null +++ b/sources_non_forked/ale/doc/ale-cuda.txt @@ -0,0 +1,25 @@ +=============================================================================== +ALE CUDA Integration *ale-cuda-options* + + +=============================================================================== +nvcc *ale-cuda-nvcc* + +g:ale_cuda_nvcc_executable *g:ale_cuda_nvcc_executable* + *b:ale_cuda_nvcc_executable* + Type: |String| + Default: `'nvcc'` + + This variable can be changed to use a different executable for nvcc. + Currently only nvcc 8.0 is supported. + + +g:ale_cuda_nvcc_options *g:ale_cuda_nvcc_options* + *b:ale_cuda_nvcc_options* + Type: |String| + Default: `'-std=c++11'` + + This variable can be changed to modify flags given to nvcc. + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-dart.txt b/sources_non_forked/ale/doc/ale-dart.txt new file mode 100644 index 00000000..c6faa5c2 --- /dev/null +++ b/sources_non_forked/ale/doc/ale-dart.txt @@ -0,0 +1,38 @@ +=============================================================================== +ALE Dart Integration *ale-dart-options* + + +=============================================================================== +dartanalyzer *ale-dart-dartanalyzer* + +Installation +------------------------------------------------------------------------------- + +Install Dart via whatever means. `dartanalyzer` will be included in the SDK. + +You can add the SDK to `$PATH`, as described here: +https://www.dartlang.org/tools/sdk + +If you have installed Dart on Linux, you can also try the following: > + " Set the executable path for dartanalyzer to the absolute path to it. + let g:ale_dart_dartanalyzer_executable = '/usr/lib/dart/bin/dartanalyzer' +< +... or similarly for wherever your Dart SDK lives. This should work without +having to modify `$PATH`. + +ALE can only check for problems with `dartanalyzer` with the file on disk. +See |ale-lint-file-linters| + +Options +------------------------------------------------------------------------------- + +g:ale_dart_dartanalyzer_executable *g:ale_dart_dartanalyzer_executable* + *b:ale_dart_dartanalyzer_executable* + Type: |String| + Default: `'dartanalyzer'` + + This variable can be set to change the path to dartanalyzer. + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-dockerfile.txt b/sources_non_forked/ale/doc/ale-dockerfile.txt new file mode 100644 index 00000000..805cc478 --- /dev/null +++ b/sources_non_forked/ale/doc/ale-dockerfile.txt @@ -0,0 +1,37 @@ +=============================================================================== +ALE Dockerfile Integration *ale-dockerfile-options* + + +=============================================================================== +hadolint *ale-dockerfile-hadolint* + + hadolint can be found at: https://github.com/hadolint/hadolint + + +g:ale_dockerfile_hadolint_use_docker *g:ale_dockerfile_hadolint_use_docker* + *b:ale_dockerfile_hadolint_use_docker* + Type: |String| + Default: `'never'` + + This variable controls if docker and the hadolint image are used to run this + linter: if 'never', docker will never be used; 'always' means docker will + always be used; 'yes' and docker will be used if the hadolint executable + cannot be found. + + For now, the default is 'never'. This may change as ale's support for using + docker to lint evolves. + + +g:ale_dockerfile_hadolint_image *g:ale_dockerfile_hadolint_image* + *b:ale_dockerfile_hadolint_image* + Type: |String| + Default: `'hadolint/hadolint'` + + This variable controls the docker image used to run hadolint. The default + is hadolint's author's build, and can be found at: + + https://hub.docker.com/r/hadolint/hadolint/ + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-elixir.txt b/sources_non_forked/ale/doc/ale-elixir.txt new file mode 100644 index 00000000..ac0ec605 --- /dev/null +++ b/sources_non_forked/ale/doc/ale-elixir.txt @@ -0,0 +1,44 @@ +=============================================================================== +ALE Elixir Integration *ale-elixir-options* + + +=============================================================================== +mix *ale-elixir-mix* + +g:ale_elixir_mix_options *g:ale_elixir_mix_options* + *b:ale_elixir_mix_options* + Type: |String| + Default: `'mix'` + + + This variable can be changed to specify the mix executable. + +=============================================================================== +mix_format *ale-elixir-mix-format* + +g:ale_elixir_mix_format_options *g:ale_elixir_mix_format_options* + *b:ale_elixir_mix_format_options* + Type: |String| + Default: `''` + + + This variable can be changed to specify the mix options passed to the + mix_format fixer + +=============================================================================== +dialyxir *ale-elixir-dialyxir* + +Dialyzer, a DIscrepancy AnaLYZer for ERlang programs. +http://erlang.org/doc/man/dialyzer.html + +It can be used with elixir through dialyxir +https://github.com/jeremyjh/dialyxir + +Options for dialyzer are not configurable by ale, but they are instead +configured on your project's `mix.exs`. + +See https://github.com/jeremyjh/dialyxir#with-explaining-stuff for more +information. + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-elm.txt b/sources_non_forked/ale/doc/ale-elm.txt new file mode 100644 index 00000000..e96205df --- /dev/null +++ b/sources_non_forked/ale/doc/ale-elm.txt @@ -0,0 +1,50 @@ +=============================================================================== +ALE Elm Integration *ale-elm-options* + + +=============================================================================== +elm-format *ale-elm-elm-format* + +g:ale_elm_format_executable *g:ale_elm_format_executable* + *b:ale_elm_format_executable* + Type: |String| + Default: `'elm-format'` + + See |ale-integrations-local-executables| + + +g:ale_elm_format_use_global *g:ale_elm_format_use_global* + *b:ale_elm_format_use_global* + Type: |Number| + Default: `0` + + See |ale-integrations-local-executables| + + +g:ale_elm_format_options *g:ale_elm_format_options* + *b:ale_elm_format_options* + Type: |String| + Default: `'--yes'` + + This variable can be set to pass additional options to elm-format. + +=============================================================================== +elm-make *ale-elm-elm-make* + +g:ale_elm_make_executable *g:ale_elm_make_executable* + *b:ale_elm_make_executable* + Type: |String| + Default: `'elm-make'` + + See |ale-integrations-local-executables| + + +g:ale_elm_make_use_global *g:ale_elm_make_use_global* + *b:ale_elm_make_use_global* + Type: |Number| + Default: `0` + + See |ale-integrations-local-executables| + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-erlang.txt b/sources_non_forked/ale/doc/ale-erlang.txt new file mode 100644 index 00000000..ad3c1e5a --- /dev/null +++ b/sources_non_forked/ale/doc/ale-erlang.txt @@ -0,0 +1,29 @@ +=============================================================================== +ALE Erlang Integration *ale-erlang-options* + + +=============================================================================== +erlc *ale-erlang-erlc* + +g:ale_erlang_erlc_options *g:ale_erlang_erlc_options* + *b:ale_erlang_erlc_options* + Type: |String| + Default: `''` + + This variable controls additional parameters passed to `erlc`, such as `-I` + or `-pa`. + + +------------------------------------------------------------------------------- +syntaxerl *ale-erlang-syntaxerl* + +g:ale_erlang_syntaxerl_executable *g:ale_erlang_syntaxerl_executable* + *b:ale_erlang_syntaxerl_executable* + Type: |String| + Default: `'syntaxerl'` + + This variable can be changed to specify the syntaxerl executable. + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-eruby.txt b/sources_non_forked/ale/doc/ale-eruby.txt new file mode 100644 index 00000000..a0f6f4f8 --- /dev/null +++ b/sources_non_forked/ale/doc/ale-eruby.txt @@ -0,0 +1,15 @@ +=============================================================================== +ALE Eruby Integration *ale-eruby-options* + +There are three linters for `eruby` files: + +- `erb` +- `erubis` +- `erubi` + +`erb` is in the Ruby standard library and is mostly universal. `erubis` is the +default parser in Rails between 3.0 and 5.1. `erubi` is the default in Rails +5.1 and later. To selectively enable a subset, see |g:ale_linters|. + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-fish.txt b/sources_non_forked/ale/doc/ale-fish.txt new file mode 100644 index 00000000..8450b38a --- /dev/null +++ b/sources_non_forked/ale/doc/ale-fish.txt @@ -0,0 +1,14 @@ +=============================================================================== +ALE Fish Integration *ale-fish-options* + +Lints fish files using `fish -n`. + +Note that `fish -n` is not foolproof: it sometimes gives false positives or +errors that are difficult to parse without more context. This integration skips +displaying errors if an error message is not found. + +If ALE is not showing any errors but your file does not run as expected, run +`fish -n ` from the command line. + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-fortran.txt b/sources_non_forked/ale/doc/ale-fortran.txt new file mode 100644 index 00000000..ed6bc724 --- /dev/null +++ b/sources_non_forked/ale/doc/ale-fortran.txt @@ -0,0 +1,36 @@ +=============================================================================== +ALE Fortran Integration *ale-fortran-options* + + +=============================================================================== +gcc *ale-fortran-gcc* + +g:ale_fortran_gcc_executable *g:ale_fortran_gcc_executable* + *b:ale_fortran_gcc_executable* + Type: |String| + Default: `'gcc'` + + This variable can be changed to modify the executable used for checking + Fortran code with GCC. + + +g:ale_fortran_gcc_options *g:ale_fortran_gcc_options* + *b:ale_fortran_gcc_options* + Type: |String| + Default: `'-Wall'` + + This variable can be changed to modify flags given to gcc. + + +g:ale_fortran_gcc_use_free_form *g:ale_fortran_gcc_use_free_form* + *b:ale_fortran_gcc_use_free_form* + Type: |Number| + Default: `1` + + When set to `1`, the `-ffree-form` flag will be used for GCC, to check files + with the free form layout. When set to `0`, `-ffixed-form` will be used + instead, for checking files with fixed form layouts. + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-fountain.txt b/sources_non_forked/ale/doc/ale-fountain.txt new file mode 100644 index 00000000..ac0870cf --- /dev/null +++ b/sources_non_forked/ale/doc/ale-fountain.txt @@ -0,0 +1,6 @@ +=============================================================================== +ALE Fountain Integration *ale-fountain-options* + + +=============================================================================== +vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-fuse.txt b/sources_non_forked/ale/doc/ale-fuse.txt new file mode 100644 index 00000000..0849c371 --- /dev/null +++ b/sources_non_forked/ale/doc/ale-fuse.txt @@ -0,0 +1,25 @@ +=============================================================================== +ALE FusionScript Integration *ale-fuse-options* + + +=============================================================================== +fusion-lint *ale-fuse-fusionlint* + +g:ale_fusion_fusionlint_executable *g:ale_fuse_fusionlint_executable* + *b:ale_fuse_fusionlint_executable* + Type: |String| + Default: `'fusion-lint'` + + This variable can be changed to change the path to fusion-lint. + + +g:ale_fuse_fusionlint_options *g:ale_fuse_fusionlint_options* + *b:ale_fuse_fusionlint_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to fusion-lint. + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-gitcommit.txt b/sources_non_forked/ale/doc/ale-gitcommit.txt new file mode 100644 index 00000000..71813dd0 --- /dev/null +++ b/sources_non_forked/ale/doc/ale-gitcommit.txt @@ -0,0 +1,42 @@ +=============================================================================== +ALE Git Commit Integration *ale-gitcommit-options* + + +=============================================================================== +gitlint *ale-gitcommit-gitlint* + +g:ale_gitcommit_gitlint_executable *g:ale_gitcommit_gitlint_executable* + *b:ale_gitcommit_gitlint_executable* + Type: |String| + Default: `'gitlint'` + + This variable can be changed to modify the executable used for gitlint. + + +g:ale_gitcommit_gitlint_options *g:ale_gitcommit_gitlint_options* + *b:ale_gitcommit_gitlint_options* + Type: |String| + Default: `''` + + This variable can be changed to add command-line arguments to the gitlint + invocation. + + For example, to dinamically set the gitlint configuration file path, you + may want to set > + + let g:ale_gitcommit_gitlint_options = '-C /home/user/.config/gitlint.ini' +< + +g:ale_gitcommit_gitlint_use_global *g:ale_gitcommit_gitlint_use_global* + *b:ale_gitcommit_gitlint_use_global* + Type: |Number| + Default: `0` + + This variable controls whether or not ALE will search for gitlint in a + virtualenv directory first. If this variable is set to `1`, then ALE will + always use |g:ale_gitcommit_gitlint_executable| for the executable path. + + Both variables can be set with `b:` buffer variables instead. + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-glsl.txt b/sources_non_forked/ale/doc/ale-glsl.txt new file mode 100644 index 00000000..257de751 --- /dev/null +++ b/sources_non_forked/ale/doc/ale-glsl.txt @@ -0,0 +1,56 @@ +=============================================================================== +ALE GLSL Integration *ale-glsl-options* + *ale-integration-glsl* + +=============================================================================== +Integration Information + + Since Vim does not detect the glsl file types out-of-the-box, you need the + runtime files for glsl from here: https://github.com/tikhomirov/vim-glsl + + Note that the current glslang-based linter expects glslangValidator in + standard paths. If it's not installed system-wide you can set + |g:ale_glsl_glslang_executable| to a specific path. + + +=============================================================================== +glslang *ale-glsl-glslang* + +g:ale_glsl_glslang_executable *g:ale_glsl_glslang_executable* + *b:ale_glsl_glslang_executable* + Type: |String| + Default: `'glslangValidator'` + + This variable can be changed to change the path to glslangValidator. + + +g:ale_glsl_glslang_options *g:ale_glsl_glslang_options* + *b:ale_glsl_glslang_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to glslangValidator. + + +=============================================================================== +glslls *ale-glsl-glslls* + +g:ale_glsl_glslls_executable *g:ale_glsl_glslls_executable* + *b:ale_glsl_glslls_executable* + Type: |String| + Default: `'glslls'` + + This variable can be changed to change the path to glslls. + See |ale-integrations-local-executables| + +g:ale_glsl_glslls_logfile *g:ale_glsl_glslls_logfile* + *b:ale_glsl_glslls_logfile* + Type: |String| + Default: `''` + + Setting this variable to a writeable file path will enable logging to that + file. + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-go.txt b/sources_non_forked/ale/doc/ale-go.txt new file mode 100644 index 00000000..b80bd454 --- /dev/null +++ b/sources_non_forked/ale/doc/ale-go.txt @@ -0,0 +1,107 @@ +=============================================================================== +ALE Go Integration *ale-go-options* + + +=============================================================================== +Integration Information + +The `gometalinter` linter is disabled by default. ALE enables `gofmt`, +`golint` and `go vet` by default. It also supports `staticcheck`, `go +build` and `gosimple`. + +To enable `gometalinter`, update |g:ale_linters| as appropriate: +> + " Enable all of the linters you want for Go. + let g:ale_linters = {'go': ['gometalinter', 'gofmt']} +< +A possible configuration is to enable `gometalinter` and `gofmt` but paired +with the `--fast` option, set by |g:ale_go_gometalinter_options|. This gets you +the benefit of running a number of linters, more than ALE would by default, +while ensuring it doesn't run any linters known to be slow or resource +intensive. + + +=============================================================================== +gobuild *ale-go-gobuild* + +g:ale_go_gobuild_options *g:ale_go_gobuild_options* + *b:ale_go_gobuild_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to the gobuild linter. + They are injected directly after "go test". + + +=============================================================================== +gofmt *ale-go-gofmt* + +g:ale_go_gofmt_options *g:ale_go_gofmt_options* + *b:ale_go_gofmt_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to the gofmt fixer. + + +=============================================================================== +gometalinter *ale-go-gometalinter* + +`gometalinter` is a `lint_file` linter, which only lints files that are +written to disk. This differs from the default behavior of linting the buffer. +See: |ale-lint-file| + +g:ale_go_gometalinter_executable *g:ale_go_gometalinter_executable* + *b:ale_go_gometalinter_executable* + Type: |String| + Default: `'gometalinter'` + + The executable that will be run for gometalinter. + + +g:ale_go_gometalinter_options *g:ale_go_gometalinter_options* + *b:ale_go_gometalinter_options* + Type: |String| + Default: `''` + + This variable can be changed to alter the command-line arguments to the + gometalinter invocation. + + Since `gometalinter` runs a number of linters that can consume a lot of + resources it's recommended to set this option to a value of `--fast` if you + use `gometalinter` as one of the linters in |g:ale_linters|. This disables a + number of linters known to be slow or consume a lot of resources. + + +g:ale_go_gometalinter_package *g:ale_go_gometalinter_package* + *b:ale_go_gometalinter_package* + Type: |Number| + Default: `0` + + When set to `1`, the whole Go package will be checked instead of only the + current file. + + +=============================================================================== +staticcheck *ale-go-staticcheck* + +g:ale_go_staticcheck_options *g:ale_go_staticcheck_options* + *b:ale_go_staticcheck_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to the staticcheck + linter. + + +g:ale_go_staticcheck_package *g:ale_go_staticcheck_package* + *b:ale_go_staticcheck_package* + Type: |Number| + Default: `0` + + When set to `1`, the whole Go package will be checked instead of only the + current file. + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-graphql.txt b/sources_non_forked/ale/doc/ale-graphql.txt new file mode 100644 index 00000000..603694bb --- /dev/null +++ b/sources_non_forked/ale/doc/ale-graphql.txt @@ -0,0 +1,22 @@ +=============================================================================== +ALE GraphQL Integration *ale-graphql-options* + + +=============================================================================== +eslint *ale-graphql-eslint* + +The `eslint` linter for GraphQL uses the JavaScript options for `eslint`; see: +|ale-javascript-eslint|. + +You will need the GraphQL ESLint plugin installed for this to work. + +=============================================================================== +gqlint *ale-graphql-gqlint* + +=============================================================================== +prettier *ale-graphql-prettier* + +See |ale-javascript-prettier| for information about the available options. + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-handlebars.txt b/sources_non_forked/ale/doc/ale-handlebars.txt new file mode 100644 index 00000000..6908aac6 --- /dev/null +++ b/sources_non_forked/ale/doc/ale-handlebars.txt @@ -0,0 +1,25 @@ +=============================================================================== +ALE Handlebars Integration *ale-handlebars-options* + + +=============================================================================== +ember-template-lint *ale-handlebars-embertemplatelint* + +g:ale_handlebars_embertemplatelint_executable + *g:ale_handlebars_embertemplatelint_executable* + Type: |String| *b:ale_handlebars_embertemplatelint_executable* + Default: `'ember-template-lint'` + + See |ale-integrations-local-executables| + + +g:ale_handlebars_embertemplatelint_use_global + *g:ale_handlebars_embertemplatelint_use_global* + Type: |Number| *b:ale_handlebars_embertemplatelint_use_global* + Default: `0` + + See |ale-integrations-local-executables| + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-haskell.txt b/sources_non_forked/ale/doc/ale-haskell.txt new file mode 100644 index 00000000..9fab39bf --- /dev/null +++ b/sources_non_forked/ale/doc/ale-haskell.txt @@ -0,0 +1,66 @@ +=============================================================================== +ALE Haskell Integration *ale-haskell-options* + + +=============================================================================== +brittany *ale-haskell-brittany* + +g:ale_haskell_brittany_executable *g:ale_haskell_brittany_executable* + *b:ale_haskell_brittany_executable* + Type: |String| + Default: `'brittany'` + + This variable can be changed to use a different executable for brittany. + +=============================================================================== +ghc *ale-haskell-ghc* + +g:ale_haskell_ghc_options *g:ale_haskell_ghc_options* + *b:ale_haskell_ghc_options* + Type: |String| + Default: `'-fno-code -v0'` + + This variable can be changed to modify flags given to ghc. + +=============================================================================== +hdevtools *ale-haskell-hdevtools* + +g:ale_haskell_hdevtools_executable *g:ale_haskell_hdevtools_executable* + *b:ale_haskell_hdevtools_executable* + Type: |String| + Default: `'hdevtools'` + + This variable can be changed to use a different executable for hdevtools. + + +g:ale_haskell_hdevtools_options *g:ale_haskell_hdevtools_options* + *b:ale_haskell_hdevtools_options* + Type: |String| + Default: `'-g -Wall'` + + This variable can be changed to modify flags given to hdevtools. + +=============================================================================== +hfmt *ale-haskell-hfmt* + +g:ale_haskell_hfmt_executable *g:ale_haskell_hfmt_executable* + *b:ale_haskell_hfmt_executable* + Type: |String| + Default: `'hfmt'` + + This variable can be changed to use a different executable for hfmt. + +=============================================================================== +stack-build *ale-haskell-stack-build* + +g:ale_haskell_stack_build_options *g:ale_haskell_stack_build_options* + *b:ale_haskell_stack_build_options* + Type: |String| + Default: `'--fast'` + + We default to using `'--fast'`. Since Stack generates binaries, your + programs will be slower unless you separately rebuild them outside of ALE. + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-html.txt b/sources_non_forked/ale/doc/ale-html.txt new file mode 100644 index 00000000..416e932e --- /dev/null +++ b/sources_non_forked/ale/doc/ale-html.txt @@ -0,0 +1,81 @@ +=============================================================================== +ALE HTML Integration *ale-html-options* + + +=============================================================================== +htmlhint *ale-html-htmlhint* + +g:ale_html_htmlhint_executable *g:ale_html_htmlhint_executable* + *b:ale_html_htmlhint_executable* + Type: |String| + Default: `'htmlhint'` + + See |ale-integrations-local-executables| + + +g:ale_html_htmlhint_options *g:ale_html_htmlhint_options* + *b:ale_html_htmlhint_options* + Type: |String| + Default: `''` + + This variable can be changed to modify flags given to HTMLHint. + + +g:ale_html_htmlhint_use_global *g:ale_html_htmlhint_use_global* + *b:ale_html_htmlhint_use_global* + Type: |String| + Default: `0` + + See |ale-integrations-local-executables| + + +=============================================================================== +tidy *ale-html-tidy* + +`tidy` is a console application which corrects and cleans up HTML and XML +documents by fixing markup errors and upgrading legacy code to modern +standards. + +Note: +`/usr/bin/tidy` on macOS (installed by default) is too old. It was released +on 31 Oct 2006. It does not consider modern HTML specs (HTML5) and shows +outdated warnings. So |ale| ignores `/usr/bin/tidy` on macOS. + +To use `tidy` on macOS, please install the latest version with Homebrew: +> + $ brew install tidy-html5 +< +`/usr/local/bin/tidy` is installed. + +g:ale_html_tidy_executable *g:ale_html_tidy_executable* + *b:ale_html_tidy_executable* + Type: |String| + Default: `'tidy'` + + This variable can be changed to change the path to tidy. + + +g:ale_html_tidy_options *g:ale_html_tidy_options* + *b:ale_html_tidy_options* + Type: |String| + Default: `'-q -e -language en'` + + This variable can be changed to change the arguments provided to the + executable. + + ALE will attempt to automatically detect the appropriate file encoding to + provide to html-tidy, and fall back to UTF-8 when encoding detection fails. + + The recognized file encodings are as follows: ascii, big5, cp1252 (win1252), + cp850 (ibm858), cp932 (shiftjis), iso-2022-jp (iso-2022), latin1, macroman + (mac), sjis (shiftjis), utf-16le, utf-16, utf-8 + + +=============================================================================== +write-good *ale-html-write-good* + +See |ale-write-good-options| + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-idris.txt b/sources_non_forked/ale/doc/ale-idris.txt new file mode 100644 index 00000000..c7500b0d --- /dev/null +++ b/sources_non_forked/ale/doc/ale-idris.txt @@ -0,0 +1,23 @@ +=============================================================================== +ALE Idris Integration *ale-idris-options* + +=============================================================================== +idris *ale-idris-idris* + +g:ale_idris_idris_executable *g:ale_idris_idris_executable* + *b:ale_idris_idris_executable* + Type: |String| + Default: `'idris'` + + This variable can be changed to change the path to idris. + + +g:ale_idris_idris_options *g:ale_idris_idris_options* + *b:ale_idris_idris_options* + Type: |String| + Default: `'--total --warnpartial --warnreach --warnipkg'` + + This variable can be changed to modify flags given to idris. + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-java.txt b/sources_non_forked/ale/doc/ale-java.txt new file mode 100644 index 00000000..0d2011f8 --- /dev/null +++ b/sources_non_forked/ale/doc/ale-java.txt @@ -0,0 +1,57 @@ +=============================================================================== +ALE Java Integration *ale-java-options* + + +=============================================================================== +checkstyle *ale-java-checkstyle* + +g:ale_java_checkstyle_options *g:ale_java_checkstyle_options* + *b:ale_java_checkstyle_options* + + Type: String + Default: '-c /google_checks.xml' + + This variable can be changed to modify flags given to checkstyle. + + +=============================================================================== +javac *ale-java-javac* + +g:ale_java_javac_classpath *g:ale_java_javac_classpath* + *b:ale_java_javac_classpath* + Type: |String| + Default: `''` + + This variable can be set to change the global classpath for Java. + + +g:ale_java_javac_options *g:ale_java_javac_options* + *b:ale_java_javac_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to javac. + + +=============================================================================== +google-java-format *ale-java-google-java-format* + + +g:ale_java_google_java_format_executable + *g:ale_java_google_java_format_executable* + *b:ale_java_google_java_format_executable* + Type: |String| + Default: `'google-java-format'` + + See |ale-integrations-local-executables| + + +g:ale_java_google_java_format_options *g:ale_java_google_java_format_options* + *b:ale_java_google_java_format_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-javascript.txt b/sources_non_forked/ale/doc/ale-javascript.txt new file mode 100644 index 00000000..f625fd7f --- /dev/null +++ b/sources_non_forked/ale/doc/ale-javascript.txt @@ -0,0 +1,298 @@ +=============================================================================== +ALE JavaScript Integration *ale-javascript-options* + + *ale-eslint-nested-configuration-files* + +For fixing files with ESLint, nested configuration files with `root: false` +are not supported. This is because ALE fixes files by writing the contents of +buffers to temporary files, and then explicitly sets the configuration file. +Configuration files which are set explicitly must be root configuration files. +If you are using nested configuration files, you should restructure your +project so your configuration files use `extends` instead. + +See the ESLint documentation here: +http://eslint.org/docs/user-guide/configuring#extending-configuration-files + +You should change the structure of your project from this: > + /path/foo/.eslintrc.js # root: true + /path/foo/bar/.eslintrc.js # root: false +< +To this: > + /path/foo/.base-eslintrc.js # Base configuration here + /path/foo/.eslintrc.js # extends: ["/path/foo/.base-eslintrc.js"] + /path/foo/bar/.eslintrc.js # extends: ["/path/foo/.base-eslintrc.js"] +< + +=============================================================================== +eslint *ale-javascript-eslint* + +g:ale_javascript_eslint_executable *g:ale_javascript_eslint_executable* + *b:ale_javascript_eslint_executable* + Type: |String| + Default: `'eslint'` + + See |ale-integrations-local-executables| + + +g:ale_javascript_eslint_options *g:ale_javascript_eslint_options* + *b:ale_javascript_eslint_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to eslint. + + +g:ale_javascript_eslint_use_global *g:ale_javascript_eslint_use_global* + *b:ale_javascript_eslint_use_global* + Type: |Number| + Default: `0` + + See |ale-integrations-local-executables| + + +g:ale_javascript_eslint_suppress_eslintignore + *g:ale_javascript_eslint_suppress_eslintignore* + *b:ale_javascript_eslint_suppress_eslintignore* + Type: |Number| + Default: `0` + + This variable can be set to `1` to disable warnings for files being ignored + by eslint. + + +g:ale_javascript_eslint_suppress_missing_config + *g:ale_javascript_eslint_suppress_missing_config* + *b:ale_javascript_eslint_suppress_missing_config* + Type: |Number| + Default: `0` + + This variable can be set to `1` to disable errors for missing eslint + configuration files. + + When turning this option on, eslint will not report any problems when no + configuration files are found. + + +=============================================================================== +flow *ale-javascript-flow* + +g:ale_javascript_flow_executable *g:ale_javascript_flow_executable* + *b:ale_javascript_flow_executable* + Type: |String| + Default: `'flow'` + + See |ale-integrations-local-executables| + + +g:ale_javascript_flow_use_home_config *g:ale_javascript_flow_use_home_config* + *b:ale_javascript_flow_use_home_config* + Type: |Number| + Default: `0` + + When set to `1`, ALE will allow Flow to be executed with configuration files + from your home directory. ALE will not run Flow with home directory + configuration files by default, as doing so can lead to Vim consuming all of + your RAM and CPU power. + + +g:ale_javascript_flow_use_global *g:ale_javascript_flow_use_global* + *b:ale_javascript_flow_use_global* + Type: |Number| + Default: `0` + + See |ale-integrations-local-executables| + + +=============================================================================== +importjs *ale-javascript-importjs* + +g:ale_javascript_importjs_executable *g:ale_javascript_importjs_executable* + *b:ale_javascript_importjs_executable* + Type: |String| + Default: `'importjs'` + + +=============================================================================== +jscs *ale-javascript-jscs* + +g:ale_javascript_jscs_executable *g:ale_javascript_jscs_executable* + *b:ale_javascript_jscs_executable* + Type: |String| + Default: `'jscs'` + + See |ale-integrations-local-executables| + + +g:ale_javascript_jscs_use_global *g:ale_javascript_jscs_use_global* + *b:ale_javascript_jscs_use_global* + Type: |Number| + Default: `0` + + See |ale-integrations-local-executables| + + +=============================================================================== +jshint *ale-javascript-jshint* + +g:ale_javascript_jshint_executable *g:ale_javascript_jshint_executable* + *b:ale_javascript_jshint_executable* + Type: |String| + Default: `'jshint'` + + See |ale-integrations-local-executables| + + +g:ale_javascript_jshint_use_global *g:ale_javascript_jshint_use_global* + *b:ale_javascript_jshint_use_global* + Type: |Number| + Default: `0` + + See |ale-integrations-local-executables| + + +=============================================================================== +prettier *ale-javascript-prettier* + +g:ale_javascript_prettier_executable *g:ale_javascript_prettier_executable* + *b:ale_javascript_prettier_executable* + Type: |String| + Default: `'prettier'` + + See |ale-integrations-local-executables| + + +g:ale_javascript_prettier_options *g:ale_javascript_prettier_options* + *b:ale_javascript_prettier_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to prettier. + + +g:ale_javascript_prettier_use_global *g:ale_javascript_prettier_use_global* + *b:ale_javascript_prettier_use_global* + Type: |Number| + Default: `0` + + See |ale-integrations-local-executables| + + +=============================================================================== +prettier-eslint *ale-javascript-prettier-eslint* + +g:ale_javascript_prettier_eslint_executable + *g:ale_javascript_prettier_eslint_executable* + *b:ale_javascript_prettier_eslint_executable* + Type: |String| + Default: `'prettier-eslint'` + + See |ale-integrations-local-executables| + + +g:ale_javascript_prettier_eslint_options + *g:ale_javascript_prettier_eslint_options* + *b:ale_javascript_prettier_eslint_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to prettier-eslint. + + +g:ale_javascript_prettier_eslint_use_global + *g:ale_javascript_prettier_eslint_use_global* + *b:ale_javascript_prettier_eslint_use_global* + Type: |Number| + Default: `0` + + See |ale-integrations-local-executables| + + +=============================================================================== +prettier-standard *ale-javascript-prettier-standard* + + +g:ale_javascript_prettier_standard_executable + *g:ale_javascript_prettier_standard_executable* + *b:ale_javascript_prettier_standard_executable* + Type: |String| + Default: `'prettier-standard'` + + See |ale-integrations-local-executables| + + +g:ale_javascript_prettier_standard_options + *g:ale_javascript_prettier_standard_options* + *b:ale_javascript_prettier_standard_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to prettier-standard. + + +g:ale_javascript_prettier_standard_use_global + *g:ale_javascript_prettier_standard_use_global* + *b:ale_javascript_prettier_standard_use_global* + Type: |Number| + Default: `0` + + See |ale-integrations-local-executables| + + + + +=============================================================================== +standard *ale-javascript-standard* + +g:ale_javascript_standard_executable *g:ale_javascript_standard_executable* + *b:ale_javascript_standard_executable* + Type: |String| + Default: `'standard'` + + See |ale-integrations-local-executables| + + +g:ale_javascript_standard_options *g:ale_javascript_standard_options* + *b:ale_javascript_standard_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to standard. + + +g:ale_javascript_standard_use_global *g:ale_javascript_standard_use_global* + *b:ale_javascript_standard_use_global* + Type: |Number| + Default: `0` + + See |ale-integrations-local-executables| + + +=============================================================================== +xo *ale-javascript-xo* + +g:ale_javascript_xo_executable *g:ale_javascript_xo_executable* + *b:ale_javascript_xo_executable* + Type: |String| + Default: `'xo'` + + See |ale-integrations-local-executables| + + +g:ale_javascript_xo_options *g:ale_javascript_xo_options* + *b:ale_javascript_xo_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to xo. + + +g:ale_javascript_xo_use_global *g:ale_javascript_xo_use_global* + *b:ale_javascript_xo_use_global* + Type: |Number| + Default: `0` + + See |ale-integrations-local-executables| + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-json.txt b/sources_non_forked/ale/doc/ale-json.txt new file mode 100644 index 00000000..1e97abce --- /dev/null +++ b/sources_non_forked/ale/doc/ale-json.txt @@ -0,0 +1,84 @@ +=============================================================================== +ALE JSON Integration *ale-json-options* + + +=============================================================================== +fixjson *ale-json-fixjson* + +fixjson is a JSON file fixer/formatter for humans using (relaxed) JSON5. +It provides: + +- Pretty-prints JSON input +- Fixes various failures while humans writing JSON + - Fixes trailing commas objects or arrays + - Fixes missing commas for elements of objects or arrays + - Adds quotes to keys in objects + - Newlines in strings + - Hex numbers + - Fixes single quotes to double quotes + +You can install it using npm: +> + $ npm install -g fixjson +< +ALE provides fixjson integration as a fixer. See |ale-fix|. + +g:ale_json_fixjson_executable *g:ale_json_fixjson_executable* + *b:ale_json_fixjson_executable* + + Type: |String| + Default: `'fixjson'` + + The executable that will be run for fixjson. + +g:ale_json_fixjson_options *g:ale_json_fixjson_options* + *b:ale_json_fixjson_options* + + Type: |String| + Default: `''` + + This variable can add extra options to the command executed for running + fixjson. + +g:ale_json_fixjson_use_global *g:ale_json_fixjson_use_global* + *b:ale_json_fixjson_use_global* + + Type: |Number| + Default: `0` + + See |ale-integrations-local-executables| + + +=============================================================================== +jsonlint *ale-json-jsonlint* + +There are no options available. + + +=============================================================================== +jq *ale-json-jq* + +g:ale_json_jq_executable *g:ale_json_jq_executable* + *b:ale_json_jq_executable* + Type: |String| + Default: `'jq'` + + This option can be changed to change the path for `jq`. + + +g:ale_json_jq_options *g:ale_json_jq_options* + *b:ale_json_jq_options* + Type: |String| + Default: `''` + + This option can be changed to pass extra options to `jq`. + + +=============================================================================== +prettier *ale-json-prettier* + +See |ale-javascript-prettier| for information about the available options. + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-kotlin.txt b/sources_non_forked/ale/doc/ale-kotlin.txt new file mode 100644 index 00000000..571d2bac --- /dev/null +++ b/sources_non_forked/ale/doc/ale-kotlin.txt @@ -0,0 +1,90 @@ +=============================================================================== +ALE Kotlin Integration *ale-kotlin-options* + *ale-integration-kotlin* + +=============================================================================== +Integration Information + + Make sure your setup has support for the kotlin file type. A filetype plugin + can be found here: https://github.com/udalov/kotlin-vim + + + Note: Make sure you have a working kotlin compiler + + +=============================================================================== +kotlinc *ale-kotlin-kotlinc* + +g:ale_kotlin_kotlinc_options *g:ale_kotlin_kotlinc_options* + Type: |String| + Default: `''` + + Additional options to pass to the kotlin compiler + +g:ale_kotlin_kotlinc_enable_config *g:ale_kotlin_kotlinc_enable_config* + Type: |Number| + Default: `0` + + Setting this variable to `1` tells the linter to load a configuration file. + This should be set in your vimrc + +g:ale_kotlin_kotlinc_config_file *g:ale_kotlin_kotlinc_config_file* + Type: |String| + Default: `'.ale_kotlin_kotlinc_config'` + + Filename of the configuration file. This should be set in your vimrc + +g:ale_kotlin_kotlinc_classpath *g:ale_kotlin_kotlinc_classpath* + Type: |String| + Default: `''` + + A string containing the paths (separated by the appropriate path separator) + of the source directories. + +g:ale_kotlin_kotlinc_sourcepath *g:ale_kotlin_kotlinc_sourcepath* + Type: |String| + Default: `''` + + A string containing the paths (separated by space) of the source + directories. + +g:ale_kotlin_kotlinc_use_module_file *g:ale_kotlin_kotlinc_use_module_file* + Type: |Number| + Default: `0` + + This option indicates whether the linter should use a module file. It is off + by default. + +g:ale_kotlin_kotlinc_module_filename *g:ale_kotlin_kotlinc_module_filename* + Type: |String| + Default: `'module.xml'` + + The filename of the module file that the linter should pass to the kotlin + compiler. + + +=============================================================================== +ktlint *ale-kotlin-ktlint* + +g:ale_kotlin_ktlint_executable *g:ale_kotlin_ktlint_executable* + Type: |String| + Default: `''` + + The Ktlint executable. + + Posix-compliant shell scripts are the only executables that can be found on + Ktlint's github release page. If you are not on such a system, your best + bet will be to download the ktlint jar and set this option to something + similar to `'java -jar /path/to/ktlint.jar'` + +g:ale_kotlin_ktlint_rulesets *g:ale_kotlin_ktlint_rulesets* + Type: |List| of |String|s + Default: [] + + This list should contain paths to ruleset jars and/or strings of maven + artifact triples. Example: + > + let g:ale_kotlin_ktlint_rulesets = ['/path/to/custom-rulset.jar', + 'com.ktlint.rulesets:mycustomrule:1.0.0'] + + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-latex.txt b/sources_non_forked/ale/doc/ale-latex.txt new file mode 100644 index 00000000..87fbd4e8 --- /dev/null +++ b/sources_non_forked/ale/doc/ale-latex.txt @@ -0,0 +1,12 @@ +=============================================================================== +ALE LaTeX Integration *ale-latex-options* + + +=============================================================================== +write-good *ale-latex-write-good* + +See |ale-write-good-options| + + +=============================================================================== +vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-less.txt b/sources_non_forked/ale/doc/ale-less.txt new file mode 100644 index 00000000..05f56e2b --- /dev/null +++ b/sources_non_forked/ale/doc/ale-less.txt @@ -0,0 +1,66 @@ +=============================================================================== +ALE Less Integration *ale-less-options* + + +=============================================================================== +lessc *ale-less-lessc* + +g:ale_less_lessc_executable *g:ale_less_lessc_executable* + *b:ale_less_lessc_executable* + Type: |String| + Default: `'lessc'` + + See |ale-integrations-local-executables| + + +g:ale_less_lessc_options *g:ale_less_lessc_options* + *b:ale_less_lessc_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to lessc. + + +g:ale_less_lessc_use_global *g:ale_less_lessc_use_global* + *b:ale_less_lessc_use_global* + Type: |String| + Default: `0` + + See |ale-integrations-local-executables| + + +=============================================================================== +prettier *ale-less-prettier* + +See |ale-javascript-prettier| for information about the available options. + + +=============================================================================== +stylelint *ale-less-stylelint* + +g:ale_less_stylelint_executable *g:ale_less_stylelint_executable* + *b:ale_less_stylelint_executable* + Type: |String| + Default: `'stylelint'` + + See |ale-integrations-local-executables| + + +g:ale_less_stylelint_options *g:ale_less_stylelint_options* + *b:ale_less_stylelint_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to stylelint. + + +g:ale_less_stylelint_use_global *g:ale_less_stylelint_use_global* + *b:ale_less_stylelint_use_global* + Type: |String| + Default: `0` + + See |ale-integrations-local-executables| + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-llvm.txt b/sources_non_forked/ale/doc/ale-llvm.txt new file mode 100644 index 00000000..2f4a46bd --- /dev/null +++ b/sources_non_forked/ale/doc/ale-llvm.txt @@ -0,0 +1,19 @@ +=============================================================================== +ALE LLVM Integration *ale-llvm-options* + + +=============================================================================== +llc *ale-llvm-llc* + +g:ale_llvm_llc_executable *g:ale_llvm_llc_executable* + *b:ale_llvm_llc_executable* + + Type: |String| + Default: "llc" + + The command to use for checking. This variable is useful when llc command + has suffix like "llc-5.0". + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-lua.txt b/sources_non_forked/ale/doc/ale-lua.txt new file mode 100644 index 00000000..f1286f89 --- /dev/null +++ b/sources_non_forked/ale/doc/ale-lua.txt @@ -0,0 +1,34 @@ +=============================================================================== +ALE Lua Integration *ale-lua-options* + +=============================================================================== +luac *ale-lua-luac* + +g:ale_lua_luac_executable *g:ale_lua_luac_executable* + *b:ale_lua_luac_executable* + Type: |String| + Default: `'luac'` + + This variable can be changed to change the path to luac. + +=============================================================================== +luacheck *ale-lua-luacheck* + +g:ale_lua_luacheck_executable *g:ale_lua_luacheck_executable* + *b:ale_lua_luacheck_executable* + Type: |String| + Default: `'luacheck'` + + This variable can be changed to change the path to luacheck. + + +g:ale_lua_luacheck_options *g:ale_lua_luacheck_options* + *b:ale_lua_luacheck_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to luacheck. + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-markdown.txt b/sources_non_forked/ale/doc/ale-markdown.txt new file mode 100644 index 00000000..d7e50093 --- /dev/null +++ b/sources_non_forked/ale/doc/ale-markdown.txt @@ -0,0 +1,43 @@ +=============================================================================== +ALE Markdown Integration *ale-markdown-options* + + +=============================================================================== +mdl *ale-markdown-mdl* + +g:ale_markdown_mdl_executable *g:ale_markdown_mdl_executable* + *b:ale_markdown_mdl_executable* + Type: |String| + Default: `'mdl'` + + See |ale-integrations-local-executables| + + +g:ale_markdown_mdl_options *g:ale_markdown_mdl_options* + *b:ale_markdown_mdl_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to mdl. + + +=============================================================================== +prettier *ale-markdown-prettier* + +See |ale-javascript-prettier| for information about the available options. + + +=============================================================================== +textlint *ale-markdown-textlint* + +See |ale-text-textlint| + + +=============================================================================== +write-good *ale-markdown-write-good* + +See |ale-write-good-options| + + +=============================================================================== +vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-nroff.txt b/sources_non_forked/ale/doc/ale-nroff.txt new file mode 100644 index 00000000..62ec7896 --- /dev/null +++ b/sources_non_forked/ale/doc/ale-nroff.txt @@ -0,0 +1,12 @@ +=============================================================================== +ALE nroff Integration *ale-nroff-options* + + +=============================================================================== +write-good *ale-nroff-write-good* + +See |ale-write-good-options| + + +=============================================================================== +vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-objc.txt b/sources_non_forked/ale/doc/ale-objc.txt new file mode 100644 index 00000000..35b9a795 --- /dev/null +++ b/sources_non_forked/ale/doc/ale-objc.txt @@ -0,0 +1,17 @@ +=============================================================================== +ALE Objective-C Integration *ale-objc-options* + + +=============================================================================== +clang *ale-objc-clang* + +g:ale_objc_clang_options *g:ale_objc_clang_options* + *b:ale_objc_clang_options* + Type: |String| + Default: `'-std=c11 -Wall'` + + This variable can be changed to modify flags given to clang. + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-objcpp.txt b/sources_non_forked/ale/doc/ale-objcpp.txt new file mode 100644 index 00000000..73d68a2e --- /dev/null +++ b/sources_non_forked/ale/doc/ale-objcpp.txt @@ -0,0 +1,17 @@ +=============================================================================== +ALE Objective-C++ Integration *ale-objcpp-options* + + +=============================================================================== +clang *ale-objcpp-clang* + +g:ale_objcpp_clang_options *g:ale_objcpp_clang_options* + *b:ale_objcpp_clang_options* + Type: |String| + Default: `'-std=c++14 -Wall'` + + This variable can be changed to modify flags given to clang. + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-ocaml.txt b/sources_non_forked/ale/doc/ale-ocaml.txt new file mode 100644 index 00000000..cfa365af --- /dev/null +++ b/sources_non_forked/ale/doc/ale-ocaml.txt @@ -0,0 +1,37 @@ +=============================================================================== +ALE OCaml Integration *ale-ocaml-options* + + +=============================================================================== +merlin *ale-ocaml-merlin* + + To use merlin linter for OCaml source code you need to make sure Merlin for + Vim is correctly configured. See the corresponding Merlin wiki page for + detailed instructions + (https://github.com/the-lambda-church/merlin/wiki/vim-from-scratch). + +=============================================================================== +ols *ale-ocaml-ols* + + The `ocaml-language-server` is the engine that powers OCaml and ReasonML + editor support using the Language Server Protocol. See the installation + instructions: + https://github.com/freebroccolo/ocaml-language-server#installation + +g:ale_ocaml_ols_executable *g:ale_ocaml_ols_executable* + *b:ale_ocaml_ols_executable* + Type: |String| + Default: `'ocaml-language-server'` + + This variable can be set to change the executable path for `ols`. + +g:ale_ocaml_ols_use_global *g:ale_ocaml_ols_use_global* + *b:ale_ocaml_ols_use_global* + Type: |String| + Default: `0` + + This variable can be set to `1` to always use the globally installed + executable. See also |ale-integrations-local-executables|. + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-perl.txt b/sources_non_forked/ale/doc/ale-perl.txt new file mode 100644 index 00000000..0a4adfff --- /dev/null +++ b/sources_non_forked/ale/doc/ale-perl.txt @@ -0,0 +1,82 @@ +=============================================================================== +ALE Perl Integration *ale-perl-options* + +ALE offers a few ways to check Perl code. Checking code with `perl` is +disabled by default, as `perl` code cannot be checked without executing it. +Specifically, we use the `-c` flag to see if `perl` code compiles. This does +not execute all of the code in a file, but it does run `BEGIN` and `CHECK` +blocks. See `perl --help` and https://stackoverflow.com/a/12908487/406224 + +See |g:ale_linters|. + + +=============================================================================== +perl *ale-perl-perl* + +g:ale_perl_perl_executable *g:ale_perl_perl_executable* + *b:ale_perl_perl_executable* + Type: |String| + Default: `'perl'` + + This variable can be changed to modify the executable used for linting perl. + + +g:ale_perl_perl_options *g:ale_perl_perl_options* + *b:ale_perl_perl_options* + Type: |String| + Default: `'-c -Mwarnings -Ilib'` + + This variable can be changed to alter the command-line arguments to the perl + invocation. + + +=============================================================================== +perlcritic *ale-perl-perlcritic* + +g:ale_perl_perlcritic_executable *g:ale_perl_perlcritic_executable* + *b:ale_perl_perlcritic_executable* + Type: |String| + Default: `'perlcritic'` + + This variable can be changed to modify the perlcritic executable used for + linting perl. + + +g:ale_perl_perlcritic_profile *g:ale_perl_perlcritic_profile* + *b:ale_perl_perlcritic_profile* + Type: |String| + Default: `'.perlcriticrc'` + + This variable can be changed to modify the perlcritic profile used for + linting perl. The current directory is checked for the file, then the + parent directory, etc, until it finds one. If no matching file is found, no + profile is passed to perlcritic. + + Set to an empty string to disable passing a specific profile to perlcritic + with the `'--profile'` option. + + To prevent perlcritic from using any profile, set this variable to an empty + string and pass `'--no-profile'`to perlcritic via the + |g:ale_perl_perlcritic_options| variable. + + +g:ale_perl_perlcritic_options *g:ale_perl_perlcritic_options* + *b:ale_perl_perlcritic_options* + Type: |String| + Default: `''` + + This variable can be changed to supply additional command-line arguments to + the perlcritic invocation. + + +g:ale_perl_perlcritic_showrules *g:ale_perl_perlcritic_showrules* + + Type: |Number| + Default: 0 + + Controls whether perlcritic rule names are shown after the error message. + Defaults to off to reduce length of message. + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-php.txt b/sources_non_forked/ale/doc/ale-php.txt new file mode 100644 index 00000000..7edfe231 --- /dev/null +++ b/sources_non_forked/ale/doc/ale-php.txt @@ -0,0 +1,187 @@ +=============================================================================== +ALE PHP Integration *ale-php-options* + + +=============================================================================== +hack *ale-php-hack* + +There are no options for this linter. + + +=============================================================================== +hackfmt *ale-php-hackfmt* + +g:ale_php_hackfmt_options *g:ale_php_hackfmt_options* + *b:ale_php_hackfmt_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to the hackfmt fixer. + + +=============================================================================== +langserver *ale-php-langserver* + +g:ale_php_langserver_executable *g:ale_php_langserver_executable* + *b:ale_php_langserver_executable* + Type: |String| + Default: `'php-language-server.php'` + + The variable can be set to configure the executable that will be used for + running the PHP language server. `vendor` directory executables will be + preferred instead of this setting if |g:ale_php_langserver_use_global| is `0`. + + See: |ale-integrations-local-executables| + + +g:ale_php_langserver_use_global *g:ale_php_langserver_use_global* + *b:ale_php_langserver_use_global* + Type: |Number| + Default: `0` + + This variable can be set to `1` to force the language server to be run with + the executable set for |g:ale_php_langserver_executable|. + + See: |ale-integrations-local-executables| + + +=============================================================================== +phan *ale-php-phan* + +WARNING: please do not use this linter if you have an configuration file +for your project because the phan will look into your entirely project and +ale will display in the current buffer warnings that may belong to other file. + +g:ale_php_phan_minimum_severity *g:ale_php_phan_minimum_severity* + *b:ale_php_phan_minimum_severity* + Type: |Number| + Default: `0` + + This variable defines the minimum severity level + + +=============================================================================== +phpcbf *ale-php-phpcbf* + +g:ale_php_phpcbf_executable *g:ale_php_phpcbf_executable* + *b:ale_php_phpcbf_executable* + Type: |String| + Default: `'phpcbf'` + + See |ale-integrations-local-executables| + + +g:ale_php_phpcbf_standard *g:ale_php_phpcbf_standard* + *b:ale_php_phpcbf_standard* + Type: |String| + Default: `''` + + This variable can be set to specify the coding standard used by phpcbf. If no + coding standard is specified, phpcbf will default to fixing against the + PEAR coding standard, or the standard you have set as the default. + + +g:ale_php_phpcbf_use_global *g:ale_php_phpcbf_use_global* + *b:ale_php_phpcbf_use_global* + Type: |Number| + Default: `0` + + See |ale-integrations-local-executables| + + +=============================================================================== +phpcs *ale-php-phpcs* + +g:ale_php_phpcs_executable *g:ale_php_phpcs_executable* + *b:ale_php_phpcs_executable* + Type: |String| + Default: `'phpcs'` + + See |ale-integrations-local-executables| + + +g:ale_php_phpcs_standard *g:ale_php_phpcs_standard* + *b:ale_php_phpcs_standard* + Type: |String| + Default: `''` + + This variable can be set to specify the coding standard used by phpcs. If no + coding standard is specified, phpcs will default to checking against the + PEAR coding standard, or the standard you have set as the default. + + +g:ale_php_phpcs_use_global *g:ale_php_phpcs_use_global* + *b:ale_php_phpcs_use_global* + Type: |Number| + Default: `0` + + See |ale-integrations-local-executables| + + +=============================================================================== +phpmd *ale-php-phpmd* + +g:ale_php_phpmd_executable *g:ale_php_phpmd_executable* + *b:ale_php_phpmd_executable* + Type: |String| + Default: `'phpmd'` + + This variable sets executable used for phpmd. + + +g:ale_php_phpmd_ruleset *g:ale_php_phpmd_ruleset* + *b:ale_php_phpmd_ruleset* + Type: |String| + Default: `'cleancode,codesize,controversial,design,naming,unusedcode'` + + This variable controls the ruleset used by phpmd. Default is to use all of + the available phpmd rulesets + + +=============================================================================== +phpstan *ale-php-phpstan* + +g:ale_php_phpstan_executable *g:ale_php_phpstan_executable* + *b:ale_php_phpstan_executable* + Type: |String| + Default: `'phpstan'` + + This variable sets executable used for phpstan. + + +g:ale_php_phpstan_level *g:ale_php_phpstan_level* + *b:ale_php_phpstan_level* + Type: |Number| + Default: `4` + + This variable controls the rule levels. 0 is the loosest and 4 is the + strictest. + + +g:ale_php_phpstan_configuration *g:ale_php_phpstan_configuration* + *b:ale_php_phpstan_configuration* + Type: |String| + Default: `''` + + This variable sets path to phpstan configuration file. + + +=============================================================================== +php-cs-fixer *ale-php-php-cs-fixer* + +g:ale_php_cs_fixer_executable *g:ale_php_cs_fixer_executable* + *b:ale_php_cs_fixer_executable* + Type: |String| + Default: `'php-cs-fixer'` + + This variable sets executable used for php-cs-fixer. + +g:ale_php_cs_fixer_use_global *g:ale_php_cs_fixer_use_global* + *b:ale_php_cs_fixer_use_global* + Type: |Boolean| + Default: `0` + + This variable force globally installed fixer. + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-po.txt b/sources_non_forked/ale/doc/ale-po.txt new file mode 100644 index 00000000..1e03b7bb --- /dev/null +++ b/sources_non_forked/ale/doc/ale-po.txt @@ -0,0 +1,12 @@ +=============================================================================== +ALE PO Integration *ale-po-options* + + +=============================================================================== +write-good *ale-po-write-good* + +See |ale-write-good-options| + + +=============================================================================== +vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-pod.txt b/sources_non_forked/ale/doc/ale-pod.txt new file mode 100644 index 00000000..c7cc0bbc --- /dev/null +++ b/sources_non_forked/ale/doc/ale-pod.txt @@ -0,0 +1,12 @@ +=============================================================================== +ALE Pod Integration *ale-pod-options* + + +=============================================================================== +write-good *ale-pod-write-good* + +See |ale-write-good-options| + + +=============================================================================== +vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-pony.txt b/sources_non_forked/ale/doc/ale-pony.txt new file mode 100644 index 00000000..3b32168e --- /dev/null +++ b/sources_non_forked/ale/doc/ale-pony.txt @@ -0,0 +1,25 @@ +=============================================================================== +ALE Pony Integration *ale-pony-options* + + +=============================================================================== +ponyc *ale-pony-ponyc* + +g:ale_pony_ponyc_executable *g:ale_pony_ponyc_executable* + *b:ale_pony_ponyc_executable* + Type: |String| + Default: `'ponyc'` + + See |ale-integrations-local-executables| + + +g:ale_pony_ponyc_options *g:ale_pony_ponyc_options* + *b:ale_pony_ponyc_options* + Type: |String| + Default: `'--pass paint'` + + This variable can be set to pass options to ponyc. + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-proto.txt b/sources_non_forked/ale/doc/ale-proto.txt new file mode 100644 index 00000000..734e23d5 --- /dev/null +++ b/sources_non_forked/ale/doc/ale-proto.txt @@ -0,0 +1,33 @@ +=============================================================================== +ALE Proto Integration *ale-proto-options* + + +=============================================================================== +Integration Information + +Linting of `.proto` files requires that the `protoc` binary is installed in the +system path and that the `protoc-gen-lint` plugin for the `protoc` binary is also +installed. + +To enable `.proto` file linting, update |g:ale_linters| as appropriate: +> + " Enable linter for .proto files + let g:ale_linters = {'proto': ['protoc-gen-lint']} +< +=============================================================================== +protoc-gen-lint *ale-proto-protoc-gen-lint* + + The linter is a plugin for the `protoc` binary. As long as the binary resides + in the system path, `protoc` will find it. + +g:ale_proto_protoc_gen_lint_options *g:ale_proto_protoc_gen_lint_options* + + Type: |String| + Default: `''` + + This variable can be changed to modify flags given to protoc. Note that the + directory of the linted file is always passed as an include path with '-I' + before any user-supplied options. + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-pug.txt b/sources_non_forked/ale/doc/ale-pug.txt new file mode 100644 index 00000000..01071485 --- /dev/null +++ b/sources_non_forked/ale/doc/ale-pug.txt @@ -0,0 +1,44 @@ +=============================================================================== +ALE Pug Integration *ale-pug-options* + + +=============================================================================== +puglint *ale-pug-puglint* + +The puglint linter will detect configuration files based on the path to the +filename automatically. Configuration files will be loaded in this order: + +1. `.pug-lintrc` +2. `.pug-lintrc.js` +3. `.pug-lintrc.json` +4. `package.json` + +You might need to create a configuration file for your project to get +meaningful results. + +g:ale_pug_puglint_executable *g:ale_pug_puglint_executable* + *b:ale_pug_puglint_executable* + Type: |String| + Default: `'pug-lint'` + + See |ale-integrations-local-executables| + + +g:ale_pug_puglint_options *g:ale_pug_puglint_options* + *b:ale_pug_puglint_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to pug-lint. + + +g:ale_pug_puglint_use_global *g:ale_pug_puglint_use_global* + *b:ale_pug_puglint_use_global* + Type: |Number| + Default: `0` + + See |ale-integrations-local-executables| + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-puppet.txt b/sources_non_forked/ale/doc/ale-puppet.txt new file mode 100644 index 00000000..604565e0 --- /dev/null +++ b/sources_non_forked/ale/doc/ale-puppet.txt @@ -0,0 +1,26 @@ +=============================================================================== +ALE Puppet Integration *ale-puppet-options* + + +=============================================================================== +puppetlint *ale-puppet-puppetlint* + +g:ale_puppet_puppetlint_executable *g:ale_puppet_puppetlint_executable* + *b:ale_puppet_puppetlint_executable* + Type: |String| + Default: `'puppet-lint'` + + This variable can be changed to specify the executable used for puppet-lint. + + +g:ale_puppet_puppetlint_options *g:ale_puppet_puppetlint_options* + *b:ale_puppet_puppetlint_options* + Type: |String| + Default: `'--no-autoloader_layout-check'` + + This variable can be changed to add command-line arguments to the + puppet-lint invocation. + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-python.txt b/sources_non_forked/ale/doc/ale-python.txt new file mode 100644 index 00000000..4d55e751 --- /dev/null +++ b/sources_non_forked/ale/doc/ale-python.txt @@ -0,0 +1,282 @@ +=============================================================================== +ALE Python Integration *ale-python-options* + + +=============================================================================== +autopep8 *ale-python-autopep8* + +g:ale_python_autopep8_executable *g:ale_python_autopep8_executable* + *b:ale_python_autopep8_executable* + Type: |String| + Default: `'autopep8'` + + See |ale-integrations-local-executables| + + +g:ale_python_autopep8_options *g:ale_python_autopep8_options* + *b:ale_python_autopep8_options* + Type: |String| + Default: `''` + + This variable can be set to pass extra options to autopep8. + + +g:ale_python_autopep8_use_global *g:ale_python_autopep8_use_global* + *b:ale_python_autopep8_use_global* + Type: |Number| + Default: `0` + + See |ale-integrations-local-executables| + + +=============================================================================== +flake8 *ale-python-flake8* + +g:ale_python_flake8_executable *g:ale_python_flake8_executable* + *b:ale_python_flake8_executable* + Type: |String| + Default: `'flake8'` + + This variable can be changed to modify the executable used for flake8. + + +g:ale_python_flake8_options *g:ale_python_flake8_options* + *b:ale_python_flake8_options* + Type: |String| + Default: `''` + + This variable can be changed to add command-line arguments to the flake8 + invocation. + + For example, to dynamically switch between programs targeting Python 2 and + Python 3, you may want to set > + + let g:ale_python_flake8_executable = 'python3' " or 'python' for Python 2 + let g:ale_python_flake8_options = '-m flake8' +< + after making sure it's installed for the appropriate Python versions (e.g. + `python3 -m pip install --user flake8`). + + +g:ale_python_flake8_use_global *g:ale_python_flake8_use_global* + *b:ale_python_flake8_use_global* + Type: |Number| + Default: `0` + + This variable controls whether or not ALE will search for flake8 in a + virtualenv directory first. If this variable is set to `1`, then ALE will + always use |g:ale_python_flake8_executable| for the executable path. + + Both variables can be set with `b:` buffer variables instead. + + +=============================================================================== +isort *ale-python-isort* + +g:ale_python_isort_executable *g:ale_python_isort_executable* + *b:ale_python_isort_executable* + Type: |String| + Default: `'isort'` + + See |ale-integrations-local-executables| + + +g:ale_python_isort_use_global *g:ale_python_isort_use_global* + *b:ale_python_isort_use_global* + Type: |Number| + Default: `0` + + See |ale-integrations-local-executables| + + +=============================================================================== +mypy *ale-python-mypy* + +The minimum supported version of mypy that ALE supports is v0.4.4. This is +the first version containing the `--shadow-file` option ALE needs to be able +to check for errors while you type. + + +g:ale_python_mypy_executable *g:ale_python_mypy_executable* + *b:ale_python_mypy_executable* + Type: |String| + Default: `'mypy'` + + See |ale-integrations-local-executables| + +g:ale_python_mypy_ignore_invalid_syntax + *g:ale_python_mypy_ignore_invalid_syntax* + *b:ale_python_mypy_ignore_invalid_syntax* + Type: |Number| + Default: `0` + + When set to `1`, syntax error messages for mypy will be ignored. This option + can be used when running other Python linters which check for syntax errors, + as mypy can take a while to finish executing. + + +g:ale_python_mypy_options *g:ale_python_mypy_options* + *b:ale_python_mypy_options* + Type: |String| + Default: `''` + + This variable can be changed to add command-line arguments to the mypy + invocation. + + +g:ale_python_mypy_use_global *g:ale_python_mypy_use_global* + *b:ale_python_mypy_use_global* + Type: |Number| + Default: `0` + + See |ale-integrations-local-executables| + + +=============================================================================== +prospector *ale-python-prospector* + +g:ale_python_prospector_executable *g:ale_python_prospector_executable* + *b:ale_python_prospector_executable* + Type: |String| + Default: `'prospector'` + + See |ale-integrations-local-executables| + + +g:ale_python_prospector_options *g:ale_python_prospector_options* + *b:ale_python_prospector_options* + Type: |String| + Default: `''` + + This variable can be changed to add command-line arguments to the prospector + invocation. + + For example, to dynamically switch between programs targeting Python 2 and + Python 3, you may want to set > + + let g:ale_python_prospector_executable = 'python3' + " or 'python' for Python 2 + let g:ale_python_prospector_options = '--rcfile /path/to/.prospector.yaml' + " The virtualenv detection needs to be disabled. + let g:ale_python_prospector_use_global = 0 + + after making sure it's installed for the appropriate Python versions (e.g. + `python3 -m pip install --user prospector`). + + +g:ale_python_prospector_use_global *g:ale_python_prospector_use_global* + *b:ale_python_prospector_use_global* + Type: |Number| + Default: `0` + + See |ale-integrations-local-executables| + + +=============================================================================== +pycodestyle *ale-python-pycodestyle* + + +g:ale_python_pycodestyle_executable *g:ale_python_pycodestyle_executable* + *b:ale_python_pycodestyle_executable* + Type: |String| + Default: `'pycodestyle'` + + See |ale-integrations-local-executables| + + +g:ale_python_pycodestyle_options *g:ale_python_pycodestyle_options* + *b:ale_python_pycodestyle_options* + Type: |String| + Default: `''` + + This variable can be changed to add command-line arguments to the + pycodestyle invocation. + + +g:ale_python_pycodestyle_use_global *g:ale_python_pycodestyle_use_global* + *b:ale_python_pycodestyle_use_global* + Type: |Number| + Default: `0` + + See |ale-integrations-local-executables| + + +=============================================================================== +pylint *ale-python-pylint* + +g:ale_python_pylint_executable *g:ale_python_pylint_executable* + *b:ale_python_pylint_executable* + Type: |String| + Default: `'pylint'` + + See |ale-integrations-local-executables| + + +g:ale_python_pylint_options *g:ale_python_pylint_options* + *b:ale_python_pylint_options* + Type: |String| + Default: `''` + + This variable can be changed to add command-line arguments to the pylint + invocation. + + For example, to dynamically switch between programs targeting Python 2 and + Python 3, you may want to set > + + let g:ale_python_pylint_executable = 'python3' " or 'python' for Python 2 + let g:ale_python_pylint_options = '--rcfile /path/to/pylint.rc' + " The virtualenv detection needs to be disabled. + let g:ale_python_pylint_use_global = 0 + + after making sure it's installed for the appropriate Python versions (e.g. + `python3 -m pip install --user pylint`). + + +g:ale_python_pylint_use_global *g:ale_python_pylint_use_global* + *b:ale_python_pylint_use_global* + Type: |Number| + Default: `0` + + See |ale-integrations-local-executables| + + +=============================================================================== +pyls *ale-python-pyls* + +g:ale_python_pyls_executable *g:ale_python_pyls_executable* + *b:ale_python_pyls_executable* + Type: |String| + Default: `'pyls'` + + See |ale-integrations-local-executables| + + +g:ale_python_pyls_use_global *g:ale_python_pyls_use_global* + *b:ale_python_pyls_use_global* + Type: |Number| + Default: `0` + + See |ale-integrations-local-executables| + + +=============================================================================== +yapf *ale-python-yapf* + +g:ale_python_yapf_executable *g:ale_python_yapf_executable* + *b:ale_python_yapf_executable* + Type: |String| + Default: `'yapf'` + + See |ale-integrations-local-executables| + + +g:ale_python_yapf_use_global *g:ale_python_yapf_use_global* + *b:ale_python_yapf_use_global* + Type: |Number| + Default: `0` + + See |ale-integrations-local-executables| + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-r.txt b/sources_non_forked/ale/doc/ale-r.txt new file mode 100644 index 00000000..f85f48fd --- /dev/null +++ b/sources_non_forked/ale/doc/ale-r.txt @@ -0,0 +1,29 @@ +=============================================================================== +ALE R Integration *ale-r-options* + + +=============================================================================== +lintr *ale-r-lintr* + +g:ale_r_lintr_options *g:ale_r_lintr_options* + *b:ale_r_lintr_options* + Type: |String| + Default: `'lintr::with_defaults()'` + + This option can be configured to change the options for lintr. + + The value of this option will be run with `eval` for the `lintr::lint` + options. Consult the lintr documentation for more information. + + +g:ale_r_lintr_lint_package *g:ale_r_lintr_lint_package* + *b:ale_r_lintr_lint_package* + Type: |Number| + Default: `0` + + When set to `1`, the file will be checked with `lintr::lint_package` instead + of `lintr::lint`. This prevents erroneous namespace warnings when linting + package files. + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-reasonml.txt b/sources_non_forked/ale/doc/ale-reasonml.txt new file mode 100644 index 00000000..36ddd75d --- /dev/null +++ b/sources_non_forked/ale/doc/ale-reasonml.txt @@ -0,0 +1,54 @@ +=============================================================================== +ALE ReasonML Integration *ale-reasonml-options* + + +=============================================================================== +merlin *ale-reasonml-merlin* + + To use merlin linter for ReasonML source code you need to make sure Merlin + for Vim is correctly configured. See the corresponding Merlin wiki page for + detailed instructions + (https://github.com/the-lambda-church/merlin/wiki/vim-from-scratch). + +=============================================================================== +ols *ale-reasonml-ols* + + The `ocaml-language-server` is the engine that powers OCaml and ReasonML + editor support using the Language Server Protocol. See the installation + instructions: + https://github.com/freebroccolo/ocaml-language-server#installation + +g:ale_reason_ols_executable *g:ale_reason_ols_executable* + *b:ale_reason_ols_executable* + Type: |String| + Default: `'ocaml-language-server'` + + This variable can be set to change the executable path for `ols`. + +g:ale_reason_ols_use_global *g:ale_reason_ols_use_global* + *b:ale_reason_ols_use_global* + Type: |String| + Default: `0` + + This variable can be set to `1` to always use the globally installed + executable. See also |ale-integrations-local-executables|. + +=============================================================================== +refmt *ale-reasonml-refmt* + +g:ale_reasonml_refmt_executable *g:ale_reasonml_refmt_executable* + *b:ale_reasonml_refmt_executable* + Type: |String| + Default: `'refmt'` + + This variable can be set to pass the path of the refmt fixer. + +g:ale_reasonml_refmt_options *g:ale_reasonml_refmt_options* + *b:ale_reasonml_refmt_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to the refmt fixer. + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-restructuredtext.txt b/sources_non_forked/ale/doc/ale-restructuredtext.txt new file mode 100644 index 00000000..02fbc4ad --- /dev/null +++ b/sources_non_forked/ale/doc/ale-restructuredtext.txt @@ -0,0 +1,12 @@ +=============================================================================== +ALE reStructuredText Integration *ale-restructuredtext-options* + + +=============================================================================== +write-good *ale-restructuredtext-write-good* + +See |ale-write-good-options| + + +=============================================================================== +vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-ruby.txt b/sources_non_forked/ale/doc/ale-ruby.txt new file mode 100644 index 00000000..85a3e137 --- /dev/null +++ b/sources_non_forked/ale/doc/ale-ruby.txt @@ -0,0 +1,102 @@ +=============================================================================== +ALE Ruby Integration *ale-ruby-options* + + +=============================================================================== +brakeman *ale-ruby-brakeman* + +g:ale_ruby_brakeman_options *g:ale_ruby_brakeman_options* + *b:ale_ruby_brakeman_options* + Type: |String| + Default: `''` + + The contents of this variable will be passed through to brakeman. + + +=============================================================================== +rails_best_practices *ale-ruby-rails_best_practices* + +g:ale_ruby_rails_best_practices_executable + *g:ale_ruby_rails_best_practices_executable* + *b:ale_ruby_rails_best_practices_executable* + Type: String + Default: 'rails_best_practices' + + Override the invoked rails_best_practices binary. Set this to `'bundle'` to + invoke `'bundle` `exec` `rails_best_practices'`. + +g:ale_ruby_rails_best_practices_options + *g:ale_ruby_rails_best_practices_options* + *b:ale_ruby_rails_best_practices_options* + Type: |String| + Default: `''` + + The contents of this variable will be passed through to rails_best_practices. + + +=============================================================================== +reek *ale-ruby-reek* + +g:ale_ruby_reek_show_context *g:ale_ruby_reek_show_context* + *b:ale_ruby_reek_show_context* + Type: |Number| + Default: 0 + + Controls whether context is included in the linter message. Defaults to off + because context is usually obvious while viewing a file. + + +g:ale_ruby_reek_show_wiki_link *g:ale_ruby_reek_show_wiki_link* + *b:ale_ruby_reek_show_wiki_link* + Type: |Number| + Default: 0 + + Controls whether linter messages contain a link to an explanatory wiki page + for the type of code smell. Defaults to off to improve readability. + + +=============================================================================== +rubocop *ale-ruby-rubocop* + +g:ale_ruby_rubocop_executable *g:ale_ruby_rubocop_executable* + *b:ale_ruby_rubocop_executable* + Type: String + Default: `'rubocop'` + + Override the invoked rubocop binary. This is useful for running rubocop + from binstubs or a bundle. + + +g:ale_ruby_rubocop_options *g:ale_ruby_rubocop_options* + *b:ale_ruby_rubocop_options* + Type: |String| + Default: `''` + + This variable can be change to modify flags given to rubocop. + + +=============================================================================== +ruby *ale-ruby-ruby* + +g:ale_ruby_ruby_executable *g:ale_ruby_ruby_executable* + *b:ale_ruby_ruby_executable* + Type: String + Default: `'ruby'` + + This variable can be changed to use a different executable for ruby. + + +=============================================================================== +rufo *ale-ruby-rufo* + +g:ale_ruby_rufo_executable *g:ale_ruby_rufo_executable* + *b:ale_ruby_rufo_executable* + Type: String + Default: `'rufo'` + + Override the invoked rufo binary. This is useful for running rufo from + binstubs or a bundle. + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-rust.txt b/sources_non_forked/ale/doc/ale-rust.txt new file mode 100644 index 00000000..dad9ae66 --- /dev/null +++ b/sources_non_forked/ale/doc/ale-rust.txt @@ -0,0 +1,153 @@ +=============================================================================== +ALE Rust Integration *ale-rust-options* + *ale-integration-rust* + +=============================================================================== +Integration Information + + Since Vim does not detect the rust file type out-of-the-box, you need the + runtime files for rust from here: https://github.com/rust-lang/rust.vim + + Note that there are three possible linters for Rust files: + + 1. rustc -- The Rust compiler is used to check the currently edited file. + So, if your project consists of multiple files, you will get some errors + when you use e.g. a struct which is defined in another file. You can use + |g:ale_rust_ignore_error_codes| to ignore some of these errors. + 2. cargo -- If your project is managed by Cargo, the whole project is + checked. That means that all errors are properly shown, but cargo can + only operate on the files written on disk, so errors will not be reported + while you type. + 3. rls -- If you have `rls` installed, you might prefer using this linter + over cargo. rls implements the Language Server Protocol for incremental + compilation of Rust code, and can check Rust files while you type. `rls` + requires Rust files to contained in Cargo projects. + 4. rustfmt -- If you have `rustfmt` installed, you can use it as a fixer to + consistently reformat your Rust code. + + Only cargo is enabled by default. To switch to using rustc instead of cargo, + configure |g:ale_linters| appropriately: > + + " See the help text for the option for more information. + let g:ale_linters = {'rust': ['rustc']} +< + + Also note that rustc 1.12. or later is needed. + + +=============================================================================== +cargo *ale-rust-cargo* + +g:ale_rust_cargo_use_check *g:ale_rust_cargo_use_check* + *b:ale_rust_cargo_use_check* + Type: |Number| + Default: `1` + + When set to `1`, this option will cause ALE to use `cargo check` instead of + `cargo build` . `cargo check` is supported since version 1.16.0 of Rust. + + ALE will never use `cargo check` when the version of `cargo` is less than + 0.17.0. + + +g:ale_rust_cargo_check_all_targets *g:ale_rust_cargo_check_all_targets* + *b:ale_rust_cargo_check_all_targets* + Type: |Number| + Default: `0` + + When set to `1`, ALE will set the `--all-targets` option when `cargo check` + is used. See |g:ale_rust_cargo_use_check|, + + +g:ale_rust_cargo_default_feature_behavior + *g:ale_rust_cargo_default_feature_behavior* + *b:ale_rust_cargo_default_feature_behavior* + Type: |String| + Default: `default` + + When set to `none`, ALE will set the `--no-default-features` option when + invoking `cargo`. Only the features specified in + |g:ale_rust_cargo_include_features| will be included when performing the + lint check. + + When set to `default`, ALE will instruct `cargo` to build all default + features specified in the project's `Cargo.toml` file, in addition to + including any additional features defined in + |g:ale_rust_cargo_include_features|. + + When set to `all`, ALE will set the `--all-features` option when + invoking `cargo`, which will include all features defined in the project's + `Cargo.toml` file when performing the lint check. + + +g:ale_rust_cargo_include_features *g:ale_rust_cargo_include_features* + *b:ale_rust_cargo_include_features* + Type: |String| + Default: `''` + + When defined, ALE will set the `--features` option when invoking `cargo` to + perform the lint check. See |g:ale_rust_cargo_default_feature_behavior|. + + +=============================================================================== +rls *ale-rust-rls* + +g:ale_rust_rls_executable *g:ale_rust_rls_executable* + *b:ale_rust_rls_executable* + Type: |String| + Default: `'rls'` + + This variable can be modified to change the executable path for `rls`. + + +g:ale_rust_rls_toolchain *g:ale_rust_rls_toolchain* + *b:ale_rust_rls_toolchain* + Type: |String| + Default: `'nightly'` + + This option can be set to change the toolchain used for `rls`. Possible + values include `'nightly'`, `'beta'`, and `'stable'`. + + The `rls` server will only be started once per executable. + + +=============================================================================== +rustc *ale-rust-rustc* + + +g:ale_rust_rustc_options *g:ale_rust_rustc_options* + *b:ale_rust_rustc_options* + Type: |String| + Default: `'-Z no-trans'` + + The variable can be used to change the options passed to `rustc`. + + `-Z no-trans` should only work with nightly builds of Rust. Be careful when + setting the options, as running `rustc` could execute code or generate + binary files. + + +g:ale_rust_ignore_error_codes *g:ale_rust_ignore_error_codes* + *b:ale_rust_ignore_error_codes* + Type: |List| of |String|s + Default: `[]` + + This variable can contain error codes which will be ignored. For example, to + ignore most errors regarding failed imports, put this in your .vimrc + > + let g:ale_rust_ignore_error_codes = ['E0432', 'E0433'] + + +=============================================================================== +rustfmt *ale-rust-rustfmt* + +g:ale_rust_rustfmt_options *g:ale_rust_rustfmt_options* + *b:ale_rust_rustfmt_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to the rustfmt fixer. + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-sass.txt b/sources_non_forked/ale/doc/ale-sass.txt new file mode 100644 index 00000000..5465957a --- /dev/null +++ b/sources_non_forked/ale/doc/ale-sass.txt @@ -0,0 +1,25 @@ +=============================================================================== +ALE SASS Integration *ale-sass-options* + + +=============================================================================== +stylelint *ale-sass-stylelint* + +g:ale_sass_stylelint_executable *g:ale_sass_stylelint_executable* + *b:ale_sass_stylelint_executable* + Type: |String| + Default: `'stylelint'` + + See |ale-integrations-local-executables| + + +g:ale_sass_stylelint_use_global *g:ale_sass_stylelint_use_global* + *b:ale_sass_stylelint_use_global* + Type: |String| + Default: `0` + + See |ale-integrations-local-executables| + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-scala.txt b/sources_non_forked/ale/doc/ale-scala.txt new file mode 100644 index 00000000..9c9472f6 --- /dev/null +++ b/sources_non_forked/ale/doc/ale-scala.txt @@ -0,0 +1,40 @@ +=============================================================================== +ALE Scala Integration *ale-scala-options* + + +=============================================================================== +scalastyle *ale-scala-scalastyle* + +`scalastyle` requires a configuration file for a project to run. When no +configuration file can be found, ALE will report a problem saying that a +configuration file is required at line 1. + +To disable `scalastyle` globally, use |g:ale_linters| like so: > + let g:ale_linters = {'scala': ['scalac']} " Enable only scalac instead +< + +See |g:ale_linters| for more information on disabling linters. + + +g:ale_scalastyle_config_loc *g:ale_scalastyle_config_loc* + + Type: |String| + Default: `''` + + A string containing the location of a global fallback configuration file. + + By default, ALE will look for a configuration file named + `scalastyle_config.xml` or `scalastyle-config.xml` in the current file's + directory or parent directories. + + +g:ale_scala_scalastyle_options *g:ale_scala_scalastyle_options* + + Type: |String| + Default: `''` + + A string containing additional options to pass to scalastyle. + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-scss.txt b/sources_non_forked/ale/doc/ale-scss.txt new file mode 100644 index 00000000..19695a76 --- /dev/null +++ b/sources_non_forked/ale/doc/ale-scss.txt @@ -0,0 +1,31 @@ +=============================================================================== +ALE SCSS Integration *ale-scss-options* + + +=============================================================================== +prettier *ale-scss-prettier* + +See |ale-javascript-prettier| for information about the available options. + + +=============================================================================== +stylelint *ale-scss-stylelint* + +g:ale_scss_stylelint_executable *g:ale_scss_stylelint_executable* + *b:ale_scss_stylelint_executable* + Type: |String| + Default: `'stylelint'` + + See |ale-integrations-local-executables| + + +g:ale_scss_stylelint_use_global *g:ale_scss_stylelint_use_global* + *b:ale_scss_stylelint_use_global* + Type: |String| + Default: `0` + + See |ale-integrations-local-executables| + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-sh.txt b/sources_non_forked/ale/doc/ale-sh.txt new file mode 100644 index 00000000..941dc59b --- /dev/null +++ b/sources_non_forked/ale/doc/ale-sh.txt @@ -0,0 +1,72 @@ +=============================================================================== +ALE Shell Integration *ale-sh-options* + + +=============================================================================== +shell *ale-sh-shell* + +g:ale_sh_shell_default_shell *g:ale_sh_shell_default_shell* + *b:ale_sh_shell_default_shell* + Type: |String| + Default: The current shell (`$SHELL`). Falls back to `'bash'` if that cannot be + read or if the current shell is `'fish'`. + + When ALE runs the linter for shells with the `-n` flag, it will attempt to + read the shell from the shebang (`#!`) line from the shell script to + determine the shell program to run. When this detection fails, this variable + will be used instead. + + +=============================================================================== +shellcheck *ale-sh-shellcheck* + +g:ale_sh_shellcheck_executable *g:ale_sh_shellcheck_executable* + *b:ale_sh_shellcheck_executable* + Type: |String| + Default: `'shellcheck'` + + This variable sets executable used for shellcheck. + + +g:ale_sh_shellcheck_options *g:ale_sh_shellcheck_options* + *b:ale_sh_shellcheck_options* + Type: |String| + Default: `''` + + With this variable we are able to pass extra arguments for shellcheck + for shellcheck invocation. + + For example, if we want shellcheck to follow external sources (`see SC1091`) + we can set the variable as such: +> + let g:ale_sh_shellcheck_options = '-x' +< + +g:ale_sh_shellcheck_exclusions *g:ale_sh_shellcheck_exclusions* + *b:ale_sh_shellcheck_exclusions* + Type: |String| + Default: `''` + + Set this variable to exclude test(s) for shellcheck (-e/--exclude option). + To exclude more than one option, separate them with commas. + + For example, to ignore some warnings that aren't applicable to files that + will be sourced by other scripts, use the buffer-local variant: +> + autocmd BufEnter PKGBUILD,.env + \ let b:ale_sh_shellcheck_exclusions = 'SC2034,SC2154,SC2164' +< + +=============================================================================== +shfmt *ale-sh-shfmt* + +g:ale_sh_shfmt_options *g:ale_sh_shfmt_options* + *b:ale_sh_shfmt_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to the shfmt fixer. + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-sml.txt b/sources_non_forked/ale/doc/ale-sml.txt new file mode 100644 index 00000000..cc8d6794 --- /dev/null +++ b/sources_non_forked/ale/doc/ale-sml.txt @@ -0,0 +1,36 @@ +=============================================================================== +ALE SML Integration *ale-sml-options* + +=============================================================================== +smlnj *ale-sml-smlnj* + *ale-sml-smlnj-cm* + +There are two SML/NJ powered checkers: + +- one using Compilation Manager that works on whole projects, but requires you + to save before errors show up +- one using the SML/NJ REPL that works as you change the text, but might fail + if your project can only be built with CM. + +We dynamically select which one to use based whether we find a `*.cm` file at +or above the directory of the file being checked. Only one checker (`smlnj`, +`smlnj-cm`) will be enabled at a time. + +------------------------------------------------------------------------------- + +g:ale_sml_smlnj_cm_file *g:ale_sml_smlnj_cm_file* + *b:ale_sml_smlnj_cm_file* + Type: |String| + Default: `'*.cm'` + + By default, ALE will look for a `*.cm` file in your current directory, + searching upwards. It stops when it finds at least one `*.cm` file (taking + the first file if there are more than one). + + Change this option (in the buffer or global scope) to control how ALE finds + CM files. For example, to always search for a CM file named `sandbox.cm`: +> + let g:ale_sml_smlnj_cm_file = 'sandbox.cm' + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-solidity.txt b/sources_non_forked/ale/doc/ale-solidity.txt new file mode 100644 index 00000000..4b74a27a --- /dev/null +++ b/sources_non_forked/ale/doc/ale-solidity.txt @@ -0,0 +1,24 @@ +=============================================================================== +ALE Solidity Integration *ale-solidity-options* + + +=============================================================================== +solhint *ale-solidity-solhint* + + Solhint should work out-of-the-box. You can further configure it using a + `.solihint.json` file. See https://github.com/protofire/solhint for more + information. + + +=============================================================================== +solium *ale-solidity-solium* + + Use of Solium linter for Solidity source code requires a .soliumrc.json + file in project root. This file can be generated by running `solium --init`. + See the corresponding solium usage for detailed instructions + (https://github.com/duaraghav8/Solium#usage). + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: + diff --git a/sources_non_forked/ale/doc/ale-spec.txt b/sources_non_forked/ale/doc/ale-spec.txt new file mode 100644 index 00000000..3da950c8 --- /dev/null +++ b/sources_non_forked/ale/doc/ale-spec.txt @@ -0,0 +1,43 @@ +=============================================================================== +ALE Spec Integration *ale-spec-options* + *ale-integration-spec* + +=============================================================================== +Integration Information + + The rpmlint linter is disabled by default, because running rpmlint can + result in the execution of code embedded in the spec file and rpmlint makes + no distinction between checks which are safe to run on untrusted files and + those which are not. + + Currently linters must be enabled globally. The rpmlint linter can be + enabled with: +> + let g:ale_linters = {'spec': ['rpmlint']} +< + +=============================================================================== +rpmlint *ale-spec-rpmlint* + +g:ale_spec_rpmlint_executable *g:ale_spec_rpmlint_executable* + *b:ale_spec_rpmlint_executable* + Type: |String| + Default: `'rpmlint'` + + This variable sets executable used for rpmlint. + + +g:ale_spec_rpmlint_options *g:ale_spec_rpmlint_options* + *b:ale_spec_rpmlint_options* + Type: |String| + Default: `''` + + Set this to pass extra arguments to rpmlint. + + For example, to instruct rpmlint to use a specific configuration file: +> + let g:ale_spec_rpmlint_options = '-f custom.cf' +< + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-stylus.txt b/sources_non_forked/ale/doc/ale-stylus.txt new file mode 100644 index 00000000..59d90551 --- /dev/null +++ b/sources_non_forked/ale/doc/ale-stylus.txt @@ -0,0 +1,33 @@ +=============================================================================== +ALE Stylus Integration *ale-stylus-options* + + +=============================================================================== +stylelint *ale-stylus-stylelint* + +g:ale_stylus_stylelint_executable *g:ale_stylus_stylelint_executable* + *b:ale_stylus_stylelint_executable* + Type: |String| + Default: `'stylelint'` + + See |ale-integrations-local-executables| + + +g:ale_stylus_stylelint_options *g:ale_stylus_stylelint_options* + *b:ale_stylus_stylelint_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to stylelint. + + +g:ale_stylus_stylelint_use_global *g:ale_stylus_stylelint_use_global* + *b:ale_stylus_stylelint_use_global* + Type: |String| + Default: `0` + + See |ale-integrations-local-executables| + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-tcl.txt b/sources_non_forked/ale/doc/ale-tcl.txt new file mode 100644 index 00000000..497c9fd4 --- /dev/null +++ b/sources_non_forked/ale/doc/ale-tcl.txt @@ -0,0 +1,25 @@ +=============================================================================== +ALE Tcl Integration *ale-tcl-options* + + +=============================================================================== +nagelfar *ale-tcl-nagelfar* + +g:ale_tcl_nagelfar_executable *g:ale_tcl_nagelfar_executable* + *b:ale_tcl_nagelfar_executable* + Type: |String| + Default: `'nagelfar.tcl'` + + This variable can be changed to change the path to nagelfar. + + +g:ale_tcl_nagelfar_options *g:ale_tcl_nagelfar_options* + *b:ale_tcl_nagelfar_options* + Type: |String| + Default: `''` + + This variable can be changed to modify flags given to nagelfar. + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-terraform.txt b/sources_non_forked/ale/doc/ale-terraform.txt new file mode 100644 index 00000000..ec86e9a0 --- /dev/null +++ b/sources_non_forked/ale/doc/ale-terraform.txt @@ -0,0 +1,29 @@ +=============================================================================== +ALE Terraform Integration *ale-terraform-options* + + +=============================================================================== +tflint *ale-terraform-tflint* + +g:ale_terraform_tflint_executable *g:ale_terraform_tflint_executable* + *b:ale_terraform_tflint_executable* + + Type: |String| + Default: `'tflint'` + + This variable can be changed to use a different executable for tflint. + + +g:ale_terraform_tflint_options *g:ale_terraform_tflint_options* + *b:ale_terraform_tflint_options* + Type: |String| + Default: `'-f json'` + + This variable can be changed to pass different options to tflint. Ale does + expect json output from tflint, so if you change this, you'll probably want + to include '-f json' in your new value. + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: + diff --git a/sources_non_forked/ale/doc/ale-tex.txt b/sources_non_forked/ale/doc/ale-tex.txt new file mode 100644 index 00000000..24aa3112 --- /dev/null +++ b/sources_non_forked/ale/doc/ale-tex.txt @@ -0,0 +1,36 @@ +=============================================================================== +ALE TeX Integration *ale-tex-options* + + +=============================================================================== +chktex *ale-tex-chktex* + +g:ale_tex_chktex_executable *g:ale_tex_chktex_executable* + *b:ale_tex_chktex_executable* + Type: |String| + Default: `'chktex'` + + This variable can be changed to change the path to chktex. + + +g:ale_tex_chktex_options *g:ale_tex_chktex_options* + *b:ale_tex_chktex_options* + Type: |String| + Default: `'-I'` + + This variable can be changed to modify flags given to chktex. + + +------------------------------------------------------------------------------ +lacheck *ale-tex-lacheck* + +g:ale_lacheck_executable *g:ale_lacheck_executable* + *b:ale_lacheck_executable* + Type: |String| + Default: '`lacheck`' + + This variable can be changed to change the path to lacheck. + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-texinfo.txt b/sources_non_forked/ale/doc/ale-texinfo.txt new file mode 100644 index 00000000..f8ed342d --- /dev/null +++ b/sources_non_forked/ale/doc/ale-texinfo.txt @@ -0,0 +1,12 @@ +=============================================================================== +ALE Texinfo Integration *ale-texinfo-options* + + +=============================================================================== +write-good *ale-texinfo-write-good* + +See |ale-write-good-options| + + +=============================================================================== +vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-text.txt b/sources_non_forked/ale/doc/ale-text.txt new file mode 100644 index 00000000..844f2ff4 --- /dev/null +++ b/sources_non_forked/ale/doc/ale-text.txt @@ -0,0 +1,42 @@ +=============================================================================== +ALE Text Integration *ale-text-options* + + +=============================================================================== +textlint *ale-text-textlint* + +The options for the textlint linter are global because it does not make +sense to have them specified on a per-language basis. + +g:ale_textlint_executable *g:ale_textlint_executable* + *b:ale_textlint_executable* + Type: |String| + Default: `'textlint'` + + See |ale-integrations-local-executables| + + +g:ale_textlint_options *g:ale_textlint_options* + *b:ale_textlint_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to textlint. + + +g:ale_textlint_use_global *g:ale_textlint_use_global* + *b:ale_textlint_use_global* + Type: |Number| + Default: `0` + + See |ale-integrations-local-executables| + + +=============================================================================== +write-good *ale-text-write-good* + +See |ale-write-good-options| + + +=============================================================================== +vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-thrift.txt b/sources_non_forked/ale/doc/ale-thrift.txt new file mode 100644 index 00000000..ed858db8 --- /dev/null +++ b/sources_non_forked/ale/doc/ale-thrift.txt @@ -0,0 +1,46 @@ +=============================================================================== +ALE Thrift Integration *ale-thrift-options* + + +=============================================================================== +thrift *ale-thrift-thrift* + +The `thrift` linter works by compiling the buffer's contents and reporting any +errors reported by the parser and the configured code generator(s). + +g:ale_thrift_thrift_executable *g:ale_thrift_thrift_executable* + *b:ale_thrift_thrift_executable* + Type: |String| + Default: `'thrift'` + + See |ale-integrations-local-executables| + + +g:ale_thrift_thrift_generators *g:ale_thrift_thrift_generators* + *b:ale_thrift_thrift_generators* + Type: |List| of |String|s + Default: `['cpp']` + + This list must contain one or more named code generators. Generator options + can be included as part of each string, e.g. `['py:dynamic']`. + + +g:ale_thrift_thrift_includes *g:ale_thrift_thrift_includes* + *b:ale_thrift_thrift_includes* + Type: |List| of |String|s + Default: `[]` + + This list contains paths that will be searched for thrift `include` + directives. + + +g:ale_thrift_thrift_options *g:ale_thrift_thrift_options* + *b:ale_thrift_thrift_options* + Type: |String| + Default: `'-strict'` + + This variable can be changed to customize the additional command-line + arguments that are passed to the thrift compiler. + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-typescript.txt b/sources_non_forked/ale/doc/ale-typescript.txt new file mode 100644 index 00000000..d83a2dfe --- /dev/null +++ b/sources_non_forked/ale/doc/ale-typescript.txt @@ -0,0 +1,103 @@ +=============================================================================== +ALE TypeScript Integration *ale-typescript-options* + + +=============================================================================== +eslint *ale-typescript-eslint* + +Because of how TypeScript compiles code to JavaScript and how interrelated +the two languages are, the `eslint` linter for TypeScript uses the JavaScript +options for `eslint` too. See: |ale-javascript-eslint|. + + +=============================================================================== +prettier *ale-typescript-prettier* + +See |ale-javascript-prettier| for information about the available options. + + +=============================================================================== +tslint *ale-typescript-tslint* + +g:ale_typescript_tslint_executable *g:ale_typescript_tslint_executable* + *b:ale_typescript_tslint_executable* + Type: |String| + Default: `'tslint'` + + See |ale-integrations-local-executables| + + +g:ale_typescript_tslint_config_path *g:ale_typescript_tslint_config_path* + *b:ale_typescript_tslint_config_path* + Type: |String| + Default: `''` + + ALE will first discover the tslint.json path in an ancestor directory. If no + such path exists, this variable will be used instead. + + +g:ale_typescript_tslint_ignore_empty_files + *g:ale_typescript_tslint_ignore_empty_files* + *b:ale_typescript_tslint_ignore_empty_files* + Type: |Number| + Default: `0` + + When set to `1`, ALE will not report any problems for empty files with + TSLint. ALE will still execute TSLint for the files, but ignore any problems + reported. This stops ALE from complaining about newly created files, + and files where lines have been added and then removed. + + +g:ale_typescript_tslint_rules_dir *g:ale_typescript_tslint_rules_dir* + *b:ale_typescript_tslint_rules_dir* + Type: |String| + Default: `''` + + If this variable is set, ALE will use it as the rules directory for tslint. + + +g:ale_typescript_tslint_use_global *g:ale_typescript_tslint_use_global* + *b:ale_typescript_tslint_use_global* + Type: |Number| + Default: `0` + + See |ale-integrations-local-executables| + + +=============================================================================== +tsserver *ale-typescript-tsserver* + +g:ale_typescript_tsserver_executable *g:ale_typescript_tsserver_executable* + *b:ale_typescript_tsserver_executable* + Type: |String| + Default: `'tsserver'` + + ALE will first discover the tsserver path in an ancestor node_modules + directory. If no such path exists, this variable will be used instead. + + If you wish to use only a globally installed version of tsserver, set + |g:ale_typescript_tsserver_use_global| to `1`. + + +g:ale_typescript_tsserver_config_path *g:ale_typescript_tsserver_config_path* + *b:ale_typescript_tsserver_config_path* + Type: |String| + Default: `''` + + ALE will first discover the tsserver.json path in an ancestor directory. If + no such path exists, this variable will be used instead. + + +g:ale_typescript_tsserver_use_global *g:ale_typescript_tsserver_use_global* + *b:ale_typescript_tsserver_use_global* + Type: |Number| + Default: `0` + + This variable controls whether or not ALE will search for a local path for + tsserver first. If this variable is set to `1`, then ALE will always use the + global version of tsserver, in preference to locally installed versions of + tsserver in node_modules. + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-verilog.txt b/sources_non_forked/ale/doc/ale-verilog.txt new file mode 100644 index 00000000..2b8ce5e2 --- /dev/null +++ b/sources_non_forked/ale/doc/ale-verilog.txt @@ -0,0 +1,43 @@ +=============================================================================== +ALE Verilog/SystemVerilog Integration *ale-verilog-options* + + +=============================================================================== +ALE can use two different linters for Verilog HDL: + + iverilog: + Using `iverilog -t null -Wall` + + verilator + Using `verilator --lint-only -Wall` + +By default, both 'verilog' and 'systemverilog' filetypes are checked. + +You can limit 'systemverilog' files to be checked using only 'verilator' by +defining 'g:ale_linters' variable: +> + au FileType systemverilog + \ let g:ale_linters = {'systemverilog' : ['verilator'],} +< + +=============================================================================== +iverilog *ale-verilog-iverilog* + + No additional options + + +=============================================================================== +verilator *ale-verilog-verilator* + +g:ale_verilog_verilator_options *g:ale_verilog_verilator_options* + *b:ale_verilog_verilator_options* + Type: |String| + Default: `''` + + This variable can be changed to modify 'verilator' command arguments + + For example `'-sv --default-language "1800-2012"'` if you want to enable + SystemVerilog parsing and select the 2012 version of the language. + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-vim-help.txt b/sources_non_forked/ale/doc/ale-vim-help.txt new file mode 100644 index 00000000..3cbe20d5 --- /dev/null +++ b/sources_non_forked/ale/doc/ale-vim-help.txt @@ -0,0 +1,12 @@ +=============================================================================== +ALE Vim help Integration *ale-vim-help-options* + + +=============================================================================== +write-good *ale-vim-help-write-good* + +See |ale-write-good-options| + + +=============================================================================== +vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-vim.txt b/sources_non_forked/ale/doc/ale-vim.txt new file mode 100644 index 00000000..30ac3a16 --- /dev/null +++ b/sources_non_forked/ale/doc/ale-vim.txt @@ -0,0 +1,19 @@ +=============================================================================== +ALE Vim Integration *ale-vim-options* + + +=============================================================================== +vint *ale-vim-vint* + +g:ale_vim_vint_show_style_issues *g:ale_vim_vint_show_style_issues* + *b:ale_vim_vint_show_style_issues* + Type: |Number| + Default: `1` + + This variable will enable/disable style issues for Vint. When this option + is disabled, only warnings and errors which are not purely style issues + will be reported. + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-vue.txt b/sources_non_forked/ale/doc/ale-vue.txt new file mode 100644 index 00000000..937b603b --- /dev/null +++ b/sources_non_forked/ale/doc/ale-vue.txt @@ -0,0 +1,11 @@ +=============================================================================== +ALE Vue Integration *ale-vue-options* + + +=============================================================================== +prettier *ale-vue-prettier* + +See |ale-javascript-prettier| for information about the available options. + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-xhtml.txt b/sources_non_forked/ale/doc/ale-xhtml.txt new file mode 100644 index 00000000..3cc639ef --- /dev/null +++ b/sources_non_forked/ale/doc/ale-xhtml.txt @@ -0,0 +1,12 @@ +=============================================================================== +ALE XHTML Integration *ale-xhtml-options* + + +=============================================================================== +write-good *ale-xhtml-write-good* + +See |ale-write-good-options| + + +=============================================================================== +vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-xml.txt b/sources_non_forked/ale/doc/ale-xml.txt new file mode 100644 index 00000000..6c8af6c7 --- /dev/null +++ b/sources_non_forked/ale/doc/ale-xml.txt @@ -0,0 +1,26 @@ +=============================================================================== +ALE XML Integration *ale-xml-options* + + +=============================================================================== +xmllint *ale-xml-xmllint* + +g:ale_xml_xmllint_executable *g:ale_xml_xmllint_executable* + *b:ale_xml_xmllint_executable* + Type: |String| + Default: `'xmllint'` + + This variable can be set to change the path to xmllint. + + +g:ale_xml_xmllint_options *g:ale_xml_xmllint_options* + *b:ale_xml_xmllint_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to xmllint. + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: + diff --git a/sources_non_forked/ale/doc/ale-yaml.txt b/sources_non_forked/ale/doc/ale-yaml.txt new file mode 100644 index 00000000..a902f25d --- /dev/null +++ b/sources_non_forked/ale/doc/ale-yaml.txt @@ -0,0 +1,78 @@ +=============================================================================== +ALE YAML Integration *ale-yaml-options* + + +=============================================================================== +swaglint *ale-yaml-swaglint* + +Website: https://github.com/byCedric/swaglint + + +Installation +------------------------------------------------------------------------------- + +Install swaglint either globally or locally: > + + npm install swaglint -g # global + npm install swaglint # local +< + +Options +------------------------------------------------------------------------------- + +g:ale_yaml_swaglint_executable *g:ale_yaml_swaglint_executable* + *b:ale_yaml_swaglint_executable* + Type: |String| + Default: `'swaglint'` + + This variable can be set to change the path to swaglint. + + +g:ale_yaml_swaglint_use_global *g:ale_yaml_swaglint_use_global* + *b:ale_yaml_swaglint_use_global* + Type: |String| + Default: `0` + + See |ale-integrations-local-executables| + + +=============================================================================== +yamllint *ale-yaml-yamllint* + +Website: https://github.com/adrienverge/yamllint + + +Installation +------------------------------------------------------------------------------- + +Install yamllint in your a virtualenv directory, locally, or globally: > + + pip install yamllint # After activating virtualenv + pip install --user yamllint # Install to ~/.local/bin + sudo pip install yamllint # Install globally + +See |g:ale_virtualenv_dir_names| for configuring how ALE searches for +virtualenv directories. + + +Options +------------------------------------------------------------------------------- + +g:ale_yaml_yamllint_executable *g:ale_yaml_yamllint_executable* + *b:ale_yaml_yamllint_executable* + Type: |String| + Default: `'yamllint'` + + This variable can be set to change the path to yamllint. + + +g:ale_yaml_yamllint_options *g:ale_yaml_yamllint_options* + *b:ale_yaml_yamllint_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to yamllint. + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale.txt b/sources_non_forked/ale/doc/ale.txt new file mode 100644 index 00000000..1c8025a4 --- /dev/null +++ b/sources_non_forked/ale/doc/ale.txt @@ -0,0 +1,2365 @@ +*ale.txt* For Vim version 8.0. +*ale* + +ALE - Asynchronous Lint Engine + +=============================================================================== +CONTENTS *ale-contents* + + 1. Introduction.........................|ale-introduction| + 2. Supported Languages & Tools..........|ale-support| + 3. Linting..............................|ale-lint| + 4. Fixing Problems......................|ale-fix| + 5. Language Server Protocol Support.....|ale-lsp| + 5.1 Completion........................|ale-completion| + 5.2 Go To Definition..................|ale-go-to-definition| + 6. Global Options.......................|ale-options| + 6.1 Highlights........................|ale-highlights| + 6.2 Options for write-good Linter.....|ale-write-good-options| + 7. Integration Documentation............|ale-integrations| + asciidoc..............................|ale-asciidoc-options| + write-good..........................|ale-asciidoc-write-good| + asm...................................|ale-asm-options| + gcc.................................|ale-asm-gcc| + awk...................................|ale-awk-options| + gawk................................|ale-awk-gawk| + c.....................................|ale-c-options| + clang...............................|ale-c-clang| + clang-format........................|ale-c-clangformat| + clangtidy...........................|ale-c-clangtidy| + cppcheck............................|ale-c-cppcheck| + flawfinder..........................|ale-c-flawfinder| + gcc.................................|ale-c-gcc| + chef..................................|ale-chef-options| + foodcritic..........................|ale-chef-foodcritic| + clojure...............................|ale-clojure-options| + joker...............................|ale-clojure-joker| + cmake.................................|ale-cmake-options| + cmakelint...........................|ale-cmake-cmakelint| + cpp...................................|ale-cpp-options| + clang...............................|ale-cpp-clang| + clangcheck..........................|ale-cpp-clangcheck| + clang-format........................|ale-cpp-clangformat| + clangtidy...........................|ale-cpp-clangtidy| + cppcheck............................|ale-cpp-cppcheck| + cpplint.............................|ale-cpp-cpplint| + flawfinder..........................|ale-cpp-flawfinder| + gcc.................................|ale-cpp-gcc| + c#....................................|ale-cs-options| + mcs.................................|ale-cs-mcs| + mcsc................................|ale-cs-mcsc| + css...................................|ale-css-options| + prettier............................|ale-css-prettier| + stylelint...........................|ale-css-stylelint| + cuda..................................|ale-cuda-options| + nvcc................................|ale-cuda-nvcc| + dart..................................|ale-dart-options| + dartanalyzer........................|ale-dart-dartanalyzer| + dockerfile............................|ale-dockerfile-options| + hadolint............................|ale-dockerfile-hadolint| + elixir................................|ale-elixir-options| + mix.................................|ale-elixir-mix| + mix_format..........................|ale-elixir-mix-format| + dialyxir............................|ale-elixir-dialyxir| + elm...................................|ale-elm-options| + elm-format..........................|ale-elm-elm-format| + elm-make............................|ale-elm-elm-make| + erlang................................|ale-erlang-options| + erlc................................|ale-erlang-erlc| + syntaxerl...........................|ale-erlang-syntaxerl| + eruby.................................|ale-eruby-options| + fish..................................|ale-fish-options| + fortran...............................|ale-fortran-options| + gcc.................................|ale-fortran-gcc| + fountain..............................|ale-fountain-options| + fusionscript..........................|ale-fuse-options| + fusion-lint.........................|ale-fuse-fusionlint| + git commit............................|ale-gitcommit-options| + gitlint.............................|ale-gitcommit-gitlint| + glsl..................................|ale-glsl-options| + glslang.............................|ale-glsl-glslang| + glslls..............................|ale-glsl-glslls| + go....................................|ale-go-options| + gobuild.............................|ale-go-gobuild| + gofmt...............................|ale-go-gofmt| + gometalinter........................|ale-go-gometalinter| + staticcheck.........................|ale-go-staticcheck| + graphql...............................|ale-graphql-options| + eslint..............................|ale-graphql-eslint| + gqlint..............................|ale-graphql-gqlint| + prettier............................|ale-graphql-prettier| + handlebars............................|ale-handlebars-options| + ember-template-lint.................|ale-handlebars-embertemplatelint| + haskell...............................|ale-haskell-options| + brittany............................|ale-haskell-brittany| + ghc.................................|ale-haskell-ghc| + hdevtools...........................|ale-haskell-hdevtools| + hfmt................................|ale-haskell-hfmt| + stack-build.........................|ale-haskell-stack-build| + html..................................|ale-html-options| + htmlhint............................|ale-html-htmlhint| + tidy................................|ale-html-tidy| + write-good..........................|ale-html-write-good| + idris.................................|ale-idris-options| + idris...............................|ale-idris-idris| + java..................................|ale-java-options| + checkstyle..........................|ale-java-checkstyle| + javac...............................|ale-java-javac| + google-java-format..................|ale-java-google-java-format| + javascript............................|ale-javascript-options| + eslint..............................|ale-javascript-eslint| + flow................................|ale-javascript-flow| + importjs............................|ale-javascript-importjs| + jscs................................|ale-javascript-jscs| + jshint..............................|ale-javascript-jshint| + prettier............................|ale-javascript-prettier| + prettier-eslint.....................|ale-javascript-prettier-eslint| + prettier-standard...................|ale-javascript-prettier-standard| + standard............................|ale-javascript-standard| + xo..................................|ale-javascript-xo| + json..................................|ale-json-options| + fixjson.............................|ale-json-fixjson| + jsonlint............................|ale-json-jsonlint| + jq..................................|ale-json-jq| + prettier............................|ale-json-prettier| + kotlin................................|ale-kotlin-options| + kotlinc.............................|ale-kotlin-kotlinc| + ktlint..............................|ale-kotlin-ktlint| + latex.................................|ale-latex-options| + write-good..........................|ale-latex-write-good| + less..................................|ale-less-options| + lessc...............................|ale-less-lessc| + prettier............................|ale-less-prettier| + stylelint...........................|ale-less-stylelint| + llvm..................................|ale-llvm-options| + llc.................................|ale-llvm-llc| + lua...................................|ale-lua-options| + luac................................|ale-lua-luac| + luacheck............................|ale-lua-luacheck| + markdown..............................|ale-markdown-options| + mdl.................................|ale-markdown-mdl| + prettier............................|ale-markdown-prettier| + textlint............................|ale-markdown-textlint| + write-good..........................|ale-markdown-write-good| + nroff.................................|ale-nroff-options| + write-good..........................|ale-nroff-write-good| + objc..................................|ale-objc-options| + clang...............................|ale-objc-clang| + objcpp................................|ale-objcpp-options| + clang...............................|ale-objcpp-clang| + ocaml.................................|ale-ocaml-options| + merlin..............................|ale-ocaml-merlin| + ols.................................|ale-ocaml-ols| + perl..................................|ale-perl-options| + perl................................|ale-perl-perl| + perlcritic..........................|ale-perl-perlcritic| + php...................................|ale-php-options| + hack................................|ale-php-hack| + hackfmt.............................|ale-php-hackfmt| + langserver..........................|ale-php-langserver| + phan................................|ale-php-phan| + phpcbf..............................|ale-php-phpcbf| + phpcs...............................|ale-php-phpcs| + phpmd...............................|ale-php-phpmd| + phpstan.............................|ale-php-phpstan| + php-cs-fixer........................|ale-php-php-cs-fixer| + po....................................|ale-po-options| + write-good..........................|ale-po-write-good| + pod...................................|ale-pod-options| + write-good..........................|ale-pod-write-good| + pony..................................|ale-pony-options| + ponyc...............................|ale-pony-ponyc| + proto.................................|ale-proto-options| + protoc-gen-lint.....................|ale-proto-protoc-gen-lint| + pug...................................|ale-pug-options| + puglint.............................|ale-pug-puglint| + puppet................................|ale-puppet-options| + puppetlint..........................|ale-puppet-puppetlint| + python................................|ale-python-options| + autopep8............................|ale-python-autopep8| + flake8..............................|ale-python-flake8| + isort...............................|ale-python-isort| + mypy................................|ale-python-mypy| + prospector..........................|ale-python-prospector| + pycodestyle.........................|ale-python-pycodestyle| + pylint..............................|ale-python-pylint| + pyls................................|ale-python-pyls| + yapf................................|ale-python-yapf| + r.....................................|ale-r-options| + lintr...............................|ale-r-lintr| + reasonml..............................|ale-reasonml-options| + merlin..............................|ale-reasonml-merlin| + ols.................................|ale-reasonml-ols| + refmt...............................|ale-reasonml-refmt| + restructuredtext......................|ale-restructuredtext-options| + write-good..........................|ale-restructuredtext-write-good| + ruby..................................|ale-ruby-options| + brakeman............................|ale-ruby-brakeman| + rails_best_practices................|ale-ruby-rails_best_practices| + reek................................|ale-ruby-reek| + rubocop.............................|ale-ruby-rubocop| + ruby................................|ale-ruby-ruby| + rufo................................|ale-ruby-rufo| + rust..................................|ale-rust-options| + cargo...............................|ale-rust-cargo| + rls.................................|ale-rust-rls| + rustc...............................|ale-rust-rustc| + rustfmt.............................|ale-rust-rustfmt| + sass..................................|ale-sass-options| + stylelint...........................|ale-sass-stylelint| + scala.................................|ale-scala-options| + scalastyle..........................|ale-scala-scalastyle| + scss..................................|ale-scss-options| + prettier............................|ale-scss-prettier| + stylelint...........................|ale-scss-stylelint| + sh....................................|ale-sh-options| + shell...............................|ale-sh-shell| + shellcheck..........................|ale-sh-shellcheck| + shfmt...............................|ale-sh-shfmt| + sml...................................|ale-sml-options| + smlnj...............................|ale-sml-smlnj| + solidity..............................|ale-solidity-options| + solhint.............................|ale-solidity-solhint| + solium..............................|ale-solidity-solium| + spec..................................|ale-spec-options| + rpmlint.............................|ale-spec-rpmlint| + stylus................................|ale-stylus-options| + stylelint...........................|ale-stylus-stylelint| + tcl...................................|ale-tcl-options| + nagelfar............................|ale-tcl-nagelfar| + terraform.............................|ale-terraform-options| + tflint..............................|ale-terraform-tflint| + tex...................................|ale-tex-options| + chktex..............................|ale-tex-chktex| + lacheck.............................|ale-tex-lacheck| + texinfo...............................|ale-texinfo-options| + write-good..........................|ale-texinfo-write-good| + text..................................|ale-text-options| + textlint............................|ale-text-textlint| + write-good..........................|ale-text-write-good| + thrift................................|ale-thrift-options| + thrift..............................|ale-thrift-thrift| + typescript............................|ale-typescript-options| + eslint..............................|ale-typescript-eslint| + prettier............................|ale-typescript-prettier| + tslint..............................|ale-typescript-tslint| + tsserver............................|ale-typescript-tsserver| + verilog/systemverilog.................|ale-verilog-options| + iverilog............................|ale-verilog-iverilog| + verilator...........................|ale-verilog-verilator| + vim...................................|ale-vim-options| + vint................................|ale-vim-vint| + vim help..............................|ale-vim-help-options| + write-good..........................|ale-vim-help-write-good| + vue...................................|ale-vue-options| + prettier............................|ale-vue-prettier| + xhtml.................................|ale-xhtml-options| + write-good..........................|ale-xhtml-write-good| + xml...................................|ale-xml-options| + xmllint.............................|ale-xml-xmllint| + yaml..................................|ale-yaml-options| + swaglint............................|ale-yaml-swaglint| + yamllint............................|ale-yaml-yamllint| + 8. Commands/Keybinds....................|ale-commands| + 9. API..................................|ale-api| + 10. Special Thanks......................|ale-special-thanks| + 11. Contact.............................|ale-contact| + +=============================================================================== +1. Introduction *ale-introduction* + +ALE provides the means to run linters asynchronously in Vim in a variety of +languages and tools. ALE sends the contents of buffers to linter programs +using the |job-control| features available in Vim 8 and NeoVim. For Vim 8, +Vim must be compiled with the |job| and |channel| and |timers| features +as a minimum. + +ALE supports the following key features for linting: + +1. Running linters when text is changed. +2. Running linters when files are opened. +3. Running linters when files are saved. (When a global flag is set.) +4. Populating the |loclist| with warning and errors. +5. Setting |signs| with warnings and errors for error markers. +6. Using |echo| to show error messages when the cursor moves. +7. Setting syntax highlights for errors. + +ALE can fix problems with files with the |ALEFix| command, using the same job +control functionality used for checking for problems. Try using the +|ALEFixSuggest| command for browsing tools that can be used to fix problems +for the current buffer. + +=============================================================================== +2. Supported Languages & Tools *ale-support* + +The following languages and tools are supported. + +Notes: + +`^` No linters for text or Vim help filetypes are enabled by default. +`!!` These linters check only files on disk. See |ale-lint-file-linters| + +* ASM: `gcc` +* Ansible: `ansible-lint` +* API Blueprint: `drafter` +* AsciiDoc: `alex`!!, `proselint`, `redpen`, `write-good` +* Awk: `gawk` +* Bash: `shell` (-n flag), `shellcheck`, `shfmt` +* Bourne Shell: `shell` (-n flag), `shellcheck`, `shfmt` +* C: `cppcheck`, `cpplint`!!, `clang`, `clangtidy`!!, `clang-format`, `flawfinder`, `gcc` +* C++ (filetype cpp): `clang`, `clangcheck`!!, `clangtidy`!!, `clang-format`, `cppcheck`, `cpplint`!!, `flawfinder`, `gcc` +* CUDA: `nvcc`!! +* C#: `mcs`, `mcsc`!! +* Chef: `foodcritic` +* Clojure: `joker` +* CMake: `cmakelint` +* CoffeeScript: `coffee`, `coffeelint` +* Crystal: `crystal`!! +* CSS: `csslint`, `prettier`, `stylelint` +* Cython (pyrex filetype): `cython` +* D: `dmd` +* Dafny: `dafny`!! +* Dart: `dartanalyzer`!!, `language_server` +* Dockerfile: `hadolint` +* Elixir: `credo`, `dialyxir`, `dogma`!! +* Elm: `elm-format, elm-make` +* Erb: `erb`, `erubi`, `erubis` +* Erlang: `erlc`, `SyntaxErl` +* Fish: `fish` (-n flag) +* Fortran: `gcc` +* Fountain: `proselint` +* FusionScript: `fusion-lint` +* Git Commit Messages: `gitlint` +* GLSL: glslang, `glslls` +* Go: `gofmt`, `goimports`, `go vet`!!, `golint`, `gotype`!!, `gometalinter`!!, `go build`!!, `gosimple`!!, `staticcheck`!! +* GraphQL: `eslint`, `gqlint`, `prettier` +* Haml: `haml-lint` +* Handlebars: `ember-template-lint` +* Haskell: `brittany`, `ghc`, `stack-ghc`, `stack-build`!!, `ghc-mod`, `stack-ghc-mod`, `hlint`, `hdevtools`, `hfmt` +* HTML: `alex`!!, `HTMLHint`, `proselint`, `tidy`, `write-good` +* Idris: `idris` +* Java: `checkstyle`, `javac`, `google-java-format` +* JavaScript: `eslint`, `flow`, `jscs`, `jshint`, `prettier`, `prettier-eslint`, `prettier-standard`, `standard`, `xo` +* JSON: `fixjson`, `jsonlint`, `jq`, `prettier` +* Kotlin: `kotlinc`, `ktlint` +* LaTeX (tex): `alex`!!, `chktex`, `lacheck`, `proselint`, `redpen`, `vale`, `write-good` +* Less: `lessc`, `prettier`, `stylelint` +* LLVM: `llc` +* Lua: `luac`, `luacheck` +* Mail: `alex`!!, `proselint`, `vale` +* Make: `checkmake` +* Markdown: `alex`!!, `markdownlint`!!, `mdl`, `prettier`, `proselint`, `redpen`, `remark-lint`, `textlint`, `vale`, `write-good` +* MATLAB: `mlint` +* Nim: `nim check`!! +* nix: `nix-instantiate` +* nroff: `alex`!!, `proselint`, `write-good` +* Objective-C: `clang` +* Objective-C++: `clang` +* OCaml: `merlin` (see |ale-ocaml-merlin|), `ols` +* Perl: `perl -c`, `perl-critic` +* PHP: `hack`, `hackfmt`, `langserver`, `phan`, `php -l`, `phpcs`, `phpmd`, `phpstan`, `phpcbf`, `php-cs-fixer` +* PO: `alex`!!, `msgfmt`, `proselint`, `write-good` +* Pod: `alex`!!, `proselint`, `write-good` +* Pony: `ponyc` +* proto: `protoc-gen-lint` +* Pug: `pug-lint` +* Puppet: `puppet`, `puppet-lint` +* Python: `autopep8`, `flake8`, `isort`, `mypy`, `prospector`, `pycodestyle`, `pyls`, `pylint`!!, `yapf` +* QML: `qmllint` +* R: `lintr` +* ReasonML: `merlin`, `ols`, `refmt` +* reStructuredText: `alex`!!, `proselint`, `redpen`, `rstcheck`, `vale`, `write-good` +* Re:VIEW: `redpen` +* RPM spec: `rpmlint` +* Ruby: `brakeman`, `rails_best_practices`!!, `reek`, `rubocop`, `ruby`, `rufo` +* Rust: `cargo`!!, `rls`, `rustc` (see |ale-integration-rust|), `rustfmt` +* SASS: `sass-lint`, `stylelint` +* SCSS: `prettier`, `sass-lint`, `scss-lint`, `stylelint` +* Scala: `scalac`, `scalastyle` +* Slim: `slim-lint` +* SML: `smlnj` +* Solidity: `solhint, solium` +* Stylus: `stylelint` +* SQL: `sqlint` +* Swift: `swiftlint`, `swiftformat` +* Tcl: `nagelfar`!! +* Terraform: `tflint` +* Texinfo: `alex`!!, `proselint`, `write-good` +* Text^: `alex`!!, `proselint`, `redpen`, `textlint`, `vale`, `write-good` +* Thrift: `thrift` +* TypeScript: `eslint`, `prettier`, `tslint`, `tsserver`, `typecheck` +* Verilog: `iverilog`, `verilator` +* Vim: `vint` +* Vim help^: `alex`!!, `proselint`, `write-good` +* Vue: `prettier` +* XHTML: `alex`!!, `proselint`, `write-good` +* XML: `xmllint` +* YAML: `swaglint`, `yamllint` + +=============================================================================== +3. Linting *ale-lint* + +ALE's primary focus is on checking for problems with your code with various +programs via some Vim code for integrating with those programs, referred to +as 'linters.' ALE supports a wide array of programs for linting by default, +but additional programs can be added easily by defining files in |runtimepath| +with the filename pattern `ale_linters//.vim`. For more +information on defining new linters, see the extensive documentation +for |ale#linter#Define()|. + +Without any configuration, ALE will attempt to check all of the code for every +file you open in Vim with all available tools by default. To see what ALE +is doing, and what options have been set, try using the |:ALEInfo| command. + +Most of the linters ALE runs will check the Vim buffer you are editing instead +of the file on disk. This allows you to check your code for errors before you +have even saved your changes. ALE will check your code in the following +circumstances, which can be configured with the associated options. + +* When you modify a buffer. - |g:ale_lint_on_text_changed| +* When you open a new or modified buffer. - |g:ale_lint_on_enter| +* When you save a buffer. - |g:ale_lint_on_save| +* When the filetype changes for a buffer. - |g:ale_lint_on_filetype_changed| +* If ALE is used to check code manually. - |:ALELint| + +In addition to the above options, ALE can also check buffers for errors when +you leave insert mode with |g:ale_lint_on_insert_leave|, which is off by +default. It is worth reading the documentation for every option. + + *ale-lint-file-linters* + +Some programs must be run against files which have been saved to disk, and +simply do not support reading temporary files or stdin, either of which are +required for ALE to be able to check for errors as you type. The programs +which behave this way are documented in the lists and tables of supported +programs. ALE will only lint files with these programs in the following +circumstances. + +* When you open a new or modified buffer. - |g:ale_lint_on_enter| +* When you save a buffer. - |g:ale_lint_on_save| +* When the filetype changes for a buffer. - |g:ale_lint_on_filetype_changed| +* If ALE is used to check code manually. - |:ALELint| + +ALE will report problems with your code in the following ways, listed with +their relevant options. + +* By updating loclist. (On by default) - |g:ale_set_loclist| +* By updating quickfix. (Off by default) - |g:ale_set_quickfix| +* By setting error highlights. - |g:ale_set_highlights| +* By creating signs in the sign column. - |g:ale_set_signs| +* By echoing messages based on your cursor. - |g:ale_echo_cursor| +* By showing balloons for your mouse cursor - |g:ale_set_balloons| + +Please consult the documentation for each option, which can reveal some other +ways of tweaking the behaviour of each way of displaying problems. You can +disable or enable whichever options you prefer. + +Most settings can be configured for each buffer. (|b:| instead of |g:|), +including disabling ALE for certain buffers with |b:ale_enabled|. The +|g:ale_pattern_options| setting can be used to configure files differently +based on regular expressions for filenames. For configuring entire projects, +the buffer-local options can be used with external plugins for reading Vim +project configuration files. Buffer-local settings can also be used in +ftplugin files for different filetypes. + + +=============================================================================== +4. Fixing Problems *ale-fix* + +ALE can fix problems with files with the |ALEFix| command. When |ALEFix| is +run, the variable |g:ale_fixers| will be read for getting a |List| of commands +for filetypes, split on `.`, and the functions named in |g:ale_fixers| will be +executed for fixing the errors. + +The |ALEFixSuggest| command can be used to suggest tools that be used to +fix problems for the current buffer. + +The values for `g:ale_fixers` can be a list of |String|, |Funcref|, or +|lambda| values. String values must either name a function, or a short name +for a function set in the ALE fixer registry. + +Each function for fixing errors must accept either one argument `(buffer)` or +two arguments `(buffer, lines)`, representing the buffer being fixed and the +lines to fix. The functions must return either `0`, for changing nothing, a +|List| for new lines to set, or a |Dictionary| for describing a command to be +run in the background. + +Functions receiving a variable number of arguments will not receive the second +argument `lines`. Functions should name two arguments if the `lines` argument +is desired. This is required to avoid unnecessary copying of the lines of +the buffers being checked. + +When a |Dictionary| is returned for an |ALEFix| callback, the following keys +are supported for running the commands. + + `command` A |String| for the command to run. This key is required. + + When `%t` is included in a command string, a temporary + file will be created, containing the lines from the file + after previous adjustment have been done. + + `read_temporary_file` When set to `1`, ALE will read the contents of the + temporary file created for `%t`. This option can be used + for commands which need to modify some file on disk in + order to fix files. + + `process_with` An optional callback for post-processing. + + The callback must accept two arguments, + `(buffer, output)`, which can be used for converting + the output from a command into lines to replace the + buffer's contents with. + + A |List| of |String|s must be returned. + + `chain_with` An optional key for defining a callback to call next. + + The callback must accept two or three arguments, + `(buffer, output)` or `(buffer, output, input)` . + Functions receiving a variable number of arguments will + only receive the first two values. The `output` argument + will contain the lines of output from the command run. + The `input` argument is the List of lines for the + buffer, after applying any previous fixers. + + The callback must return the same values returned for + any fixer function. This allows fixer functions to be + chained recursively. + + When the command string returned for a fixer is an empty + string, the next command in the chain will still be run. + This allows commands to be skipped, like version checks + that are cached. An empty List will be passed to the + next callback in the chain for the `output`. + + `read_buffer` An optional key for disabling reading the buffer. + + When set to `0`, ALE will not pipe the buffer's data + into the command via stdin. This option is ignored and + the buffer is not read when `read_temporary_file` is + `1`. + + This option defaults to `0` when `chain_with` is defined + as anything other than `v:null`, and defaults to `1` + otherwise. This is so earlier commands in a chain + do not receive the buffer's data by default. + + *ale-fix-configuration* + +Synchronous functions and asynchronous jobs will be run in a sequence for +fixing files, and can be combined. For example: +> + let g:ale_fixers = { + \ 'javascript': [ + \ 'DoSomething', + \ 'eslint', + \ {buffer, lines -> filter(lines, 'v:val !=~ ''^\s*//''')}, + \ ], + \} + + ALEFix +< +The above example will call a function called `DoSomething` which could act +upon some lines immediately, then run `eslint` from the ALE registry, and +then call a lambda function which will remove every single line comment +from the file. + +For buffer-local settings, such as in |g:ale_pattern_options| or in ftplugin +files, a |List| may be used for configuring the fixers instead. +> + " Same as the above, only a List can be used instead of a Dictionary. + let b:ale_fixers = [ + \ 'DoSomething', + \ 'eslint', + \ {buffer, lines -> filter(lines, 'v:val !=~ ''^\s*//''')}, + \] + + ALEFix +< +For convenience, a plug mapping is defined for |ALEFix|, so you can set up a +keybind easily for fixing files. > + + " Bind F8 to fixing problems with ALE + nmap (ale_fix) +< +Files can be fixed automatically with the following options, which are all off +by default. + +|g:ale_fix_on_save| - Fix files when they are saved. + + +=============================================================================== +5. Language Server Protocol Support *ale-lsp* + +ALE offers some support for integrating with Language Server Protocol (LSP) +servers. LSP linters can be used in combination with any other linter, and +will automatically connect to LSP servers when needed. ALE also supports +`tsserver` for TypeScript, which uses a different but very similar protocol. + +ALE supports the following LSP/tsserver features. + +1. Diagnostics/linting - Enabled via selecting linters as usual. +2. Completion (Only for tsserver) +3. Go to definition + + +------------------------------------------------------------------------------- +5.1 Completion *ale-completion* + +NOTE: At the moment, only `tsserver` for TypeScript code is supported for +completion. + +ALE offers limited support for automatic completion of code while you type. +Completion is only supported while a least one LSP linter is enabled. ALE +will only suggest symbols provided by the LSP servers. + +Suggestions will be made while you type after completion is enabled. +Completion can be enabled by setting |g:ale_completion_enabled| to `1`. The +delay for completion can be configured with |g:ale_completion_delay|. ALE will +only suggest so many possible matches for completion. The maximum number of +items can be controlled with |g:ale_completion_max_suggestions|. + + +------------------------------------------------------------------------------- +5.2 Go To Definition *ale-go-to-definition* + +ALE supports jumping to the files and locations where symbols are defined +through any enabled LSP linters. The locations ALE will jump to depend on the +information returned by LSP servers. The following commands are supported: + +|ALEGoToDefinition| - Open the definition of the symbol under the cursor. +|ALEGoToDefinitionInTab| - The same, but for opening the file in a new tab. + + +=============================================================================== +6. Global Options *ale-options* + +g:airline#extensions#ale#enabled *g:airline#extensions#ale#enabled* + + Type: |Number| + Default: `1` + + Enables or disables the |airline|'s native extension for ale, which displays + warnings and errors in the status line, prefixed by + |airline#extensions#ale#error_symbol| and + |airline#extensions#ale#warning_symbol|. + + +g:ale_cache_executable_check_failures *g:ale_cache_executable_check_failures* + + Type: |Number| + Default: `0` + + When set to `1`, ALE will cache failing executable checks for linters. By + default, only executable checks which succeed will be cached. + + When this option is set to `1`, Vim will have to be restarted after new + executables are installed for ALE to be able to run linters for those + executables. + + +g:ale_change_sign_column_color *g:ale_change_sign_column_color* + + Type: |Number| + Default: `0` + + When set to `1`, this option will set different highlights for the sign + column itself when ALE reports problems with a file. This option can be + combined with |g:ale_sign_column_always|. + + ALE uses the following highlight groups for highlighting the sign column: + + `ALESignColumnWithErrors` - Links to `error` by default. + `ALESignColumnWithoutErrors` - Uses the value for `SignColumn` by default. + + The sign column color can only be changed globally in Vim. The sign column + might produce unexpected results if editing different files in split + windows. + + +g:ale_command_wrapper *g:ale_command_wrapper* + *b:ale_command_wrapper* + Type: |String| + Default: `''` + + An option for wrapping all commands that ALE runs, for linters, fixers, + and LSP commands. This option can be set globally, or for specific buffers. + + This option can be used to apply nice to all commands. For example: > + + " Prefix all commands with nice. + let g:ale_command_wrapper = 'nice -n5' +< + Use the |ALEInfo| command to view the commands that are run. All of the + arguments for commands will be put on the end of the wrapped command by + default. A `%*` marker can be used to spread the arguments in the wrapped + command. > + + " Has the same effect as the above. + let g:ale_command_wrapper = 'nice -n5 %*' +< + + For passing all of the arguments for a command as one argument to a wrapper, + `%@` can be used instead. > + + " Will result in say: /bin/bash -c 'other-wrapper -c "some command" -x' + let g:ale_command_wrapper = 'other-wrapper -c %@ -x' +< + For commands including `&&` or `;`, only the last command in the list will + be passed to the wrapper. `&&` is most commonly used in ALE to change the + working directory before running a command. + + +g:ale_completion_delay *g:ale_completion_delay* + + Type: |Number| + Default: `100` + + The number of milliseconds before ALE will send a request to a language + server for completions after you have finished typing. + + See |ale-completion| + + +g:ale_completion_enabled *g:ale_completion_enabled* + + Type: |Number| + Default: `0` + + When this option is set to `1`, completion support will be enabled. + + See |ale-completion| + + +g:ale_completion_max_suggestions *g:ale_completion_max_suggestions* + + Type: |Number| + Default: `50` + + The maximum number of items ALE will suggest in completion menus for + automatic completion. + + Setting this number higher will require more processing time, and may + suggest too much noise. Setting this number lower will require less + processing time, but some suggestions will not be included, so you might not + be able to see the suggestions you want. + + Adjust this option as needed, depending on the complexity of your codebase + and your available processing power. + + +g:ale_echo_cursor *g:ale_echo_cursor* + + Type: |Number| + Default: `1` + + When this option is set to `1`, a truncated message will be echoed when a + cursor is near a warning or error. ALE will attempt to find the warning or + error at a column nearest to the cursor when the cursor is resting on a line + which contains a warning or error. This option can be set to `0` to disable + this behaviour. + The format of the message can be customizable in |g:ale_echo_msg_format|. + + +g:ale_echo_delay *g:ale_echo_delay* + *b:ale_echo_delay* + Type: |Number| + Default: `10` + + Given any integer, this option controls the number of milliseconds before + ALE will echo a message for a problem near the cursor. + + The value can be increased to decrease the amount of processing ALE will do + for files displaying a large number of problems. + + +g:ale_echo_msg_error_str *g:ale_echo_msg_error_str* + + Type: |String| + Default: `'Error'` + + The string used for `%severity%` for errors. See |g:ale_echo_msg_format| + + +g:ale_echo_msg_format *g:ale_echo_msg_format* +b:ale_echo_msg_format *b:ale_echo_msg_format* + + Type: |String| + Default: `'%code: %%s'` + + This variable defines a message format for echoed messages. The following + sequences of characters will be replaced. + + `%s` - replaced with the text for the problem + `%...code...% `- replaced with the error code + `%linter%` - replaced with the name of the linter + `%severity%` - replaced withe severity of the problem + + The strings for `%severity%` can be configured with the following options. + + |g:ale_echo_msg_error_str| - Defaults to `'Error'` + |g:ale_echo_msg_info_str| - Defaults to `'Info'` + |g:ale_echo_msg_warning_str| - Defaults to `'Warning'` + + `%code%` is replaced with the error code, and replaced with an empty string + when there is no error code. Any extra characters between the percent signs + will be printed when an error code is present. For example, a message like + `(error code): message` will be printed for `'%(code): %%s'` and simply the + message will be printed when there is no code. + + |g:ale_echo_cursor| needs to be set to 1 for messages to be displayed. + + The echo message format can also be configured separately for each buffer, + so different formats can be used for differnt languages. (Say in ftplugin + files.) + + +g:ale_echo_msg_info_str *g:ale_echo_msg_info_str* + + Type: |String| + Default: `'Info'` + + The string used for `%severity%` for info. See |g:ale_echo_msg_format| + + +g:ale_echo_msg_warning_str *g:ale_echo_msg_warning_str* + + Type: |String| + Default: `'Warning'` + + The string used for `%severity%` for warnings. See |g:ale_echo_msg_format| + + +g:ale_emit_conflict_warnings *g:ale_emit_conflict_warnings* + + Type: |Number| + Default: `1` + + When set to `0`, ALE will not emit any warnings on startup about conflicting + plugins. ALE will probably not work if other linting plugins are installed. + + When this option is set to `1`, ALE will add its `after` directory to + |runtimepath| automatically, so the checks can be applied. Setting this + option to `0` before ALE is loaded will prevent ALE from modifying + |runtimepath|. + + +g:ale_enabled *g:ale_enabled* + *b:ale_enabled* + + Type: |Number| + Default: `1` + + When set to `0`, this option will completely disable ALE, such that no + error checking will be performed, etc. ALE can be toggled on and off with + the |ALEToggle| command, which changes this option. + + ALE can be disabled in each buffer by setting `let b:ale_enabled = 0` + Disabling ALE based on filename patterns can be accomplished by setting + a regular expression for |g:ale_pattern_options|. For example: > + + " Disable linting for all minified JS files. + let g:ale_pattern_options = {'\.min.js$': {'ale_enabled': 0}} +< + + See |g:ale_pattern_options| for more information on that option. + + +g:ale_fixers *g:ale_fixers* + *b:ale_fixers* + + Type: |Dictionary| + Default: `{}` + + A mapping from filetypes to |List| values for functions for fixing errors. + See |ale-fix| for more information. + + This variable can be overridden with variables in each buffer. + `b:ale_fixers` can be set to a |List| of callbacks instead, which can be + more convenient. + + +g:ale_fix_on_save *g:ale_fix_on_save* +b:ale_fix_on_save *b:ale_fix_on_save* + + Type: |Number| + Default: `0` + + When set to 1, ALE will fix files when they are saved. + + If |g:ale_lint_on_save| is set to 1, files will be checked with linters + after files are fixed, only when the buffer is open, or re-opened. Changes + to the file will be saved to the file on disk. + + Fixing files can be disabled or enabled for individual buffers by setting + `b:ale_fix_on_save` to `0` or `1`. + + +g:ale_history_enabled *g:ale_history_enabled* + + Type: |Number| + Default: `1` + + When set to `1`, ALE will remember the last few commands which were run + for every buffer which is open. This information can be viewed with the + |ALEInfo| command. The size of the buffer can be controlled with the + |g:ale_max_buffer_history_size| option. + + This option can be disabled if storing a command history is not desired. + + +g:ale_history_log_output *g:ale_history_log_output* + + Type: |Number| + Default: `1` + + When set to `1`, ALE will store the output of commands which have completed + successfully in the command history, and the output will be displayed when + using |ALEInfo|. + + |g:ale_history_enabled| must be set to `1` for this output to be stored or + printed. + + Some memory will be consumed by this option. It is very useful for figuring + out what went wrong with linters, and for bug reports. Turn this option off + if you want to save on some memory usage. + + +g:ale_keep_list_window_open *g:ale_keep_list_window_open* + *b:ale_keep_list_window_open* + Type: |Number| + Default: `0` + + When set to `1`, this option will keep the loclist or quickfix windows event + after all warnings/errors have been removed for files. By default the + loclist or quickfix windows will be closed automatically when there are no + warnings or errors. + + See |g:ale_open_list| + + +g:ale_list_window_size *g:ale_list_window_size* + *b:ale_list_window_size* + Type: |Number| + Default: `10` + + This number configures the number of lines to set for the height of windows + opened automatically for ALE problems. The default of `10` matches the Vim + default height. + + See |g:ale_open_list| for information on automatically opening windows + for quickfix or the loclist. + + +g:ale_lint_delay *g:ale_lint_delay* + + Type: |Number| + Default: `200` + + This variable controls the milliseconds delay after which the linters will + be run after text is changed. This option is only meaningful with the + |g:ale_lint_on_text_changed| variable set to `always`, `insert`, or `normal`. + + +g:ale_lint_on_enter *g:ale_lint_on_enter* + + Type: |Number| + Default: `1` + + When this option is set to `1`, the |BufWinEnter| and |BufRead| events will + be used to apply linters when buffers are first opened. If this is not + desired, this variable can be set to `0` in your vimrc file to disable this + behaviour. + + The |FileChangedShellPost| and |BufEnter| events will be used to check if + files have been changed outside of Vim. If a file is changed outside of + Vim, it will be checked when it is next opened. + + A |BufWinLeave| event will be used to look for the |E924|, |E925|, or |E926| + errors after moving from a loclist or quickfix window to a new buffer. If + prompts for these errors are opened after moving to new buffers, then ALE + will automatically send the `` key needed to close the prompt. + + +g:ale_lint_on_filetype_changed *g:ale_lint_on_filetype_changed* + + Type: |Number| + Default: `1` + + This option will cause ALE to run whenever the filetype is changed. A short + delay will be used before linting will be done, so the filetype can be + changed quickly several times in a row, but resulting in only one lint + cycle. + + If |g:ale_lint_on_enter| is set to `0`, then ALE will not lint a file when + the filetype is initially set. Otherwise ALE would still lint files when + buffers are opened, and the option for doing so is turned off. + + +g:ale_lint_on_save *g:ale_lint_on_save* + + Type: |Number| + Default: `1` + + This option will make ALE run the linters whenever a file is saved when it + it set to `1` in your vimrc file. This option can be used in combination + with the |g:ale_lint_on_enter| and |g:ale_lint_on_text_changed| options to + make ALE only check files after that have been saved, if that is what is + desired. + + +g:ale_lint_on_text_changed *g:ale_lint_on_text_changed* + + Type: |String| + Default: `always` + + By default, ALE will check files with the various supported programs when + text is changed by using the |TextChanged| event. If this behaviour is not + desired, then this option can be disabled by setting it to `never`. The + |g:ale_lint_delay| variable will be used to set a |timer_start()| on a + delay, and each change to a file will continue to call |timer_stop()| and + |timer_start()| repeatedly until the timer ticks by, and the linters will be + run. The checking of files will run in the background, so it should not + inhibit editing files. This option can also be set to `insert` or `normal` + to lint when text is changed only in insert or normal mode respectively. + + +g:ale_lint_on_insert_leave *g:ale_lint_on_insert_leave* + + Type: |Number| + Default: `0` + + When set to `1` in your vimrc file, this option will cause ALE to run + linters when you leave insert mode. + + ALE will not lint files when you escape insert mode with |CTRL-C| by + default. You can make ALE lint files with this option when you use |CTRL-C| + with the following keybind. > + + " Make using Ctrl+C do the same as Escape, to trigger autocmd commands + inoremap +< + +g:ale_linter_aliases *g:ale_linter_aliases* + *b:ale_linter_aliases* + Type: |Dictionary| + Default: `{}` + + The |g:ale_linter_aliases| option can be used to set aliases from one + filetype to another. A given filetype can be mapped to use the linters + run for another given filetype. + + This |Dictionary| will be merged with a default dictionary containing the + following values: > + + { + \ 'zsh': 'sh', + \ 'csh': 'sh', + \} +< + For example, if you wish to map a new filetype `'foobar'` to run the `'php'` + linters, you could set the following: > + + let g:ale_linter_aliases = {'foobar': 'php'} +< + When combined with the |g:ale_linters| option, the original filetype + (`'foobar'`) will be used for determining which linters to run, + not the aliased type (`'php'`). This allows an aliased type to run a + different set of linters from the type it is being mapped to. + + Passing a list of filetypes is also supported. Say you want to lint + javascript and css embedded in HTML (using linters that support that). + You could alias `html` like so: + + `let g:ale_linter_aliases = {'html': ['html', 'javascript', 'css']}` + + Note that `html` itself was included as an alias. That is because aliases + will override the original linters for the aliased filetype. + + Linter aliases can be configured in each buffer with buffer-local variables. + ALE will first look for aliases for filetypes in the `b:ale_linter_aliases` + variable, then `g:ale_linter_aliases`, and then a default Dictionary. + + `b:ale_linter_aliases` can be set to a |List|, to tell ALE to load the + linters for specific filetypes for a given buffer. > + + let b:ale_linter_aliases = ['html', 'javascript', 'css'] +< + No linters will be loaded when the buffer's filetype is empty. + +g:ale_linters *g:ale_linters* + *b:ale_linters* + Type: |Dictionary| + Default: `{}` + + The |g:ale_linters| option sets a |Dictionary| mapping a filetype to a + |List| of linter programs to be run when checking particular filetypes. + + This |Dictionary| will be merged with a default dictionary containing the + following values: > + + { + \ 'csh': ['shell'], + \ 'go': ['gofmt', 'golint', 'go vet'], + \ 'help': [], + \ 'perl': ['perlcritic'], + \ 'python': ['flake8', 'mypy', 'pylint'], + \ 'rust': ['cargo'], + \ 'spec': [], + \ 'text': [], + \ 'zsh': ['shell'], + \} +< + This option can be used to enable only a particular set of linters for a + file. For example, you can enable only `eslint` for JavaScript files: > + + let g:ale_linters = {'javascript': ['eslint']} +< + If you want to disable all linters for a particular filetype, you can pass + an empty list of linters as the value: > + + let g:ale_linters = {'javascript': []} +< + All linters will be run for unspecified filetypes. All available linters can + be enabled explicitly for a given filetype by passing the string `'all'`, + instead of a List. > + + let g:ale_linters = {'c': 'all'} +< + Linters can be configured in each buffer with buffer-local variables. ALE + will first look for linters for filetypes in the `b:ale_linters` variable, + then `g:ale_linters`, and then the default Dictionary mentioned above. + + `b:ale_linters` can be set to a List, or the string `'all'`. When linters + for two different filetypes share the same name, the first linter loaded + will be used. Any ambiguity can be resolved by using a Dictionary specifying + which linter to run for which filetype instead. > + + " Use ESLint for the buffer if the filetype includes 'javascript'. + let b:ale_linters = {'javascript': ['eslint'], 'html': ['tidy']} + " Use a List for the same setting. This will work in most cases. + let b:ale_linters = ['eslint', 'tidy'] + " Disable all linters for the buffer. + let b:ale_linters = [] + " Explicitly enable all available linters for the filetype. + let b:ale_linters = 'all' +< + ALE can be configured to disable all linters unless otherwise specified with + `g:ale_enabled` or `b:ale_enabled` with the option |g:ale_linters_explicit|. + + +g:ale_linters_explicit *g:ale_linters_explicit* + + Type: |Number| + Default: `0` + + When set to `1`, only the linters from |g:ale_linters| and |b:ale_linters| + will be enabled. The default behavior for ALE is to enable as many linters + as possible, unless otherwise specified. + + +g:ale_list_vertical *g:ale_list_vertical* + *b:ale_list_vertical* + Type: |Number| + Default: `0` + + When set to `1`, this will cause ALE to open any windows (loclist or + quickfix) vertically instead of horizontally (|vert| |lopen|) or (|vert| + |copen|) + + +g:ale_loclist_msg_format *g:ale_loclist_msg_format* +b:ale_loclist_msg_format *b:ale_loclist_msg_format* + + Type: |String| + Default: `g:ale_echo_msg_format` + + This option is the same as |g:ale_echo_msg_format|, but for formatting the + message used for the loclist and the quickfix list. + + The strings for configuring `%severity%` are also used for this option. + + +g:ale_max_buffer_history_size *g:ale_max_buffer_history_size* + + Type: |Number| + Default: `20` + + This setting controls the maximum number of commands which will be stored in + the command history used for |ALEInfo|. Command history will be rotated in + a FIFO manner. If set to a number <= 0, then the history will be + continuously set to an empty |List|. + + History can be disabled completely with |g:ale_history_enabled|. + + +g:ale_max_signs *g:ale_max_signs* + *b:ale_max_signs* + Type: |Number| + Default: `-1` + + When set to any positive integer, ALE will not render any more than the + given number of signs for any one buffer. + + When set to `0`, no signs will be set, but sign processing will still be + done, so existing signs can be removed. + + When set to any other value, no limit will be imposed on the number of signs + set. + + For disabling sign processing, see |g:ale_set_signs|. + + +g:ale_maximum_file_size *g:ale_maximum_file_size* + *b:ale_maximum_file_size* + Type: |Number| + Default: `0` + + A maximum file size in bytes for ALE to check. If set to any positive + number, ALE will skip checking files larger than the given size. + + +g:ale_open_list *g:ale_open_list* + *b:ale_open_list* + Type: |Number| or |String| + Default: `0` + + When set to `1`, this will cause ALE to automatically open a window for the + loclist (|lopen|) or for the quickfix list instead if |g:ale_set_quickfix| + is `1`. (|copen|) + + When set to `'on_save'`, ALE will only open the loclist after buffers have + been saved. The list will be opened some time after buffers are saved and + any linter for a buffer returns results. + + The window will be kept open until all warnings or errors are cleared, + including those not set by ALE, unless |g:ale_keep_list_window_open| is set + to `1`, in which case the window will be kept open when no problems are + found. + + The window size can be configured with |g:ale_list_window_size|. + + Windows can be opened vertically with |g:ale_list_vertical|. + + If you want to close the loclist window automatically when the buffer is + closed, you can set up the following |autocmd| command: > + + augroup CloseLoclistWindowGroup + autocmd! + autocmd QuitPre * if empty(&buftype) | lclose | endif + augroup END +< + +g:ale_pattern_options *g:ale_pattern_options* + + Type: |Dictionary| + Default: `{}` + + This option maps regular expression patterns to |Dictionary| values for + buffer variables. This option can be set to automatically configure + different settings for different files. For example: > + + " Use just ESLint for linting and fixing files which end in '.foo.js' + let g:ale_pattern_options = { + \ '\.foo\.js$': { + \ 'ale_linters': ['eslint'], + \ 'ale_fixers': ['eslint'], + \ }, + \} +< + See |b:ale_linters| and |b:ale_fixers| for information for those options. + + Filenames are matched with |match()|, and patterns depend on the |magic| + setting, unless prefixed with the special escape sequences like `'\v'`, etc. + The patterns can match any part of a filename. The absolute path of the + filename will be used for matching, taken from `expand('%:p')`. + + The options for every match for the filename will be applied, with the + pattern keys sorted in alphabetical order. Options for `'zebra'` will + override the options for `'alpha'` for a filename `alpha-zebra`. + + +g:ale_pattern_options_enabled *g:ale_pattern_options_enabled* + + Type: |Number| + Default: `!empty(g:ale_pattern_options)` + + This option can be used for turning the behaviour of setting + |g:ale_pattern_options| on or off. By default, setting a single key for + |g:ale_pattern_options| will turn this option on, as long as the setting is + configured before ALE is loaded. + + +g:ale_set_balloons *g:ale_set_balloons* + *b:ale_set_balloons* + + Type: |Number| + Default: `has('balloon_eval')` + + When this option is set to `1`, balloon messages will be displayed for + problems. Problems nearest to the cursor on the line the cursor is over will + be displayed. Balloons will not be shown when either |g:ale_enabled| is `0` + or |b:ale_enabled| is `0`. + + `b:ale_set_balloons` can be set to `0` to disable balloons for a buffer. + Balloons cannot be enabled for a specific buffer when not initially enabled + globally. + + +g:ale_set_highlights *g:ale_set_highlights* + + Type: |Number| + Default: `has('syntax')` + + When this option is set to `1`, highlights will be set for problems. + + ALE will use the following highlight groups for problems: + + |ALEError| - Items with `'type': 'E'` + |ALEWarning| - Items with `'type': 'W'` + |ALEInfo.| - Items with `'type': 'I'` + |ALEStyleError| - Items with `'type': 'E'` and `'sub_type': 'style'` + |ALEStyleWarning| - Items with `'type': 'W'` and `'sub_type': 'style'` + + When |g:ale_set_signs| is set to `0`, the following highlights for entire + lines will be set. + + |ALEErrorLine| - All items with `'type': 'E'` + |ALEWarningLine| - All items with `'type': 'W'` + |ALEInfoLine| - All items with `'type': 'I'` + + Vim can only highlight the characters up to the last column in a buffer for + match highlights, whereas the line highlights when signs are enabled will + run to the edge of the screen. + + +g:ale_set_loclist *g:ale_set_loclist* + + Type: |Number| + Default: `1` + + When this option is set to `1`, the |loclist| will be populated with any + warnings and errors which are found by ALE. This feature can be used to + implement jumping between errors through typical use of |lnext| and |lprev|. + + +g:ale_set_quickfix *g:ale_set_quickfix* + + Type: |Number| + Default: `0` + + When this option is set to `1`, the |quickfix| list will be populated with + any problems which are found by ALE, instead of the |loclist|. The loclist + will never be populated when this option is on. + + Problems from every buffer ALE has checked will be included in the quickfix + list, which can be checked with |:copen|. Problems will be de-duplicated. + + This feature should not be used in combination with tools for searching for + matches and commands like |:cfdo|, as ALE will replace the quickfix list + pretty frequently. If you wish to use such tools, you should populate the + loclist instead. + + +g:ale_set_signs *g:ale_set_signs* + + Type: |Number| + Default: `has('signs')` + + When this option is set to `1`, the |sign| column will be populated with + signs marking where problems appear in the file. + + ALE will use the following highlight groups for problems: + + |ALEErrorSign| - Items with `'type': 'E'` + |ALEWarningSign| - Items with `'type': 'W'` + |ALEInfoSign| - Items with `'type': 'I'` + |ALEStyleErrorSign| - Items with `'type': 'E'` and `'sub_type': 'style'` + |ALEStyleWarningSign| - Items with `'type': 'W'` and `'sub_type': 'style'` + + In addition to the style of the signs, the style of lines where signs appear + can be configured with the following highlights: + + |ALEErrorLine| - All items with `'type': 'E'` + |ALEWarningLine| - All items with `'type': 'W'` + |ALEInfoLine| - All items with `'type': 'I'` + + The markers for the highlights can be customized with the following options: + + |g:ale_sign_error| + |g:ale_sign_warning| + |g:ale_sign_info| + |g:ale_sign_style_error| + |g:ale_sign_style_warning| + + When multiple problems exist on the same line, the signs will take + precedence in the order above, from highest to lowest. + + To limit the number of signs ALE will set, see |g:ale_max_signs|. + + +g:ale_sign_column_always *g:ale_sign_column_always* + + Type: |Number| + Default: `0` + + By default, the sign gutter will disappear when all warnings and errors have + been fixed for a file. When this option is set to `1`, the sign column will + remain open. This can be preferable if you don't want the text in your file + to move around as you edit a file. + + +g:ale_sign_error *g:ale_sign_error* + + Type: |String| + Default: `'>>'` + + The sign for errors in the sign gutter. + + +g:ale_sign_info *g:ale_sign_info* + + Type: |String| + Default: `g:ale_sign_warning` + + The sign for "info" markers in the sign gutter. + + +g:ale_sign_style_error *g:ale_sign_style_error* + + Type: |String| + Default: `g:ale_sign_error` + + The sign for style errors in the sign gutter. + + +g:ale_sign_style_warning *g:ale_sign_style_warning* + + Type: |String| + Default: `g:ale_sign_warning` + + The sign for style warnings in the sign gutter. + + +g:ale_sign_offset *g:ale_sign_offset* + + Type: |Number| + Default: `1000000` + + This variable controls offset from which numeric IDs will be generated for + new signs. Signs cannot share the same ID values, so when two Vim plugins + set signs at the same time, the IDs have to be configured such that they do + not conflict with one another. If the IDs used by ALE are found to conflict + with some other plugin, this offset value can be changed, and hopefully both + plugins will work together. See |sign-place| for more information on how + signs are set. + + +g:ale_sign_warning *g:ale_sign_warning* + + Type: |String| + Default: `'--'` + + The sign for warnings in the sign gutter. + + +g:ale_type_map *g:ale_type_map* + *b:ale_type_map* + Type: |Dictionary| + Default: `{}` + + This option can be set re-map problem types for linters. Each key in the + |Dictionary| should be the name of a linter, and each value must be a + |Dictionary| mapping problem types from one type to another. The following + types are supported: + + `'E'` - `{'type': 'E'}` + `'ES'` - `{'type': 'E', 'sub_type': 'style'}` + `'W'` - `{'type': 'W'}` + `'WS'` - `{'type': 'W', 'sub_type': 'style'}` + `'I'` - `{'type': 'I'}` + + For example, if you want to turn flake8 errors into warnings, you can write + the following: > + + let g:ale_type_map = {'flake8': {'ES': 'WS', 'E': 'W'}} +< + If you wanted to turn style errors and warnings into regular errors and + warnings, you can write the following: > + + let g:ale_type_map = {'flake8': {'ES': 'E', 'WS': 'W'}} +< + Type maps can be set per-buffer with `b:ale_type_map`. + + +g:ale_virtualenv_dir_names *g:ale_virtualenv_dir_names* +b:ale_virtualenv_dir_names *b:ale_virtualenv_dir_names* + + Type: |List| + Default: `['.env', 'env', 've-py3', 've', 'virtualenv', 'venv']` + + A list of directory names to be used when searching upwards from Python + files to discover virtulenv directories with. + + For directory named `'foo'`, ALE will search for `'foo/bin/activate'` + (`foo\Scripts\activate\` on Windows) in all directories on and above the + directory containing the Python file to find virtualenv paths. + + +g:ale_warn_about_trailing_blank_lines *g:ale_warn_about_trailing_blank_lines* +b:ale_warn_about_trailing_blank_lines *b:ale_warn_about_trailing_blank_lines* + + Type: |Number| + Default: `1` + + When this option is set to `1`, warnings about trailing blank lines will be + shown. + + This option behaves similarly to |g:ale_warn_about_trailing_whitespace|. + + +g:ale_warn_about_trailing_whitespace *g:ale_warn_about_trailing_whitespace* +b:ale_warn_about_trailing_whitespace *b:ale_warn_about_trailing_whitespace* + + Type: |Number| + Default: `1` + + When this option is set to `1`, warnings relating to trailing whitespace on + lines will be shown. If warnings are too irritating while editing buffers, + and you have configured Vim to automatically remove trailing whitespace, + you can disable these warnings by setting this option to `0`. + + Not all linters may respect this option. If a linter does not, please file a + bug report, and it may be possible to add such support. + + This option may be configured on a per buffer basis. + + +g:ale_windows_node_executable_path *g:ale_windows_node_executable_path* + *b:ale_windows_node_executable_path* + + Type: |String| + Default: `'node.exe'` + + This variable is used as the path to the executable to use for executing + scripts with Node.js on Windows. + + For Windows, any file with a `.js` file extension needs to be executed with + the node executable explicitly. Otherwise, Windows could try and open the + scripts with other applications, like a text editor. Therefore, these + scripts are executed with whatever executable is configured with this + setting. + + +------------------------------------------------------------------------------- +6.1. Highlights *ale-highlights* + +ALEError *ALEError* + + Default: `highlight link ALEError SpellBad` + + The highlight used for highlighted errors. See |g:ale_set_highlights|. + + +ALEErrorLine *ALEErrorLine* + + Default: Undefined + + The highlight for an entire line where errors appear. Only the first + line for a problem will be highlighted. + + See |g:ale_set_signs| and |g:ale_set_highlights|. + + +ALEErrorSign *ALEErrorSign* + + Default: `highlight link ALEErrorSign error` + + The highlight used for error signs. See |g:ale_set_signs|. + + +ALEInfo *ALEInfo.* + *ALEInfo-highlight* + Default: `highlight link ALEInfo ALEWarning` + + The highlight used for highlighted info messages. See |g:ale_set_highlights|. + + +ALEInfoSign *ALEInfoSign* + + Default: `highlight link ALEInfoSign ALEWarningSign` + + The highlight used for info message signs. See |g:ale_set_signs|. + + +ALEInfoLine *ALEInfoLine* + + Default: Undefined + + The highlight for entire lines where info messages appear. Only the first + line for a problem will be highlighted. + + See |g:ale_set_signs| and |g:ale_set_highlights|. + + +ALEStyleError *ALEStyleError* + + Default: `highlight link ALEStyleError ALEError` + + The highlight used for highlighted style errors. See |g:ale_set_highlights|. + + +ALEStyleErrorSign *ALEStyleErrorSign* + + Default: `highlight link ALEStyleErrorSign ALEErrorSign` + + The highlight used for style error signs. See |g:ale_set_signs|. + + +ALEStyleWarning *ALEStyleWarning* + + Default: `highlight link ALEStyleWarning ALEError` + + The highlight used for highlighted style warnings. See |g:ale_set_highlights|. + + +ALEStyleWarningSign *ALEStyleWarningSign* + + Default: `highlight link ALEStyleWarningSign ALEWarningSign` + + The highlight used for style warning signs. See |g:ale_set_signs|. + + +ALEWarning *ALEWarning* + + Default: `highlight link ALEWarning SpellCap` + + The highlight used for highlighted warnings. See |g:ale_set_highlights|. + + +ALEWarningLine *ALEWarningLine* + + Default: Undefined + + The highlight for entire lines where warnings appear. Only the first line + for a problem will be highlighted. + + See |g:ale_set_signs| and |g:ale_set_highlights|. + + +ALEWarningSign *ALEWarningSign* + + Default: `highlight link ALEWarningSign todo` + + The highlight used for warning signs. See |g:ale_set_signs|. + + +------------------------------------------------------------------------------- +6.2. Options for write-good *ale-write-good-options* + +The options for the write-good linter are global because it does not make +sense to have them specified on a per-language basis. + +g:ale_writegood_executable *g:ale_writegood_executable* + *b:ale_writegood_executable* + Type: |String| + Default: `'writegood'` + + See |ale-integrations-local-executables| + + +g:ale_writegood_options *g:ale_writegood_options* + *b:ale_writegood_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to writegood. + + +g:ale_writegood_use_global *g:ale_writegood_use_global* + *b:ale_writegood_use_global* + Type: |Number| + Default: `0` + + See |ale-integrations-local-executables| + + +=============================================================================== +7. Integration Documentation *ale-integrations* + +Linter and fixer options are documented in individual help files. See the +table of contents at |ale-contents|. + +Every option for programs can be set globally, or individually for each +buffer. For example, `b:ale_python_flake8_executable` will override any +values set for `g:ale_python_flake8_executable`. + + *ale-integrations-local-executables* + +Some tools will prefer to search for locally-installed executables, unless +configured otherwise. For example, the `eslint` linter will search for +various executable paths in `node_modules`. The `flake8` linter will search +for virtualenv directories. + +If you prefer to use global executables for those tools, set the relevant +`_use_global` and `_executable` options for those linters. > + + " Use the global executable with a special name for eslint. + let g:ale_javascript_eslint_executable = 'special-eslint' + let g:ale_javascript_eslint_use_global = 1 + + " Use the global executable with a special name for flake8. + let g:ale_python_flake8_executable = '/foo/bar/flake8' + let g:ale_python_flake8_use_global = 1 +< + +The option |g:ale_virtualenv_dir_names| controls the local virtualenv paths +ALE will use to search for Python executables. + + +=============================================================================== +8. Commands/Keybinds *ale-commands* + +ALEFix *ALEFix* + + Fix problems with the current buffer. See |ale-fix| for more information. + + A plug mapping `(ale_fix)` is defined for this command. + + +ALEFixSuggest *ALEFixSuggest* + + Suggest tools that can be used to fix problems in the current buffer. + + See |ale-fix| for more information. + + +ALEGoToDefinition *ALEGoToDefinition* + + Jump to the definition of a symbol under the cursor using the enabled LSP + linters for the buffer. ALE will jump to a definition if an LSP server + provides a location to jump to. Otherwise, ALE will do nothing. + + A plug mapping `(ale_go_to_definition)` is defined for this command. + + +ALEGoToDefinitionInTab *ALEGoToDefinitionInTab* + + The same as |ALEGoToDefinition|, but opens results in a new tab. + + A plug mapping `(ale_go_to_definition_in_tab)` is defined for this + command. + + *:ALELint* +ALELint *ALELint* + + Run ALE once for the current buffer. This command can be used to run ALE + manually, instead of automatically, if desired. + + This command will also run linters where `lint_file` is set to `1`, or in + other words linters which check the file instead of the Vim buffer. + + A plug mapping `(ale_lint)` is defined for this command. + + +ALEPrevious *ALEPrevious* +ALEPreviousWrap *ALEPreviousWrap* +ALENext *ALENext* +ALENextWrap *ALENextWrap* +ALEFirst *ALEFirst* +ALELast *ALELast* + *ale-navigation-commands* + + Move between warnings or errors in a buffer. ALE will only navigate between + the errors or warnings it generated, even if both |g:ale_set_quickfix| + and |g:ale_set_loclist| are set to `0`. + + `ALEPrevious` and `ALENext` will stop at the top and bottom of a file, while + `ALEPreviousWrap` and `ALENextWrap` will wrap around the file to find + the last or first warning or error in the file, respectively. + + `ALEFirst` goes to the first error or warning in the buffer, while `ALELast` + goes to the last one. + + The following || mappings are defined for the commands: > + (ale_previous) - ALEPrevious + (ale_previous_wrap) - ALEPreviousWrap + (ale_next) - ALENext + (ale_next_wrap) - ALENextWrap + (ale_first) - ALEFirst + (ale_last) - ALELast +< + For example, these commands could be bound to the keys Ctrl + j + and Ctrl + k: > + + " Map movement through errors without wrapping. + nmap (ale_previous) + nmap (ale_next) + " OR map keys to use wrapping. + nmap (ale_previous_wrap) + nmap (ale_next_wrap) +< + +ALEToggle *ALEToggle* +ALEEnable *ALEEnable* +ALEDisable *ALEDisable* +ALEToggleBuffer *ALEToggleBuffer* +ALEEnableBuffer *ALEEnableBuffer* +ALEDisableBuffer *ALEDisableBuffer* + + `ALEToggle`, `ALEEnable`, and `ALEDisable` enable or disable ALE linting, + including all of its autocmd events, loclist items, quickfix items, signs, + current jobs, etc., globally. Executing any of these commands will change + the |g:ale_enabled| variable. + + ALE can be disabled or enabled for only a single buffer with + `ALEToggleBuffer`, `ALEEnableBuffer`, and `ALEDisableBuffer`. Disabling ALE + for a buffer will not remove autocmd events, but will prevent ALE from + checking for problems and reporting problems for whatever buffer the + `ALEDisableBuffer` or `ALEToggleBuffer` command is executed from. These + commands can be used for temporarily disabling ALE for a buffer. These + commands will modify the |b:ale_enabled| variable. + + ALE linting cannot be enabled for a single buffer when it is disabled + globally, as disabling ALE globally removes the autocmd events needed to + perform linting with. + + The following plug mappings are defined, for conveniently defining keybinds: + + |ALEToggle| - `(ale_toggle)` + |ALEEnable| - `(ale_enable)` + |ALEDisable| - `(ale_disable)` + |ALEToggleBuffer| - `(ale_toggle_buffer)` + |ALEEnableBuffer| - `(ale_enable_buffer)` + |ALEDisableBuffer| - `(ale_disable_buffer)` + + For removing problems reported by ALE, but leaving ALE enabled, see + |ALEReset| and |ALEResetBuffer|. + + *:ALEDetail* +ALEDetail *ALEDetail* + + Show the full linter message for the current line in the preview window. + This will only have an effect on lines that contain a linter message. The + preview window can be easily closed with the `q` key. + + A plug mapping `(ale_detail)` is defined for this command. + + + *:ALEInfo* +ALEInfo *ALEInfo* +ALEInfoToClipboard *ALEInfoToClipboard* + + Print runtime information about ALE, including the values of global and + buffer-local settings for ALE, the linters that are enabled, the commands + that have been run, and the output of commands. + + ALE will log the commands that are run by default. If you wish to disable + this, set |g:ale_history_enabled| to `0`. Because it could be expensive, ALE + does not remember the output of recent commands by default. Set + |g:ale_history_log_output| to `1` to enable logging of output for commands. + ALE will only log the output captured for parsing problems, etc. + + The command `:ALEInfoToClipboard` can be used to output ALEInfo directly to + your clipboard. This might not work on every machine. + + +ALEReset *ALEReset* +ALEResetBuffer *ALEResetBuffer* + + `ALEReset` will remove all problems reported by ALE for all buffers. + `ALEResetBuffer` will remove all problems reported for a single buffer. + + Either command will leave ALE linting enabled, so ALE will report problems + when linting is performed again. See |ale-lint| for more information. + + The following plug mappings are defined, for conveniently defining keybinds: + + |ALEReset| - `(ale_reset)` + |ALEResetBuffer| - `(ale_reset_buffer)` + + ALE can be disabled globally or for a buffer with |ALEDisable| or + |ALEDisableBuffer|. + + +ALEStopAllLSPs *ALEStopAllLSPs* + + `ALEStopAllLSPs` will close and stop all channels and jobs for all LSP-like + clients, including tsserver, remove all of the data stored for them, and + delete all of the problems found for them, updating every linted buffer. + + This command can be used when LSP clients mess up and need to be restarted. + + +=============================================================================== +9. API *ale-api* + +ale#Queue(delay, [linting_flag, buffer_number]) *ale#Queue()* + + Run linters for the current buffer, based on the filetype of the buffer, + with a given `delay`. A `delay` of `0` will run the linters immediately. + The linters will always be run in the background. Calling this function + again from the same buffer + + An optional `linting_flag` argument can be given. If `linting_flag` + is `'lint_file'`, then linters where the `lint_file` option is set to `1` will be + run. Linters with `lint_file` set to `1` are not run by default. + + An optional `buffer_number` argument can be given for specifying the buffer + to check. The active buffer (`bufnr('')`) will be checked by default. + + *ale-cool-down* + If an exception is thrown when queuing/running ALE linters, ALE will enter + a cool down period where it will stop checking anything for a short period + of time. This is to prevent ALE from seriously annoying users if a linter + is broken, or when developing ALE itself. + + +ale#engine#CreateDirectory(buffer) *ale#engine#CreateDirectory()* + + Create a new temporary directory with a unique name, and manage that + directory with |ale#engine#ManageDirectory()|, so it will be removed as + soon as possible. + + It is advised to only call this function from a callback function for + returning a linter command to run. + + +ale#engine#EscapeCommandPart(command_part) *ale#engine#EscapeCommandPart()* + + Given a |String|, return a |String| with all `%` characters replaced with + `%%` instead. This function can be used to escape strings which are + dynamically generated for commands before handing them over to ALE, + so that ALE doesn't treat any strings with `%` formatting sequences + specially. + + +ale#engine#GetLoclist(buffer) *ale#engine#GetLoclist()* + + Given a buffer number, this function will return the list of problems + reported by ALE for a given buffer in the format accepted by |setqflist()|. + + A reference to the buffer's list of problems will be returned. The list must + be copied before applying |map()| or |filter()|. + + +ale#engine#IsCheckingBuffer(buffer) *ale#engine#IsCheckingBuffer()* + + Given a buffer number, returns `1` when ALE is busy checking that buffer. + + This function can be used for status lines, tab names, etc. + + +ale#engine#ManageFile(buffer, filename) *ale#engine#ManageFile()* + + Given a buffer number for a buffer currently running some linting tasks + and a filename, register a filename with ALE for automatic deletion after + linting is complete, or when Vim exits. + + If Vim exits suddenly, ALE will try its best to remove temporary files, but + ALE cannot guarantee with absolute certainty that the files will be removed. + It is advised to create temporary files in the operating system's managed + temporary file directory, such as with |tempname()|. + + Directory names should not be given to this function. ALE will only delete + files and symlinks given to this function. This is to prevent entire + directories from being accidentally deleted, say in cases of writing + `dir . '/' . filename` where `filename` is actually `''`, etc. ALE instead + manages directories separetly with the |ale#engine#ManageDirectory| function. + + +ale#engine#ManageDirectory(buffer, directory) *ale#engine#ManageDirectory()* + + Like |ale#engine#ManageFile()|, but directories and all of their contents + will be deleted, akin to `rm -rf directory`, which could lead to loss of + data if mistakes are made. This command will also delete any temporary + filenames given to it. + + It is advised to use |ale#engine#ManageFile()| instead for deleting single + files. + + +ale#fix#registry#Add(name, func, filetypes, desc, [aliases]) + *ale#fix#registry#Add()* + + Given a |String| `name` for a name to add to the registry, a |String| `func` + for a function name, a |List| `filetypes` for a list of filetypes to + set for suggestions, and a |String| `desc` for a short description of + the fixer, register a fixer in the registry. + + The `name` can then be used for |g:ale_fixers| in place of the function + name, and suggested for fixing files. + + An optional |List| of |String|s for aliases can be passed as the `aliases` + argument. These aliases can also be used for looking up a fixer function. + ALE will search for fixers in the registry first by `name`, then by their + `aliases`. + + +ale#linter#Define(filetype, linter) *ale#linter#Define()* + + Given a |String| for a filetype and a |Dictionary| Describing a linter + configuration, add a linter for the given filetype. The dictionaries each + offer the following options: + + `name` The name of the linter. These names will be used by + |g:ale_linters| option for enabling/disabling + particular linters. + + This argument is required. + + `callback` A |String| or |Funcref| for a callback function + accepting two arguments (buffer, lines), for a + buffer number the output is for, and the lines of + output from a linter. + + This callback function should return a |List| of + |Dictionary| objects in the format accepted by + |setqflist()|. The |List| will be sorted by line and + then column order so it can be searched with a binary + search by in future before being passed on to the + |loclist|, etc. + + This argument is required, unless the linter is an + LSP linter. In which case, this argument must not be + defined, as LSP linters handle diangostics + automatically. See |ale-lsp-linters|. + + The keys for each item in the List will be handled in + the following manner: + *ale-loclist-format* + `text` - This error message is required. + `lnum` - The line number is required. Any strings + will be automatically converted to numbers by + using `str2nr()`. + + Line 0 will be moved to line 1, and lines beyond + the end of the file will be moved to the end. + `col` - The column number is optional and will + default to `0`. Any strings will be automatically + converted to number using `str2nr()`. + `end_col` - An optional end column number. + This key can be set to specify the column problems + end on, for improved highlighting. + `end_lnum` - An optional end line number. + This key can set along with `end_col` for + highlighting multi-line problems. + `bufnr` - This key represents the buffer number the + problems are for. This value will default to + the buffer number being checked. + + The `filename` key can be set instead of this key, + and then the eventual `bufnr` value in the final + list will either represent the number for an open + buffer or `-1` for a file not open in any buffer. + `filename` - An optional filename for the file the + problems are for. This should be an absolute path to + a file. + + Problems for files which have not yet been opened + will be set in those files after they are opened + and have been checked at least once. + + Temporary files in directories used for Vim + temporary files with `tempname()` will be asssumed + to be the buffer being checked, unless the `bufnr` + key is also set with a valid number for some other + buffer. + `vcol` - Defaults to `0`. + `type` - Defaults to `'E'`. + `nr` - Defaults to `-1`. + + `executable` A |String| naming the executable itself which + will be run. This value will be used to check if the + program requested is installed or not. + + Either this or the `executable_callback` argument + must be provided. + + `executable_callback ` A |String| or |Funcref| for a callback function + accepting a buffer number. A |String| should be + returned for the executable to check. This can be + used in place of `executable` when more complicated + processing is needed. + + `command` A |String| for an executable to run asynchronously. + This command will be fed the lines from the buffer to + check, and will produce the lines of output given to + the `callback`. + + `command_callback` A |String| or |Funcref| for a callback function + accepting a buffer number. A |String| should be + returned for a command to run. This can be used in + place of `command` when more complicated processing + is needed. + + If an empty string is returned from the callback, + no jobs for linting will be run for that linter. + This can be used for skipping a linter call, + say if no configuration file was found. + + *ale-command-chain* + `command_chain` A |List| of |Dictionary| items defining a series + of commands to be run. At least one |Dictionary| + should be provided. Each Dictionary must contain the + key `callback`, defining a |String| or |Funcref| for + a function returning a |String| for a command to run. + + The callback functions for each command after the + first command in in the chain should accept two + arguments `(buffer, output)`, a buffer number and a + |List| of lines of output from the previous command + in the chain. + + The first callback function in a chain accepts only + a `(buffer)` argument, as there are no previous + commands to run which return `output`. + + If an empty string is returned for a command in a + chain, that command in the chain will be skipped, + and the next function in the chain will be called + immediately instead. If the last command in a chain + returns an empty string, then no linting will be + performed. + + Commands in the chain will all use the + `output_stream` value provided in the root + |Dictionary|. Each command in the chain can also + provide an `output_stream` key to override this value. + See the `output_stream` description for more + information. + + Commands in the chain all behave as if `read_buffer` + is set to `0` by default, except for the last command + in the chain, which uses the value set for + `read_buffer` in the root |Dictionary|. Each command + in the chain can also provide a `read_buffer` key + to override these values. + See the `read_buffer` description for more + information. + + `output_stream` A |String| for the output stream the lines of output + should be read from for the command which is run. The + accepted values are `'stdout'`, `'stderr'`, and + `'both'`. This argument defaults to `'stdout'`. This + argument can be set for linter programs which output + their errors and warnings to the stderr stream + instead of stdout. The option `'both'` will read + from both stder and stdout at the same time. + + `read_buffer` A |Number| (`0` or `1`) indicating whether a command + should read the Vim buffer as input via stdin. This + option is set to `1` by default, and can be disabled + if a command manually reads from a temporary file + instead, etc. + + *ale-lint-file* + `lint_file` A |Number| (`0` or `1`) indicating whether a command + should read the file instead of the Vim buffer. This + option can be used for linters which must check the + file on disk, and which cannot check a Vim buffer + instead. + + Linters set with this option will not be run as a + user types, per |g:ale_lint_on_text_changed|. Linters + will instead be run only when events occur against + the file on disk, including |g:ale_lint_on_enter| + and |g:ale_lint_on_save|. Linters with this option + set to `1` will also be run when linters are run + manually, per |ALELintPost-autocmd|. + + When this option is set to `1`, `read_buffer` will + be set automatically to `0`. The two options cannot + be used together. + + *ale-lsp-linters* + `lsp` A |String| for defining LSP (Language Server Protocol) + linters. + + This argument may be omitted or `''` when a linter + does not represent an LSP linter. + + When this argument is set to `'stdio'`, then the + linter will be defined as an LSP linter which keeps a + process for a language server runnning, and + communicates with it directly via a |channel|. + + When this argument is not empty, then the + `project_callback` and `language_callback` arguments + must also be defined. + + LSP linters handle diagnostics automatically, so + the `callback` argument must not be defined. + + `project_callback` A |String| or |Funcref| for a callback function + accepting a buffer number. A |String| should be + returned representing the path to the project for the + file being checked with the language server. If an + empty string is returned, the file will not be + checked at all. + + This argument must only be set if the `lsp` argument + is also set to a non-empty string. + + `language_callback` A |String| or |Funcref| for a callback function + accepting a buffer number. A |String| should be + returned representing the name of the language being + checked. + + This argument must only be set if the `lsp` argument + is also set to a non-empty string. + + `aliases` A |List| of aliases for the linter name. + + This argument can be set with alternative names for + selecting the linter with |g:ale_linters|. This + setting can make it easier to guess the linter name + by offering a few alternatives. + + Only one of `command`, `command_callback`, or `command_chain` should be + specified. `command_callback` is generally recommended when a command string + needs to be generated dynamically, or any global options are used. + `command_chain` is recommended where any system calls need to be made to + retrieve some kind of information before running the final command. + + If temporary files or directories are created for commands run with + `command_callback` or `command_chain`, then these tempoary files or + directories can be managed by ALE, for automatic deletion. + See |ale#engine#ManageFile()| and |ale#engine#ManageDirectory| for more + information. + + *ale-command-format-strings* + + All command strings will be formatted for special character sequences. + Any substring `%s` will be replaced with the full path to the current file + being edited. This format option can be used to pass the exact filename + being edited to a program. + + For example: > + 'command': 'eslint -f unix --stdin --stdin-filename %s' +< + Any substring `%t` will be replaced with a path to a temporary file. Merely + adding `%t` will cause ALE to create a temporary file containing the + contents of the buffer being checked. All occurrences of `%t` in command + strings will reference the one temporary file. The temporary file will be + created inside a temporary directory, and the entire temporary directory + will be automatically deleted, following the behaviour of + |ale#engine#ManageDirectory|. This option can be used for some linters which + do not support reading from stdin. + + For example: > + 'command': 'ghc -fno-code -v0 %t', +< + The character sequence `%%` can be used to emit a literal `%` into a + command, so literal character sequences `%s` and `%t` can be escaped by + using `%%s` and `%%t` instead, etc. + + If a callback for a command generates part of a command string which might + possibly contain `%%`, `%s`, or `%t` where the special formatting behaviour + is not desired, the |ale#engine#EscapeCommandPart()| function can be used to + replace those characters to avoid formatting issues. + + *ale-linter-loading-behaviour* + + Linters for ALE will be loaded by searching |runtimepath| in the following + format: > + + ale_linters//.vim +< + Any linters which exist anywhere in |runtimepath| with that directory + structure will be automatically loaded for the matching |filetype|. Filetypes + containing `.` characters will be split into individual parts, and files + will be loaded for each filetype between the `.` characters. + + +ale#linter#Get(filetype) *ale#linter#Get()* + + Return all of linters configured for a given filetype as a |List| of + |Dictionary| values in the format specified by |ale#linter#Define()|. + + Filetypes may be dot-separated to invoke linters for multiple filetypes: + for instance, the filetype `javascript.jsx` will return linters for both the + `javascript` and `jsx` filetype. + + Aliases may be defined in as described in |g:ale_linter_aliases|. Aliases + are applied after dot-separated filetypes are broken up into their + components. + + +ale#statusline#Count(buffer) *ale#statusline#Count()* + + Given the number of a buffer which may have problems, return a |Dictionary| + containing information about the number of problems detected by ALE. The + following keys are supported: + + `error` -> The number of problems with type `E` and `sub_type != 'style'` + `warning` -> The number of problems with type `W` and `sub_type != 'style'` + `info` -> The number of problems with type `I` + `style_error` -> The number of problems with type `E` and `sub_type == 'style'` + `style_warning` -> The number of problems with type `W` and `sub_type == 'style'` + `total` -> The total number of problems. + + +b:ale_linted *b:ale_linted* + + `b:ale_linted` is set to the number of times a buffer has been checked by + ALE after all linters for one lint cycle have finished checking a buffer. + This variable may not be defined until ALE first checks a buffer, so it + should be accessed with |get()| or |getbufvar()|. For example: > + + " Print a message indicating how many times ALE has checked this buffer. + echo 'ALE has checked this buffer ' . get(b:, 'ale_linted') . ' time(s).' + " Print 'checked' using getbufvar() if a buffer has been checked. + echo getbufvar(bufnr(''), 'ale_linted', 0) > 0 ? 'checked' : 'not checked' +< + +ALELintPre *ALELintPre-autocmd* +ALELintPost *ALELintPost-autocmd* +ALEFixPre *ALEFixPre-autocmd* +ALEFixPost *ALEFixPost-autocmd* + + These |User| autocommands are triggered before and after every lint or fix + cycle. They can be used to update statuslines, send notifications, etc. + The autocmd commands are run with |:silent|, so |:unsilent| is required for + echoing messges. + + For example to change the color of the statusline while the linter is + running: +> + augroup ALEProgress + autocmd! + autocmd User ALELintPre hi Statusline ctermfg=darkgrey + autocmd User ALELintPOST hi Statusline ctermfg=NONE + augroup end +< + Or to display the progress in the statusline: +> + let s:ale_running = 0 + let l:stl .= '%{s:ale_running ? "[linting]" : ""}' + augroup ALEProgress + autocmd! + autocmd User ALELintPre let s:ale_running = 1 | redrawstatus + autocmd User ALELintPost let s:ale_running = 0 | redrawstatus + augroup end +< + +=============================================================================== +10. Special Thanks *ale-special-thanks* + +Special thanks to Mark Grealish (https://www.bhalash.com/) for providing ALE's +snazzy looking ale glass logo. Cheers, Mark! + +=============================================================================== +11. Contact *ale-contact* + +If you like this plugin, and wish to get in touch, check out the GitHub +page for issues and more at https://github.com/w0rp/ale + +If you wish to contact the author of this plugin directly, please feel +free to send an email to devw0rp@gmail.com. + +Please drink responsibly, or not at all, which is ironically the preference +of w0rp, who is teetotal. + + + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/ftplugin/ale-fix-suggest.vim b/sources_non_forked/ale/ftplugin/ale-fix-suggest.vim new file mode 100644 index 00000000..189a4dc2 --- /dev/null +++ b/sources_non_forked/ale/ftplugin/ale-fix-suggest.vim @@ -0,0 +1,2 @@ +" Close the ALEFixSuggest window with the q key. +noremap q :q! diff --git a/sources_non_forked/ale/ftplugin/ale-preview.vim b/sources_non_forked/ale/ftplugin/ale-preview.vim new file mode 100644 index 00000000..ffbffbd5 --- /dev/null +++ b/sources_non_forked/ale/ftplugin/ale-preview.vim @@ -0,0 +1,2 @@ +" Close the ALEPreviewWindow window with the q key. +noremap q :q! diff --git a/sources_non_forked/ale/plugin/ale.vim b/sources_non_forked/ale/plugin/ale.vim new file mode 100644 index 00000000..1aa35826 --- /dev/null +++ b/sources_non_forked/ale/plugin/ale.vim @@ -0,0 +1,323 @@ +" Author: w0rp +" Description: Main entry point for the plugin: sets up prefs and autocommands +" Preferences can be set in vimrc files and so on to configure ale + +" Sanity Checks + +if exists('g:loaded_ale_dont_use_this_in_other_plugins_please') + finish +endif + +" Set a special flag used only by this plugin for preventing doubly +" loading the script. +let g:loaded_ale_dont_use_this_in_other_plugins_please = 1 + +" A flag for detecting if the required features are set. +if has('nvim') + let s:has_features = has('timers') +else + " Check if Job and Channel functions are available, instead of the + " features. This works better on old MacVim versions. + let s:has_features = has('timers') && exists('*job_start') && exists('*ch_close_in') +endif + +if !s:has_features + " Only output a warning if editing some special files. + if index(['', 'gitcommit'], &filetype) == -1 + execute 'echoerr ''ALE requires NeoVim >= 0.1.5 or Vim 8 with +timers +job +channel''' + execute 'echoerr ''Please update your editor appropriately.''' + endif + + " Stop here, as it won't work. + finish +endif + +if has('nvim') && !has('nvim-0.2.0') && !get(g:, 'ale_use_deprecated_neovim') + execute 'echom ''ALE support for NeoVim versions below 0.2.0 is deprecated.''' + execute 'echom ''Use `let g:ale_use_deprecated_neovim = 1` to silence this warning for now.''' +endif + +" This flag can be set to 0 to disable emitting conflict warnings. +let g:ale_emit_conflict_warnings = get(g:, 'ale_emit_conflict_warnings', 1) + +if g:ale_emit_conflict_warnings +\&& match(&runtimepath, '[/\\]ale[/\\]after') < 0 + " Add the after directory to the runtimepath + " This is only done if the after directory isn't already in runtimepath + let &runtimepath .= ',' . expand(':p:h:h') . '/after' +endif + +" Set this flag so that other plugins can use it, like airline. +let g:loaded_ale = 1 + +" Set the TMPDIR environment variable if it is not set automatically. +" This can automatically fix some environments. +if has('unix') && empty($TMPDIR) + let $TMPDIR = '/tmp' +endif + +" This global variable is used internally by ALE for tracking information for +" each buffer which linters are being run against. +let g:ale_buffer_info = {} + +" User Configuration + +" This option prevents ALE autocmd commands from being run for particular +" filetypes which can cause issues. +let g:ale_filetype_blacklist = [ +\ 'dirvish', +\ 'nerdtree', +\ 'qf', +\ 'tags', +\ 'unite', +\] + +" This Dictionary configures which linters are enabled for which languages. +call ale#Set('linters', {}) +" This option can be changed to only enable explicitly selected linters. +call ale#Set('linters_explicit', 0) + +" This Dictionary configures which functions will be used for fixing problems. +let g:ale_fixers = get(g:, 'ale_fixers', {}) + +" This Dictionary allows users to set up filetype aliases for new filetypes. +let g:ale_linter_aliases = get(g:, 'ale_linter_aliases', {}) + +" This flag can be set with a number of milliseconds for delaying the +" execution of a linter when text is changed. The timeout will be set and +" cleared each time text is changed, so repeated edits won't trigger the +" jobs for linting until enough time has passed after editing is done. +let g:ale_lint_delay = get(g:, 'ale_lint_delay', 200) + +" This flag can be set to 'never' to disable linting when text is changed. +" This flag can also be set to 'insert' or 'normal' to lint when text is +" changed only in insert or normal mode respectively. +let g:ale_lint_on_text_changed = get(g:, 'ale_lint_on_text_changed', 'always') + +" This flag can be set to 1 to enable linting when leaving insert mode. +let g:ale_lint_on_insert_leave = get(g:, 'ale_lint_on_insert_leave', 0) + +" This flag can be set to 0 to disable linting when the buffer is entered. +let g:ale_lint_on_enter = get(g:, 'ale_lint_on_enter', 1) + +" This flag can be set to 1 to enable linting when a buffer is written. +let g:ale_lint_on_save = get(g:, 'ale_lint_on_save', 1) + +" This flag can be set to 1 to enable linting when the filetype is changed. +let g:ale_lint_on_filetype_changed = get(g:, 'ale_lint_on_filetype_changed', 1) + +call ale#Set('fix_on_save', 0) + +" This flag may be set to 0 to disable ale. After ale is loaded, :ALEToggle +" should be used instead. +let g:ale_enabled = get(g:, 'ale_enabled', 1) + +" These flags dictates if ale uses the quickfix or the loclist (loclist is the +" default, quickfix overrides loclist). +let g:ale_set_loclist = get(g:, 'ale_set_loclist', 1) +let g:ale_set_quickfix = get(g:, 'ale_set_quickfix', 0) + +" This flag dictates if ale open the configured loclist +let g:ale_open_list = get(g:, 'ale_open_list', 0) + +" This flag dictates if ale keeps open loclist even if there is no error in loclist +let g:ale_keep_list_window_open = get(g:, 'ale_keep_list_window_open', 0) + +" This flag dictates that quickfix windows should be opened vertically +let g:ale_list_vertical = get(g:, 'ale_list_vertical', 0) + +" The window size to set for the quickfix and loclist windows +call ale#Set('list_window_size', 10) + +" This flag can be set to 0 to disable setting signs. +" This is enabled by default only if the 'signs' feature exists. +let g:ale_set_signs = get(g:, 'ale_set_signs', has('signs')) +" This flag can be set to some integer to control the maximum number of signs +" that ALE will set. +let g:ale_max_signs = get(g:, 'ale_max_signs', -1) + +" This flag can be set to 1 to enable changing the sign column colors when +" there are errors. +call ale#Set('change_sign_column_color', 0) + +" This flag can be set to 0 to disable setting error highlights. +let g:ale_set_highlights = get(g:, 'ale_set_highlights', has('syntax')) + +" These variables dictate what sign is used to indicate errors and warnings. +call ale#Set('sign_error', '>>') +call ale#Set('sign_style_error', g:ale_sign_error) +call ale#Set('sign_warning', '--') +call ale#Set('sign_style_warning', g:ale_sign_warning) +call ale#Set('sign_info', g:ale_sign_warning) + +" This variable sets an offset which can be set for sign IDs. +" This ID can be changed depending on what IDs are set for other plugins. +" The dummy sign will use the ID exactly equal to the offset. +let g:ale_sign_offset = get(g:, 'ale_sign_offset', 1000000) + +" This flag can be set to 1 to keep sign gutter always open +let g:ale_sign_column_always = get(g:, 'ale_sign_column_always', 0) + +" A string format for the echoed message +call ale#Set('echo_msg_format', '%code: %%s') +" The same for the loclist. +call ale#Set('loclist_msg_format', g:ale_echo_msg_format) + +" Strings used for severity in the echoed message +let g:ale_echo_msg_error_str = get(g:, 'ale_echo_msg_error_str', 'Error') +let g:ale_echo_msg_info_str = get(g:, 'ale_echo_msg_info_str', 'Info') +let g:ale_echo_msg_warning_str = get(g:, 'ale_echo_msg_warning_str', 'Warning') + +" This flag can be set to 0 to disable echoing when the cursor moves. +let g:ale_echo_cursor = get(g:, 'ale_echo_cursor', 1) +" Controls the milliseconds delay before echoing a message. +let g:ale_echo_delay = get(g:, 'ale_echo_delay', 10) + +" This flag can be set to 0 to disable balloon support. +call ale#Set('set_balloons', has('balloon_eval')) + +" A deprecated setting for ale#statusline#Status() +" See :help ale#statusline#Count() for getting status reports. +let g:ale_statusline_format = get(g:, 'ale_statusline_format', +\ ['%d error(s)', '%d warning(s)', 'OK'] +\) + +" This flag can be set to 0 to disable warnings for trailing whitespace +call ale#Set('warn_about_trailing_whitespace', 1) +" This flag can be set to 0 to disable warnings for trailing blank lines +call ale#Set('warn_about_trailing_blank_lines', 1) + +" A flag for controlling the maximum size of the command history to store. +let g:ale_max_buffer_history_size = get(g:, 'ale_max_buffer_history_size', 20) + +" A flag for enabling or disabling the command history. +let g:ale_history_enabled = get(g:, 'ale_history_enabled', 1) + +" A flag for storing the full output of commands in the history. +let g:ale_history_log_output = get(g:, 'ale_history_log_output', 1) + +" A flag for caching failed executable checks. +" This is off by default, because it will cause problems. +call ale#Set('cache_executable_check_failures', 0) + +" A dictionary mapping regular expression patterns to arbitrary buffer +" variables to be set. Useful for configuration ALE based on filename +" patterns. +call ale#Set('pattern_options', {}) +call ale#Set('pattern_options_enabled', !empty(g:ale_pattern_options)) + +" A maximum file size for checking for errors. +call ale#Set('maximum_file_size', 0) + +" Remapping of linter problems. +call ale#Set('type_map', {}) + +" Enable automatic completion with LSP servers and tsserver +call ale#Set('completion_enabled', 0) +call ale#Set('completion_delay', 100) +call ale#Set('completion_max_suggestions', 50) + +" A setting for wrapping commands. +call ale#Set('command_wrapper', '') + +if g:ale_set_balloons + call ale#balloon#Enable() +endif + +if g:ale_completion_enabled + call ale#completion#Enable() +endif + +" Define commands for moving through warnings and errors. +command! -bar ALEPrevious :call ale#loclist_jumping#Jump('before', 0) +command! -bar ALEPreviousWrap :call ale#loclist_jumping#Jump('before', 1) +command! -bar ALENext :call ale#loclist_jumping#Jump('after', 0) +command! -bar ALENextWrap :call ale#loclist_jumping#Jump('after', 1) +command! -bar ALEFirst :call ale#loclist_jumping#JumpToIndex(0) +command! -bar ALELast :call ale#loclist_jumping#JumpToIndex(-1) + +" A command for showing error details. +command! -bar ALEDetail :call ale#cursor#ShowCursorDetail() + +" Define commands for turning ALE on or off. +command! -bar ALEToggle :call ale#toggle#Toggle() +command! -bar ALEEnable :call ale#toggle#Enable() +command! -bar ALEDisable :call ale#toggle#Disable() +command! -bar ALEReset :call ale#toggle#Reset() +" Commands for turning ALE on or off for a buffer. +command! -bar ALEToggleBuffer :call ale#toggle#ToggleBuffer(bufnr('')) +command! -bar ALEEnableBuffer :call ale#toggle#EnableBuffer(bufnr('')) +command! -bar ALEDisableBuffer :call ale#toggle#DisableBuffer(bufnr('')) +command! -bar ALEResetBuffer :call ale#toggle#ResetBuffer(bufnr('')) +" A command to stop all LSP-like clients, including tsserver. +command! -bar ALEStopAllLSPs :call ale#lsp#reset#StopAllLSPs() + +" A command for linting manually. +command! -bar ALELint :call ale#Queue(0, 'lint_file') + +" Define a command to get information about current filetype. +command! -bar ALEInfo :call ale#debugging#Info() +" The same, but copy output to your clipboard. +command! -bar ALEInfoToClipboard :call ale#debugging#InfoToClipboard() + +" Fix problems in files. +command! -bar ALEFix :call ale#fix#Fix() +" Suggest registered functions to use for fixing problems. +command! -bar ALEFixSuggest :call ale#fix#registry#Suggest(&filetype) + +" Go to definition for tsserver and LSP +command! -bar ALEGoToDefinition :call ale#definition#GoTo({}) +command! -bar ALEGoToDefinitionInTab :call ale#definition#GoTo({'open_in_tab': 1}) + +" mappings for commands +nnoremap (ale_previous) :ALEPrevious +nnoremap (ale_previous_wrap) :ALEPreviousWrap +nnoremap (ale_next) :ALENext +nnoremap (ale_next_wrap) :ALENextWrap +nnoremap (ale_first) :ALEFirst +nnoremap (ale_last) :ALELast +nnoremap (ale_toggle) :ALEToggle +nnoremap (ale_enable) :ALEEnable +nnoremap (ale_disable) :ALEDisable +nnoremap (ale_reset) :ALEReset +nnoremap (ale_toggle_buffer) :ALEToggleBuffer +nnoremap (ale_enable_buffer) :ALEEnableBuffer +nnoremap (ale_disable_buffer) :ALEDisableBuffer +nnoremap (ale_reset_buffer) :ALEResetBuffer +nnoremap (ale_lint) :ALELint +nnoremap (ale_detail) :ALEDetail +nnoremap (ale_fix) :ALEFix +nnoremap (ale_go_to_definition) :ALEGoToDefinition +nnoremap (ale_go_to_definition_in_tab) :ALEGoToDefinitionInTab + +" Set up autocmd groups now. +call ale#toggle#InitAuGroups() + +" Housekeeping + +augroup ALECleanupGroup + autocmd! + " Clean up buffers automatically when they are unloaded. + autocmd BufDelete * call ale#engine#Cleanup(str2nr(expand(''))) + autocmd QuitPre * call ale#events#QuitEvent(str2nr(expand(''))) +augroup END + +" Backwards Compatibility + +function! ALELint(delay) abort + if !get(g:, 'ale_deprecation_ale_lint', 0) + execute 'echom ''ALELint() is deprecated, use ale#Queue() instead.''' + let g:ale_deprecation_ale_lint = 1 + endif + + call ale#Queue(a:delay) +endfunction + +function! ALEGetStatusLine() abort + if !get(g:, 'ale_deprecation_ale_get_status_line', 0) + execute 'echom ''ALEGetStatusLine() is deprecated.''' + let g:ale_deprecation_ale_get_status_line = 1 + endif + + return ale#statusline#Status() +endfunction diff --git a/sources_non_forked/ale/syntax/ale-fix-suggest.vim b/sources_non_forked/ale/syntax/ale-fix-suggest.vim new file mode 100644 index 00000000..b112f5b5 --- /dev/null +++ b/sources_non_forked/ale/syntax/ale-fix-suggest.vim @@ -0,0 +1,13 @@ +if exists('b:current_syntax') + finish +endif + +syn match aleFixerComment /^.*$/ +syn match aleFixerName /\(^\|, \)'[^']*'/ +syn match aleFixerHelp /^See :help ale-fix-configuration/ + +hi def link aleFixerComment Comment +hi def link aleFixerName String +hi def link aleFixerHelp Statement + +let b:current_syntax = 'ale-fix-suggest' diff --git a/sources_non_forked/syntastic/.gitignore b/sources_non_forked/syntastic/.gitignore deleted file mode 100644 index cc07c931..00000000 --- a/sources_non_forked/syntastic/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -*~ -*.swp -tags -.DS_Store diff --git a/sources_non_forked/syntastic/CONTRIBUTING.md b/sources_non_forked/syntastic/CONTRIBUTING.md deleted file mode 100644 index 44eb13f8..00000000 --- a/sources_non_forked/syntastic/CONTRIBUTING.md +++ /dev/null @@ -1,105 +0,0 @@ -# CONTRIBUTING -- - - -1\. [Bug reports / GitHub issues](#bugreps) -2\. [Submitting a patch](#patches) -3\. [General style notes](#generalstyle) -4\. [Syntax checker notes](#checkerstyle) -- - - - - - -## 1. Bug reports / GitHub issues - -Please note that the preferred channel for posting bug reports is the -[issue tracker at GitHub][bug_tracker]. Reports posted elsewhere are less likely -to be seen by the core team. - -When reporting a bug make sure you search the existing GitHub issues -for the same/similar issues. If you find one, feel free to add a `+1` -comment with any additional information that may help us solve the -issue. - -When creating a new issue be sure to state the following: - -* steps to reproduce the bug; -* the version of Vim you are using (run `:ver` to find out); -* the version of syntastic you are using (see `:SyntasticInfo`). - -For syntax checker bugs also state the version of the checker executable -that you are using. Adding debugging information is typically useful -too: - -* open a file handled by your checker; -* set `g:syntastic_debug` to 1 or 3; -* run the checker; -* copy the output of `:mes`. - - - -## 2. Submitting a patch - -Before you consider adding features to syntastic, _please_ spend a few minutes -(re-)reading the latest version of the [manual][manual]. Syntastic is changing -rapidly at times, and it's possible that some features you want to add exist -already. - -To submit a patch: - -* fork the [repo][github] on GitHub; -* make a [topic branch][branches] and start hacking; -* submit a pull request based off your topic branch. - -Small, focused patches are preferred. - -Large changes to the code should be discussed with the core team first. -Create an issue and explain your plan and see what we say. - -Also, make sure to update the manual whenever applicable. Nobody can use -features that aren't documented. - - - -## 3. General style notes - -Follow the coding conventions/styles used in the syntastic core: - -* use 4 space indents; -* don't use abbreviated keywords - e.g. use `endfunction`, not `endfun` -(there's always room for more fun!); -* don't use `l:` prefixes for variables unless actually required (i.e. -almost never); -* code for maintainability; we would rather a function be a couple of -lines longer and have (for example) some [explaining variables][variables] to -aid readability. - - - -## 4. Syntax checker notes - -Make sure to read the [guide][guide] if you plan to add new syntax checkers. - -Use the existing checkers as templates, rather than writing everything -from scratch. - -The preferred style for error format strings is one "clause" per line. -E.g. (from the `coffee` checker): - -```vim -let errorformat = - \ '%E%f:%l:%c: %trror: %m,' . - \ 'Syntax%trror: In %f\, %m on line %l,' . - \ '%EError: In %f\, Parse error on line %l: %m,' . - \ '%EError: In %f\, %m on line %l,' . - \ '%W%f(%l): lint warning: %m,' . - \ '%W%f(%l): warning: %m,' . - \ '%E%f(%l): SyntaxError: %m,' . - \ '%-Z%p^,' . - \ '%-G%.%#' -``` - -[bug_tracker]: https://github.com/vim-syntastic/syntastic/issues -[manual]: https://github.com/vim-syntastic/syntastic/blob/master/doc/syntastic.txt -[github]: https://github.com/vim-syntastic/syntastic -[branches]: https://github.com/dchelimsky/rspec/wiki/Topic-Branches#using-topic-branches-when-contributing-patches -[variables]: http://www.refactoring.com/catalog/extractVariable.html -[guide]: https://github.com/vim-syntastic/syntastic/wiki/Syntax-Checker-Guide diff --git a/sources_non_forked/syntastic/LICENCE b/sources_non_forked/syntastic/LICENCE deleted file mode 100644 index 8b1a9d81..00000000 --- a/sources_non_forked/syntastic/LICENCE +++ /dev/null @@ -1,13 +0,0 @@ - DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE - Version 2, December 2004 - -Copyright (C) 2004 Sam Hocevar - -Everyone is permitted to copy and distribute verbatim or modified -copies of this license document, and changing it is allowed as long -as the name is changed. - - DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. You just DO WHAT THE FUCK YOU WANT TO. diff --git a/sources_non_forked/syntastic/README.markdown b/sources_non_forked/syntastic/README.markdown deleted file mode 100644 index d78d6e9e..00000000 --- a/sources_non_forked/syntastic/README.markdown +++ /dev/null @@ -1,546 +0,0 @@ - , - / \,,_ .'| - ,{{| /}}}}/_.' _____________________________________________ - }}}}` '{{' '. / \ - {{{{{ _ ;, \ / Ladies and Gentlemen, \ - ,}}}}}} /o`\ ` ;) | | - {{{{{{ / ( | this is ... | - }}}}}} | \ | | - {{{{{{{{ \ \ | | - }}}}}}}}} '.__ _ | | _____ __ __ _ | - {{{{{{{{ /`._ (_\ / | / ___/__ ______ / /_____ ______/ /_(_)____ | - }}}}}}' | //___/ --=: \__ \/ / / / __ \/ __/ __ `/ ___/ __/ / ___/ | - jgs `{{{{` | '--' | ___/ / /_/ / / / / /_/ /_/ (__ ) /_/ / /__ | - }}}` | /____/\__, /_/ /_/\__/\__,_/____/\__/_/\___/ | - | /____/ | - | / - \_____________________________________________/ - - -- - - -1. [Introduction](#introduction) -2. [Installation](#installation) -2.1. [Requirements](#requirements) -2.2. [Installing syntastic with Pathogen](#installpathogen) -3. [Recommended settings](#settings) -4. [FAQ](#faq) -4.1. [I installed syntastic but it isn't reporting any errors...](#faqinfo) -4.2. [Syntastic supports several checkers for my filetype, how do I tell it which one(s) to use?](#faqcheckers) -4.3. [How can I run checkers for "foreign" filetypes against the current file?](#faqforeign) -4.4. [I have enabled multiple checkers for the current filetype. How can I display all errors from all checkers together?](#faqaggregate) -4.5. [How can I pass additional arguments to a checker?](#faqargs) -4.6. [I run a checker and the location list is not updated...](#faqloclist) -4.6. [I run`:lopen` or `:lwindow` and the error window is empty...](#faqloclist) -4.7. [How can I jump between the different errors without using the location list at the bottom of the window?](#faqlnext) -4.8. [The error window is closed automatically when I `:quit` the current buffer but not when I `:bdelete` it?](#faqbdelete) -4.9. [My favourite checker needs to load a configuration file from the project's root rather than the current directory...](#faqconfig) -4.10. [What is the difference between syntax checkers and style checkers?](#faqstyle) -4.11. [How can I check scripts written for different versions of Python?](#faqpython) -4.12. [How can I check scripts written for different versions of Ruby?](#faqruby) -4.13. [The `perl` checker has stopped working...](#faqperl) -4.14. [What happened to the `rustc` checker?](#faqrust) -4.15. [What happened to the `tsc` checker?](#faqtsc) -4.16. [What happened to the `xcrun` checker?](#faqxcrun) -5. [Resources](#otherresources) - -- - - - - - -## 1\. Introduction - -Syntastic is a syntax checking plugin for [Vim][vim] created by -[Martin Grenfell][scrooloose]. It runs files through external syntax checkers -and displays any resulting errors to the user. This can be done on demand, or -automatically as files are saved. If syntax errors are detected, the user is -notified and is happy because they didn't have to compile their code or execute -their script to find them. - -At the time of this writing, syntastic has checking plugins for ACPI -Source Language, ActionScript, Ada, Ansible configurations, API Blueprint, -AppleScript, AsciiDoc, Assembly languages, BEMHTML, Bro, Bourne shell, C, C++, -C#, Cabal, Chef, CMake, CoffeeScript, Coco, Coq, CSS, Cucumber, CUDA, D, Dart, -DocBook, Dockerfile, Dust, Elixir, Erlang, eRuby, Fortran, Gentoo metadata, -GLSL, Go, Haml, Haskell, Haxe, Handlebars, HSS, HTML, Java, JavaScript, JSON, -JSX, Julia, LESS, Lex, Limbo, LISP, LLVM intermediate language, Lua, Markdown, -MATLAB, Mercury, NASM, Nix, Objective-C, Objective-C++, OCaml, Perl, Perl -6, Perl POD, PHP, gettext Portable Object, OS X and iOS property lists, Pug -(formerly Jade), Puppet, Python, QML, R, Racket, RDF TriG, RDF Turtle, Relax -NG, reStructuredText, RPM spec, Ruby, SASS/SCSS, Scala, Slim, SML, Solidity, -Sphinx, SQL, Stylus, Tcl, TeX, Texinfo, Twig, TypeScript, Vala, Verilog, VHDL, -Vim help, VimL, Vue.js, xHtml, XML, XSLT, XQuery, YACC, YAML, YANG data models, -YARA rules, z80, Zope page templates, and Zsh. See the [manual][checkers] for -details about the corresponding supported checkers (`:help syntastic-checkers` -in Vim). - -A number of third-party Vim plugins also provide checkers for syntastic, for -example: [merlin][merlin], [omnisharp-vim][omnisharp], [rust.vim][rust], -[syntastic-extras][myint], [syntastic-more][roktas], [tsuquyomi][tsuquyomi], -[vim-crystal][crystal], [vim-eastwood][eastwood], and [vim-swift][swift]. - -Below is a screenshot showing the methods that Syntastic uses to display syntax -errors. Note that, in practise, you will only have a subset of these methods -enabled. - -![Screenshot 1][screenshot] - -1. Errors are loaded into the location list for the corresponding window. -2. When the cursor is on a line containing an error, the error message is echoed in the command window. -3. Signs are placed beside lines with errors - note that warnings are displayed in a different color. -4. There is a configurable statusline flag you can include in your statusline config. -5. Hover the mouse over a line containing an error and the error message is displayed as a balloon. -6. (not shown) Highlighting errors with syntax highlighting. Erroneous parts of lines can be highlighted. - - - -## 2\. Installation - - - -### 2.1\. Requirements - -Syntastic itself has rather relaxed requirements: it doesn't have any external -dependencies, and it needs a version of [Vim][vim] compiled with a few common -features: `autocmd`, `eval`, `file_in_path`, `modify_fname`, `quickfix`, -`reltime`, `statusline`, and `user_commands`. Not all possible combinations of -features that include the ones above make equal sense on all operating systems, -but Vim version 7 or later with the "normal", "big", or "huge" feature sets -should be fine. - -Syntastic should work with any modern plugin managers for Vim, such as -[NeoBundle][neobundle], [Pathogen][pathogen], [Vim-Addon-Manager][vam], -[Vim-Plug][plug], or [Vundle][vundle]. Instructions for installing syntastic -with [Pathogen][pathogen] are included below for completeness. - -Starting with Vim version 7.4.1486 you can also load syntastic using the -standard mechanism of packages, without the help of third-party plugin managers -(see `:help packages` in Vim for details). Beware however that, while support -for packages has been added in Vim 7.4.1384, the functionality needed by -syntastic is present only in versions 7.4.1486 and later. - -Last but not least: syntastic doesn't know how to do any syntax checks by -itself. In order to get meaningful results you need to install external -checkers corresponding to the types of files you use. Please consult the -[manual][checkers] (`:help syntastic-checkers` in Vim) for a list of supported -checkers. - - - -### 2.2\. Installing syntastic with Pathogen - -If you already have [Pathogen][pathogen] working then skip [Step 1](#step1) and go to -[Step 2](#step2). - - - -#### 2.2.1\. Step 1: Install pathogen.vim - -First I'll show you how to install Tim Pope's [Pathogen][pathogen] so that it's easy to -install syntastic. Do this in your terminal so that you get the `pathogen.vim` -file and the directories it needs: -```sh -mkdir -p ~/.vim/autoload ~/.vim/bundle && \ -curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim -``` -Next you *need* to add this to your `~/.vimrc`: -```vim -execute pathogen#infect() -``` - - - -#### 2.2.2\. Step 2: Install syntastic as a Pathogen bundle - -You now have pathogen installed and can put syntastic into `~/.vim/bundle` like -this: -```sh -cd ~/.vim/bundle && \ -git clone --depth=1 https://github.com/vim-syntastic/syntastic.git -``` -Quit vim and start it back up to reload it, then type: -```vim -:Helptags -``` -If you get an error when you do this, then you probably didn't install -[Pathogen][pathogen] right. Go back to [Step 1](#step1) and make sure you did the -following: - -1. Created both the `~/.vim/autoload` and `~/.vim/bundle` directories. -2. Added the `execute pathogen#infect()` line to your `~/.vimrc` file -3. Did the `git clone` of syntastic inside `~/.vim/bundle` -4. Have permissions to access all of these directories. - - - -## 3\. Recommended settings - -Syntastic has numerous options that can be configured, and the defaults -are not particularly well suitable for new users. It is recommended -that you start by adding the following lines to your `vimrc` file, and -return to them after reading the manual (see `:help syntastic` in Vim): -```vim -set statusline+=%#warningmsg# -set statusline+=%{SyntasticStatuslineFlag()} -set statusline+=%* - -let g:syntastic_always_populate_loc_list = 1 -let g:syntastic_auto_loc_list = 1 -let g:syntastic_check_on_open = 1 -let g:syntastic_check_on_wq = 0 -``` - - - -## 4\. FAQ - - - -__4.1. Q. I installed syntastic but it isn't reporting any errors...__ - -A. The most likely reason is that none of the syntax checkers that it requires -are installed. For example: by default, python requires either `flake8` or -`pylint` to be installed and in your `$PATH`. Read the [manual][checkers] -(`:help syntastic-checkers` in Vim) to find out what executables are -supported. Note that aliases do not work; the actual executables must be -available in your `$PATH`. Symbolic links are okay though. You can see -syntastic's idea of available checkers by running `:SyntasticInfo`. - -A second probable reason is that none of the available checkers are -enabled. Syntastic comes preconfigured with a default list of enabled checkers -per filetype, but this list is kept short in order to prevent slowing down Vim -or trying to run conflicting checks. The command `:SyntasticInfo` will show you -which checkers are enabled. You can tell syntastic which checkers (among the -available ones) you want to run by setting `g:syntastic__checkers` in -your `vimrc` (see [below](#faqcheckers)). - -A third possible reason is that the `$PATH` seen by syntastic might not be same -as the `$PATH` in your login shell. Syntastic runs checkers using the shell -pointed to by Vim's `shell` (or by `g:syntastic_shell`, if set), and that's the -shell you need to configure to set the proper `$PATH` and environment variables -for your checkers. You can see syntastic's idea of `$PATH` by running -```vim -:echo syntastic#util#system('echo "$PATH"') -``` -on UNIX and Mac OS-X systems, or -```vim -:echo syntastic#util#system('echo %PATH%') -``` -on Windows. - -Finally, another reason it could fail is that either the command line options -or the error output for a syntax checker may have changed. In this case, make -sure you have the latest version of the syntax checker installed. If it still -fails then post an [issue][bug_tracker] - or better yet, create a pull request. - - - -__4.2. Q. Syntastic supports several checkers for my filetype, how do I tell it -which one(s) to use?__ - -A. Add a line like this to your `vimrc`: -```vim -let g:syntastic__checkers = [''] -``` - -To see the list of supported checkers for your filetype read the -[manual][checkers] (`:help syntastic-checkers` in Vim). - -For example, Python has the following checkers, among others: `flake8`, -`pyflakes`, `pylint` and a native `python` checker. To tell syntastic to use -`pylint`, you would use this setting: -```vim -let g:syntastic_python_checkers = ['pylint'] -``` - -Checkers can be chained together like this: -```vim -let g:syntastic_php_checkers = ['php', 'phpcs', 'phpmd'] -``` - -This is telling syntastic to run the `php` checker first, and if no errors are -found, run `phpcs`, and then `phpmd`. - -You can also run checkers explicitly by calling `:SyntasticCheck `. -For example to run `phpcs` and `phpmd`: -```vim -:SyntasticCheck phpcs phpmd -``` - -This works for any checkers available for the current filetype, even if they -aren't listed in `g:syntastic__checkers`. - - - -__4.3. Q. How can I run checkers for "foreign" filetypes against the current -file?__ - -A. You need to qualify the name of the "foreign" checker with the name -of its filetype. For example to check `tex` files with the checker -`language_check` (which normally acts only on files of type `text`), you can -add `text/language_check` to the list fo checkers for `tex`: -```vim -let g:syntastic_tex_checkers = ['lacheck', 'text/language_check'] -``` - -This also works with `:SyntasticCheck`, e.g. the following command runs -`text/language_check` against the current file regardless of the current -filetype: -```vim -:SyntasticCheck text/language_check -``` - -Of course, the checkers specified this way need to be known to syntastic, and -they need to be shown as available when you run `:SyntasticInfo`. You can't -just make up a combination of a filetype and a program name and expect it to -work as a checker. - - - -__4.4. Q. I have enabled multiple checkers for the current filetype. How can I -display all errors from all checkers together?__ - -A. Set `g:syntastic_aggregate_errors` to 1 in your `vimrc`: -```vim -let g:syntastic_aggregate_errors = 1 -``` - -See `:help syntastic-aggregating-errors` for more details. - - - -__4.5. Q. How can I pass additional arguments to a checker?__ - -A. In most cases a command line is constructed using an internal function -named `makeprgBuild()`, which provides a number of options that allow you to -customise every part of the command that gets run. You can set these options -using global variables. - -The general form of the global `args` variable is -`syntastic___args`. Thus if you wanted to pass -`--my --args --here` to the Ruby `mri` checker you would add this line to your -`vimrc`: -```vim -let g:syntastic_ruby_mri_args = "--my --args --here" -``` - -See `:help syntastic-checker-options` for more information. - -A number of checkers don't use the `makeprgBuild()` function mentioned above, -or have additional options that can be configured. For these checkers the exact -list of options should be included in the [manual][checkers] -(`:help syntastic-checkers` in Vim). - - - -__4.6. Q. I run a checker and the location list is not updated...__ -__4.6. Q. I run`:lopen` or `:lwindow` and the error window is empty...__ - -A. By default the location list is changed only when you run the `:Errors` -command, in order to minimise conflicts with other plugins. If you want the -location list to always be updated when you run the checkers, add this line to -your `vimrc`: -```vim -let g:syntastic_always_populate_loc_list = 1 -``` - - - -__4.7. Q. How can I jump between the different errors without using the location -list at the bottom of the window?__ - -A. Vim provides several built-in commands for this. See `:help :lnext` and -`:help :lprevious`. - -If you use these commands a lot then you may want to add shortcut mappings to -your `vimrc`, or install something like [unimpaired][unimpaired], which provides such -mappings (among other things). - - - -__4.8. Q. The error window is closed automatically when I `:quit` the current buffer -but not when I `:bdelete` it?__ - -A. There is no safe way to handle that situation automatically, but you can -work around it: -```vim -nnoremap :lclose:bdelete -cabbrev bd =(getcmdtype()==#':' && getcmdpos()==1 ? 'lclose\|bdelete' : 'bd') -``` - - - -__4.9. My favourite checker needs to load a configuration file from the -project's root rather than the current directory...__ - -A. You can set up an `autocmd` to search for the configuration file in the -current directory and upwards, and add it to the checker's options when found. -For example for `jscs`: - -```vim -function! FindConfig(prefix, what, where) - let cfg = findfile(a:what, escape(a:where, ' ') . ';') - return cfg !=# '' ? ' ' . a:prefix . ' ' . shellescape(cfg) : '' -endfunction - -autocmd FileType javascript let b:syntastic_javascript_jscs_args = - \ get(g:, 'syntastic_javascript_jscs_args', '') . - \ FindConfig('-c', '.jscsrc', expand(':p:h', 1)) -``` - - - -__4.10. Q. What is the difference between syntax checkers and style checkers?__ - -A. The errors and warnings they produce are highlighted differently and can -be filtered by different rules, but otherwise the distinction is pretty much -arbitrary. There is an ongoing effort to keep things consistent, so you can -_generally_ expect messages produced by syntax checkers to be _mostly_ related -to syntax, and messages produced by style checkers to be _mostly_ about style. -But there can be no formal guarantee that, say, a style checker that runs into -a syntax error wouldn't die with a fatal message, nor that a syntax checker -wouldn't give you warnings against using some constructs as being bad practice. -There is also no guarantee that messages marked as `style` are less severe than -the ones marked as `syntax` (whatever that might mean). And there are even a -few Frankenstein checkers (for example `flake8` and `pylama`) that, by their -nature, produce both kinds of messages. Syntastic is not smart enough to be -able to sort out these things by itself. - -Generally it's more useful to look at this from the perspective of filtering -unwanted messages, rather than as an indicator of severity levels. The -distinction between syntax and style is orthogonal to the distinction between -errors and warnings, and thus you can turn off messages based on level, on -type, or both. - -e.g. To disable all style messages: -```vim -let g:syntastic_quiet_messages = { "type": "style" } -``` -See `:help syntastic_quiet_messages` for more information. - - - -__4.11. Q. How can I check scripts written for different versions of Python?__ - -A. Install a Python version manager such as [virtualenv][virtualenv] -or [pyenv][pyenv], activate the environment for the relevant version -of Python, and install in it the checkers you want to use. Set -`g:syntastic_python_checkers` accordingly in your `vimrc`, and run [Vim][vim] -from the virtual environment. - -If you're starting Vim from a desktop manager rather than from a terminal you -might need to write wrapper scripts around your checkers, to activate the -virtual environment before running the actual checks. Then you'll need to -point the relevant `g:syntastic_python__exec` variables to the wrapper -scripts. - - - -__4.12. Q. How can I check scripts written for different versions of Ruby?__ - -A. Install a Ruby version manager such as [rvm][rvm] or [rbenv][rbenv], -activate the relevant version of Ruby, and install in it the checkers you want -to use. Set `g:syntastic_ruby_checkers` accordingly in your `vimrc`, and run -[Vim][vim] under the relevant Ruby version. - -If you're starting Vim from a desktop manager rather than from a terminal -and depending on the version manager you use you might need to write wrapper -scripts around your checkers, to activate the relevant version of Ruby -before running the actual checks. Then you'll need to point the relevant -`g:syntastic_ruby__exec` variables to the wrapper scripts. - - - -__4.13. Q. The `perl` checker has stopped working...__ - -A. The `perl` checker runs `perl -c` against your file, which in turn -__executes__ any `BEGIN`, `UNITCHECK`, and `CHECK` blocks, and any `use` -statements in your file (cf. [perlrun][perlrun]). This is probably fine if you -wrote the file yourself, but it's a security problem if you're checking -third-party files. Since there is currently no way to disable this behaviour -while still producing useful results, the checker is now disabled by default. -To (re-)enable it, make sure the `g:syntastic_perl_checkers` list includes -`perl`, and set `g:syntastic_enable_perl_checker` to 1 in your `vimrc`: -```vim -let g:syntastic_enable_perl_checker = 1 -``` - - - -__4.14. Q. What happened to the `rustc` checker?__ - -A. It is now part of the [rust.vim][rust] plugin. If you install this plugin the -checker should be picked up automatically by syntastic. - - - -__4.15. Q. What happened to the `tsc` checker?__ - -A. It didn't meet people's expectations and it has been removed. The plugin -[tsuquyomi][tsuquyomi] comes packaged with a checker for TypeScript. If you -install this plugin the checker should be picked up automatically by syntastic. - - - -__4.16. Q. What happened to the `xcrun` checker?__ - -A. The `xcrun` checker used to have a security problem and it has been removed. -A better checker for __Swift__ is part of the [vim-swift][swift] plugin. If you -install this plugin the checker should be picked up automatically by syntastic. - - - -## 5\. Resources - -The preferred place for posting suggestions, reporting bugs, and general -discussions related to syntastic is the [issue tracker at GitHub][bug_tracker]. -A guide for writing syntax checkers can be found in the [wiki][guide]. -There are also a dedicated [google group][google_group], and a -[syntastic tag at StackOverflow][stack_overflow]. - -Syntastic aims to provide a common interface to syntax checkers for as many -languages as possible. For particular languages, there are, of course, other -plugins that provide more functionality than syntastic. You might want to take -a look at [ghcmod-vim][ghcmod], [jedi-vim][jedi], [python-mode][python_mode], [vim-go][vimgo], or -[YouCompleteMe][ycm]. - -[scrooloose]: https://github.com/scrooloose -[screenshot]: https://github.com/vim-syntastic/syntastic/raw/master/_assets/screenshot_1.png - -[bug_tracker]: https://github.com/vim-syntastic/syntastic/issues -[checkers]: https://github.com/vim-syntastic/syntastic/blob/master/doc/syntastic-checkers.txt -[crystal]: https://github.com/rhysd/vim-crystal -[eastwood]: https://github.com/venantius/vim-eastwood -[ghcmod]: https://github.com/eagletmt/ghcmod-vim -[google_group]: https://groups.google.com/group/vim-syntastic -[guide]: https://github.com/vim-syntastic/syntastic/wiki/Syntax-Checker-Guide -[jedi]: https://github.com/davidhalter/jedi-vim -[merlin]: https://github.com/the-lambda-church/merlin -[myint]: https://github.com/myint/syntastic-extras -[neobundle]: https://github.com/Shougo/neobundle.vim -[omnisharp]: https://github.com/OmniSharp/omnisharp-vim -[pathogen]: https://github.com/tpope/vim-pathogen -[perlrun]: http://perldoc.perl.org/perlrun.html#*-c* -[plug]: https://github.com/junegunn/vim-plug/ -[pyenv]: https://github.com/yyuu/pyenv -[python_mode]: https://github.com/klen/python-mode -[rbenv]: https://github.com/rbenv/rbenv -[roktas]: https://github.com/roktas/syntastic-more -[rust]: https://github.com/rust-lang/rust.vim -[rvm]: https://rvm.io/ -[stack_overflow]: http://stackoverflow.com/questions/tagged/syntastic -[swift]: https://github.com/kballard/vim-swift -[tsuquyomi]: https://github.com/Quramy/tsuquyomi/ -[unimpaired]: https://github.com/tpope/vim-unimpaired -[vam]: https://github.com/MarcWeber/vim-addon-manager -[vim]: http://www.vim.org/ -[vimgo]: https://github.com/fatih/vim-go -[virtualenv]: https://virtualenv.pypa.io/en/stable/ -[vnu]: http://about.validator.nu/ -[vnu_jar]: https://github.com/validator/validator/releases/latest -[vnu_server]: http://validator.github.io/validator/#standalone -[vundle]: https://github.com/gmarik/Vundle.vim -[ycm]: http://valloric.github.io/YouCompleteMe/ - - diff --git a/sources_non_forked/syntastic/_assets/screenshot_1.png b/sources_non_forked/syntastic/_assets/screenshot_1.png deleted file mode 100644 index c1b69f4b..00000000 Binary files a/sources_non_forked/syntastic/_assets/screenshot_1.png and /dev/null differ diff --git a/sources_non_forked/syntastic/autoload/syntastic/c.vim b/sources_non_forked/syntastic/autoload/syntastic/c.vim deleted file mode 100644 index e49a29a0..00000000 --- a/sources_non_forked/syntastic/autoload/syntastic/c.vim +++ /dev/null @@ -1,341 +0,0 @@ -if exists('g:loaded_syntastic_c_autoload') || !exists('g:loaded_syntastic_plugin') - finish -endif -let g:loaded_syntastic_c_autoload = 1 - -let s:save_cpo = &cpo -set cpo&vim - -" Public functions {{{1 - -" convenience function to determine the 'null device' parameter -" based on the current operating system -function! syntastic#c#NullOutput() abort " {{{2 - let known_os = has('unix') || has('mac') || syntastic#util#isRunningWindows() - return known_os ? '-o ' . syntastic#util#DevNull() : '' -endfunction " }}}2 - -" read additional compiler flags from the given configuration file -" the file format and its parsing mechanism is inspired by clang_complete -function! syntastic#c#ReadConfig(file) abort " {{{2 - call syntastic#log#debug(g:_SYNTASTIC_DEBUG_CHECKERS, 'ReadConfig: looking for', a:file) - - " search upwards from the current file's directory - let config = syntastic#util#findFileInParent(a:file, expand('%:p:h', 1)) - if config ==# '' - call syntastic#log#debug(g:_SYNTASTIC_DEBUG_CHECKERS, 'ReadConfig: file not found') - return '' - endif - call syntastic#log#debug(g:_SYNTASTIC_DEBUG_CHECKERS, 'ReadConfig: config file:', config) - if !filereadable(config) - call syntastic#log#debug(g:_SYNTASTIC_DEBUG_CHECKERS, 'ReadConfig: file unreadable') - return '' - endif - - " convert filename into absolute path - let filepath = fnamemodify(config, ':p:h') - - " try to read config file - try - let lines = readfile(config) - catch /\m^Vim\%((\a\+)\)\=:E48[45]/ - call syntastic#log#debug(g:_SYNTASTIC_DEBUG_CHECKERS, 'ReadConfig: error reading file') - return '' - endtry - - " filter out empty lines and comments - call filter(lines, 'v:val !~# ''\v^(\s*#|$)''') - - " remove leading and trailing spaces - call map(lines, 'substitute(v:val, ''\m^\s\+'', "", "")') - call map(lines, 'substitute(v:val, ''\m\s\+$'', "", "")') - - let parameters = [] - for line in lines - let matches = matchstr(line, '\m\C^\s*-I\s*\zs.\+') - if matches !=# '' - " this one looks like an absolute path - if match(matches, '\m^\%(/\|\a:\)') != -1 - call add(parameters, '-I' . matches) - else - call add(parameters, '-I' . filepath . syntastic#util#Slash() . matches) - endif - else - call add(parameters, line) - endif - endfor - - return join(map(parameters, 'syntastic#util#shescape(v:val)')) -endfunction " }}}2 - -" GetLocList() for C-like compilers -function! syntastic#c#GetLocList(filetype, subchecker, options) abort " {{{2 - try - let flags = s:_get_cflags(a:filetype, a:subchecker, a:options) - catch /\m\C^Syntastic: skip checks$/ - return [] - endtry - - let makeprg = syntastic#util#shexpand(g:syntastic_{a:filetype}_compiler) . - \ ' ' . flags . ' ' . syntastic#util#shexpand('%') - - let errorformat = s:_get_checker_var('g', a:filetype, a:subchecker, 'errorformat', a:options['errorformat']) - - let postprocess = s:_get_checker_var('g', a:filetype, a:subchecker, 'remove_include_errors', 0) ? - \ ['filterForeignErrors'] : [] - - " process makeprg - return SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat, - \ 'postprocess': postprocess }) -endfunction " }}}2 - -" }}}1 - -" Private functions {{{1 - -" initialize c/cpp syntax checker handlers -function! s:_init() abort " {{{2 - let s:handlers = [] - let s:cflags = {} - - call s:_registerHandler('\m\', 's:_checkPhp', []) - call s:_registerHandler('\m\', 's:_checkPython', []) - call s:_registerHandler('\m\' - echohl ErrorMsg - echomsg 'syntastic: error: ' . a:msg - echohl None -endfunction " }}}2 - -function! syntastic#log#oneTimeWarn(msg) abort " {{{2 - if index(s:one_time_notices_issued, a:msg) >= 0 - return - endif - - call add(s:one_time_notices_issued, a:msg) - call syntastic#log#warn(a:msg) -endfunction " }}}2 - -" @vimlint(EVL102, 1, l:OLD_VAR) -function! syntastic#log#deprecationWarn(old, new, ...) abort " {{{2 - if exists('g:syntastic_' . a:old) && !exists('g:syntastic_' . a:new) - let msg = 'variable g:syntastic_' . a:old . ' is deprecated, please use ' - - if a:0 - let OLD_VAR = g:syntastic_{a:old} - try - let NEW_VAR = eval(a:1) - let msg .= 'in its stead: let g:syntastic_' . a:new . ' = ' . string(NEW_VAR) - let g:syntastic_{a:new} = NEW_VAR - catch - let msg .= 'g:syntastic_' . a:new . ' instead' - endtry - else - let msg .= 'g:syntastic_' . a:new . ' instead' - let g:syntastic_{a:new} = g:syntastic_{a:old} - endif - - call syntastic#log#oneTimeWarn(msg) - endif -endfunction " }}}2 -" @vimlint(EVL102, 0, l:OLD_VAR) - -function! syntastic#log#debug(level, msg, ...) abort " {{{2 - if !s:_isDebugEnabled(a:level) - return - endif - - let leader = s:_log_timestamp() - call s:_logRedirect(1) - - if a:0 - " filter out dictionary functions - echomsg leader . a:msg . ' ' . - \ strtrans(string(type(a:1) == type({}) || type(a:1) == type([]) ? - \ filter(copy(a:1), 'type(v:val) != type(function("tr"))') : a:1)) - else - echomsg leader . a:msg - endif - - call s:_logRedirect(0) -endfunction " }}}2 - -function! syntastic#log#debugShowOptions(level, names) abort " {{{2 - if !s:_isDebugEnabled(a:level) - return - endif - - let leader = s:_log_timestamp() - call s:_logRedirect(1) - - let vlist = copy(type(a:names) == type('') ? [a:names] : a:names) - let add_shell = index(vlist, 'shell') >= 0 && &shell !=# syntastic#util#var('shell') - if !empty(vlist) - call map(vlist, "'&' . v:val . ' = ' . strtrans(string(eval('&' . v:val))) . (s:_is_modified(v:val) ? ' (!)' : '')") - if add_shell - call add(vlist, 'u:shell = ' . strtrans(string(syntastic#util#var('shell'))) . ' (!)') - endif - echomsg leader . join(vlist, ', ') - endif - call s:_logRedirect(0) -endfunction " }}}2 - -function! syntastic#log#debugShowVariables(level, names) abort " {{{2 - if !s:_isDebugEnabled(a:level) - return - endif - - let leader = s:_log_timestamp() - call s:_logRedirect(1) - - let vlist = type(a:names) == type('') ? [a:names] : a:names - for name in vlist - let msg = s:_format_variable(name) - if msg !=# '' - echomsg leader . msg - endif - endfor - - call s:_logRedirect(0) -endfunction " }}}2 - -function! syntastic#log#debugDump(level) abort " {{{2 - if !s:_isDebugEnabled(a:level) - return - endif - - call syntastic#log#debugShowVariables( a:level, sort(keys(g:_SYNTASTIC_DEFAULTS)) ) -endfunction " }}}2 - -function! syntastic#log#ndebug(level, title, messages) abort " {{{2 - if s:_isDebugEnabled(a:level) - return - endif - - call syntastic#log#error(a:title) - if type(a:messages) == type([]) - for msg in a:messages - echomsg msg - endfor - else - echomsg a:messages - endif -endfunction " }}}2 - -" }}}1 - -" Private functions {{{1 - -function! s:_isDebugEnabled_smart(level) abort " {{{2 - return and(g:syntastic_debug, a:level) -endfunction " }}}2 - -function! s:_isDebugEnabled_dumb(level) abort " {{{2 - " poor man's bit test for bit N, assuming a:level == 2**N - return (g:syntastic_debug / a:level) % 2 -endfunction " }}}2 - -let s:_isDebugEnabled = function(exists('*and') ? 's:_isDebugEnabled_smart' : 's:_isDebugEnabled_dumb') -lockvar s:_isDebugEnabled - -function! s:_logRedirect(on) abort " {{{2 - if exists('g:syntastic_debug_file') - if a:on - try - execute 'redir >> ' . fnameescape(expand(g:syntastic_debug_file, 1)) - catch /\m^Vim\%((\a\+)\)\=:/ - silent! redir END - unlet g:syntastic_debug_file - endtry - else - silent! redir END - endif - endif -endfunction " }}}2 - -" }}}1 - -" Utilities {{{1 - -function! s:_log_timestamp_smart() abort " {{{2 - return printf('syntastic: %f: ', reltimefloat(reltime(g:_SYNTASTIC_START))) -endfunction " }}}2 - -function! s:_log_timestamp_dumb() abort " {{{2 - return 'syntastic: ' . split(reltimestr(reltime(g:_SYNTASTIC_START)))[0] . ': ' -endfunction " }}}2 - -let s:_log_timestamp = function(has('float') && exists('*reltimefloat') ? 's:_log_timestamp_smart' : 's:_log_timestamp_dumb') -lockvar s:_log_timestamp - -function! s:_format_variable(name) abort " {{{2 - let vals = [] - if exists('g:syntastic_' . a:name) - call add(vals, 'g:syntastic_' . a:name . ' = ' . strtrans(string(g:syntastic_{a:name}))) - endif - if exists('b:syntastic_' . a:name) - call add(vals, 'b:syntastic_' . a:name . ' = ' . strtrans(string(b:syntastic_{a:name}))) - endif - - return join(vals, ', ') -endfunction " }}}2 - -function! s:_is_modified(name) abort " {{{2 - if !exists('s:option_defaults') - let s:option_defaults = {} - endif - if !has_key(s:option_defaults, a:name) - let opt_save = eval('&' . a:name) - execute 'set ' . a:name . '&' - let s:option_defaults[a:name] = eval('&' . a:name) - execute 'let &' . a:name . ' = ' . string(opt_save) - endif - - return s:option_defaults[a:name] !=# eval('&' . a:name) -endfunction " }}}2 - -" }}}1 - -let &cpo = s:save_cpo -unlet s:save_cpo - -" vim: set sw=4 sts=4 et fdm=marker: diff --git a/sources_non_forked/syntastic/autoload/syntastic/postprocess.vim b/sources_non_forked/syntastic/autoload/syntastic/postprocess.vim deleted file mode 100644 index c69f3978..00000000 --- a/sources_non_forked/syntastic/autoload/syntastic/postprocess.vim +++ /dev/null @@ -1,84 +0,0 @@ -if exists('g:loaded_syntastic_postprocess_autoload') || !exists('g:loaded_syntastic_plugin') - finish -endif -let g:loaded_syntastic_postprocess_autoload = 1 - -let s:save_cpo = &cpo -set cpo&vim - -" Public functions {{{1 - -" merge consecutive blanks -function! syntastic#postprocess#compressWhitespace(errors) abort " {{{2 - for e in a:errors - let e['text'] = substitute(e['text'], "\001", '', 'g') - let e['text'] = substitute(e['text'], '\n', ' ', 'g') - let e['text'] = substitute(e['text'], '\m\s\{2,}', ' ', 'g') - let e['text'] = substitute(e['text'], '\m^\s\+', '', '') - let e['text'] = substitute(e['text'], '\m\s\+$', '', '') - endfor - - return a:errors -endfunction " }}}2 - -" remove spurious CR under Cygwin -function! syntastic#postprocess#cygwinRemoveCR(errors) abort " {{{2 - if has('win32unix') - for e in a:errors - let e['text'] = substitute(e['text'], '\r', '', 'g') - endfor - endif - - return a:errors -endfunction " }}}2 - -" decode XML entities -function! syntastic#postprocess#decodeXMLEntities(errors) abort " {{{2 - for e in a:errors - let e['text'] = syntastic#util#decodeXMLEntities(e['text']) - endfor - - return a:errors -endfunction " }}}2 - -" filter out errors referencing other files -function! syntastic#postprocess#filterForeignErrors(errors) abort " {{{2 - return filter(copy(a:errors), 'get(v:val, "bufnr") == ' . bufnr('')) -endfunction " }}}2 - -" make sure line numbers are not past end of buffers -" XXX: this loads all referenced buffers in memory -function! syntastic#postprocess#guards(errors) abort " {{{2 - let buffers = syntastic#util#unique(map(filter(copy(a:errors), 'v:val["valid"]'), 'str2nr(v:val["bufnr"])')) - - let guards = {} - for b in buffers - let guards[b] = len(getbufline(b, 1, '$')) - endfor - - for e in a:errors - if e['valid'] && e['lnum'] > guards[e['bufnr']] - let e['lnum'] = guards[e['bufnr']] - endif - endfor - - return a:errors -endfunction " }}}2 - -" convert error messages from UTF-8 to the current encoding -function! syntastic#postprocess#iconv(errors) abort " {{{2 - if has('iconv') && &encoding !=# '' && &encoding !=# 'utf-8' - for e in a:errors - let e['text'] = iconv(e['text'], "utf-8", &encoding) - endfor - endif - - return a:errors -endfunction " }}}2 - -" }}}1 - -let &cpo = s:save_cpo -unlet s:save_cpo - -" vim: set sw=4 sts=4 et fdm=marker: diff --git a/sources_non_forked/syntastic/autoload/syntastic/preprocess.vim b/sources_non_forked/syntastic/autoload/syntastic/preprocess.vim deleted file mode 100644 index ff7f3a30..00000000 --- a/sources_non_forked/syntastic/autoload/syntastic/preprocess.vim +++ /dev/null @@ -1,728 +0,0 @@ -if exists('g:loaded_syntastic_preprocess_autoload') || !exists('g:loaded_syntastic_plugin') - finish -endif -let g:loaded_syntastic_preprocess_autoload = 1 - -let s:save_cpo = &cpo -set cpo&vim - -" Public functions {{{1 - -function! syntastic#preprocess#bandit(errors) abort " {{{2 - let out = [] - let json = s:_decode_JSON(join(a:errors, '')) - - if type(json) == type({}) && has_key(json, 'results') && type(json['results']) == type([]) - for issue in json['results'] - if type(issue) == type({}) - try - call add(out, - \ issue['filename'] . ':' . - \ issue['line_number'] . ':' . - \ { 'LOW': 'I', 'MEDIUM': 'W', 'HIGH': 'E' }[issue['issue_severity']] . ':' . - \ issue['test_id'][1:] . ':' . - \ issue['issue_text'] . - \ ' [' . issue['test_name'] . '] (confidence: ' . issue['issue_confidence'] . ')') - catch /\m^Vim\%((\a\+)\)\=:E716/ - call syntastic#log#warn('checker python/bandit: unrecognized error item ' . string(issue)) - let out = [] - break - endtry - else - call syntastic#log#warn('checker python/bandit: unrecognized error item ' . string(issue)) - endif - endfor - else - call syntastic#log#warn('checker python/bandit: unrecognized error format (crashed checker?)') - endif - - return out -endfunction " }}}2 - -function! syntastic#preprocess#cabal(errors) abort " {{{2 - let out = [] - let star = 0 - for err in a:errors - if star - if err ==# '' - let star = 0 - else - let out[-1] .= ' ' . err - endif - else - call add(out, err) - if err =~# '\m^*\s' - let star = 1 - endif - endif - endfor - return out -endfunction " }}}2 - -function! syntastic#preprocess#checkstyle(errors) abort " {{{2 - let out = [] - let fname = expand('%', 1) - for err in a:errors - if match(err, '\m') > -1 - let line = str2nr(matchstr(err, '\m\ \[[^]]+\])+\ze:'', "", "")') -endfunction " }}}2 - -function! syntastic#preprocess#dockerfile_lint(errors) abort " {{{2 - let out = [] - let json = s:_decode_JSON(join(a:errors, '')) - - if type(json) == type({}) - try - let data = json['error']['data'] + json['warn']['data'] + json['info']['data'] - for e in data - let type = toupper(e['level'][0]) - if type ==# 'I' - let type = 'W' - let style = 1 - else - let style = 0 - endif - - let line = get(e, 'line', 1) - let message = e['message'] - if has_key(e, 'description') && e['description'] !=# 'None' - let message = message . '. ' . e['description'] - endif - - let msg = - \ type . ':' . - \ style . ':' . - \ line . ':' . - \ message - call add(out, msg) - endfor - catch /\m^Vim\%((\a\+)\)\=:E716/ - call syntastic#log#warn('checker dockerfile/dockerfile_lint: unrecognized error format (crashed checker?)') - let out = [] - endtry - else - call syntastic#log#warn('checker dockerfile/dockerfile_lint: unrecognized error format (crashed checker?)') - endif - return out -endfunction " }}}2 - -function! syntastic#preprocess#dscanner(errors) abort " {{{2 - let idx = 0 - while idx < len(a:errors) && a:errors[idx][0] !=# '{' - let idx += 1 - endwhile - let errs = s:_decode_JSON(join(a:errors[idx :], '')) - - let out = [] - if type(errs) == type({}) && has_key(errs, 'issues') && type(errs['issues']) == type([]) - for issue in errs['issues'] - try - call add(out, - \ issue['fileName'] . ':' . - \ issue['line'] . ':' . - \ issue['column'] . ':' . - \ issue['message'] . ' [' . issue['key'] . ']') - catch /\m^Vim\%((\a\+)\)\=:E716/ - call syntastic#log#warn('checker d/dscanner: unrecognized error item ' . string(issue)) - let out = [] - break - endtry - endfor - else - call syntastic#log#warn('checker d/dscanner: unrecognized error format (crashed checker?)') - endif - - return out -endfunction " }}}2 - -function! syntastic#preprocess#flow(errors) abort " {{{2 - let idx = 0 - while idx < len(a:errors) && a:errors[idx][0] !=# '{' - let idx += 1 - endwhile - let errs = s:_decode_JSON(join(a:errors[idx :], '')) - - let out = [] - if type(errs) == type({}) && has_key(errs, 'errors') && type(errs['errors']) == type([]) - for e in errs['errors'] - if type(e) == type({}) && has_key(e, 'message') && type(e['message']) == type([]) && len(e['message']) - let m = e['message'][0] - let t = e['message'][1:] - - try - let msg = - \ m['path'] . ':' . - \ m['line'] . ':' . - \ m['start'] . ':' . - \ (m['line'] ==# m['endline'] && str2nr(m['end']) > 0 ? m['end'] . ':' : '') . - \ ' ' . m['descr'] - - if len(t) - let msg .= ' ' . join(map(t, - \ 'v:val["descr"] . " (" . v:val["path"] . ":" . v:val["line"] . ":" . v:val["start"] . ' . - \ '"," . (v:val["line"] !=# v:val["endline"] ? v:val["endline"] . ":" : "") . ' . - \ 'v:val["end"] . ")"')) - endif - - let msg = substitute(msg, '\r', '', 'g') - let msg = substitute(msg, '\n', ' ', 'g') - - call add(out, msg) - catch /\m^Vim\%((\a\+)\)\=:E716/ - call syntastic#log#warn('checker javascript/flow: unrecognized error format (crashed checker?)') - let out = [] - break - endtry - else - call syntastic#log#warn('checker javascript/flow: unrecognized error format (crashed checker?)') - let out = [] - break - endif - endfor - else - call syntastic#log#warn('checker javascript/flow: unrecognized error format (crashed checker?)') - endif - - return out -endfunction " }}}2 - -function! syntastic#preprocess#iconv(errors) abort " {{{2 - return - \ has('iconv') && &encoding !=# '' && &encoding !=# 'utf-8' ? - \ map(a:errors, 'iconv(v:val, "utf-8", &encoding)') : - \ a:errors -endfunction " }}}2 - -function! syntastic#preprocess#jscs(errors) abort " {{{2 - let errs = join(a:errors, '') - if errs ==# '' - return [] - endif - - let json = s:_decode_JSON(errs) - - let out = [] - if type(json) == type({}) - for fname in keys(json) - if type(json[fname]) == type([]) - for e in json[fname] - try - let e['message'] = substitute(e['message'], "\n", ' ', 'g') - cal add(out, fname . ':' . e['line'] . ':' . e['column'] . ':' . e['message']) - catch /\m^Vim\%((\a\+)\)\=:E716/ - call syntastic#log#warn('checker javascript/jscs: unrecognized error item ' . string(e)) - let out = [] - endtry - endfor - else - call syntastic#log#warn('checker javascript/jscs: unrecognized error format (crashed checker?)') - endif - endfor - else - call syntastic#log#warn('checker javascript/jscs: unrecognized error format (crashed checker?)') - endif - return out -endfunction " }}}2 - -function! syntastic#preprocess#killEmpty(errors) abort " {{{2 - return filter(copy(a:errors), 'v:val !=# ""') -endfunction " }}}2 - -function! syntastic#preprocess#perl(errors) abort " {{{2 - let out = [] - - for e in a:errors - let parts = matchlist(e, '\v^(.*)\sat\s(.{-})\sline\s(\d+)(.*)$') - if !empty(parts) - call add(out, parts[2] . ':' . parts[3] . ':' . parts[1] . parts[4]) - endif - endfor - - return syntastic#util#unique(out) -endfunction " }}}2 - -function! syntastic#preprocess#perl6(errors) abort " {{{2 - if a:errors[0] ==# 'Syntax OK' - return [] - endif - - let errs = s:_decode_JSON(join(a:errors, '')) - - let out = [] - if type(errs) == type({}) - try - for val in values(errs) - let line = get(val, 'line', 0) - let pos = get(val, 'pos', 0) - if pos && has('byte_offset') - let line_pos = byte2line(pos + 1) - let column = line_pos > 0 ? pos - line2byte(line_pos) + 2 : 0 - else - let column = 0 - endif - - call add(out, join([ - \ get(val, 'filename', ''), - \ line, - \ column, - \ get(val, 'message', '') ], ':')) - endfor - catch /\m^Vim\%((\a\+)\)\=:E716/ - call syntastic#log#warn('checker perl6/perl6: unrecognized error item ' . string(val)) - let out = [] - endtry - else - call syntastic#log#warn('checker perl6/perl6: unrecognized error format') - endif - - return out -endfunction " }}}2 - -function! syntastic#preprocess#prospector(errors) abort " {{{2 - let errs = join(a:errors, '') - if errs ==# '' - return [] - endif - - let json = s:_decode_JSON(errs) - - let out = [] - if type(json) == type({}) && has_key(json, 'messages') - if type(json['messages']) == type([]) - for e in json['messages'] - if type(e) == type({}) - try - if e['source'] ==# 'pylint' - let e['location']['character'] += 1 - endif - - let msg = - \ e['location']['path'] . ':' . - \ e['location']['line'] . ':' . - \ e['location']['character'] . ': ' . - \ e['code'] . ' ' . - \ e['message'] . ' ' . - \ '[' . e['source'] . ']' - - call add(out, msg) - catch /\m^Vim\%((\a\+)\)\=:E716/ - call syntastic#log#warn('checker python/prospector: unrecognized error item ' . string(e)) - let out = [] - break - endtry - else - call syntastic#log#warn('checker python/prospector: unrecognized error item ' . string(e)) - let out = [] - break - endif - endfor - else - call syntastic#log#warn('checker python/prospector: unrecognized error format (crashed checker?)') - endif - else - call syntastic#log#warn('checker python/prospector: unrecognized error format (crashed checker?)') - endif - - return out -endfunction " }}}2 - -function! syntastic#preprocess#rparse(errors) abort " {{{2 - let errlist = copy(a:errors) - - " remove uninteresting lines and handle continuations - let i = 0 - while i < len(errlist) - if i > 0 && errlist[i][:1] ==# ' ' && errlist[i] !~# '\m\s\+\^$' - let errlist[i-1] .= errlist[i][1:] - call remove(errlist, i) - elseif errlist[i] !~# '\m^\(Lint:\|Lint checking:\|Error in\) ' - call remove(errlist, i) - else - let i += 1 - endif - endwhile - - let out = [] - let fname = '' - for e in errlist - if match(e, '\m^Lint: ') == 0 - let parts = matchlist(e, '\m^Lint: \(.*\): found on lines \([0-9, ]\+\)\(+\(\d\+\) more\)\=') - if len(parts) >= 3 - for line in split(parts[2], '\m,\s*') - call add(out, 'E:' . fname . ':' . line . ': ' . parts[1]) - endfor - endif - if len(parts) >= 5 && parts[4] !=# '' - call add(out, 'E:' . fname . ':0: ' . parts[1] . ' - ' . parts[4] . ' messages not shown') - endif - elseif match(e, '\m^Lint checking: ') == 0 - let fname = matchstr(e, '\m^Lint checking: \zs.*') - elseif match(e, '\m^Error in ') == 0 - call add(out, substitute(e, '\m^Error in .\+ : .\+\ze:\d\+:\d\+: ', 'E:' . fname, '')) - endif - endfor - - return out -endfunction " }}}2 - -function! syntastic#preprocess#scss_lint(errors) abort " {{{2 - let errs = join(a:errors, '') - if errs ==# '' - return [] - endif - - let json = s:_decode_JSON(errs) - - let out = [] - if type(json) == type({}) - for fname in keys(json) - if type(json[fname]) == type([]) - for e in json[fname] - try - cal add(out, fname . ':' . - \ e['severity'][0] . ':' . - \ e['line'] . ':' . - \ e['column'] . ':' . - \ e['length'] . ':' . - \ ( has_key(e, 'linter') ? e['linter'] . ': ' : '' ) . - \ e['reason']) - catch /\m^Vim\%((\a\+)\)\=:E716/ - call syntastic#log#warn('checker scss/scss_lint: unrecognized error item ' . string(e)) - let out = [] - endtry - endfor - else - call syntastic#log#warn('checker scss/scss_lint: unrecognized error format (crashed checker?)') - endif - endfor - else - call syntastic#log#warn('checker scss/scss_lint: unrecognized error format (crashed checker?)') - endif - return out -endfunction " }}}2 - -function! syntastic#preprocess#stylelint(errors) abort " {{{2 - let out = [] - - " CssSyntaxError: /path/to/file.css:2:11: Missed semicolon - let parts = matchlist(a:errors[0], '\v^CssSyntaxError: (.{-1,}):(\d+):(\d+): (.+)') - if len(parts) > 4 - call add(out, 'E:' . join(parts[1:4], ':')) - else - let errs = s:_decode_JSON(join(a:errors, '')) - - let out = [] - if type(errs) == type([]) && len(errs) == 1 && type(errs[0]) == type({}) && - \ has_key(errs[0], 'source') && has_key(errs[0], 'warnings') && type(errs[0]['warnings']) == type([]) - - for e in errs[0]['warnings'] - try - let severity = type(e['severity']) == type(0) ? ['W', 'E'][e['severity']-1] : e['severity'][0] - let msg = - \ severity . ':' . - \ errs[0]['source'] . ':' . - \ e['line'] . ':' . - \ e['column'] . ':' . - \ e['text'] - call add(out, msg) - catch /\m^Vim\%((\a\+)\)\=:E716/ - call syntastic#log#warn('checker css/stylelint: unrecognized error item ' . string(e)) - let out = [] - break - endtry - endfor - else - call syntastic#log#warn('checker css/stylelint: unrecognized error format (crashed checker?)') - endif - endif - return out -endfunction " }}}2 - -function! syntastic#preprocess#tern_lint(errors) abort " {{{2 - let errs = join(a:errors, '') - let json = s:_decode_JSON(errs) - -echomsg string(json) - let out = [] - if type(json) == type({}) && has_key(json, 'messages') && type(json['messages']) == type([]) - for e in json['messages'] - try - let line_from = byte2line(e['from'] + 1) - if line_from > 0 - let line = line_from - let column = e['from'] - line2byte(line_from) + 2 - let line_to = byte2line(e['from'] + 1) - let hl = line_to == line ? e['to'] - line2byte(line_to) + 1 : 0 - else - let line = 0 - let column = 0 - let hl = 0 - endif - - if column < 0 - let column = 0 - endif - if hl < 0 - let hl = 0 - endif - - call add(out, - \ e['file'] . ':' . - \ e['severity'][0] . ':' . - \ line . ':' . - \ column . ':' . - \ hl . ':' . - \ e['message']) - catch /\m^Vim\%((\a\+)\)\=:E716/ - call syntastic#log#warn('checker javascript/tern_lint: unrecognized error item ' . string(e)) - let out = [] - endtry - endfor - else - call syntastic#log#warn('checker javascript/tern_lint: unrecognized error format (crashed checker?)') - endif - -echomsg string(out) - return out -endfunction " }}}2 - -function! syntastic#preprocess#tslint(errors) abort " {{{2 - return map(copy(a:errors), 'substitute(v:val, ''\v^((ERROR|WARNING): )?\zs(\([^)]+\))\s(.+)$'', ''\4 \3'', "")') -endfunction " }}}2 - -function! syntastic#preprocess#validator(errors) abort " {{{2 - let out = [] - for e in a:errors - let parts = matchlist(e, '\v^"([^"]+)"(.+)') - if len(parts) >= 3 - " URL decode, except leave alone any "+" - let parts[1] = substitute(parts[1], '\m%\(\x\x\)', '\=nr2char("0x".submatch(1))', 'g') - let parts[1] = substitute(parts[1], '\m\\"', '"', 'g') - let parts[1] = substitute(parts[1], '\m\\\\', '\\', 'g') - call add(out, '"' . parts[1] . '"' . parts[2]) - endif - endfor - return out -endfunction " }}}2 - -function! syntastic#preprocess#vint(errors) abort " {{{2 - let errs = s:_decode_JSON(join(a:errors, '')) - - let out = [] - if type(errs) == type([]) - for e in errs - if type(e) == type({}) - try - let msg = - \ e['file_path'] . ':' . - \ e['line_number'] . ':' . - \ e['column_number'] . ':' . - \ e['severity'][0] . ': ' . - \ e['description'] . ' (' . - \ e['policy_name'] . ')' - - call add(out, msg) - catch /\m^Vim\%((\a\+)\)\=:E716/ - call syntastic#log#warn('checker vim/vint: unrecognized error item ' . string(e)) - let out = [] - break - endtry - else - call syntastic#log#warn('checker vim/vint: unrecognized error item ' . string(e)) - let out = [] - break - endif - endfor - else - call syntastic#log#warn('checker vim/vint: unrecognized error format (crashed checker?)') - endif - - return out -endfunction " }}}2 - -" }}}1 - -" Workarounds {{{1 - -" In errorformat, \ or % following %f make it depend on isfname. The default -" setting of isfname is crafted to work with completion, rather than general -" filename matching. The result for syntastic is that filenames containing -" spaces (or a few other special characters) can't be matched. -" -" Fixing isfname to address this problem would depend on the set of legal -" characters for filenames on the filesystem the project's files lives on. -" Inferring the kind of filesystem a file lives on, in advance to parsing the -" file's name, is an interesting problem (think f.i. a file loaded from a VFAT -" partition, mounted on Linux). A problem syntastic is not prepared to solve. -" -" As a result, the functions below exist for the only reason to avoid using -" things like %f\, in errorformat. -" -" References: -" https://groups.google.com/forum/#!topic/vim_dev/pTKmZmouhio -" https://vimhelp.appspot.com/quickfix.txt.html#error-file-format - -function! syntastic#preprocess#basex(errors) abort " {{{2 - let out = [] - let idx = 0 - while idx < len(a:errors) - let parts = matchlist(a:errors[idx], '\v^\[\S+\] Stopped at (.+), (\d+)/(\d+):') - if len(parts) > 3 - let err = parts[1] . ':' . parts[2] . ':' . parts[3] . ':' - let parts = matchlist(a:errors[idx+1], '\v^\[(.)\D+(\d+)\] (.+)') - if len(parts) > 3 - let err .= (parts[1] ==? 'W' || parts[1] ==? 'E' ? parts[1] : 'E') . ':' . parts[2] . ':' . parts[3] - call add(out, err) - let idx +=1 - endif - elseif a:errors[idx] =~# '\m^\[' - " unparseable errors - call add(out, a:errors[idx]) - endif - let idx +=1 - endwhile - return out -endfunction " }}}2 - -function! syntastic#preprocess#bro(errors) abort " {{{2 - let out = [] - for e in a:errors - let parts = matchlist(e, '\v^%(fatal )?(error|warning) in (.{-1,}), line (\d+): (.+)') - if len(parts) > 4 - let parts[1] = parts[1][0] - call add(out, join(parts[1:4], ':')) - endif - endfor - return out -endfunction " }}}2 - -function! syntastic#preprocess#coffeelint(errors) abort " {{{2 - let out = [] - for e in a:errors - let parts = matchlist(e, '\v^(.{-1,}),(\d+)%(,\d*)?,(error|warn),(.+)') - if len(parts) > 4 - let parts[3] = parts[3][0] - call add(out, join(parts[1:4], ':')) - endif - endfor - return out -endfunction " }}}2 - -function! syntastic#preprocess#mypy(errors) abort " {{{2 - let out = [] - for e in a:errors - " column numbers - let parts = matchlist(e, '\v^(.{-1,}):(\d+):(\d+): ([ew])%(rror|arning): (.+)') - if len(parts) > 5 - let parts[3] += 1 - call add(out, join(parts[1:5], ':')) - continue - endif - - " no column numbers - let parts = matchlist(e, '\v^(.{-1,}):(\d+): ([ew])%(rror|arning): (.+)') - if len(parts) > 4 - call add(out, join(parts[1:4], ':')) - continue - endif - - " obsolete format - let parts = matchlist(e, '\v^(.{-1,}), line (\d+): (.+)') - if len(parts) > 3 - let parts[4] = parts[3] - let parts[3] = 'e' - call add(out, join(parts[1:4], ':')) - endif - endfor - return out -endfunction " }}}2 - -function! syntastic#preprocess#nix(errors) abort " {{{2 - let out = [] - for e in a:errors - let parts = matchlist(e, '\v^(.{-1,}), at (.{-1,}):(\d+):(\d+)$') - if len(parts) > 4 - call add(out, join(parts[2:4], ':') . ':' . parts[1]) - continue - endif - - let parts = matchlist(e, '\v^(.{-1,}) at (.{-1,}), line (\d+):') - if len(parts) > 3 - call add(out, parts[2] . ':' . parts[3] . ':' . parts[1]) - continue - endif - - let parts = matchlist(e, '\v^error: (.{-1,}), in (.{-1,})$') - if len(parts) > 2 - call add(out, parts[2] . ':' . parts[1]) - endif - endfor - return out -endfunction " }}}2 - -" }}}1 - -" Private functions {{{1 - -" @vimlint(EVL102, 1, l:true) -" @vimlint(EVL102, 1, l:false) -" @vimlint(EVL102, 1, l:null) -function! s:_decode_JSON(json) abort " {{{2 - if a:json ==# '' - return [] - endif - - " The following is inspired by https://github.com/MarcWeber/vim-addon-manager and - " http://stackoverflow.com/questions/17751186/iterating-over-a-string-in-vimscript-or-parse-a-json-file/19105763#19105763 - " A hat tip to Marc Weber for this trick - if substitute(a:json, '\v\"%(\\.|[^"\\])*\"|true|false|null|[+-]?\d+%(\.\d+%([Ee][+-]?\d+)?)?', '', 'g') !~# "[^,:{}[\\] \t]" - " JSON artifacts - let true = 1 - let false = 0 - let null = '' - - try - let object = eval(a:json) - catch - " malformed JSON - let object = '' - endtry - else - let object = '' - endif - - return object -endfunction " }}}2 -" @vimlint(EVL102, 0, l:true) -" @vimlint(EVL102, 0, l:false) -" @vimlint(EVL102, 0, l:null) - -" }}}1 - -let &cpo = s:save_cpo -unlet s:save_cpo - -" vim: set sw=4 sts=4 et fdm=marker: diff --git a/sources_non_forked/syntastic/autoload/syntastic/util.vim b/sources_non_forked/syntastic/autoload/syntastic/util.vim deleted file mode 100644 index 8a17fe64..00000000 --- a/sources_non_forked/syntastic/autoload/syntastic/util.vim +++ /dev/null @@ -1,635 +0,0 @@ -if exists('g:loaded_syntastic_util_autoload') || !exists('g:loaded_syntastic_plugin') - finish -endif -let g:loaded_syntastic_util_autoload = 1 - -let s:save_cpo = &cpo -set cpo&vim - -" Public functions {{{1 - -function! syntastic#util#isRunningWindows() abort " {{{2 - return has('win16') || has('win32') || has('win64') -endfunction " }}}2 - -function! syntastic#util#DevNull() abort " {{{2 - if syntastic#util#isRunningWindows() - return 'NUL' - endif - return '/dev/null' -endfunction " }}}2 - -" Get directory separator -function! syntastic#util#Slash() abort " {{{2 - return (!exists('+shellslash') || &shellslash) ? '/' : '\' -endfunction " }}}2 - -function! syntastic#util#CygwinPath(path) abort " {{{2 - return substitute(syntastic#util#system('cygpath -m ' . syntastic#util#shescape(a:path)), "\n", '', 'g') -endfunction " }}}2 - -function! syntastic#util#system(command) abort " {{{2 - let old_shell = &shell - let old_lc_messages = $LC_MESSAGES - let old_lc_all = $LC_ALL - - let &shell = syntastic#util#var('shell') - let $LC_MESSAGES = 'C' - let $LC_ALL = '' - - let crashed = 0 - let cmd_start = reltime() - try - let out = system(a:command) - catch - let crashed = 1 - call syntastic#log#error('exception running system(' . string(a:command) . '): ' . v:exception) - if syntastic#util#isRunningWindows() - call syntastic#log#debug(g:_SYNTASTIC_DEBUG_CHECKERS, '$TMP = ' . string($TMP) . ', $TEMP = ' . string($TEMP)) - else - call syntastic#log#debug(g:_SYNTASTIC_DEBUG_CHECKERS, '$TERM = ' . string($TERM)) - call syntastic#log#debug(g:_SYNTASTIC_DEBUG_CHECKERS, '$TMPDIR = ' . string($TMPDIR)) - endif - call syntastic#log#debug(g:_SYNTASTIC_DEBUG_TRACE, '$PATH = ' . string($PATH)) - call syntastic#log#debug(g:_SYNTASTIC_DEBUG_TRACE, 'getcwd() = ' . string(getcwd())) - call syntastic#log#debugShowOptions(g:_SYNTASTIC_DEBUG_TRACE, g:_SYNTASTIC_SHELL_OPTIONS) - let out = '' - endtry - let cmd_time = split(reltimestr(reltime(cmd_start)))[0] - - let $LC_ALL = old_lc_all - let $LC_MESSAGES = old_lc_messages - - let &shell = old_shell - - if !crashed && exists('g:_SYNTASTIC_DEBUG_TRACE') - call syntastic#log#debug(g:_SYNTASTIC_DEBUG_TRACE, 'system: command run in ' . cmd_time . 's') - endif - - return out -endfunction " }}}2 - -" Create a temporary directory -function! syntastic#util#tmpdir() abort " {{{2 - let tempdir = '' - - if (has('unix') || has('mac')) && executable('mktemp') && !has('win32unix') - " TODO: option "-t" to mktemp(1) is not portable - let tmp = $TMPDIR !=# '' ? $TMPDIR : $TMP !=# '' ? $TMP : '/tmp' - let out = split(syntastic#util#system('mktemp -q -d ' . tmp . '/vim-syntastic-' . s:_fuzz() . '-XXXXXXXX'), "\n") - if v:shell_error == 0 && len(out) == 1 - let tempdir = out[0] - endif - endif - - if tempdir ==# '' - if has('win32') || has('win64') - let tempdir = $TEMP . syntastic#util#Slash() . 'vim-syntastic-' . s:_fuzz() - elseif has('win32unix') - let tempdir = syntastic#util#CygwinPath('/tmp/vim-syntastic-' . s:_fuzz()) - elseif $TMPDIR !=# '' - let tempdir = $TMPDIR . '/vim-syntastic-' . s:_fuzz() - else - let tempdir = '/tmp/vim-syntastic-' . s:_fuzz() - endif - - try - call mkdir(tempdir, 'p', 0700) - catch /\m^Vim\%((\a\+)\)\=:E739/ - call syntastic#log#error(v:exception) - let tempdir = '.' - endtry - endif - - return tempdir -endfunction " }}}2 - -" Recursively remove a directory -function! syntastic#util#rmrf(what) abort " {{{2 - " try to make sure we don't delete directories we didn't create - if a:what !~? 'vim-syntastic-' - return - endif - - if getftype(a:what) ==# 'dir' - call s:_delete(a:what, 'rf') - else - silent! call delete(a:what) - endif -endfunction " }}}2 - -function! syntastic#util#getbufvar(buf, name, ...) abort " {{{2 - return a:0 ? s:_getbufvar(a:buf, a:name, a:1) : getbufvar(a:buf, a:name) -endfunction " }}}2 - -" Search the first 5 lines of the file for a magic number and return a map -" containing the args and the executable -" -" e.g. -" -" #!/usr/bin/perl -f -bar -" -" returns -" -" {'exe': '/usr/bin/perl', 'args': ['-f', '-bar']} -function! syntastic#util#parseShebang(buf) abort " {{{2 - for lnum in range(1, 5) - let line = get(getbufline(a:buf, lnum), 0, '') - if line =~# '^#!' - let line = substitute(line, '\v^#!\s*(\S+/env(\s+-\S+)*\s+)?', '', '') - let exe = matchstr(line, '\m^\S*\ze') - let args = split(matchstr(line, '\m^\S*\zs.*')) - return { 'exe': exe, 'args': args } - endif - endfor - - return { 'exe': '', 'args': [] } -endfunction " }}}2 - -" Get the value of a Vim variable. Allow buffer variables to override global ones. -function! syntastic#util#bufRawVar(buf, name, ...) abort " {{{2 - return s:_getbufvar(a:buf, a:name, get(g:, a:name, a:0 ? a:1 : '')) -endfunction "}}}2 - -" Get the value of a syntastic variable. Allow buffer variables to override global ones. -function! syntastic#util#bufVar(buf, name, ...) abort " {{{2 - return call('syntastic#util#bufRawVar', [a:buf, 'syntastic_' . a:name] + a:000) -endfunction "}}}2 - -" Get the value of a Vim variable. Allow local variables to override global ones. -function! syntastic#util#rawVar(name, ...) abort " {{{2 - return get(b:, a:name, get(g:, a:name, a:0 ? a:1 : '')) -endfunction " }}}2 - -" Get the value of a syntastic variable. Allow local variables to override global ones. -function! syntastic#util#var(name, ...) abort " {{{2 - return call('syntastic#util#rawVar', ['syntastic_' . a:name] + a:000) -endfunction " }}}2 - -" Parse a version string. Return an array of version components. -function! syntastic#util#parseVersion(version, ...) abort " {{{2 - return map(split(matchstr( a:version, a:0 ? a:1 : '\v^\D*\zs\d+(\.\d+)+\ze' ), '\m\.'), 'str2nr(v:val)') -endfunction " }}}2 - -" Verify that the 'installed' version is at least the 'required' version. -" -" 'installed' and 'required' must be arrays. If they have different lengths, -" the "missing" elements will be assumed to be 0 for the purposes of checking. -" -" See http://semver.org for info about version numbers. -function! syntastic#util#versionIsAtLeast(installed, required) abort " {{{2 - return syntastic#util#compareLexi(a:installed, a:required) >= 0 -endfunction " }}}2 - -" Almost lexicographic comparison of two lists of integers. :) If lists -" have different lengths, the "missing" elements are assumed to be 0. -function! syntastic#util#compareLexi(a, b) abort " {{{2 - for idx in range(max([len(a:a), len(a:b)])) - let a_element = str2nr(get(a:a, idx, 0)) - let b_element = str2nr(get(a:b, idx, 0)) - if a_element != b_element - return a_element > b_element ? 1 : -1 - endif - endfor - " still here, thus everything matched - return 0 -endfunction " }}}2 - -function! syntastic#util#screenWidth(str, tabstop) abort " {{{2 - let chunks = split(a:str, "\t", 1) - let width = s:_width(chunks[-1]) - for c in chunks[:-2] - let cwidth = s:_width(c) - let width += cwidth + a:tabstop - cwidth % a:tabstop - endfor - return width -endfunction " }}}2 - -" Print as much of a:msg as possible without "Press Enter" prompt appearing -function! syntastic#util#wideMsg(msg) abort " {{{2 - let old_ruler = &ruler - let old_showcmd = &showcmd - - "This is here because it is possible for some error messages to - "begin with \n which will cause a "press enter" prompt. - let msg = substitute(a:msg, "\n", '', 'g') - - "convert tabs to spaces so that the tabs count towards the window - "width as the proper amount of characters - let chunks = split(msg, "\t", 1) - let msg = join(map(chunks[:-2], 'v:val . repeat(" ", &tabstop - s:_width(v:val) % &tabstop)'), '') . chunks[-1] - let msg = strpart(msg, 0, &columns - 1) - - set noruler noshowcmd - call syntastic#util#redraw(0) - - echo msg - - let &ruler = old_ruler - let &showcmd = old_showcmd -endfunction " }}}2 - -" Check whether a buffer is loaded, listed, and not hidden -function! syntastic#util#bufIsActive(buffer) abort " {{{2 - " convert to number, or hell breaks loose - let buf = str2nr(a:buffer) - - if !bufloaded(buf) || !buflisted(buf) - return 0 - endif - - " get rid of hidden buffers - for tab in range(1, tabpagenr('$')) - if index(tabpagebuflist(tab), buf) >= 0 - return 1 - endif - endfor - - return 0 -endfunction " }}}2 - -" Start in directory a:where and walk up the parent folders until it finds a -" file named a:what; return path to that file -function! syntastic#util#findFileInParent(what, where) abort " {{{2 - let old_suffixesadd = &suffixesadd - let &suffixesadd = '' - let file = findfile(a:what, escape(a:where, ' ,') . ';') - let &suffixesadd = old_suffixesadd - return file -endfunction " }}}2 - -" Start in directory a:where and walk up the parent folders until it finds a -" file matching a:what; return path to that file -function! syntastic#util#findGlobInParent(what, where) abort " {{{2 - let here = fnamemodify(a:where, ':p') - - let root = syntastic#util#Slash() - if syntastic#util#isRunningWindows() && here[1] ==# ':' - " The drive letter is an ever-green source of fun. That's because - " we don't care about running syntastic on Amiga these days. ;) - let root = fnamemodify(root, ':p') - let root = here[0] . root[1:] - endif - - let old = '' - while here !=# '' - try - " Vim 7.4.279 and later - let p = globpath(here, a:what, 1, 1) - catch /\m^Vim\%((\a\+)\)\=:E118/ - let p = split(globpath(here, a:what, 1), "\n") - endtry - - if !empty(p) - return fnamemodify(p[0], ':p') - elseif here ==? root || here ==? old - break - endif - - let old = here - - " we use ':h:h' rather than ':h' since ':p' adds a trailing '/' - " if 'here' is a directory - let here = fnamemodify(here, ':p:h:h') - endwhile - - return '' -endfunction " }}}2 - -" Returns the buffer number of a filename -" @vimlint(EVL104, 1, l:old_shellslash) -function! syntastic#util#fname2buf(fname) abort " {{{2 - if exists('+shellslash') - " bufnr() can't cope with backslashes - let old_shellslash = &shellslash - let &shellslash = 1 - endif - - " this is a best-effort attempt to escape file patterns (cf. :h file-pattern) - " XXX it fails for filenames containing something like \{2,3} - let buf = -1 - for md in [':~:.', ':~', ':p'] - try - " Older versions of Vim can throw E94 here - let buf = bufnr('^' . escape(fnamemodify(a:fname, md), '\*?,{}[') . '$') - catch - " catch everything - endtry - if buf != -1 - break - endif - endfor - if buf == -1 - " XXX definitely wrong, but hope is the last thing to die :) - let buf = bufnr(fnamemodify(a:fname, ':p')) - endif - - if exists('+shellslash') - let &shellslash = old_shellslash - endif - - return buf -endfunction " }}}2 -" @vimlint(EVL104, 0, l:old_shellslash) - -" Returns unique elements in a list -function! syntastic#util#unique(list) abort " {{{2 - let seen = {} - let uniques = [] - for e in a:list - let k = string(e) - if !has_key(seen, k) - let seen[k] = 1 - call add(uniques, e) - endif - endfor - return uniques -endfunction " }}}2 - -" A less noisy shellescape() -function! syntastic#util#shescape(string) abort " {{{2 - return a:string =~# '\m^[A-Za-z0-9_/.-]\+$' ? a:string : shellescape(a:string) -endfunction " }}}2 - -" A less noisy shellescape(expand()) -function! syntastic#util#shexpand(string, ...) abort " {{{2 - return syntastic#util#shescape(a:0 ? expand(a:string, a:1) : expand(a:string, 1)) -endfunction " }}}2 - -" Escape arguments -function! syntastic#util#argsescape(opt) abort " {{{2 - if type(a:opt) == type('') && a:opt !=# '' - return [a:opt] - elseif type(a:opt) == type([]) - return map(copy(a:opt), 'syntastic#util#shescape(v:val)') - endif - - return [] -endfunction " }}}2 - -" Decode XML entities -function! syntastic#util#decodeXMLEntities(string) abort " {{{2 - let str = a:string - let str = substitute(str, '\m<', '<', 'g') - let str = substitute(str, '\m>', '>', 'g') - let str = substitute(str, '\m"', '"', 'g') - let str = substitute(str, '\m'', "'", 'g') - let str = substitute(str, '\m&', '\&', 'g') - return str -endfunction " }}}2 - -function! syntastic#util#redraw(full) abort " {{{2 - if a:full - redraw! - else - redraw - endif -endfunction " }}}2 - -function! syntastic#util#dictFilter(errors, filter) abort " {{{2 - let rules = s:_translateFilter(a:filter) - " call syntastic#log#debug(g:_SYNTASTIC_DEBUG_TRACE, "applying filter:", rules) - try - call filter(a:errors, rules) - catch /\m^Vim\%((\a\+)\)\=:E/ - let msg = matchstr(v:exception, '\m^Vim\%((\a\+)\)\=:\zs.*') - call syntastic#log#error('quiet_messages: ' . msg) - endtry -endfunction " }}}2 - -" Return a [seconds, fractions] list of strings, representing the -" (hopefully high resolution) time since program start -function! syntastic#util#stamp() abort " {{{2 - return split( split(reltimestr(reltime(g:_SYNTASTIC_START)))[0], '\.' ) -endfunction " }}}2 - -function! syntastic#util#setLastTick(buf) abort " {{{2 - call setbufvar(a:buf, 'syntastic_lasttick', getbufvar(a:buf, 'changedtick')) -endfunction " }}}2 - -" Add unique IDs to windows -function! syntastic#util#setWids() abort " {{{2 - for tab in range(1, tabpagenr('$')) - for win in range(1, tabpagewinnr(tab, '$')) - if gettabwinvar(tab, win, 'syntastic_wid') ==# '' - call settabwinvar(tab, win, 'syntastic_wid', s:_wid_base . s:_wid_pool) - let s:_wid_pool += 1 - endif - endfor - endfor -endfunction " }}}2 - -function! syntastic#util#str2float(val) abort " {{{2 - return s:_str2float(a:val) -endfunction " }}}2 - -function! syntastic#util#float2str(val) abort " {{{2 - return s:_float2str(a:val) -endfunction " }}}2 - -" Crude printf()-like width formatter. Handles wide characters. -function! syntastic#util#wformat(format, str) abort " {{{2 - if a:format ==# '' - return a:str - endif - - echomsg string(a:format) . ', ' . string(a:str) - let specs = matchlist(a:format, '\v^(-?)(0?)(%([1-9]\d*))?%(\.(\d+))?$') - if len(specs) < 5 - return a:str - endif - - let flushleft = specs[1] ==# '-' - let lpad = specs[2] ==# '0' ? '0' : ' ' - let minlen = str2nr(specs[3]) - let maxlen = str2nr(specs[4]) - let out = substitute(a:str, "\t", ' ', 'g') - - if maxlen && s:_width(out) > maxlen - let chars = filter(split(out, '\zs\ze', 1), 'v:val !=# ""') - let out = '' - - if flushleft - for c in chars - if s:_width(out . c) < maxlen - let out .= c - else - let out .= &encoding ==# 'utf-8' && &termencoding ==# 'utf-8' ? "\u2026" : '>' - break - endif - endfor - else - call reverse(chars) - for c in chars - if s:_width(c . out) < maxlen - let out = c . out - else - let out = (&encoding ==# 'utf-8' && &termencoding ==# 'utf-8' ? "\u2026" : '<') . out - break - endif - endfor - endif - endif - - if minlen && s:_width(out) < minlen - if flushleft - let out .= repeat(' ', minlen - s:_width(out)) - else - let out = repeat(lpad, minlen - s:_width(out)) . out - endif - endif - - return out -endfunction " }}}2 - -" }}}1 - -" Private functions {{{1 - -function! s:_translateFilter(filters) abort " {{{2 - let conditions = [] - for k in keys(a:filters) - if type(a:filters[k]) == type([]) - call extend(conditions, map(copy(a:filters[k]), 's:_translateElement(k, v:val)')) - else - call add(conditions, s:_translateElement(k, a:filters[k])) - endif - endfor - - if conditions == [] - let conditions = ['1'] - endif - return len(conditions) == 1 ? conditions[0] : join(map(conditions, '"(" . v:val . ")"'), ' && ') -endfunction " }}}2 - -function! s:_translateElement(key, term) abort " {{{2 - let fkey = a:key - if fkey[0] ==# '!' - let fkey = fkey[1:] - let not = 1 - else - let not = 0 - endif - - if fkey ==? 'level' - let op = not ? ' ==? ' : ' !=? ' - let ret = 'v:val["type"]' . op . string(a:term[0]) - elseif fkey ==? 'type' - if a:term ==? 'style' - let op = not ? ' ==? ' : ' !=? ' - let ret = 'get(v:val, "subtype", "")' . op . '"style"' - else - let op = not ? '!' : '' - let ret = op . 'has_key(v:val, "subtype")' - endif - elseif fkey ==? 'regex' - let op = not ? ' =~? ' : ' !~? ' - let ret = 'v:val["text"]' . op . string(a:term) - elseif fkey ==? 'file' || fkey[:4] ==? 'file:' - let op = not ? ' =~# ' : ' !~# ' - let ret = 'bufname(str2nr(v:val["bufnr"]))' - let mod = fkey[4:] - if mod !=# '' - let ret = 'fnamemodify(' . ret . ', ' . string(mod) . ')' - endif - let ret .= op . string(a:term) - else - call syntastic#log#warn('quiet_messages: ignoring invalid key ' . strtrans(string(fkey))) - let ret = '1' - endif - return ret -endfunction " }}}2 - -" strwidth() was added in Vim 7.3; if it doesn't exist, we use strlen() -" and hope for the best :) -let s:_width = function(exists('*strwidth') ? 'strwidth' : 'strlen') -lockvar s:_width - -" @vimlint(EVL103, 1, a:flags) -function! s:_delete_dumb(what, flags) abort " {{{2 - if !exists('s:rmrf') - let s:rmrf = - \ has('unix') || has('mac') ? 'rm -rf' : - \ has('win32') || has('win64') ? 'rmdir /S /Q' : - \ has('win16') || has('win95') || has('dos16') || has('dos32') ? 'deltree /Y' : '' - endif - - if s:rmrf !=# '' - silent! call syntastic#util#system(s:rmrf . ' ' . syntastic#util#shescape(a:what)) - else - call s:_rmrf(a:what) - endif -endfunction " }}}2 -" @vimlint(EVL103, 0, a:flags) - -" delete(dir, 'rf') was added in Vim 7.4.1107, but it didn't become usable until 7.4.1128 -let s:_delete = function(v:version > 704 || (v:version == 704 && has('patch1128')) ? 'delete' : 's:_delete_dumb') -lockvar s:_delete - -function! s:_rmrf(what) abort " {{{2 - if !exists('s:rmdir') - let s:rmdir = syntastic#util#shescape(get(g:, 'netrw_localrmdir', 'rmdir')) - endif - - if getftype(a:what) ==# 'dir' - if filewritable(a:what) != 2 - return - endif - - try - " Vim 7.4.279 and later - let entries = globpath(a:what, '*', 1, 1) - catch /\m^Vim\%((\a\+)\)\=:E118/ - let entries = split(globpath(a:what, '*', 1), "\n") - endtry - for f in entries - call s:_rmrf(f) - endfor - silent! call syntastic#util#system(s:rmdir . ' ' . syntastic#util#shescape(a:what)) - else - silent! call delete(a:what) - endif -endfunction " }}}2 - -let s:_str2float = function(exists('*str2float') ? 'str2float' : 'str2nr') -lockvar s:_str2float - -function! s:_float2str_smart(val) abort " {{{2 - return printf('%.1f', a:val) -endfunction " }}}2 - -function! s:_float2str_dumb(val) abort " {{{2 - return a:val -endfunction " }}}2 - -let s:_float2str = function(has('float') ? 's:_float2str_smart' : 's:_float2str_dumb') -lockvar s:_float2str - -function! s:_getbufvar_dumb(buf, name, ...) abort " {{{2 - let ret = getbufvar(a:buf, a:name) - if a:0 && type(ret) == type('') && ret ==# '' - unlet! ret - let ret = a:1 - endif - return ret -endfunction "}}}2 - -let s:_getbufvar = function(v:version > 703 || (v:version == 703 && has('patch831')) ? 'getbufvar' : 's:_getbufvar_dumb') -lockvar s:_getbufvar - -function! s:_fuzz_dumb() abort " {{{2 - return 'tmp' -endfunction " }}}2 - -let s:_fuzz = function(exists('*getpid') ? 'getpid' : 's:_fuzz_dumb') -lockvar s:_fuzz - -" }}}1 - -let s:_wid_base = 'syntastic_' . s:_fuzz() . '_' . reltimestr(g:_SYNTASTIC_START) . '_' -let s:_wid_pool = 0 - -let &cpo = s:save_cpo -unlet s:save_cpo - -" vim: set sw=4 sts=4 et fdm=marker: diff --git a/sources_non_forked/syntastic/doc/syntastic-checkers.txt b/sources_non_forked/syntastic/doc/syntastic-checkers.txt deleted file mode 100644 index 5f256b3a..00000000 --- a/sources_non_forked/syntastic/doc/syntastic-checkers.txt +++ /dev/null @@ -1,7843 +0,0 @@ -*syntastic-checkers.txt* Syntastic checkers -*syntastic-checkers* - -============================================================================== -SYNTAX CHECKERS BY LANGUAGE *syntastic-checkers-lang* - -|syntastic| comes with checkers for the following languages: - - ACPI Source Language.....................|syntastic-checkers-asl| - ActionScript.............................|syntastic-checkers-actionscript| - Ada......................................|syntastic-checkers-ada| - Ansible..................................|syntastic-checkers-ansible| - API Blueprint............................|syntastic-checkers-apiblueprint| - AppleScript..............................|syntastic-checkers-applescript| - AsciiDoc.................................|syntastic-checkers-asciidoc| - Assembly Languages.......................|syntastic-checkers-asm| - - BEMHTML..................................|syntastic-checkers-bemhtml| - Bro......................................|syntastic-checkers-bro| - - C........................................|syntastic-checkers-c| - C#.......................................|syntastic-checkers-cs| - C++......................................|syntastic-checkers-cpp| - Cabal....................................|syntastic-checkers-cabal| - Chef.....................................|syntastic-checkers-chef| - CMake....................................|syntastic-checkers-cmake| - COBOL....................................|syntastic-checkers-cobol| - Coco.....................................|syntastic-checkers-co| - CoffeeScript.............................|syntastic-checkers-coffee| - Coq......................................|syntastic-checkers-coq| - CSS......................................|syntastic-checkers-css| - Cucumber.................................|syntastic-checkers-cucumber| - CUDA.....................................|syntastic-checkers-cuda| - - D........................................|syntastic-checkers-d| - Dart.....................................|syntastic-checkers-dart| - DocBook..................................|syntastic-checkers-docbk| - Dockerfile...............................|syntastic-checkers-dockerfile| - Dust.....................................|syntastic-checkers-dustjs| - - Elixir...................................|syntastic-checkers-elixir| - Erlang...................................|syntastic-checkers-erlang| - eRuby....................................|syntastic-checkers-eruby| - - Fortran..................................|syntastic-checkers-fortran| - - Gentoo Metadata..........................|syntastic-checkers-gentoo| - Gettext PO...............................|syntastic-checkers-po| - GLSL.....................................|syntastic-checkers-glsl| - Go.......................................|syntastic-checkers-go| - - Haml.....................................|syntastic-checkers-haml| - Handlebars...............................|syntastic-checkers-handlebars| - Haskell..................................|syntastic-checkers-haskell| - Haxe.....................................|syntastic-checkers-haxe| - HSS......................................|syntastic-checkers-hss| - HTML.....................................|syntastic-checkers-html| - - Java.....................................|syntastic-checkers-java| - JavaScript...............................|syntastic-checkers-javascript| - JSON.....................................|syntastic-checkers-json| - Julia....................................|syntastic-checkers-julia| - - LESS.....................................|syntastic-checkers-less| - Lex......................................|syntastic-checkers-lex| - Limbo....................................|syntastic-checkers-limbo| - LISP.....................................|syntastic-checkers-lisp| - LLVM.....................................|syntastic-checkers-llvm| - Lua......................................|syntastic-checkers-lua| - - Markdown.................................|syntastic-checkers-markdown| - MATLAB...................................|syntastic-checkers-matlab| - Mercury..................................|syntastic-checkers-mercury| - - NASM.....................................|syntastic-checkers-nasm| - Nix......................................|syntastic-checkers-nix| - nroff....................................|syntastic-checkers-nroff| - - Objective-C..............................|syntastic-checkers-objc| - Objective-C++............................|syntastic-checkers-objcpp| - OCaml....................................|syntastic-checkers-ocaml| - - Perl.....................................|syntastic-checkers-perl| - Perl 6...................................|syntastic-checkers-perl6| - PHP......................................|syntastic-checkers-php| - POD......................................|syntastic-checkers-pod| - Pug (formerly Jade)......................|syntastic-checkers-pug| - Puppet...................................|syntastic-checkers-puppet| - Python...................................|syntastic-checkers-python| - - QML......................................|syntastic-checkers-qml| - - R........................................|syntastic-checkers-r| - R Markdown...............................|syntastic-checkers-rmd| - Racket...................................|syntastic-checkers-racket| - Relax NG.................................|syntastic-checkers-rnc| - reStructuredText.........................|syntastic-checkers-rst| - RPM spec.................................|syntastic-checkers-spec| - Ruby.....................................|syntastic-checkers-ruby| - - SASS.....................................|syntastic-checkers-sass| - Scala....................................|syntastic-checkers-scala| - SCSS.....................................|syntastic-checkers-scss| - Sh.......................................|syntastic-checkers-sh| - Slim.....................................|syntastic-checkers-slim| - SML......................................|syntastic-checkers-sml| - Solidity.................................|syntastic-checkers-solidity| - SQL......................................|syntastic-checkers-sql| - Stylus...................................|syntastic-checkers-stylus| - - Tcl......................................|syntastic-checkers-tcl| - TeX......................................|syntastic-checkers-tex| - Texinfo..................................|syntastic-checkers-texinfo| - Text.....................................|syntastic-checkers-text| - Turtle...................................|syntastic-checkers-turtle| - TriG.....................................|syntastic-checkers-trig| - Twig.....................................|syntastic-checkers-twig| - TypeScript...............................|syntastic-checkers-typescript| - - Vala.....................................|syntastic-checkers-vala| - Verilog..................................|syntastic-checkers-verilog| - VHDL.....................................|syntastic-checkers-vhdl| - Vim help.................................|syntastic-checkers-help| - VimL.....................................|syntastic-checkers-vim| - Vue.js...................................|syntastic-checkers-vue| - - xHTML....................................|syntastic-checkers-xhtml| - XML......................................|syntastic-checkers-xml| - XQuery...................................|syntastic-checkers-xquery| - XSLT.....................................|syntastic-checkers-xslt| - - YACC.....................................|syntastic-checkers-yacc| - YAML.....................................|syntastic-checkers-yaml| - YANG.....................................|syntastic-checkers-yang| - YARA.....................................|syntastic-checkers-yara| - - Z80......................................|syntastic-checkers-z80| - Zope Page Templates......................|syntastic-checkers-zpt| - Zsh......................................|syntastic-checkers-zsh| - -Third-party checkers are available for additional languages. - -============================================================================== -SYNTAX CHECKERS FOR ACPI SOURCE LANGUAGE *syntastic-checkers-asl* - -The following checkers are available for the ACPI Source Language (filetype -"asl"): - - 1. iasl.....................|syntastic-asl-iasl| - ------------------------------------------------------------------------------- -1. iasl *syntastic-asl-iasl* - -Name: iasl -Maintainer: Peter Wu - -"iasl" is a compiler/decompiler for ACPI Source Language (ASL) and ACPI -Machine Language (AML). See the project's page for details: - - https://acpica.org/ - -Checker options~ - -This checker is initialised using the "makeprgBuild()" function and thus it -accepts the standard options described at |syntastic-config-makeprg|. - -Note~ - -You probably also need a plugin to set |filetype| for ASL files, such as -"vim-acpi-asl": - - https://github.com/martinlroth/vim-acpi-asl - -============================================================================== -SYNTAX CHECKERS FOR ACTIONSCRIPT *syntastic-checkers-actionscript* - -The following checkers are available for ActionScript (filetype -"actionscript"): - - 1. mxmlc....................|syntastic-actionscript-mxmlc| - ------------------------------------------------------------------------------- -1. mxmlc *syntastic-actionscript-mxmlc* - -Name: mxmlc -Maintainer: Andy Earnshaw - -"mxmlc" is a compiler for ActionScript. See Apache Flex for details: - - http://flex.apache.org/ - -Checker options~ - -This checker is initialised using the "makeprgBuild()" function and thus it -accepts the standard options described at |syntastic-config-makeprg|. - -============================================================================== -SYNTAX CHECKERS FOR ADA *syntastic-checkers-ada* - -The following checkers are available for Ada (filetype "ada"): - - 1. GCC......................|syntastic-ada-gcc| - ------------------------------------------------------------------------------- -1. GCC *syntastic-ada-gcc* - -Name: gcc -Maintainer: Alfredo Di Napoli - -Checker options~ - *'g:syntastic_ada_compiler'* -Type: string -Default: "gcc" -Compiler executable. - - *'g:syntastic_ada_errorformat'* -Type: string -Default: unset -Override for the default |'errorformat'|. - - *'g:syntastic_ada_remove_include_errors'* -Type: boolean -Default: 0 -By default, errors in files included from the file being checked are shown. -Set this variable to 1 to remove messages about errors in included files. -Please note that this means syntastic will silently abort checks if there are -fatal errors in one of the included files. - - *'g:syntastic_ada_compiler_options'* -Type: string -Default: unset -Compilation flags (such as defines or include directories) to be passed to the -linter. - - *'g:syntastic_ada_config_file'* -Type: string -Default: ".syntastic_ada_config" -File containing additional compilation flags to be passed to the linter, one -option per line (cf. |syntastic-config-files|). - - *'g:syntastic_ada_include_dirs'* -Type: array of strings -Default: [] -Include directories to be passed to the linter, in addition to the above -compilation flags. You can set it like this: > - let g:syntastic_ada_include_dirs = ["includes", "headers"] -< -and the corresponding "-Iincludes -Iheaders" will be added to the compilation -flags. - - *'b:syntastic_ada_cflags'* -Type: string -Default: unset -Buffer-local variable. Additional compilation flags specific to the current -buffer. - - *'g:syntastic_ada_check_header'* -Type: boolean -Default: 0 -If the current file is a header (namely if its extension is "ads"), all checks -are silently skipped. You can force syntastic to check header files by -setting the above variable to 1. - -Note~ - -This checker doesn't call the "makeprgBuild()" function, and thus it ignores -the usual 'g:syntastic_ada_gcc_