gitignore sources_non_forked_cache
This commit is contained in:
parent
aff5c8f75a
commit
378168c979
1752 changed files with 208511 additions and 1 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,5 +1,5 @@
|
|||
temp_dirs/undodir/*
|
||||
sources_non_forked/*
|
||||
sources_non_forked_cache/*
|
||||
temp_dirs/yankring_history_v2.txt
|
||||
sources_forked/yankring/doc/tags
|
||||
my_plugins/
|
||||
|
|
1
sources_non_forked/ack.vim/.gitignore
vendored
Normal file
1
sources_non_forked/ack.vim/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
tags
|
89
sources_non_forked/ack.vim/LICENSE
Normal file
89
sources_non_forked/ack.vim/LICENSE
Normal file
|
@ -0,0 +1,89 @@
|
|||
ack.vim is distributed under the same license terms as Vim itself, which you
|
||||
can find in full with `:help license` within Vim, or copied in full herein.
|
||||
|
||||
Copyright (c) 2007-2015 Antoine Imbert <antoine.imbert+ackvim@gmail.com>
|
||||
and contributors.
|
||||
|
||||
Maintainers may be contacted via GitHub Issues at:
|
||||
|
||||
https://github.com/mileszs/ack.vim/issues
|
||||
|
||||
|
||||
VIM LICENSE
|
||||
|
||||
I) There are no restrictions on distributing unmodified copies of Vim except
|
||||
that they must include this license text. You can also distribute
|
||||
unmodified parts of Vim, likewise unrestricted except that they must
|
||||
include this license text. You are also allowed to include executables
|
||||
that you made from the unmodified Vim sources, plus your own usage
|
||||
examples and Vim scripts.
|
||||
|
||||
II) It is allowed to distribute a modified (or extended) version of Vim,
|
||||
including executables and/or source code, when the following four
|
||||
conditions are met:
|
||||
1) This license text must be included unmodified.
|
||||
2) The modified Vim must be distributed in one of the following five ways:
|
||||
a) If you make changes to Vim yourself, you must clearly describe in
|
||||
the distribution how to contact you. When the maintainer asks you
|
||||
(in any way) for a copy of the modified Vim you distributed, you
|
||||
must make your changes, including source code, available to the
|
||||
maintainer without fee. The maintainer reserves the right to
|
||||
include your changes in the official version of Vim. What the
|
||||
maintainer will do with your changes and under what license they
|
||||
will be distributed is negotiable. If there has been no negotiation
|
||||
then this license, or a later version, also applies to your changes.
|
||||
The current maintainer is Bram Moolenaar <Bram@vim.org>. If this
|
||||
changes it will be announced in appropriate places (most likely
|
||||
vim.sf.net, www.vim.org and/or comp.editors). When it is completely
|
||||
impossible to contact the maintainer, the obligation to send him
|
||||
your changes ceases. Once the maintainer has confirmed that he has
|
||||
received your changes they will not have to be sent again.
|
||||
b) If you have received a modified Vim that was distributed as
|
||||
mentioned under a) you are allowed to further distribute it
|
||||
unmodified, as mentioned at I). If you make additional changes the
|
||||
text under a) applies to those changes.
|
||||
c) Provide all the changes, including source code, with every copy of
|
||||
the modified Vim you distribute. This may be done in the form of a
|
||||
context diff. You can choose what license to use for new code you
|
||||
add. The changes and their license must not restrict others from
|
||||
making their own changes to the official version of Vim.
|
||||
d) When you have a modified Vim which includes changes as mentioned
|
||||
under c), you can distribute it without the source code for the
|
||||
changes if the following three conditions are met:
|
||||
- The license that applies to the changes permits you to distribute
|
||||
the changes to the Vim maintainer without fee or restriction, and
|
||||
permits the Vim maintainer to include the changes in the official
|
||||
version of Vim without fee or restriction.
|
||||
- You keep the changes for at least three years after last
|
||||
distributing the corresponding modified Vim. When the maintainer
|
||||
or someone who you distributed the modified Vim to asks you (in
|
||||
any way) for the changes within this period, you must make them
|
||||
available to him.
|
||||
- You clearly describe in the distribution how to contact you. This
|
||||
contact information must remain valid for at least three years
|
||||
after last distributing the corresponding modified Vim, or as long
|
||||
as possible.
|
||||
e) When the GNU General Public License (GPL) applies to the changes,
|
||||
you can distribute the modified Vim under the GNU GPL version 2 or
|
||||
any later version.
|
||||
3) A message must be added, at least in the output of the ":version"
|
||||
command and in the intro screen, such that the user of the modified Vim
|
||||
is able to see that it was modified. When distributing as mentioned
|
||||
under 2)e) adding the message is only required for as far as this does
|
||||
not conflict with the license used for the changes.
|
||||
4) The contact information as required under 2)a) and 2)d) must not be
|
||||
removed or changed, except that the person himself can make
|
||||
corrections.
|
||||
|
||||
III) If you distribute a modified version of Vim, you are encouraged to use
|
||||
the Vim license for your changes and make them available to the
|
||||
maintainer, including the source code. The preferred way to do this is
|
||||
by e-mail or by uploading the files to a server and e-mailing the URL.
|
||||
If the number of changes is small (e.g., a modified Makefile) e-mailing a
|
||||
context diff will do. The e-mail address to be used is
|
||||
<maintainer@vim.org>
|
||||
|
||||
IV) It is not allowed to remove this license from the distribution of the Vim
|
||||
sources, parts of it or from a modified version. You may use this
|
||||
license for previous Vim releases instead of the license that they came
|
||||
with, at your option.
|
163
sources_non_forked/ack.vim/README.md
Normal file
163
sources_non_forked/ack.vim/README.md
Normal file
|
@ -0,0 +1,163 @@
|
|||
# ack.vim
|
||||
|
||||
Run your favorite search tool from Vim, with an enhanced results list.
|
||||
|
||||
This plugin was designed as a Vim frontend for the programmer's search tool
|
||||
[ack]. ack can be used as a replacement for 99% of the uses of `grep`. The
|
||||
plugin allows you to search with ack from within Vim and shows the results in a
|
||||
split window.
|
||||
|
||||
But here's a little secret for the Vim-seasoned: it's just a light wrapper for
|
||||
Vim's [grepprg] and the [quickfix] window for match results. This makes it easy
|
||||
to integrate with your own Vim configuration and use existing knowledge of core
|
||||
features. It also means the plugin is flexible to use with other search tools.
|
||||
|
||||
[grepprg]: http://vimdoc.sourceforge.net/htmldoc/options.html#'grepprg'
|
||||
[quickfix]: http://vimdoc.sourceforge.net/htmldoc/quickfix.html#quickfix
|
||||
|
||||
## Installation
|
||||
|
||||
### ack
|
||||
|
||||
You will need ack (>= 2.0), of course. To install it follow the
|
||||
[manual](http://beyondgrep.com/install/).
|
||||
|
||||
### The Plugin
|
||||
|
||||
It is recommended to use one of the popular plugin managers for Vim. There are
|
||||
many and you probably already have a preferred one, but a few examples for your
|
||||
copy-and-paste convenience:
|
||||
|
||||
#### Pathogen
|
||||
|
||||
$ git clone https://github.com/mileszs/ack.vim.git ~/.vim/bundle/ack.vim
|
||||
|
||||
#### Vundle
|
||||
|
||||
```vim
|
||||
Plugin 'mileszs/ack.vim'
|
||||
```
|
||||
|
||||
#### NeoBundle
|
||||
|
||||
```vim
|
||||
NeoBundle 'mileszs/ack.vim'
|
||||
```
|
||||
|
||||
#### Manual (not recommended)
|
||||
|
||||
[Download][releases] the plugin and extract it in `~/.vim/` (or
|
||||
`%PROGRAMFILES%/Vim/vimfiles` on Windows).
|
||||
|
||||
## Usage
|
||||
|
||||
:Ack [options] {pattern} [{directories}]
|
||||
|
||||
Search recursively in `{directories}` (which defaults to the current directory)
|
||||
for the `{pattern}`.
|
||||
|
||||
Files containing the search term will be listed in the quickfix window, along
|
||||
with the line number of the occurrence, once for each occurrence. `<Enter>` on
|
||||
a line in this window will open the file and place the cursor on the matching
|
||||
line.
|
||||
|
||||
Just like where you use `:grep`, `:grepadd`, `:lgrep`, and :`lgrepadd`, you can
|
||||
use `:Ack`, `:AckAdd`, `:LAck`, and `:LAckAdd` respectively. (See `:help Ack`
|
||||
after installing, or [`doc/ack.txt`][doc] in the repo, for more information.)
|
||||
|
||||
For more ack help see [ack documentation](http://beyondgrep.com/documentation/).
|
||||
|
||||
[doc]: https://github.com/mileszs/ack.vim/blob/master/doc/ack.txt
|
||||
|
||||
### Keyboard Shortcuts
|
||||
|
||||
The quickfix results window is augmented with these convenience mappings:
|
||||
|
||||
? a quick summary of these keys, repeat to close
|
||||
o to open (same as Enter)
|
||||
O to open and close the quickfix window
|
||||
go to preview file, open but maintain focus on ack.vim results
|
||||
t to open in new tab
|
||||
T to open in new tab without moving to it
|
||||
h to open in horizontal split
|
||||
H to open in horizontal split, keeping focus on the results
|
||||
v to open in vertical split
|
||||
gv to open in vertical split, keeping focus on the results
|
||||
q to close the quickfix window
|
||||
|
||||
### Gotchas
|
||||
|
||||
To search for a pattern that contains whitespace, you need to enclose the
|
||||
pattern in single quotes. For example: `:Ack 'foo bar'` to search for
|
||||
'foo bar'.
|
||||
|
||||
Some characters have special meaning, and need to be escaped in your search
|
||||
pattern. For instance, `#`. You need to escape it with `:Ack '\\\#define
|
||||
foo'` to search for '#define foo'. See [issue #5].
|
||||
|
||||
[issue #5]: https://github.com/mileszs/ack.vim/issues/5
|
||||
|
||||
## Possibly FAQ
|
||||
|
||||
#### Can I use `ag` ([The Silver Searcher]) with this?
|
||||
|
||||
Absolutely, and probably other tools if their output is similar or you can
|
||||
write a pattern match for it--just set `g:ackprg`. If you like, you can fall
|
||||
back to Ack in case you use your vimrc on a system without Ag available:
|
||||
|
||||
```vim
|
||||
if executable('ag')
|
||||
let g:ackprg = 'ag --vimgrep'
|
||||
endif
|
||||
```
|
||||
|
||||
Since Ack is quite portable you might check a copy of it into your dotfiles
|
||||
repository in `~/bin` so you'll nearly always have it available.
|
||||
|
||||
#### What's the difference from ag.vim?
|
||||
|
||||
Well... not a lot really.
|
||||
|
||||
Present maintainer, yours truly, [kind of wishes they never forked][sadface],
|
||||
contributes to both, and wouldn't mind seeing them merged again. ag.vim got a
|
||||
nice code clean-up (which ack.vim is now hopefully getting), and ack.vim picked
|
||||
up a few features that haven't made their way to ag.vim, like `:AckWindow`,
|
||||
optional background search execution with [vim-dispatch], and auto-previewing.
|
||||
|
||||
#### I don't want to jump to the first result automatically. ####
|
||||
|
||||
Use `:Ack!`, with bang. If you want this behavior most of the time, you might
|
||||
like an abbreviation or mapping in your personal config, something like these:
|
||||
|
||||
```vim
|
||||
cnoreabbrev Ack Ack!
|
||||
nnoremap <Leader>a :Ack!<Space>
|
||||
```
|
||||
|
||||
Most of the `:[L]Ack*` commands support this. Note that this behavior follows
|
||||
the convention of Vim's built-in `:grep` and `:make` commands.
|
||||
|
||||
[The Silver Searcher]: https://github.com/ggreer/the_silver_searcher
|
||||
[sadface]: https://github.com/mileszs/ack.vim/commit/d97090fb502d40229e6976dfec0e06636ba227d5#commitcomment-5771145
|
||||
|
||||
## Changelog
|
||||
|
||||
Please see [the GitHub releases page][releases].
|
||||
|
||||
## Credits
|
||||
|
||||
This plugin is derived from Antoine Imbert's blog post [ack and Vim
|
||||
Integration][] (in particular, the function in the update to the post). [Miles
|
||||
Sterrett][mileszs] packaged it up as a plugin and documented it in Vim's help
|
||||
format, and since then [many contributors][contributors] have submitted
|
||||
enhancements and fixes.
|
||||
|
||||
And of course, where would we be without [ack]. And, you know, Vim.
|
||||
|
||||
[ack and Vim Integration]: http://blog.ant0ine.com/typepad/2007/03/ack-and-vim-integration.html
|
||||
[mileszs]: https://github.com/mileszs
|
||||
[contributors]: https://github.com/mileszs/ack.vim/graphs/contributors
|
||||
[ack]: http://beyondgrep.com/
|
||||
|
||||
[vim-dispatch]: https://github.com/tpope/vim-dispatch
|
||||
[releases]: https://github.com/mileszs/ack.vim/releases
|
246
sources_non_forked/ack.vim/autoload/ack.vim
Normal file
246
sources_non_forked/ack.vim/autoload/ack.vim
Normal file
|
@ -0,0 +1,246 @@
|
|||
if exists('g:autoloaded_ack') || &cp
|
||||
finish
|
||||
endif
|
||||
|
||||
if exists('g:ack_use_dispatch')
|
||||
if g:ack_use_dispatch && !exists(':Dispatch')
|
||||
call s:Warn('Dispatch not loaded! Falling back to g:ack_use_dispatch = 0.')
|
||||
let g:ack_use_dispatch = 0
|
||||
endif
|
||||
else
|
||||
let g:ack_use_dispatch = 0
|
||||
endif
|
||||
|
||||
"-----------------------------------------------------------------------------
|
||||
" Public API
|
||||
"-----------------------------------------------------------------------------
|
||||
|
||||
function! ack#Ack(cmd, args) "{{{
|
||||
call s:Init(a:cmd)
|
||||
redraw
|
||||
|
||||
" Local values that we'll temporarily set as options when searching
|
||||
let l:grepprg = g:ackprg
|
||||
let l:grepformat = '%f:%l:%c:%m,%f:%l:%m' " Include column number
|
||||
|
||||
" Strip some options that are meaningless for path search and set match
|
||||
" format accordingly.
|
||||
if s:SearchingFilepaths()
|
||||
let l:grepprg = substitute(l:grepprg, '-H\|--column', '', 'g')
|
||||
let l:grepformat = '%f'
|
||||
endif
|
||||
|
||||
" Check user policy for blank searches
|
||||
if empty(a:args)
|
||||
if !g:ack_use_cword_for_empty_search
|
||||
echo "No regular expression found."
|
||||
return
|
||||
endif
|
||||
endif
|
||||
|
||||
" If no pattern is provided, search for the word under the cursor
|
||||
let l:grepargs = empty(a:args) ? expand("<cword>") : a:args . join(a:000, ' ')
|
||||
|
||||
"Bypass search if cursor is on blank string
|
||||
if l:grepargs == ""
|
||||
echo "No regular expression found."
|
||||
return
|
||||
endif
|
||||
|
||||
" NOTE: we escape special chars, but not everything using shellescape to
|
||||
" allow for passing arguments etc
|
||||
let l:escaped_args = escape(l:grepargs, '|#%')
|
||||
|
||||
echo "Searching ..."
|
||||
|
||||
if g:ack_use_dispatch
|
||||
call s:SearchWithDispatch(l:grepprg, l:escaped_args, l:grepformat)
|
||||
else
|
||||
call s:SearchWithGrep(a:cmd, l:grepprg, l:escaped_args, l:grepformat)
|
||||
endif
|
||||
|
||||
" Dispatch has no callback mechanism currently, we just have to display the
|
||||
" list window early and wait for it to populate :-/
|
||||
call ack#ShowResults()
|
||||
call s:Highlight(l:grepargs)
|
||||
endfunction "}}}
|
||||
|
||||
function! ack#AckFromSearch(cmd, args) "{{{
|
||||
let search = getreg('/')
|
||||
" translate vim regular expression to perl regular expression.
|
||||
let search = substitute(search, '\(\\<\|\\>\)', '\\b', 'g')
|
||||
call ack#Ack(a:cmd, '"' . search . '" ' . a:args)
|
||||
endfunction "}}}
|
||||
|
||||
function! ack#AckHelp(cmd, args) "{{{
|
||||
let args = a:args . ' ' . s:GetDocLocations()
|
||||
call ack#Ack(a:cmd, args)
|
||||
endfunction "}}}
|
||||
|
||||
function! ack#AckWindow(cmd, args) "{{{
|
||||
let files = tabpagebuflist()
|
||||
|
||||
" remove duplicated filenames (files appearing in more than one window)
|
||||
let files = filter(copy(sort(files)), 'index(files,v:val,v:key+1)==-1')
|
||||
call map(files, "bufname(v:val)")
|
||||
|
||||
" remove unnamed buffers as quickfix (empty strings before shellescape)
|
||||
call filter(files, 'v:val != ""')
|
||||
|
||||
" expand to full path (avoid problems with cd/lcd in au QuickFixCmdPre)
|
||||
let files = map(files, "shellescape(fnamemodify(v:val, ':p'))")
|
||||
let args = a:args . ' ' . join(files)
|
||||
|
||||
call ack#Ack(a:cmd, args)
|
||||
endfunction "}}}
|
||||
|
||||
function! ack#ShowResults() "{{{
|
||||
let l:handler = s:UsingLocList() ? g:ack_lhandler : g:ack_qhandler
|
||||
execute l:handler
|
||||
call s:ApplyMappings()
|
||||
redraw!
|
||||
endfunction "}}}
|
||||
|
||||
"-----------------------------------------------------------------------------
|
||||
" Private API
|
||||
"-----------------------------------------------------------------------------
|
||||
|
||||
function! s:ApplyMappings() "{{{
|
||||
if !s:UsingListMappings() || &filetype != 'qf'
|
||||
return
|
||||
endif
|
||||
|
||||
let l:wintype = s:UsingLocList() ? 'l' : 'c'
|
||||
let l:closemap = ':' . l:wintype . 'close<CR>'
|
||||
let g:ack_mappings.q = l:closemap
|
||||
|
||||
nnoremap <buffer> <silent> ? :call <SID>QuickHelp()<CR>
|
||||
|
||||
if g:ack_autoclose
|
||||
" We just map the 'go' and 'gv' mappings to close on autoclose, wtf?
|
||||
for key_map in items(g:ack_mappings)
|
||||
execute printf("nnoremap <buffer> <silent> %s %s", get(key_map, 0), get(key_map, 1) . l:closemap)
|
||||
endfor
|
||||
|
||||
execute "nnoremap <buffer> <silent> <CR> <CR>" . l:closemap
|
||||
else
|
||||
for key_map in items(g:ack_mappings)
|
||||
execute printf("nnoremap <buffer> <silent> %s %s", get(key_map, 0), get(key_map, 1))
|
||||
endfor
|
||||
endif
|
||||
|
||||
if exists("g:ackpreview") " if auto preview in on, remap j and k keys
|
||||
nnoremap <buffer> <silent> j j<CR><C-W><C-P>
|
||||
nnoremap <buffer> <silent> k k<CR><C-W><C-P>
|
||||
nmap <buffer> <silent> <Down> j
|
||||
nmap <buffer> <silent> <Up> k
|
||||
endif
|
||||
endfunction "}}}
|
||||
|
||||
function! s:GetDocLocations() "{{{
|
||||
let dp = ''
|
||||
for p in split(&rtp, ',')
|
||||
let p = p . '/doc/'
|
||||
if isdirectory(p)
|
||||
let dp = p . '*.txt ' . dp
|
||||
endif
|
||||
endfor
|
||||
|
||||
return dp
|
||||
endfunction "}}}
|
||||
|
||||
function! s:Highlight(args) "{{{
|
||||
if !g:ackhighlight
|
||||
return
|
||||
endif
|
||||
|
||||
let @/ = matchstr(a:args, "\\v(-)\@<!(\<)\@<=\\w+|['\"]\\zs.{-}\\ze['\"]")
|
||||
call feedkeys(":let &hlsearch=1 \| echo \<CR>", "n")
|
||||
endfunction "}}}
|
||||
|
||||
" Initialize state for an :Ack* or :LAck* search
|
||||
function! s:Init(cmd) "{{{
|
||||
let s:searching_filepaths = (a:cmd =~# '-g$') ? 1 : 0
|
||||
let s:using_loclist = (a:cmd =~# '^l') ? 1 : 0
|
||||
|
||||
if g:ack_use_dispatch && s:using_loclist
|
||||
call s:Warn('Dispatch does not support location lists! Proceeding with quickfix...')
|
||||
let s:using_loclist = 0
|
||||
endif
|
||||
endfunction "}}}
|
||||
|
||||
function! s:QuickHelp() "{{{
|
||||
execute 'edit' globpath(&rtp, 'doc/ack_quick_help.txt')
|
||||
|
||||
silent normal gg
|
||||
setlocal buftype=nofile bufhidden=hide nobuflisted
|
||||
setlocal nomodifiable noswapfile
|
||||
setlocal filetype=help
|
||||
setlocal nonumber norelativenumber nowrap
|
||||
setlocal foldmethod=diff foldlevel=20
|
||||
|
||||
nnoremap <buffer> <silent> ? :q!<CR>:call ack#ShowResults()<CR>
|
||||
endfunction "}}}
|
||||
|
||||
function! s:SearchWithDispatch(grepprg, grepargs, grepformat) "{{{
|
||||
let l:makeprg_bak = &l:makeprg
|
||||
let l:errorformat_bak = &l:errorformat
|
||||
|
||||
" We don't execute a :grep command for Dispatch, so add -g here instead
|
||||
if s:SearchingFilepaths()
|
||||
let l:grepprg = a:grepprg . ' -g'
|
||||
else
|
||||
let l:grepprg = a:grepprg
|
||||
endif
|
||||
|
||||
try
|
||||
let &l:makeprg = l:grepprg . ' ' . a:grepargs
|
||||
let &l:errorformat = a:grepformat
|
||||
|
||||
Make
|
||||
finally
|
||||
let &l:makeprg = l:makeprg_bak
|
||||
let &l:errorformat = l:errorformat_bak
|
||||
endtry
|
||||
endfunction "}}}
|
||||
|
||||
function! s:SearchWithGrep(grepcmd, grepprg, grepargs, grepformat) "{{{
|
||||
let l:grepprg_bak = &l:grepprg
|
||||
let l:grepformat_bak = &grepformat
|
||||
|
||||
try
|
||||
let &l:grepprg = a:grepprg
|
||||
let &grepformat = a:grepformat
|
||||
|
||||
silent execute a:grepcmd a:grepargs
|
||||
finally
|
||||
let &l:grepprg = l:grepprg_bak
|
||||
let &grepformat = l:grepformat_bak
|
||||
endtry
|
||||
endfunction "}}}
|
||||
|
||||
" Are we finding matching files, not lines? (the -g option -- :AckFile)
|
||||
function! s:SearchingFilepaths() "{{{
|
||||
return get(s:, 'searching_filepaths', 0)
|
||||
endfunction "}}}
|
||||
|
||||
" Predicate for whether mappings are enabled for list type of current search.
|
||||
function! s:UsingListMappings() "{{{
|
||||
if s:UsingLocList()
|
||||
return g:ack_apply_lmappings
|
||||
else
|
||||
return g:ack_apply_qmappings
|
||||
endif
|
||||
endfunction "}}}
|
||||
|
||||
" Were we invoked with a :LAck command?
|
||||
function! s:UsingLocList() "{{{
|
||||
return get(s:, 'using_loclist', 0)
|
||||
endfunction "}}}
|
||||
|
||||
function! s:Warn(msg) "{{{
|
||||
echohl WarningMsg | echomsg 'Ack: ' . a:msg | echohl None
|
||||
endf "}}}
|
||||
|
||||
let g:autoloaded_ack = 1
|
||||
" vim:set et sw=2 ts=2 tw=78 fdm=marker
|
315
sources_non_forked/ack.vim/doc/ack.txt
Normal file
315
sources_non_forked/ack.vim/doc/ack.txt
Normal file
|
@ -0,0 +1,315 @@
|
|||
*ack.txt* Plugin that integrates ack with Vim
|
||||
|
||||
==============================================================================
|
||||
Author: Antoine Imbert <antoine.imbert+ackvim@gmail.com> *ack-author*
|
||||
License: Same terms as Vim itself (see |license|)
|
||||
|
||||
This plugin is only available if 'compatible' is not set.
|
||||
|
||||
{Vi does not have any of this}
|
||||
|
||||
==============================================================================
|
||||
INTRODUCTION *ack*
|
||||
|
||||
This plugin is a front for the Perl module App::Ack. Ack can be used as a
|
||||
replacement for grep. This plugin will allow you to run ack from vim, and
|
||||
shows the results in a split window.
|
||||
|
||||
:Ack[!] [options] {pattern} [{directory}] *:Ack*
|
||||
|
||||
Search recursively in {directory} (which defaults to the current
|
||||
directory) for the {pattern}. Behaves just like the |:grep| command, but
|
||||
will open the |Quickfix| window for you. If [!] is not given the first
|
||||
occurrence is jumped to.
|
||||
|
||||
:AckAdd [options] {pattern} [{directory}] *:AckAdd*
|
||||
|
||||
Just like |:Ack|, but instead of making a new list, the matches are
|
||||
appended to the current |quickfix| list.
|
||||
|
||||
:AckFromSearch [{directory}] *:AckFromSearch*
|
||||
|
||||
Just like |:Ack| but the pattern is from previous search.
|
||||
|
||||
:LAck [options] {pattern} [{directory}] *:LAck*
|
||||
|
||||
Just like |:Ack| but instead of the |quickfix| list, matches are placed in
|
||||
the current |location-list|.
|
||||
|
||||
:LAckAdd [options] {pattern} [{directory}] *:LAckAdd*
|
||||
|
||||
Just like |:AckAdd| but instead of the |quickfix| list, matches are added
|
||||
to the current |location-list|
|
||||
|
||||
:AckFile [options] {pattern} [{directory}] *:AckFile*
|
||||
|
||||
Search recursively in {directory} (which defaults to the current
|
||||
directory) for filenames matching the {pattern}. Behaves just like the
|
||||
|:grep| command, but will open the |Quickfix| window for you.
|
||||
|
||||
:AckHelp[!] [options] {pattern} *:AckHelp*
|
||||
|
||||
Search vim documentation files for the {pattern}. Behaves just like the
|
||||
|:Ack| command, but searches only vim documentation .txt files
|
||||
|
||||
:LAckHelp [options] {pattern} *:LAckHelp*
|
||||
|
||||
Just like |:AckHelp| but instead of the |quickfix| list, matches are placed
|
||||
in the current |location-list|.
|
||||
|
||||
:AckWindow[!] [options] {pattern} *:AckWindow*
|
||||
|
||||
Search all buffers visible in the screen (current tab page only) files for
|
||||
the {pattern}.
|
||||
|
||||
:LAckWindow [options] {pattern} *:LAckWindow*
|
||||
|
||||
Just like |:AckWindow| but instead of the |quickfix| list, matches are
|
||||
placed in the current |location-list|.
|
||||
|
||||
Files containing the search term will be listed in the split window, along
|
||||
with the line number of the occurrence, once for each occurrence. <Enter> on
|
||||
a line in this window will open the file, and place the cursor on the matching
|
||||
line.
|
||||
|
||||
Note that if you are using Dispatch.vim with |g:ack_use_dispatch|, location
|
||||
lists are not supported, because Dispatch does not support them at this time.
|
||||
`:LAck` versions of commands above will give a warning and proceed to use the
|
||||
quickfix list instead.
|
||||
|
||||
See http://beyondgrep.com/ for more information on searching with ack.
|
||||
|
||||
|
||||
==============================================================================
|
||||
CONFIGURATION *ack-configuration*
|
||||
|
||||
*g:ackprg*
|
||||
g:ackprg
|
||||
Default for ubuntu: "ack-grep"
|
||||
Default for other systems: "ack"
|
||||
|
||||
Use this option to specify the search command and its default arguments.
|
||||
|
||||
Example:
|
||||
>
|
||||
let g:ackprg = "ag --vimgrep"
|
||||
<
|
||||
*g:ack_default_options*
|
||||
g:ack_default_options
|
||||
Default: " -s -H --nocolor --nogroup --column"
|
||||
|
||||
Use this option to specify the default arguments given to `ack`. This is only
|
||||
used if |g:ackprg| has not been customized from the default--if you are using
|
||||
a custom search program instead of Ack, set your preferred options in
|
||||
|g:ackprg|.
|
||||
|
||||
NOTE: This option may be deprecated in the future. ~
|
||||
|
||||
Example:
|
||||
>
|
||||
let g:ack_default_options =
|
||||
\ " -s -H --nocolor --nogroup --column --smart-case --follow"
|
||||
<
|
||||
*g:ack_apply_qmappings*
|
||||
g:ack_apply_qmappings
|
||||
Default: 1
|
||||
|
||||
This option enables mappings on the |quickfix| window.
|
||||
|
||||
*g:ack_apply_lmappings*
|
||||
g:ack_apply_lmappings
|
||||
Default: 1
|
||||
|
||||
This option enables mappings on |location-list| windows.
|
||||
|
||||
*g:ack_mappings*
|
||||
g:ack_mappings
|
||||
Default: {
|
||||
\ "t": "<C-W><CR><C-W>T",
|
||||
\ "T": "<C-W><CR><C-W>TgT<C-W>j",
|
||||
\ "o": "<CR>",
|
||||
\ "O": "<CR><C-W><C-W>:ccl<CR>",
|
||||
\ "go": "<CR><C-W>j",
|
||||
\ "h": "<C-W><CR><C-W>K",
|
||||
\ "H": "<C-W><CR><C-W>K<C-W>b",
|
||||
\ "v": "<C-W><CR><C-W>H<C-W>b<C-W>J<C-W>t",
|
||||
\ "gv": "<C-W><CR><C-W>H<C-W>b<C-W>J" }
|
||||
|
||||
This option list all maps create on quickfix/Location list window.
|
||||
|
||||
Example, if you want to open the result in the middle of the screen:
|
||||
>
|
||||
let g:ack_mappings = { "o": "<CR>zz" }
|
||||
<
|
||||
*g:ack_qhandler*
|
||||
g:ack_qhandler
|
||||
Default: "botright copen"
|
||||
|
||||
Command to open the quickview window.
|
||||
|
||||
If you want to open a quickview window with 30 lines you can do:
|
||||
>
|
||||
let g:ack_qhandler = "botright copen 30"
|
||||
<
|
||||
*g:ack_lhandler*
|
||||
g:ack_lhandler
|
||||
Default: "botright lopen"
|
||||
|
||||
Command to open the Location list window.
|
||||
|
||||
If you want to open a Location list window with 30 lines you can do:
|
||||
>
|
||||
let g:ack_lhandler = "botright lopen 30"
|
||||
<
|
||||
*g:ackhighlight*
|
||||
g:ackhighlight
|
||||
Default: 0
|
||||
|
||||
Use this option to highlight the searched term.
|
||||
|
||||
Example:
|
||||
>
|
||||
let g:ackhighlight = 1
|
||||
<
|
||||
*g:ack_autoclose*
|
||||
g:ack_autoclose
|
||||
Default: 0
|
||||
|
||||
Use this option to specify whether to close the quickfix window after
|
||||
using any of the shortcuts.
|
||||
|
||||
Example:
|
||||
>
|
||||
let g:ack_autoclose = 1
|
||||
<
|
||||
*g:ack_autofold_results*
|
||||
g:ack_autofold_results
|
||||
Default: 0
|
||||
|
||||
Use this option to fold the results in quickfix by file name. Only the current
|
||||
fold will be open by default and while you press 'j' and 'k' to move between the
|
||||
results if you hit other fold the last one will be closed and the current will
|
||||
be open.
|
||||
|
||||
Example:
|
||||
>
|
||||
let g:ack_autofold_results = 1
|
||||
<
|
||||
*g:ackpreview*
|
||||
g:ackpreview
|
||||
Default: 0
|
||||
|
||||
Use this option to automagically open the file with 'j' or 'k'.
|
||||
|
||||
Example:
|
||||
>
|
||||
let g:ackpreview = 1
|
||||
<
|
||||
*g:ack_use_dispatch*
|
||||
g:ack_use_dispatch
|
||||
Default: 0
|
||||
|
||||
Use this option to use vim-dispatch to run searches in the background, with a
|
||||
variety of execution backends for different systems.
|
||||
|
||||
Due to limitations in Dispatch at this time, location lists are unsupported
|
||||
and result windows will appear before results are ready. Still, these may be
|
||||
acceptable tradeoffs for very large projects where searches are slow.
|
||||
|
||||
Example:
|
||||
>
|
||||
let g:ack_use_dispatch = 1
|
||||
<
|
||||
*g:ack_use_cword_for_empty_search*
|
||||
g:ack_use_cword_for_empty_search
|
||||
Default: 1
|
||||
|
||||
Use this option to enable blank searches to run against the word under the
|
||||
cursor. When this option is not set, blank searches will only output an error
|
||||
message.
|
||||
|
||||
Example:
|
||||
>
|
||||
let g:ack_use_cword_for_empty_search = 0
|
||||
<
|
||||
==============================================================================
|
||||
MAPPINGS *ack-mappings*
|
||||
|
||||
The following keyboard shortcuts are available in the |quickfix| and
|
||||
|location-list| windows:
|
||||
|
||||
? display a quick summary of these mappings.
|
||||
|
||||
o open file (same as Enter).
|
||||
|
||||
O open file and close the quickfix window.
|
||||
|
||||
go preview file (open but maintain focus on ack.vim results).
|
||||
|
||||
t open in a new tab.
|
||||
|
||||
T open in new tab without moving to it.
|
||||
|
||||
h open in horizontal split.
|
||||
|
||||
H open in horizontal split, keeping focus on the results.
|
||||
|
||||
v open in vertical split.
|
||||
|
||||
gv open in vertical split, keeping focus on the results.
|
||||
|
||||
q close the quickfix window.
|
||||
|
||||
To adjust these, see |g:ack_mappings|.
|
||||
|
||||
==============================================================================
|
||||
Ignoring files *ack-ignore*
|
||||
|
||||
If you're using this plugin with ag, The Silver Searcher, bear in mind that:
|
||||
|
||||
- It ignores file patterns from your .gitignore and .hgignore.
|
||||
|
||||
- If there are other files in your source repository you don't wish to
|
||||
search, you can add their patterns to an .agignore file.
|
||||
|
||||
==============================================================================
|
||||
ISSUES AND FAQ *ack-issues-and-faq*
|
||||
|
||||
I don't want to jump to the first result automatically.~
|
||||
|
||||
Use `:Ack!`, with bang. If you want this behavior most of the time, you
|
||||
might like an abbreviation or mapping in your personal config, something
|
||||
like these:
|
||||
>
|
||||
cnoreabbrev Ack Ack!
|
||||
nnoremap <Leader>a :Ack!<Space>
|
||||
<
|
||||
Most of the `:[L]Ack*` commands support this. Note that this behavior
|
||||
follows the convention of Vim's built-in |:grep| and |:make| commands.
|
||||
|
||||
I use NERDTree and opening ack.vim results in a vertical split displacing it.~
|
||||
|
||||
You are probably using NERDTree with its default alignment at the left
|
||||
side of the window. Set these custom mappings in your vimrc to work around
|
||||
this:
|
||||
>
|
||||
let g:ack_mappings = {
|
||||
\ 'v': '<C-W><CR><C-W>L<C-W>p<C-W>J<C-W>p',
|
||||
\ 'gv': '<C-W><CR><C-W>L<C-W>p<C-W>J' }
|
||||
<
|
||||
This solution will be improved in the future.
|
||||
|
||||
Results show a mix of relative and absolute paths, making them hard to read.~
|
||||
|
||||
This is a quirk of Vim that can happen with plain |:vimgrep| too. You can
|
||||
try this in your vimrc to work around it:
|
||||
>
|
||||
autocmd BufAdd * exe "cd" fnameescape(getcwd())
|
||||
<
|
||||
but for some users this may be disruptive to their Vim workflow. For more
|
||||
details, see:
|
||||
|
||||
http://vi.stackexchange.com/a/4816/7174
|
||||
https://github.com/mileszs/ack.vim/issues/143
|
||||
|
||||
vim:set et sw=4 ts=4 tw=78:
|
15
sources_non_forked/ack.vim/doc/ack_quick_help.txt
Normal file
15
sources_non_forked/ack.vim/doc/ack_quick_help.txt
Normal file
|
@ -0,0 +1,15 @@
|
|||
==== ack.vim quick help ===============
|
||||
|
||||
*?:* a quick summary of these keys, repeat to close
|
||||
*o:* to open (same as Enter)
|
||||
*O:* to open and close the quickfix window
|
||||
*go:* to preview file, open but maintain focus on ack.vim results
|
||||
*t:* to open in new tab
|
||||
*T:* to open in new tab without moving to it
|
||||
*h:* to open in horizontal split
|
||||
*H:* to open in horizontal split, keeping focus on the results
|
||||
*v:* to open in vertical split
|
||||
*gv:* to open in vertical split, keeping focus on the results
|
||||
*q:* to close the quickfix window
|
||||
|
||||
========================================
|
9
sources_non_forked/ack.vim/ftplugin/qf.vim
Normal file
9
sources_non_forked/ack.vim/ftplugin/qf.vim
Normal file
|
@ -0,0 +1,9 @@
|
|||
if exists("g:ack_autofold_results") && g:ack_autofold_results
|
||||
setlocal foldlevel=0
|
||||
setlocal foldmethod=expr
|
||||
setlocal foldexpr=matchstr(getline(v:lnum),'^[^\|]\\+')==#matchstr(getline(v:lnum+1),'^[^\|]\\+')?1:'<1'
|
||||
setlocal foldenable
|
||||
setlocal foldclose=all
|
||||
setlocal foldopen=all
|
||||
nnoremap <buffer> j jzz
|
||||
endif
|
83
sources_non_forked/ack.vim/plugin/ack.vim
Normal file
83
sources_non_forked/ack.vim/plugin/ack.vim
Normal file
|
@ -0,0 +1,83 @@
|
|||
if exists('g:loaded_ack') || &cp
|
||||
finish
|
||||
endif
|
||||
|
||||
if !exists("g:ack_default_options")
|
||||
let g:ack_default_options = " -s -H --nopager --nocolor --nogroup --column"
|
||||
endif
|
||||
|
||||
" Location of the ack utility
|
||||
if !exists("g:ackprg")
|
||||
if executable('ack-grep')
|
||||
let g:ackprg = "ack-grep"
|
||||
elseif executable('ack')
|
||||
let g:ackprg = "ack"
|
||||
else
|
||||
finish
|
||||
endif
|
||||
let g:ackprg .= g:ack_default_options
|
||||
endif
|
||||
|
||||
if !exists("g:ack_apply_qmappings")
|
||||
let g:ack_apply_qmappings = !exists("g:ack_qhandler")
|
||||
endif
|
||||
|
||||
if !exists("g:ack_apply_lmappings")
|
||||
let g:ack_apply_lmappings = !exists("g:ack_lhandler")
|
||||
endif
|
||||
|
||||
let s:ack_mappings = {
|
||||
\ "t": "<C-W><CR><C-W>T",
|
||||
\ "T": "<C-W><CR><C-W>TgT<C-W>j",
|
||||
\ "o": "<CR>",
|
||||
\ "O": "<CR><C-W>p<C-W>c",
|
||||
\ "go": "<CR><C-W>p",
|
||||
\ "h": "<C-W><CR><C-W>K",
|
||||
\ "H": "<C-W><CR><C-W>K<C-W>b",
|
||||
\ "v": "<C-W><CR><C-W>H<C-W>b<C-W>J<C-W>t",
|
||||
\ "gv": "<C-W><CR><C-W>H<C-W>b<C-W>J" }
|
||||
|
||||
if exists("g:ack_mappings")
|
||||
let g:ack_mappings = extend(s:ack_mappings, g:ack_mappings)
|
||||
else
|
||||
let g:ack_mappings = s:ack_mappings
|
||||
endif
|
||||
|
||||
if !exists("g:ack_qhandler")
|
||||
let g:ack_qhandler = "botright copen"
|
||||
endif
|
||||
|
||||
if !exists("g:ack_lhandler")
|
||||
let g:ack_lhandler = "botright lopen"
|
||||
endif
|
||||
|
||||
if !exists("g:ackhighlight")
|
||||
let g:ackhighlight = 0
|
||||
endif
|
||||
|
||||
if !exists("g:ack_autoclose")
|
||||
let g:ack_autoclose = 0
|
||||
endif
|
||||
|
||||
if !exists("g:ack_autofold_results")
|
||||
let g:ack_autofold_results = 0
|
||||
endif
|
||||
|
||||
if !exists("g:ack_use_cword_for_empty_search")
|
||||
let g:ack_use_cword_for_empty_search = 1
|
||||
endif
|
||||
|
||||
command! -bang -nargs=* -complete=file Ack call ack#Ack('grep<bang>', <q-args>)
|
||||
command! -bang -nargs=* -complete=file AckAdd call ack#Ack('grepadd<bang>', <q-args>)
|
||||
command! -bang -nargs=* -complete=file AckFromSearch call ack#AckFromSearch('grep<bang>', <q-args>)
|
||||
command! -bang -nargs=* -complete=file LAck call ack#Ack('lgrep<bang>', <q-args>)
|
||||
command! -bang -nargs=* -complete=file LAckAdd call ack#Ack('lgrepadd<bang>', <q-args>)
|
||||
command! -bang -nargs=* -complete=file AckFile call ack#Ack('grep<bang> -g', <q-args>)
|
||||
command! -bang -nargs=* -complete=help AckHelp call ack#AckHelp('grep<bang>', <q-args>)
|
||||
command! -bang -nargs=* -complete=help LAckHelp call ack#AckHelp('lgrep<bang>', <q-args>)
|
||||
command! -bang -nargs=* AckWindow call ack#AckWindow('grep<bang>', <q-args>)
|
||||
command! -bang -nargs=* LAckWindow call ack#AckWindow('lgrep<bang>', <q-args>)
|
||||
|
||||
let g:loaded_ack = 1
|
||||
|
||||
" vim:set et sw=2 ts=2 tw=78 fdm=marker
|
22
sources_non_forked/ale/LICENSE
Normal file
22
sources_non_forked/ale/LICENSE
Normal file
|
@ -0,0 +1,22 @@
|
|||
Copyright (c) 2016-2020, w0rp <devw0rp@gmail.com>
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
26
sources_non_forked/ale/ale_linters/ada/adals.vim
Normal file
26
sources_non_forked/ale/ale_linters/ada/adals.vim
Normal file
|
@ -0,0 +1,26 @@
|
|||
" Author: Bartek Jasicki http://github.com/thindil
|
||||
" Description: Support for Ada Language Server
|
||||
|
||||
call ale#Set('ada_adals_executable', 'ada_language_server')
|
||||
call ale#Set('ada_adals_project', 'default.gpr')
|
||||
call ale#Set('ada_adals_encoding', 'utf-8')
|
||||
|
||||
function! ale_linters#ada#adals#GetAdaLSConfig(buffer) abort
|
||||
return {
|
||||
\ 'ada.projectFile': ale#Var(a:buffer, 'ada_adals_project'),
|
||||
\ 'ada.defaultCharset': ale#Var(a:buffer, 'ada_adals_encoding')
|
||||
\}
|
||||
endfunction
|
||||
|
||||
function! ale_linters#ada#adals#GetRootDirectory(buffer) abort
|
||||
return fnamemodify(bufname(a:buffer), ':p:h')
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('ada', {
|
||||
\ 'name': 'adals',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': {b -> ale#Var(b, 'ada_adals_executable')},
|
||||
\ 'command': '%e',
|
||||
\ 'project_root': function('ale_linters#ada#adals#GetRootDirectory'),
|
||||
\ 'lsp_config': function('ale_linters#ada#adals#GetAdaLSConfig')
|
||||
\})
|
5
sources_non_forked/ale/ale_linters/ada/cspell.vim
Normal file
5
sources_non_forked/ale/ale_linters/ada/cspell.vim
Normal file
|
@ -0,0 +1,5 @@
|
|||
scriptencoding utf-8
|
||||
" Author: David Houston <houstdav000>
|
||||
" Description: cspell support for Ada files.
|
||||
|
||||
call ale#handlers#cspell#DefineLinter('ada')
|
54
sources_non_forked/ale/ale_linters/ada/gcc.vim
Normal file
54
sources_non_forked/ale/ale_linters/ada/gcc.vim
Normal file
|
@ -0,0 +1,54 @@
|
|||
" Author: Martino Pilia <martino.pilia@gmail.com>
|
||||
" Description: Lint Ada files with GCC
|
||||
|
||||
call ale#Set('ada_gcc_executable', 'gcc')
|
||||
|
||||
" -gnatwa: activate most optional warnings
|
||||
" -gnatq: try semantic analysis even if syntax errors have been found
|
||||
call ale#Set('ada_gcc_options', '-gnatwa -gnatq')
|
||||
|
||||
function! ale_linters#ada#gcc#GetCommand(buffer) abort
|
||||
" Build a suitable output file name. The output file is specified because
|
||||
" the .ali file may be created even if no code generation is attempted.
|
||||
" The output file name must match the source file name (except for the
|
||||
" extension), so here we cannot use the null file as output.
|
||||
let l:tmp_dir = fnamemodify(ale#command#CreateDirectory(a:buffer), ':p')
|
||||
let l:out_file = l:tmp_dir . fnamemodify(bufname(a:buffer), ':t:r') . '.o'
|
||||
|
||||
" -gnatc: Check syntax and semantics only (no code generation attempted)
|
||||
return '%e -x ada -c -gnatc'
|
||||
\ . ' -o ' . ale#Escape(l:out_file)
|
||||
\ . ' -I %s:h'
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'ada_gcc_options'))
|
||||
\ . ' %t'
|
||||
endfunction
|
||||
|
||||
" For the message format please refer to:
|
||||
" https://gcc.gnu.org/onlinedocs/gnat_ugn/Output-and-Error-Message-Control.html
|
||||
" https://gcc.gnu.org/onlinedocs/gnat_ugn/Warning-Message-Control.html
|
||||
function! ale_linters#ada#gcc#Handle(buffer, lines) abort
|
||||
" Error format: <filename>:<lnum>:<col>: <text>
|
||||
" Warning format: <filename>:<lnum>:<col>: warning: <text>
|
||||
let l:re = '\v(.+):([0-9]+):([0-9]+):\s+(warning:)?\s*(.+)\s*'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:re)
|
||||
call add(l:output, {
|
||||
\ 'bufnr': a:buffer,
|
||||
\ 'lnum': str2nr(l:match[2]),
|
||||
\ 'col': str2nr(l:match[3]),
|
||||
\ 'type': l:match[4] is# 'warning:' ? 'W' : 'E',
|
||||
\ 'text': l:match[5],
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('ada', {
|
||||
\ 'name': 'gcc',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': {b -> ale#Var(b, 'ada_gcc_executable')},
|
||||
\ 'command': function('ale_linters#ada#gcc#GetCommand'),
|
||||
\ 'callback': 'ale_linters#ada#gcc#Handle',
|
||||
\})
|
128
sources_non_forked/ale/ale_linters/ansible/ansible_lint.vim
Normal file
128
sources_non_forked/ale/ale_linters/ansible/ansible_lint.vim
Normal file
|
@ -0,0 +1,128 @@
|
|||
" Authors: Bjorn Neergaard <bjorn@neersighted.com>, Vytautas Macionis <vytautas.macionis@manomail.de>
|
||||
" Description: ansible-lint for ansible-yaml files
|
||||
|
||||
call ale#Set('ansible_ansible_lint_executable', 'ansible-lint')
|
||||
|
||||
function! ale_linters#ansible#ansible_lint#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'ansible_ansible_lint_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#ansible#ansible_lint#Handle(buffer, version, 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
|
||||
|
||||
let l:version_group = ale#semver#GTE(a:version, [6, 0, 0]) ? '>=6.0.0' :
|
||||
\ ale#semver#GTE(a:version, [5, 0, 0]) ? '>=5.0.0' :
|
||||
\ '<5.0.0'
|
||||
let l:output = []
|
||||
|
||||
if '>=6.0.0' is# l:version_group
|
||||
let l:error_codes = { 'blocker': 'E', 'critical': 'E', 'major': 'W', 'minor': 'W', 'info': 'I' }
|
||||
let l:linter_issues = json_decode(join(a:lines, ''))
|
||||
|
||||
for l:issue in l:linter_issues
|
||||
if ale#path#IsBufferPath(a:buffer, l:issue.location.path)
|
||||
call add(l:output, {
|
||||
\ 'lnum': exists('l:issue.location.lines.begin.column') ? l:issue.location.lines.begin.line :
|
||||
\ l:issue.location.lines.begin,
|
||||
\ 'col': exists('l:issue.location.lines.begin.column') ? l:issue.location.lines.begin.column : 0,
|
||||
\ 'text': l:issue.check_name,
|
||||
\ 'detail': l:issue.description,
|
||||
\ 'code': l:issue.severity,
|
||||
\ 'type': l:error_codes[l:issue.severity],
|
||||
\})
|
||||
endif
|
||||
endfor
|
||||
endif
|
||||
|
||||
if '>=5.0.0' is# l:version_group
|
||||
" Matches patterns line the following:
|
||||
" test.yml:3:148: syntax-check 'var' is not a valid attribute for a Play
|
||||
" roles/test/tasks/test.yml:8: [package-latest] [VERY_LOW] Package installs should not use latest
|
||||
" D:\test\tasks\test.yml:8: [package-latest] [VERY_LOW] package installs should not use latest
|
||||
let l:pattern = '\v^(%([a-zA-Z]:)?[^:]+):(\d+):%((\d+):)? %(\[([-[:alnum:]]+)\]) %(\[([_[:alnum:]]+)\]) (.*)$'
|
||||
let l:error_codes = { 'VERY_HIGH': 'E', 'HIGH': 'E', 'MEDIUM': 'W', 'LOW': 'W', 'VERY_LOW': 'W', 'INFO': 'I' }
|
||||
|
||||
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': l:match[2] + 0,
|
||||
\ 'col': l:match[3] + 0,
|
||||
\ 'text': l:match[6],
|
||||
\ 'code': l:match[4],
|
||||
\ 'type': l:error_codes[l:match[5]],
|
||||
\})
|
||||
endif
|
||||
endfor
|
||||
endif
|
||||
|
||||
if '<5.0.0' is# l:version_group
|
||||
" Matches patterns line the following:
|
||||
" test.yml:35: [EANSIBLE0002] Trailing whitespace
|
||||
let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):?(\d+)?: \[?([[:alnum:]]+)\]? (.*)$'
|
||||
|
||||
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
|
||||
endif
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
function! ale_linters#ansible#ansible_lint#GetCommand(buffer, version) abort
|
||||
let l:commands = {
|
||||
\ '>=6.0.0': '%e --nocolor -f json -x yaml %s',
|
||||
\ '>=5.0.0': '%e --nocolor --parseable-severity -x yaml %s',
|
||||
\ '<5.0.0': '%e --nocolor -p %t'
|
||||
\}
|
||||
let l:command = ale#semver#GTE(a:version, [6, 0]) ? l:commands['>=6.0.0'] :
|
||||
\ ale#semver#GTE(a:version, [5, 0]) ? l:commands['>=5.0.0'] :
|
||||
\ l:commands['<5.0.0']
|
||||
|
||||
return l:command
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('ansible', {
|
||||
\ 'name': 'ansible_lint',
|
||||
\ 'aliases': ['ansible', 'ansible-lint'],
|
||||
\ 'executable': function('ale_linters#ansible#ansible_lint#GetExecutable'),
|
||||
\ 'command': {buffer -> ale#semver#RunWithVersionCheck(
|
||||
\ buffer,
|
||||
\ ale_linters#ansible#ansible_lint#GetExecutable(buffer),
|
||||
\ '%e --version',
|
||||
\ function('ale_linters#ansible#ansible_lint#GetCommand'),
|
||||
\ )},
|
||||
\ 'lint_file': 1,
|
||||
\ 'callback': {buffer, lines -> ale#semver#RunWithVersionCheck(
|
||||
\ buffer,
|
||||
\ ale_linters#ansible#ansible_lint#GetExecutable(buffer),
|
||||
\ '%e --version',
|
||||
\ {buffer, version -> ale_linters#ansible#ansible_lint#Handle(
|
||||
\ buffer,
|
||||
\ l:version,
|
||||
\ lines)},
|
||||
\ )},
|
||||
\})
|
38
sources_non_forked/ale/ale_linters/apiblueprint/drafter.vim
Normal file
38
sources_non_forked/ale/ale_linters/apiblueprint/drafter.vim
Normal file
|
@ -0,0 +1,38 @@
|
|||
" Author: nametake https://nametake.github.io
|
||||
" Description: apiblueprint parser
|
||||
|
||||
function! ale_linters#apiblueprint#drafter#HandleErrors(buffer, lines) abort
|
||||
" Matches patterns line the following:
|
||||
"
|
||||
" warning: (3) unable to parse response signature, expected 'response [<HTTP status code>] [(<media type>)]'; line 4, column 3k - line 4, column 22
|
||||
" warning: (10) message-body asset is expected to be a pre-formatted code block, separate it by a newline and indent every of its line by 12 spaces or 3 tabs; line 30, column 5 - line 30, column 9; line 31, column 9 - line 31, column 14; line 32, column 9 - line 32, column 14
|
||||
let l:pattern = '\(^.*\): (\d\+) \(.\{-\}\); line \(\d\+\), column \(\d\+\) - line \d\+, column \d\+\(.*; line \d\+, column \d\+ - line \(\d\+\), column \(\d\+\)\)\{-\}$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines[2:], l:pattern)
|
||||
let l:item = {
|
||||
\ 'type': l:match[1] is# 'warning' ? 'W' : 'E',
|
||||
\ 'text': l:match[2],
|
||||
\ 'lnum': l:match[3] + 0,
|
||||
\ 'col': l:match[4] + 0,
|
||||
\}
|
||||
|
||||
if l:match[5] isnot# ''
|
||||
let l:item.end_lnum = l:match[6] + 0
|
||||
let l:item.end_col = l:match[7] + 0
|
||||
endif
|
||||
|
||||
call add(l:output, l:item)
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
|
||||
call ale#linter#Define('apiblueprint', {
|
||||
\ 'name': 'drafter',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': 'drafter',
|
||||
\ 'command': 'drafter --use-line-num --validate',
|
||||
\ 'callback': 'ale_linters#apiblueprint#drafter#HandleErrors',
|
||||
\})
|
|
@ -0,0 +1,12 @@
|
|||
" Author: Leo <thinkabit.ukim@gmail.com>
|
||||
" Description: apkbuild-lint from atools linter for APKBUILDs
|
||||
|
||||
call ale#Set('apkbuild_apkbuild_lint_executable', 'apkbuild-lint')
|
||||
|
||||
call ale#linter#Define('apkbuild', {
|
||||
\ 'name': 'apkbuild_lint',
|
||||
\ 'output_stream': 'stdout',
|
||||
\ 'executable': {b -> ale#Var(b, 'apkbuild_apkbuild_lint_executable')},
|
||||
\ 'command': '%e %t',
|
||||
\ 'callback': 'ale#handlers#atools#Handle',
|
||||
\})
|
|
@ -0,0 +1,12 @@
|
|||
" Author: Leo <thinkabit.ukim@gmail.com>
|
||||
" Description: secfixes-check from atools linter for APKBUILDs
|
||||
|
||||
call ale#Set('apkbuild_secfixes_check_executable', 'secfixes-check')
|
||||
|
||||
call ale#linter#Define('apkbuild', {
|
||||
\ 'name': 'secfixes_check',
|
||||
\ 'output_stream': 'stdout',
|
||||
\ 'executable': {b -> ale#Var(b, 'apkbuild_secfixes_check_executable')},
|
||||
\ 'command': '%e %t',
|
||||
\ 'callback': 'ale#handlers#atools#Handle',
|
||||
\})
|
4
sources_non_forked/ale/ale_linters/asciidoc/alex.vim
Normal file
4
sources_non_forked/ale/ale_linters/asciidoc/alex.vim
Normal file
|
@ -0,0 +1,4 @@
|
|||
" Author: Johannes Wienke <languitar@semipol.de>
|
||||
" Description: alex for asciidoc files
|
||||
|
||||
call ale#handlers#alex#DefineLinter('asciidoc', '--text')
|
5
sources_non_forked/ale/ale_linters/asciidoc/cspell.vim
Normal file
5
sources_non_forked/ale/ale_linters/asciidoc/cspell.vim
Normal file
|
@ -0,0 +1,5 @@
|
|||
scriptencoding utf-8
|
||||
" Author: David Houston <houstdav000>
|
||||
" Description: cspell support for ASCIIDoc files.
|
||||
|
||||
call ale#handlers#cspell#DefineLinter('asciidoc')
|
|
@ -0,0 +1,5 @@
|
|||
" Author: Horacio Sanson (hsanson [ät] gmail.com)
|
||||
" Description: languagetool for asciidoc files, copied from markdown.
|
||||
|
||||
|
||||
call ale#handlers#languagetool#DefineLinter('asciidoc')
|
|
@ -0,0 +1,9 @@
|
|||
" Author: Daniel M. Capella https://github.com/polyzen
|
||||
" Description: proselint for AsciiDoc files
|
||||
|
||||
call ale#linter#Define('asciidoc', {
|
||||
\ 'name': 'proselint',
|
||||
\ 'executable': 'proselint',
|
||||
\ 'command': 'proselint %t',
|
||||
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
||||
\})
|
9
sources_non_forked/ale/ale_linters/asciidoc/redpen.vim
Normal file
9
sources_non_forked/ale/ale_linters/asciidoc/redpen.vim
Normal file
|
@ -0,0 +1,9 @@
|
|||
" Author: rhysd https://rhysd.github.io
|
||||
" Description: Redpen, a proofreading tool (http://redpen.cc)
|
||||
|
||||
call ale#linter#Define('asciidoc', {
|
||||
\ 'name': 'redpen',
|
||||
\ 'executable': 'redpen',
|
||||
\ 'command': 'redpen -f asciidoc -r json %t',
|
||||
\ 'callback': 'ale#handlers#redpen#HandleRedpenOutput',
|
||||
\})
|
9
sources_non_forked/ale/ale_linters/asciidoc/textlint.vim
Normal file
9
sources_non_forked/ale/ale_linters/asciidoc/textlint.vim
Normal file
|
@ -0,0 +1,9 @@
|
|||
" Author: TANIGUCHI Masaya <ta2gch@gmail.com>
|
||||
" Description: textlint for AsciiDoc files
|
||||
|
||||
call ale#linter#Define('asciidoc', {
|
||||
\ 'name': 'textlint',
|
||||
\ 'executable': function('ale#handlers#textlint#GetExecutable'),
|
||||
\ 'command': function('ale#handlers#textlint#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#textlint#HandleTextlintOutput',
|
||||
\})
|
9
sources_non_forked/ale/ale_linters/asciidoc/vale.vim
Normal file
9
sources_non_forked/ale/ale_linters/asciidoc/vale.vim
Normal file
|
@ -0,0 +1,9 @@
|
|||
" Author: Jeff Kreeftmeijer https://github.com/jeffkreeftmeijer
|
||||
" Description: vale for AsciiDoc files
|
||||
|
||||
call ale#linter#Define('asciidoc', {
|
||||
\ 'name': 'vale',
|
||||
\ 'executable': 'vale',
|
||||
\ 'command': 'vale --output=line %t',
|
||||
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
||||
\})
|
|
@ -0,0 +1,4 @@
|
|||
" Author: Sumner Evans <sumner.evans98@gmail.com>
|
||||
" Description: write-good for AsciiDoc files
|
||||
|
||||
call ale#handlers#writegood#DefineLinter('asciidoc')
|
37
sources_non_forked/ale/ale_linters/asm/gcc.vim
Normal file
37
sources_non_forked/ale/ale_linters/asm/gcc.vim
Normal file
|
@ -0,0 +1,37 @@
|
|||
" Author: Lucas Kolstad <lkolstad@uw.edu>
|
||||
" Description: gcc linter for asm files
|
||||
|
||||
call ale#Set('asm_gcc_executable', 'gcc')
|
||||
call ale#Set('asm_gcc_options', '-Wall')
|
||||
|
||||
function! ale_linters#asm#gcc#GetCommand(buffer) abort
|
||||
" `-o /dev/null` or `-o null` is needed to catch all errors,
|
||||
" -fsyntax-only doesn't catch everything.
|
||||
return '%e -x assembler'
|
||||
\ . ' -o ' . g:ale#util#nul_file
|
||||
\ . '-iquote %s:h'
|
||||
\ . ' ' . ale#Var(a:buffer, 'asm_gcc_options') . ' -'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#asm#gcc#Handle(buffer, lines) abort
|
||||
let l:pattern = '^.\+:\(\d\+\): \([^:]\+\): \(.\+\)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'type': l:match[2] =~? 'error' ? 'E' : 'W',
|
||||
\ 'text': l:match[3],
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('asm', {
|
||||
\ 'name': 'gcc',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': {b -> ale#Var(b, 'asm_gcc_executable')},
|
||||
\ 'command': function('ale_linters#asm#gcc#GetCommand'),
|
||||
\ 'callback': 'ale_linters#asm#gcc#Handle',
|
||||
\})
|
36
sources_non_forked/ale/ale_linters/avra/avra.vim
Normal file
36
sources_non_forked/ale/ale_linters/avra/avra.vim
Normal file
|
@ -0,0 +1,36 @@
|
|||
" Author: Utkarsh Verma <utkarshverma@protonmail.com>
|
||||
" Description: AVRA linter for avra syntax.
|
||||
|
||||
call ale#Set('avra_avra_executable', 'avra')
|
||||
call ale#Set('avra_avra_options', '')
|
||||
|
||||
function! ale_linters#avra#avra#GetCommand(buffer) abort
|
||||
return '%e'
|
||||
\ . ' %t'
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'avra_avra_options'))
|
||||
\ . ' -o ' . g:ale#util#nul_file
|
||||
endfunction
|
||||
|
||||
function! ale_linters#avra#avra#Handle(buffer, lines) abort
|
||||
" Note that we treat 'fatal' as errors.
|
||||
let l:pattern = '^\S\+(\(\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,
|
||||
\ 'type': l:match[2] =~? 'Error' ? 'E' : 'W',
|
||||
\ 'text': l:match[3],
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('avra', {
|
||||
\ 'name': 'avra',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': {b -> ale#Var(b, 'avra_avra_executable')},
|
||||
\ 'command': function('ale_linters#avra#avra#GetCommand'),
|
||||
\ 'callback': 'ale_linters#avra#avra#Handle',
|
||||
\})
|
23
sources_non_forked/ale/ale_linters/awk/gawk.vim
Normal file
23
sources_non_forked/ale/ale_linters/awk/gawk.vim
Normal file
|
@ -0,0 +1,23 @@
|
|||
" Author: kmarc <korondi.mark@gmail.com>
|
||||
" Description: This file adds support for using GNU awk with scripts.
|
||||
|
||||
call ale#Set('awk_gawk_executable', 'gawk')
|
||||
call ale#Set('awk_gawk_options', '')
|
||||
|
||||
function! ale_linters#awk#gawk#GetCommand(buffer) abort
|
||||
" note the --source 'BEGIN ...' is to prevent
|
||||
" gawk from attempting to execute the body of the script
|
||||
" it is linting.
|
||||
return '%e --source ' . ale#Escape('BEGIN { exit } END { exit 1 }')
|
||||
\ . ' --lint'
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'awk_gawk_options'))
|
||||
\ . ' -f %t /dev/null'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('awk', {
|
||||
\ 'name': 'gawk',
|
||||
\ 'executable': {b -> ale#Var(b, 'awk_gawk_executable')},
|
||||
\ 'command': function('ale_linters#awk#gawk#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#gawk#HandleGawkFormat',
|
||||
\ 'output_stream': 'both'
|
||||
\})
|
4
sources_non_forked/ale/ale_linters/bats/shellcheck.vim
Normal file
4
sources_non_forked/ale/ale_linters/bats/shellcheck.vim
Normal file
|
@ -0,0 +1,4 @@
|
|||
" Author: Ian2020 <https://github.com/Ian2020>
|
||||
" Description: shellcheck linter for bats scripts.
|
||||
|
||||
call ale#handlers#shellcheck#DefineLinter('bats')
|
80
sources_non_forked/ale/ale_linters/bib/bibclean.vim
Normal file
80
sources_non_forked/ale/ale_linters/bib/bibclean.vim
Normal file
|
@ -0,0 +1,80 @@
|
|||
" Author: Horacio Sanson - https://github.com/hsanson
|
||||
" Description: Support for bibclean linter for BibTeX files.
|
||||
|
||||
call ale#Set('bib_bibclean_executable', 'bibclean')
|
||||
|
||||
function! ale_linters#bib#bibclean#GetCommand(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'bib_bibclean_executable')
|
||||
|
||||
return ale#Escape(l:executable) . ' -file-position '
|
||||
endfunction
|
||||
|
||||
function! ale_linters#bib#bibclean#get_type(str) abort
|
||||
if a:str is# '??'
|
||||
return 'E'
|
||||
else
|
||||
return 'W'
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! ale_linters#bib#bibclean#match_msg(line) abort
|
||||
" Legacy message pattern works for bibclean <= v2.11.4. If empty, try
|
||||
" the new message pattern for bibtex > v2.11.4
|
||||
let l:matches_legacy = matchlist(a:line, '^\(.*\) "stdin", line \(\d\+\): \(.*\)$')
|
||||
|
||||
return ! empty(l:matches_legacy) ? l:matches_legacy
|
||||
\ : matchlist(a:line, '^\(.*\) stdin:\(\d\+\):\(.*\)$')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#bib#bibclean#match_entry(line) abort
|
||||
return matchlist(a:line, 'Entry input byte=.* line=\(.*\) column=\(.*\) output .*$')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#bib#bibclean#match_value(line) abort
|
||||
return matchlist(a:line, 'Value input byte=.* line=\(.*\) column=\(.*\) output .*$')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#bib#bibclean#Handle(buffer, lines) abort
|
||||
let l:output = []
|
||||
|
||||
let l:type = 'E'
|
||||
let l:msg = ''
|
||||
|
||||
for l:line in a:lines
|
||||
if empty(l:msg)
|
||||
let l:mlist = ale_linters#bib#bibclean#match_msg(l:line)
|
||||
|
||||
if !empty(l:mlist)
|
||||
let l:msg = l:mlist[3]
|
||||
let l:type = ale_linters#bib#bibclean#get_type(l:mlist[1])
|
||||
endif
|
||||
else
|
||||
if l:type is# 'E'
|
||||
let l:mlist = ale_linters#bib#bibclean#match_entry(l:line)
|
||||
else
|
||||
let l:mlist = ale_linters#bib#bibclean#match_value(l:line)
|
||||
endif
|
||||
|
||||
if !empty(l:mlist)
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:mlist[1],
|
||||
\ 'col': l:mlist[2],
|
||||
\ 'text': l:msg,
|
||||
\ 'type': l:type
|
||||
\})
|
||||
|
||||
let l:msg = ''
|
||||
endif
|
||||
endif
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('bib', {
|
||||
\ 'name': 'bibclean',
|
||||
\ 'executable': {b -> ale#Var(b, 'bib_bibclean_executable')},
|
||||
\ 'command': function('ale_linters#bib#bibclean#GetCommand'),
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'callback': 'ale_linters#bib#bibclean#Handle',
|
||||
\})
|
64
sources_non_forked/ale/ale_linters/bicep/bicep.vim
Normal file
64
sources_non_forked/ale/ale_linters/bicep/bicep.vim
Normal file
|
@ -0,0 +1,64 @@
|
|||
" Author: Carl Smedstad <carl.smedstad at protonmail dot com>
|
||||
" Description: bicep for bicep files
|
||||
|
||||
let g:ale_bicep_bicep_executable =
|
||||
\ get(g:, 'ale_bicep_bicep_executable', 'bicep')
|
||||
|
||||
let g:ale_bicep_bicep_options =
|
||||
\ get(g:, 'ale_bicep_bicep_options', '')
|
||||
|
||||
function! ale_linters#bicep#bicep#Executable(buffer) abort
|
||||
return ale#Var(a:buffer, 'bicep_bicep_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#bicep#bicep#Command(buffer) abort
|
||||
let l:executable = ale_linters#bicep#bicep#Executable(a:buffer)
|
||||
let l:options = ale#Var(a:buffer, 'bicep_bicep_options')
|
||||
|
||||
if has('win32')
|
||||
let l:nullfile = 'NUL'
|
||||
else
|
||||
let l:nullfile = '/dev/null'
|
||||
endif
|
||||
|
||||
return ale#Escape(l:executable)
|
||||
\ . ' build --outfile '
|
||||
\ . l:nullfile
|
||||
\ . ' '
|
||||
\ . l:options
|
||||
\ . ' %s'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#bicep#bicep#Handle(buffer, lines) abort
|
||||
let l:pattern = '\v^.*\((\d+),(\d+)\)\s:\s([a-zA-Z]*)\s([-a-zA-Z0-9]*):\s(.*)'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
if l:match[3] is# 'Error'
|
||||
let l:type = 'E'
|
||||
elseif l:match[3] is# 'Warning'
|
||||
let l:type = 'W'
|
||||
else
|
||||
let l:type = 'I'
|
||||
endif
|
||||
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'col': l:match[2] + 0,
|
||||
\ 'type': l:type,
|
||||
\ 'code': l:match[4],
|
||||
\ 'text': l:match[5],
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('bicep', {
|
||||
\ 'name': 'bicep',
|
||||
\ 'executable': function('ale_linters#bicep#bicep#Executable'),
|
||||
\ 'command': function('ale_linters#bicep#bicep#Command'),
|
||||
\ 'callback': 'ale_linters#bicep#bicep#Handle',
|
||||
\ 'output_stream': 'both',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
47
sources_non_forked/ale/ale_linters/bitbake/oelint_adv.vim
Normal file
47
sources_non_forked/ale/ale_linters/bitbake/oelint_adv.vim
Normal file
|
@ -0,0 +1,47 @@
|
|||
" Author: offa
|
||||
" Description: oelint-adv for BitBake files
|
||||
|
||||
call ale#Set('bitbake_oelint_adv_executable', 'oelint-adv')
|
||||
call ale#Set('bitbake_oelint_adv_options', '')
|
||||
call ale#Set('bitbake_oelint_adv_config', '.oelint.cfg')
|
||||
|
||||
function! ale_linters#bitbake#oelint_adv#Command(buffer) abort
|
||||
let l:config_file = ale#path#FindNearestFile(a:buffer,
|
||||
\ ale#Var(a:buffer, 'bitbake_oelint_adv_config'))
|
||||
|
||||
return ((!empty(l:config_file))
|
||||
\ ? 'OELINT_CONFIG=' . ale#Escape(l:config_file) . ' '
|
||||
\ : '')
|
||||
\ . '%e --quiet '
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'bitbake_oelint_adv_options')) . '%s'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#bitbake#oelint_adv#Handle(buffer, lines) abort
|
||||
let l:pattern = '\v^(.+):(.+):(.+):(.+):(.+)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'lnum': str2nr(l:match[2]),
|
||||
\ 'type': l:match[3] is# 'error'
|
||||
\ ? 'E' : (l:match[3] is# 'warning' ? 'W' : 'I'),
|
||||
\ 'text': StripAnsiCodes(l:match[5]),
|
||||
\ 'code': l:match[4]
|
||||
\ })
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
function! StripAnsiCodes(line) abort
|
||||
return substitute(a:line, '\e\[[0-9;]\+[mK]', '', 'g')
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('bitbake', {
|
||||
\ 'name': 'oelint_adv',
|
||||
\ 'output_stream': 'both',
|
||||
\ 'executable': {b -> ale#Var(b, 'bitbake_oelint_adv_executable')},
|
||||
\ 'cwd': '%s:h',
|
||||
\ 'command': function('ale_linters#bitbake#oelint_adv#Command'),
|
||||
\ 'callback': 'ale_linters#bitbake#oelint_adv#Handle',
|
||||
\ })
|
67
sources_non_forked/ale/ale_linters/c/cc.vim
Normal file
67
sources_non_forked/ale/ale_linters/c/cc.vim
Normal file
|
@ -0,0 +1,67 @@
|
|||
" Author: w0rp <devw0rp@gmail.com>
|
||||
" Description: A C compiler linter for C files with gcc/clang, etc.
|
||||
|
||||
call ale#Set('c_cc_executable', '<auto>')
|
||||
call ale#Set('c_cc_options', '-std=c11 -Wall')
|
||||
call ale#Set('c_cc_use_header_lang_flag', -1)
|
||||
call ale#Set('c_cc_header_exts', ['h'])
|
||||
|
||||
function! ale_linters#c#cc#GetExecutable(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'c_cc_executable')
|
||||
|
||||
" Default to either clang or gcc.
|
||||
if l:executable is# '<auto>'
|
||||
if ale#engine#IsExecutable(a:buffer, 'clang')
|
||||
let l:executable = 'clang'
|
||||
else
|
||||
let l:executable = 'gcc'
|
||||
endif
|
||||
endif
|
||||
|
||||
return l:executable
|
||||
endfunction
|
||||
|
||||
function! ale_linters#c#cc#GetCommand(buffer, output) abort
|
||||
let l:cflags = ale#c#GetCFlags(a:buffer, a:output)
|
||||
let l:ale_flags = ale#Var(a:buffer, 'c_cc_options')
|
||||
|
||||
if l:cflags =~# '-std='
|
||||
let l:ale_flags = substitute(
|
||||
\ l:ale_flags,
|
||||
\ '-std=\(c\|gnu\)[0-9]\{2\}',
|
||||
\ '',
|
||||
\ 'g')
|
||||
endif
|
||||
|
||||
" Select the correct language flag depending on the executable, options
|
||||
" and file extension
|
||||
let l:executable = ale_linters#c#cc#GetExecutable(a:buffer)
|
||||
let l:use_header_lang_flag = ale#Var(a:buffer, 'c_cc_use_header_lang_flag')
|
||||
let l:header_exts = ale#Var(a:buffer, 'c_cc_header_exts')
|
||||
let l:lang_flag = ale#c#GetLanguageFlag(
|
||||
\ a:buffer,
|
||||
\ l:executable,
|
||||
\ l:use_header_lang_flag,
|
||||
\ l:header_exts,
|
||||
\ 'c')
|
||||
|
||||
" -iquote with the directory the file is in makes #include work for
|
||||
" headers in the same directory.
|
||||
"
|
||||
" `-o /dev/null` or `-o null` is needed to catch all errors,
|
||||
" -fsyntax-only doesn't catch everything.
|
||||
return '%e -S -x ' . l:lang_flag
|
||||
\ . ' -o ' . g:ale#util#nul_file
|
||||
\ . ' -iquote %s:h'
|
||||
\ . ale#Pad(l:cflags)
|
||||
\ . ale#Pad(l:ale_flags) . ' -'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('c', {
|
||||
\ 'name': 'cc',
|
||||
\ 'aliases': ['gcc', 'clang'],
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': function('ale_linters#c#cc#GetExecutable'),
|
||||
\ 'command': {b -> ale#c#RunMakeCommand(b, function('ale_linters#c#cc#GetCommand'))},
|
||||
\ 'callback': 'ale#handlers#gcc#HandleGCCFormatWithIncludes',
|
||||
\})
|
15
sources_non_forked/ale/ale_linters/c/ccls.vim
Normal file
15
sources_non_forked/ale/ale_linters/c/ccls.vim
Normal file
|
@ -0,0 +1,15 @@
|
|||
" Author: Ye Jingchen <ye.jingchen@gmail.com>, Ben Falconer <ben@falconers.me.uk>, jtalowell <jtalowell@protonmail.com>
|
||||
" Description: A language server for C
|
||||
|
||||
call ale#Set('c_ccls_executable', 'ccls')
|
||||
call ale#Set('c_ccls_init_options', {})
|
||||
call ale#Set('c_build_dir', '')
|
||||
|
||||
call ale#linter#Define('c', {
|
||||
\ 'name': 'ccls',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': {b -> ale#Var(b, 'c_ccls_executable')},
|
||||
\ 'command': '%e',
|
||||
\ 'project_root': function('ale#handlers#ccls#GetProjectRoot'),
|
||||
\ 'initialization_options': {b -> ale#handlers#ccls#GetInitOpts(b, 'c_ccls_init_options')},
|
||||
\})
|
22
sources_non_forked/ale/ale_linters/c/clangd.vim
Normal file
22
sources_non_forked/ale/ale_linters/c/clangd.vim
Normal file
|
@ -0,0 +1,22 @@
|
|||
" Author: Andrey Melentyev <andrey.melentyev@protonmail.com>
|
||||
" Description: Clangd language server
|
||||
|
||||
call ale#Set('c_clangd_executable', 'clangd')
|
||||
call ale#Set('c_clangd_options', '')
|
||||
call ale#Set('c_build_dir', '')
|
||||
|
||||
function! ale_linters#c#clangd#GetCommand(buffer) abort
|
||||
let l:build_dir = ale#c#GetBuildDirectory(a:buffer)
|
||||
|
||||
return '%e'
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'c_clangd_options'))
|
||||
\ . (!empty(l:build_dir) ? ' -compile-commands-dir=' . ale#Escape(l:build_dir) : '')
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('c', {
|
||||
\ 'name': 'clangd',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': {b -> ale#Var(b, 'c_clangd_executable')},
|
||||
\ 'command': function('ale_linters#c#clangd#GetCommand'),
|
||||
\ 'project_root': function('ale#c#FindProjectRoot'),
|
||||
\})
|
52
sources_non_forked/ale/ale_linters/c/clangtidy.vim
Normal file
52
sources_non_forked/ale/ale_linters/c/clangtidy.vim
Normal file
|
@ -0,0 +1,52 @@
|
|||
" Author: vdeurzen <tim@kompiler.org>, w0rp <devw0rp@gmail.com>,
|
||||
" gagbo <gagbobada@gmail.com>, Andrej Radovic <r.andrej@gmail.com>
|
||||
" Description: clang-tidy linter for c files
|
||||
|
||||
call ale#Set('c_clangtidy_executable', 'clang-tidy')
|
||||
" Set this option to check the checks clang-tidy will apply.
|
||||
" The number of checks that can be applied to C files is limited in contrast to
|
||||
" C++
|
||||
"
|
||||
" Consult the check list in clang-tidy's documentation:
|
||||
" http://clang.llvm.org/extra/clang-tidy/checks/list.html
|
||||
|
||||
call ale#Set('c_clangtidy_checks', [])
|
||||
" Set this option to manually set some options for clang-tidy to use as compile
|
||||
" flags.
|
||||
" This will disable compile_commands.json detection.
|
||||
call ale#Set('c_clangtidy_options', '')
|
||||
" Set this option to manually set options for clang-tidy directly.
|
||||
call ale#Set('c_clangtidy_extra_options', '')
|
||||
call ale#Set('c_build_dir', '')
|
||||
|
||||
function! ale_linters#c#clangtidy#GetCommand(buffer, output) abort
|
||||
let l:checks = join(ale#Var(a:buffer, 'c_clangtidy_checks'), ',')
|
||||
let l:build_dir = ale#c#GetBuildDirectory(a:buffer)
|
||||
let l:options = ''
|
||||
|
||||
" Get the extra options if we couldn't find a build directory.
|
||||
if empty(l:build_dir)
|
||||
let l:options = ale#Var(a:buffer, 'c_clangtidy_options')
|
||||
let l:cflags = ale#c#GetCFlags(a:buffer, a:output)
|
||||
let l:options .= !empty(l:options) ? ale#Pad(l:cflags) : l:cflags
|
||||
endif
|
||||
|
||||
" Get the options to pass directly to clang-tidy
|
||||
let l:extra_options = ale#Var(a:buffer, 'c_clangtidy_extra_options')
|
||||
|
||||
return '%e'
|
||||
\ . (!empty(l:checks) ? ' -checks=' . ale#Escape(l:checks) : '')
|
||||
\ . (!empty(l:extra_options) ? ' ' . ale#Escape(l:extra_options) : '')
|
||||
\ . ' %s'
|
||||
\ . (!empty(l:build_dir) ? ' -p ' . ale#Escape(l:build_dir) : '')
|
||||
\ . (!empty(l:options) ? ' -- ' . l:options : '')
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('c', {
|
||||
\ 'name': 'clangtidy',
|
||||
\ 'output_stream': 'stdout',
|
||||
\ 'executable': {b -> ale#Var(b, 'c_clangtidy_executable')},
|
||||
\ 'command': {b -> ale#c#RunMakeCommand(b, function('ale_linters#c#clangtidy#GetCommand'))},
|
||||
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
29
sources_non_forked/ale/ale_linters/c/cppcheck.vim
Normal file
29
sources_non_forked/ale/ale_linters/c/cppcheck.vim
Normal file
|
@ -0,0 +1,29 @@
|
|||
" Author: Bart Libert <bart.libert@gmail.com>
|
||||
" Description: cppcheck linter for c files
|
||||
|
||||
call ale#Set('c_cppcheck_executable', 'cppcheck')
|
||||
call ale#Set('c_cppcheck_options', '--enable=style')
|
||||
|
||||
function! ale_linters#c#cppcheck#GetCommand(buffer) abort
|
||||
let l:compile_commands_option = ale#handlers#cppcheck#GetCompileCommandsOptions(a:buffer)
|
||||
let l:buffer_path_include = empty(l:compile_commands_option)
|
||||
\ ? ale#handlers#cppcheck#GetBufferPathIncludeOptions(a:buffer)
|
||||
\ : ''
|
||||
let l:template = ' --template=' . ale#Escape('{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}')
|
||||
|
||||
return '%e -q --language=c'
|
||||
\ . l:template
|
||||
\ . ale#Pad(l:compile_commands_option)
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'c_cppcheck_options'))
|
||||
\ . l:buffer_path_include
|
||||
\ . ' %t'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('c', {
|
||||
\ 'name': 'cppcheck',
|
||||
\ 'output_stream': 'both',
|
||||
\ 'executable': {b -> ale#Var(b, 'c_cppcheck_executable')},
|
||||
\ 'cwd': function('ale#handlers#cppcheck#GetCwd'),
|
||||
\ 'command': function('ale_linters#c#cppcheck#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#cppcheck#HandleCppCheckFormat',
|
||||
\})
|
20
sources_non_forked/ale/ale_linters/c/cpplint.vim
Normal file
20
sources_non_forked/ale/ale_linters/c/cpplint.vim
Normal file
|
@ -0,0 +1,20 @@
|
|||
" Author: Justin Huang <justin.y.huang@live.com>
|
||||
" Description: cpplint for c files
|
||||
|
||||
call ale#Set('c_cpplint_executable', 'cpplint')
|
||||
call ale#Set('c_cpplint_options', '')
|
||||
|
||||
function! ale_linters#c#cpplint#GetCommand(buffer) abort
|
||||
let l:options = ale#Var(a:buffer, 'c_cpplint_options')
|
||||
|
||||
return '%e' . ale#Pad(l:options) . ' %s'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('c', {
|
||||
\ 'name': 'cpplint',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': {b -> ale#Var(b, 'c_cpplint_executable')},
|
||||
\ 'command': function('ale_linters#c#cpplint#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#cpplint#HandleCppLintFormat',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
30
sources_non_forked/ale/ale_linters/c/cquery.vim
Normal file
30
sources_non_forked/ale/ale_linters/c/cquery.vim
Normal file
|
@ -0,0 +1,30 @@
|
|||
" Author: Ben Falconer <ben@falconers.me.uk>, jtalowell <jtalowell@protonmail.com>
|
||||
" Description: A language server for C
|
||||
|
||||
call ale#Set('c_cquery_executable', 'cquery')
|
||||
call ale#Set('c_cquery_cache_directory', expand('~/.cache/cquery'))
|
||||
|
||||
function! ale_linters#c#cquery#GetProjectRoot(buffer) abort
|
||||
" Try to find cquery configuration files first.
|
||||
let l:config = ale#path#FindNearestFile(a:buffer, '.cquery')
|
||||
|
||||
if !empty(l:config)
|
||||
return fnamemodify(l:config, ':h')
|
||||
endif
|
||||
|
||||
" Fall back on default project root detection.
|
||||
return ale#c#FindProjectRoot(a:buffer)
|
||||
endfunction
|
||||
|
||||
function! ale_linters#c#cquery#GetInitializationOptions(buffer) abort
|
||||
return {'cacheDirectory': ale#Var(a:buffer, 'c_cquery_cache_directory')}
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('c', {
|
||||
\ 'name': 'cquery',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': {b -> ale#Var(b, 'c_cquery_executable')},
|
||||
\ 'command': '%e',
|
||||
\ 'project_root': function('ale_linters#c#cquery#GetProjectRoot'),
|
||||
\ 'initialization_options': function('ale_linters#c#cquery#GetInitializationOptions'),
|
||||
\})
|
5
sources_non_forked/ale/ale_linters/c/cspell.vim
Normal file
5
sources_non_forked/ale/ale_linters/c/cspell.vim
Normal file
|
@ -0,0 +1,5 @@
|
|||
scriptencoding utf-8
|
||||
" Author: David Houston <houstdav000>
|
||||
" Description: cspell support for C files.
|
||||
|
||||
call ale#handlers#cspell#DefineLinter('c')
|
25
sources_non_forked/ale/ale_linters/c/flawfinder.vim
Normal file
25
sources_non_forked/ale/ale_linters/c/flawfinder.vim
Normal file
|
@ -0,0 +1,25 @@
|
|||
" Author: Christian Gibbons <cgibbons@gmu.edu>
|
||||
" Description: flawfinder linter for c files
|
||||
|
||||
call ale#Set('c_flawfinder_executable', 'flawfinder')
|
||||
call ale#Set('c_flawfinder_options', '')
|
||||
call ale#Set('c_flawfinder_minlevel', 1)
|
||||
call ale#Set('c_flawfinder_error_severity', 6)
|
||||
|
||||
function! ale_linters#c#flawfinder#GetCommand(buffer) abort
|
||||
" Set the minimum vulnerability level for flawfinder to bother with
|
||||
let l:minlevel = ' --minlevel=' . ale#Var(a:buffer, 'c_flawfinder_minlevel')
|
||||
|
||||
return '%e -CDQS'
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'c_flawfinder_options'))
|
||||
\ . l:minlevel
|
||||
\ . ' %t'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('c', {
|
||||
\ 'name': 'flawfinder',
|
||||
\ 'output_stream': 'stdout',
|
||||
\ 'executable': {b -> ale#Var(b, 'c_flawfinder_executable')},
|
||||
\ 'command': function('ale_linters#c#flawfinder#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#flawfinder#HandleFlawfinderFormat',
|
||||
\})
|
37
sources_non_forked/ale/ale_linters/cairo/starknet.vim
Normal file
37
sources_non_forked/ale/ale_linters/cairo/starknet.vim
Normal file
|
@ -0,0 +1,37 @@
|
|||
" Author: 0xHyoga <0xHyoga@gmx.com>
|
||||
" Description: Report starknet-compile errors in cairo code
|
||||
|
||||
call ale#Set('cairo_starknet_executable', 'starknet-compile')
|
||||
call ale#Set('cairo_starknet_options', '')
|
||||
|
||||
function! ale_linters#cairo#starknet#Handle(buffer, lines) abort
|
||||
" Error always on the first line
|
||||
" e.g ex01.cairo:20:6: Could not find module 'contracts.utils.ex00_base'. Searched in the following paths:
|
||||
let l:pattern = '\v\.cairo:(\d+):(\d+):+ (.*)'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'lnum': str2nr(l:match[1]),
|
||||
\ 'col': str2nr(l:match[2]),
|
||||
\ 'type': 'E',
|
||||
\ 'text': l:match[3],
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
function! ale_linters#cairo#starknet#GetCommand(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'cairo_starknet_executable')
|
||||
|
||||
return l:executable . ale#Pad(ale#Var(a:buffer, 'cairo_starknet_options')) . ' %s'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('cairo', {
|
||||
\ 'name': 'starknet',
|
||||
\ 'executable': {b -> ale#Var(b, 'cairo_starknet_executable')},
|
||||
\ 'command': function('ale_linters#cairo#starknet#GetCommand'),
|
||||
\ 'callback': 'ale_linters#cairo#starknet#Handle',
|
||||
\ 'output_stream': 'stderr',
|
||||
\})
|
54
sources_non_forked/ale/ale_linters/chef/cookstyle.vim
Normal file
54
sources_non_forked/ale/ale_linters/chef/cookstyle.vim
Normal file
|
@ -0,0 +1,54 @@
|
|||
" Author: Raphael Hoegger - https://github.com/pfuender
|
||||
" Description: Cookstyle (RuboCop based), a code style analyzer for Ruby files
|
||||
|
||||
call ale#Set('chef_cookstyle_executable', 'cookstyle')
|
||||
call ale#Set('chef_cookstyle_options', '')
|
||||
|
||||
function! ale_linters#chef#cookstyle#GetCommand(buffer) abort
|
||||
let l:options = ale#Var(a:buffer, 'chef_cookstyle_options')
|
||||
|
||||
return '%e' . ale#Pad(escape(l:options, '~')) . ' --force-exclusion --format json --stdin ' . ' %s'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#chef#cookstyle#Handle(buffer, lines) abort
|
||||
if len(a:lines) == 0
|
||||
return []
|
||||
endif
|
||||
|
||||
let l:errors = ale#util#FuzzyJSONDecode(a:lines[0], {})
|
||||
|
||||
if !has_key(l:errors, 'summary')
|
||||
\|| l:errors['summary']['offense_count'] == 0
|
||||
\|| empty(l:errors['files'])
|
||||
return []
|
||||
endif
|
||||
|
||||
let l:output = []
|
||||
|
||||
for l:error in l:errors['files'][0]['offenses']
|
||||
let l:start_col = str2nr(l:error['location']['start_column'])
|
||||
let l:end_col = str2nr(l:error['location']['last_column'])
|
||||
|
||||
if !l:end_col
|
||||
let l:end_col = l:start_col + 1
|
||||
endif
|
||||
|
||||
call add(l:output, {
|
||||
\ 'lnum': str2nr(l:error['location']['line']),
|
||||
\ 'col': l:start_col,
|
||||
\ 'end_col': l:end_col,
|
||||
\ 'code': l:error['cop_name'],
|
||||
\ 'text': l:error['message'],
|
||||
\ 'type': l:error['severity'] is? 'convention' ? 'W' : 'E',
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('chef', {
|
||||
\ 'name': 'cookstyle',
|
||||
\ 'executable': {b -> ale#Var(b, 'chef_cookstyle_executable')},
|
||||
\ 'command': function('ale_linters#chef#cookstyle#GetCommand'),
|
||||
\ 'callback': 'ale_linters#chef#cookstyle#Handle',
|
||||
\})
|
41
sources_non_forked/ale/ale_linters/chef/foodcritic.vim
Normal file
41
sources_non_forked/ale/ale_linters/chef/foodcritic.vim
Normal file
|
@ -0,0 +1,41 @@
|
|||
" Author: Edward Larkey <edwlarkey@mac.com>
|
||||
" Author: Jose Junior <jose.junior@gmail.com>
|
||||
" Author: w0rp <devw0rp@gmail.com>
|
||||
" Description: This file adds the foodcritic linter for Chef files.
|
||||
|
||||
call ale#Set('chef_foodcritic_executable', 'foodcritic')
|
||||
call ale#Set('chef_foodcritic_options', '')
|
||||
|
||||
function! ale_linters#chef#foodcritic#GetCommand(buffer) abort
|
||||
let l:options = ale#Var(a:buffer, 'chef_foodcritic_options')
|
||||
|
||||
return '%e' . ale#Pad(escape(l:options, '~')) . ' %s'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#chef#foodcritic#Handle(buffer, lines) abort
|
||||
" Matches patterns line the following:
|
||||
"
|
||||
" FC002: Avoid string interpolation where not required: httpd.rb:13
|
||||
let l:pattern = '\v([^:]+): (.+): ([a-zA-Z]?:?[^:]+):(\d+)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'code': l:match[1],
|
||||
\ 'text': l:match[2],
|
||||
\ 'filename': l:match[3],
|
||||
\ 'lnum': l:match[4] + 0,
|
||||
\ 'type': 'W',
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('chef', {
|
||||
\ 'name': 'foodcritic',
|
||||
\ 'executable': {b -> ale#Var(b, 'chef_foodcritic_executable')},
|
||||
\ 'command': function('ale_linters#chef#foodcritic#GetCommand'),
|
||||
\ 'callback': 'ale_linters#chef#foodcritic#Handle',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
47
sources_non_forked/ale/ale_linters/clojure/clj_kondo.vim
Normal file
47
sources_non_forked/ale/ale_linters/clojure/clj_kondo.vim
Normal file
|
@ -0,0 +1,47 @@
|
|||
" Author: Masashi Iizuka <liquidz.uo@gmail.com>
|
||||
" Description: linter for clojure using clj-kondo https://github.com/borkdude/clj-kondo
|
||||
|
||||
call ale#Set('clojure_clj_kondo_options', '--cache')
|
||||
|
||||
function! ale_linters#clojure#clj_kondo#GetCommand(buffer) abort
|
||||
let l:options = ale#Var(a:buffer, 'clojure_clj_kondo_options')
|
||||
|
||||
let l:command = 'clj-kondo'
|
||||
\ . ale#Pad(l:options)
|
||||
\ . ' --lint -'
|
||||
\ . ' --filename %s'
|
||||
|
||||
return l:command
|
||||
endfunction
|
||||
|
||||
function! ale_linters#clojure#clj_kondo#HandleCljKondoFormat(buffer, lines) abort
|
||||
" output format
|
||||
" <filename>:<line>:<column>: <issue type>: <message>
|
||||
let l:pattern = '\v^[a-zA-Z]?:?[^:]+:(\d+)?:(\d+)?:? ((Exception|error|warning): ?(.+))$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
let l:type = 'E'
|
||||
|
||||
if l:match[4] is? 'warning'
|
||||
let l:type = 'W'
|
||||
endif
|
||||
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'col': l:match[2] + 0,
|
||||
\ 'text': l:match[3],
|
||||
\ 'type': l:type,
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('clojure', {
|
||||
\ 'name': 'clj-kondo',
|
||||
\ 'output_stream': 'stdout',
|
||||
\ 'executable': 'clj-kondo',
|
||||
\ 'command': function('ale_linters#clojure#clj_kondo#GetCommand'),
|
||||
\ 'callback': 'ale_linters#clojure#clj_kondo#HandleCljKondoFormat',
|
||||
\})
|
34
sources_non_forked/ale/ale_linters/clojure/joker.vim
Normal file
34
sources_non_forked/ale/ale_linters/clojure/joker.vim
Normal file
|
@ -0,0 +1,34 @@
|
|||
" Author: Nic West <nicwest@mailbox.org>
|
||||
" Description: linter for clojure using joker https://github.com/candid82/joker
|
||||
|
||||
function! ale_linters#clojure#joker#HandleJokerFormat(buffer, lines) abort
|
||||
" output format
|
||||
" <filename>:<line>:<column>: <issue type>: <message>
|
||||
let l:pattern = '\v^[a-zA-Z]?:?[^:]+:(\d+):(\d+):? ((Read error|Parse error|Parse warning|Exception): ?(.+))$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
let l:type = 'E'
|
||||
|
||||
if l:match[4] is? 'Parse warning'
|
||||
let l:type = 'W'
|
||||
endif
|
||||
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'col': l:match[2] + 0,
|
||||
\ 'text': l:match[3],
|
||||
\ 'type': l:type,
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('clojure', {
|
||||
\ 'name': 'joker',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': 'joker',
|
||||
\ 'command': 'joker --working-dir %s --lint %t',
|
||||
\ 'callback': 'ale_linters#clojure#joker#HandleJokerFormat',
|
||||
\})
|
|
@ -0,0 +1,36 @@
|
|||
" Author: Yasuhiro Kiyota <yasuhiroki.duck@gmail.com>
|
||||
" Description: Support cfn-python-lint for AWS Cloudformation template file
|
||||
|
||||
function! ale_linters#cloudformation#cfn_python_lint#Handle(buffer, lines) abort
|
||||
" Matches patterns line the following:
|
||||
"
|
||||
" sample.template.yaml:96:7:96:15:E3012:Property Resources/Sample/Properties/FromPort should be of type Integer
|
||||
let l:pattern = '\v^(.*):(\d+):(\d+):(\d+):(\d+):([[:alnum:]]+):(.*)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
let l:code = l:match[6]
|
||||
|
||||
if ale#path#IsBufferPath(a:buffer, l:match[1])
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[2],
|
||||
\ 'col': l:match[3],
|
||||
\ 'end_lnum': l:match[4],
|
||||
\ 'end_col': l:match[5],
|
||||
\ 'code': l:code,
|
||||
\ 'type': l:code[:0] is# 'E' ? 'E' : 'W',
|
||||
\ 'text': l:match[7]
|
||||
\})
|
||||
endif
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('cloudformation', {
|
||||
\ 'name': 'cloudformation',
|
||||
\ 'aliases': ['cfn-lint'],
|
||||
\ 'executable': 'cfn-lint',
|
||||
\ 'command': 'cfn-lint --template %t --format parseable',
|
||||
\ 'callback': 'ale_linters#cloudformation#cfn_python_lint#Handle',
|
||||
\})
|
43
sources_non_forked/ale/ale_linters/cmake/cmake_lint.vim
Normal file
43
sources_non_forked/ale/ale_linters/cmake/cmake_lint.vim
Normal file
|
@ -0,0 +1,43 @@
|
|||
" Author: Carl Smedstad <carl.smedstad at protonmail dot com>
|
||||
" Description: cmake-lint for cmake files
|
||||
|
||||
let g:ale_cmake_cmake_lint_executable =
|
||||
\ get(g:, 'ale_cmake_cmake_lint_executable', 'cmake-lint')
|
||||
|
||||
let g:ale_cmake_cmake_lint_options =
|
||||
\ get(g:, 'ale_cmake_cmake_lint_options', '')
|
||||
|
||||
function! ale_linters#cmake#cmake_lint#Executable(buffer) abort
|
||||
return ale#Var(a:buffer, 'cmake_cmake_lint_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#cmake#cmake_lint#Command(buffer) abort
|
||||
let l:executable = ale_linters#cmake#cmake_lint#Executable(a:buffer)
|
||||
let l:options = ale#Var(a:buffer, 'cmake_cmake_lint_options')
|
||||
|
||||
return ale#Escape(l:executable) . ' ' . l:options . ' %t'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#cmake#cmake_lint#Handle(buffer, lines) abort
|
||||
let l:pattern = '\v^[^:]+:(\d+),?(\d+)?:\s\[([A-Z]\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,
|
||||
\ 'col': l:match[2] + 0,
|
||||
\ 'type': 'W',
|
||||
\ 'code': l:match[3],
|
||||
\ 'text': l:match[4],
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('cmake', {
|
||||
\ 'name': 'cmake_lint',
|
||||
\ 'executable': function('ale_linters#cmake#cmake_lint#Executable'),
|
||||
\ 'command': function('ale_linters#cmake#cmake_lint#Command'),
|
||||
\ 'callback': 'ale_linters#cmake#cmake_lint#Handle',
|
||||
\})
|
24
sources_non_forked/ale/ale_linters/cmake/cmakelint.vim
Normal file
24
sources_non_forked/ale/ale_linters/cmake/cmakelint.vim
Normal file
|
@ -0,0 +1,24 @@
|
|||
" Author: Kenneth Benzie <k.benzie83@gmail.com>
|
||||
" Description: cmakelint for cmake files
|
||||
|
||||
let g:ale_cmake_cmakelint_executable =
|
||||
\ get(g:, 'ale_cmake_cmakelint_executable', 'cmakelint')
|
||||
|
||||
let g:ale_cmake_cmakelint_options =
|
||||
\ get(g:, 'ale_cmake_cmakelint_options', '')
|
||||
|
||||
function! ale_linters#cmake#cmakelint#Executable(buffer) abort
|
||||
return ale#Var(a:buffer, 'cmake_cmakelint_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#cmake#cmakelint#Command(buffer) abort
|
||||
return ale_linters#cmake#cmakelint#Executable(a:buffer)
|
||||
\ . ' ' . ale#Var(a:buffer, 'cmake_cmakelint_options') . ' %t'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('cmake', {
|
||||
\ 'name': 'cmakelint',
|
||||
\ 'executable': function('ale_linters#cmake#cmakelint#Executable'),
|
||||
\ 'command': function('ale_linters#cmake#cmakelint#Command'),
|
||||
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
||||
\})
|
23
sources_non_forked/ale/ale_linters/coffee/coffee.vim
Normal file
23
sources_non_forked/ale/ale_linters/coffee/coffee.vim
Normal file
|
@ -0,0 +1,23 @@
|
|||
" Author: KabbAmine - https://github.com/KabbAmine
|
||||
" Description: Coffee for checking coffee files
|
||||
|
||||
function! ale_linters#coffee#coffee#GetExecutable(buffer) abort
|
||||
return ale#path#ResolveLocalPath(
|
||||
\ a:buffer,
|
||||
\ 'node_modules/.bin/coffee',
|
||||
\ 'coffee'
|
||||
\)
|
||||
endfunction
|
||||
|
||||
function! ale_linters#coffee#coffee#GetCommand(buffer) abort
|
||||
return ale_linters#coffee#coffee#GetExecutable(a:buffer)
|
||||
\ . ' -cp -s'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('coffee', {
|
||||
\ 'name': 'coffee',
|
||||
\ 'executable': function('ale_linters#coffee#coffee#GetExecutable'),
|
||||
\ 'command': function('ale_linters#coffee#coffee#GetCommand'),
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
|
||||
\})
|
43
sources_non_forked/ale/ale_linters/coffee/coffeelint.vim
Normal file
43
sources_non_forked/ale/ale_linters/coffee/coffeelint.vim
Normal file
|
@ -0,0 +1,43 @@
|
|||
" Author: Prashanth Chandra https://github.com/prashcr
|
||||
" Description: coffeelint linter for coffeescript files
|
||||
|
||||
function! ale_linters#coffee#coffeelint#GetExecutable(buffer) abort
|
||||
return ale#path#ResolveLocalPath(
|
||||
\ a:buffer,
|
||||
\ 'node_modules/.bin/coffeelint',
|
||||
\ 'coffeelint'
|
||||
\)
|
||||
endfunction
|
||||
|
||||
function! ale_linters#coffee#coffeelint#GetCommand(buffer) abort
|
||||
return ale_linters#coffee#coffeelint#GetExecutable(a:buffer)
|
||||
\ . ' --stdin --reporter csv'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#coffee#coffeelint#Handle(buffer, lines) abort
|
||||
" Matches patterns like the following:
|
||||
"
|
||||
" path,lineNumber,lineNumberEnd,level,message
|
||||
" stdin,14,,error,Throwing strings is forbidden
|
||||
"
|
||||
" Note that we currently ignore lineNumberEnd for multiline errors
|
||||
let l:pattern = 'stdin,\(\d\+\),\(\d*\),\(.\{-1,}\),\(.\+\)'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'lnum': str2nr(l:match[1]),
|
||||
\ 'type': l:match[3] is# 'error' ? 'E' : 'W',
|
||||
\ 'text': l:match[4],
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('coffee', {
|
||||
\ 'name': 'coffeelint',
|
||||
\ 'executable': function('ale_linters#coffee#coffeelint#GetExecutable'),
|
||||
\ 'command': function('ale_linters#coffee#coffeelint#GetCommand'),
|
||||
\ 'callback': 'ale_linters#coffee#coffeelint#Handle',
|
||||
\})
|
67
sources_non_forked/ale/ale_linters/cpp/cc.vim
Normal file
67
sources_non_forked/ale/ale_linters/cpp/cc.vim
Normal file
|
@ -0,0 +1,67 @@
|
|||
" Author: w0rp <devw0rp@gmail.com>
|
||||
" Description: A C++ compiler linter for C++ files with gcc/clang, etc.
|
||||
|
||||
call ale#Set('cpp_cc_executable', '<auto>')
|
||||
call ale#Set('cpp_cc_options', '-std=c++14 -Wall')
|
||||
call ale#Set('cpp_cc_use_header_lang_flag', -1)
|
||||
call ale#Set('cpp_cc_header_exts', ['h', 'hpp'])
|
||||
|
||||
function! ale_linters#cpp#cc#GetExecutable(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'cpp_cc_executable')
|
||||
|
||||
" Default to either clang++ or gcc.
|
||||
if l:executable is# '<auto>'
|
||||
if ale#engine#IsExecutable(a:buffer, 'clang++')
|
||||
let l:executable = 'clang++'
|
||||
else
|
||||
let l:executable = 'gcc'
|
||||
endif
|
||||
endif
|
||||
|
||||
return l:executable
|
||||
endfunction
|
||||
|
||||
function! ale_linters#cpp#cc#GetCommand(buffer, output) abort
|
||||
let l:cflags = ale#c#GetCFlags(a:buffer, a:output)
|
||||
let l:ale_flags = ale#Var(a:buffer, 'cpp_cc_options')
|
||||
|
||||
if l:cflags =~# '-std='
|
||||
let l:ale_flags = substitute(
|
||||
\ l:ale_flags,
|
||||
\ '-std=\(c\|gnu\)++[0-9]\{2\}',
|
||||
\ '',
|
||||
\ 'g')
|
||||
endif
|
||||
|
||||
" Select the correct language flag depending on the executable, options
|
||||
" and file extension
|
||||
let l:executable = ale_linters#cpp#cc#GetExecutable(a:buffer)
|
||||
let l:use_header_lang_flag = ale#Var(a:buffer, 'cpp_cc_use_header_lang_flag')
|
||||
let l:header_exts = ale#Var(a:buffer, 'cpp_cc_header_exts')
|
||||
let l:lang_flag = ale#c#GetLanguageFlag(
|
||||
\ a:buffer,
|
||||
\ l:executable,
|
||||
\ l:use_header_lang_flag,
|
||||
\ l:header_exts,
|
||||
\ 'c++')
|
||||
|
||||
" -iquote with the directory the file is in makes #include work for
|
||||
" headers in the same directory.
|
||||
"
|
||||
" `-o /dev/null` or `-o null` is needed to catch all errors,
|
||||
" -fsyntax-only doesn't catch everything.
|
||||
return '%e -S -x ' . l:lang_flag
|
||||
\ . ' -o ' . g:ale#util#nul_file
|
||||
\ . ' -iquote %s:h'
|
||||
\ . ale#Pad(l:cflags)
|
||||
\ . ale#Pad(l:ale_flags) . ' -'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('cpp', {
|
||||
\ 'name': 'cc',
|
||||
\ 'aliases': ['gcc', 'clang', 'g++', 'clang++'],
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': function('ale_linters#cpp#cc#GetExecutable'),
|
||||
\ 'command': {b -> ale#c#RunMakeCommand(b, function('ale_linters#cpp#cc#GetCommand'))},
|
||||
\ 'callback': 'ale#handlers#gcc#HandleGCCFormatWithIncludes',
|
||||
\})
|
15
sources_non_forked/ale/ale_linters/cpp/ccls.vim
Normal file
15
sources_non_forked/ale/ale_linters/cpp/ccls.vim
Normal file
|
@ -0,0 +1,15 @@
|
|||
" Author: Ye Jingchen <ye.jingchen@gmail.com>, Ben Falconer <ben@falconers.me.uk>, jtalowell <jtalowell@protonmail.com>
|
||||
" Description: A language server for C++
|
||||
|
||||
call ale#Set('cpp_ccls_executable', 'ccls')
|
||||
call ale#Set('cpp_ccls_init_options', {})
|
||||
call ale#Set('c_build_dir', '')
|
||||
|
||||
call ale#linter#Define('cpp', {
|
||||
\ 'name': 'ccls',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': {b -> ale#Var(b, 'cpp_ccls_executable')},
|
||||
\ 'command': '%e',
|
||||
\ 'project_root': function('ale#handlers#ccls#GetProjectRoot'),
|
||||
\ 'initialization_options': {b -> ale#handlers#ccls#GetInitOpts(b, 'cpp_ccls_init_options')},
|
||||
\})
|
35
sources_non_forked/ale/ale_linters/cpp/clangcheck.vim
Normal file
35
sources_non_forked/ale/ale_linters/cpp/clangcheck.vim
Normal file
|
@ -0,0 +1,35 @@
|
|||
" Author: gagbo <gagbobada@gmail.com>
|
||||
" Description: clang-check linter for cpp files
|
||||
|
||||
call ale#Set('cpp_clangcheck_executable', 'clang-check')
|
||||
call ale#Set('cpp_clangcheck_options', '')
|
||||
call ale#Set('c_build_dir', '')
|
||||
|
||||
function! ale_linters#cpp#clangcheck#GetCommand(buffer) abort
|
||||
let l:user_options = ale#Var(a:buffer, 'cpp_clangcheck_options')
|
||||
|
||||
" Try to find compilation database to link automatically
|
||||
let l:build_dir = ale#Var(a:buffer, 'c_build_dir')
|
||||
|
||||
if empty(l:build_dir)
|
||||
let [l:root, l:json_file] = ale#c#FindCompileCommands(a:buffer)
|
||||
let l:build_dir = ale#path#Dirname(l:json_file)
|
||||
endif
|
||||
|
||||
" The extra arguments in the command are used to prevent .plist files from
|
||||
" being generated. These are only added if no build directory can be
|
||||
" detected.
|
||||
return '%e -analyze %s'
|
||||
\ . (empty(l:build_dir) ? ' --extra-arg=-Xclang --extra-arg=-analyzer-output=text --extra-arg=-fno-color-diagnostics': '')
|
||||
\ . ale#Pad(l:user_options)
|
||||
\ . (!empty(l:build_dir) ? ' -p ' . ale#Escape(l:build_dir) : '')
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('cpp', {
|
||||
\ 'name': 'clangcheck',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': {b -> ale#Var(b, 'cpp_clangcheck_executable')},
|
||||
\ 'command': function('ale_linters#cpp#clangcheck#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
22
sources_non_forked/ale/ale_linters/cpp/clangd.vim
Normal file
22
sources_non_forked/ale/ale_linters/cpp/clangd.vim
Normal file
|
@ -0,0 +1,22 @@
|
|||
" Author: Andrey Melentyev <andrey.melentyev@protonmail.com>
|
||||
" Description: Clangd language server
|
||||
|
||||
call ale#Set('cpp_clangd_executable', 'clangd')
|
||||
call ale#Set('cpp_clangd_options', '')
|
||||
call ale#Set('c_build_dir', '')
|
||||
|
||||
function! ale_linters#cpp#clangd#GetCommand(buffer) abort
|
||||
let l:build_dir = ale#c#GetBuildDirectory(a:buffer)
|
||||
|
||||
return '%e'
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'cpp_clangd_options'))
|
||||
\ . (!empty(l:build_dir) ? ' -compile-commands-dir=' . ale#Escape(l:build_dir) : '')
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('cpp', {
|
||||
\ 'name': 'clangd',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': {b -> ale#Var(b, 'cpp_clangd_executable')},
|
||||
\ 'command': function('ale_linters#cpp#clangd#GetCommand'),
|
||||
\ 'project_root': function('ale#c#FindProjectRoot'),
|
||||
\})
|
53
sources_non_forked/ale/ale_linters/cpp/clangtidy.vim
Normal file
53
sources_non_forked/ale/ale_linters/cpp/clangtidy.vim
Normal file
|
@ -0,0 +1,53 @@
|
|||
" Author: vdeurzen <tim@kompiler.org>, w0rp <devw0rp@gmail.com>,
|
||||
" gagbo <gagbobada@gmail.com>
|
||||
" Description: clang-tidy linter for cpp files
|
||||
|
||||
call ale#Set('cpp_clangtidy_executable', 'clang-tidy')
|
||||
" Set this option to check the checks clang-tidy will apply.
|
||||
call ale#Set('cpp_clangtidy_checks', [])
|
||||
" Set this option to manually set some options for clang-tidy to use as compile
|
||||
" flags.
|
||||
" This will disable compile_commands.json detection.
|
||||
call ale#Set('cpp_clangtidy_options', '')
|
||||
" Set this option to manually set options for clang-tidy directly.
|
||||
call ale#Set('cpp_clangtidy_extra_options', '')
|
||||
call ale#Set('c_build_dir', '')
|
||||
|
||||
function! ale_linters#cpp#clangtidy#GetCommand(buffer, output) abort
|
||||
let l:checks = join(ale#Var(a:buffer, 'cpp_clangtidy_checks'), ',')
|
||||
let l:build_dir = ale#c#GetBuildDirectory(a:buffer)
|
||||
let l:options = ''
|
||||
|
||||
" Get the extra options if we couldn't find a build directory.
|
||||
if empty(l:build_dir)
|
||||
let l:options = ale#Var(a:buffer, 'cpp_clangtidy_options')
|
||||
let l:cflags = ale#c#GetCFlags(a:buffer, a:output)
|
||||
let l:options .= !empty(l:options) ? ale#Pad(l:cflags) : l:cflags
|
||||
|
||||
" Tell clang-tidy a .h header with a C++ filetype in Vim is a C++ file
|
||||
" only when compile-commands.json file is not there. Adding these
|
||||
" flags makes clang-tidy completely ignore compile commands.
|
||||
if expand('#' . a:buffer) =~# '\.h$'
|
||||
let l:options .= !empty(l:options) ? ' -x c++' : '-x c++'
|
||||
endif
|
||||
endif
|
||||
|
||||
" Get the options to pass directly to clang-tidy
|
||||
let l:extra_options = ale#Var(a:buffer, 'cpp_clangtidy_extra_options')
|
||||
|
||||
return '%e'
|
||||
\ . (!empty(l:checks) ? ' -checks=' . ale#Escape(l:checks) : '')
|
||||
\ . (!empty(l:extra_options) ? ' ' . ale#Escape(l:extra_options) : '')
|
||||
\ . ' %s'
|
||||
\ . (!empty(l:build_dir) ? ' -p ' . ale#Escape(l:build_dir) : '')
|
||||
\ . (!empty(l:options) ? ' -- ' . l:options : '')
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('cpp', {
|
||||
\ 'name': 'clangtidy',
|
||||
\ 'output_stream': 'stdout',
|
||||
\ 'executable': {b -> ale#Var(b, 'cpp_clangtidy_executable')},
|
||||
\ 'command': {b -> ale#c#RunMakeCommand(b, function('ale_linters#cpp#clangtidy#GetCommand'))},
|
||||
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
32
sources_non_forked/ale/ale_linters/cpp/clazy.vim
Normal file
32
sources_non_forked/ale/ale_linters/cpp/clazy.vim
Normal file
|
@ -0,0 +1,32 @@
|
|||
" Description: clazy linter for cpp files (clang-based and Qt-oriented)
|
||||
|
||||
call ale#Set('cpp_clazy_executable', 'clazy-standalone')
|
||||
" Set this option to check the checks clazy will apply.
|
||||
call ale#Set('cpp_clazy_checks', ['level1'])
|
||||
" Set this option to manually set some options for clazy.
|
||||
" This will disable compile_commands.json detection.
|
||||
call ale#Set('cpp_clazy_options', '')
|
||||
call ale#Set('c_build_dir', '')
|
||||
|
||||
function! ale_linters#cpp#clazy#GetCommand(buffer) abort
|
||||
let l:checks = join(ale#Var(a:buffer, 'cpp_clazy_checks'), ',')
|
||||
let l:build_dir = ale#c#GetBuildDirectory(a:buffer)
|
||||
|
||||
" Get the extra options if we couldn't find a build directory.
|
||||
let l:options = ale#Var(a:buffer, 'cpp_clazy_options')
|
||||
|
||||
return '%e'
|
||||
\ . (!empty(l:checks) ? ' -checks=' . ale#Escape(l:checks) : '')
|
||||
\ . (!empty(l:build_dir) ? ' -p ' . ale#Escape(l:build_dir) : '')
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . ' %s'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('cpp', {
|
||||
\ 'name': 'clazy',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': {b -> ale#Var(b, 'cpp_clazy_executable')},
|
||||
\ 'command': function('ale_linters#cpp#clazy#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
29
sources_non_forked/ale/ale_linters/cpp/cppcheck.vim
Normal file
29
sources_non_forked/ale/ale_linters/cpp/cppcheck.vim
Normal file
|
@ -0,0 +1,29 @@
|
|||
" Author: Bart Libert <bart.libert@gmail.com>
|
||||
" Description: cppcheck linter for cpp files
|
||||
|
||||
call ale#Set('cpp_cppcheck_executable', 'cppcheck')
|
||||
call ale#Set('cpp_cppcheck_options', '--enable=style')
|
||||
|
||||
function! ale_linters#cpp#cppcheck#GetCommand(buffer) abort
|
||||
let l:compile_commands_option = ale#handlers#cppcheck#GetCompileCommandsOptions(a:buffer)
|
||||
let l:buffer_path_include = empty(l:compile_commands_option)
|
||||
\ ? ale#handlers#cppcheck#GetBufferPathIncludeOptions(a:buffer)
|
||||
\ : ''
|
||||
let l:template = ' --template=' . ale#Escape('{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}')
|
||||
|
||||
return '%e -q --language=c++'
|
||||
\ . l:template
|
||||
\ . ale#Pad(l:compile_commands_option)
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'cpp_cppcheck_options'))
|
||||
\ . l:buffer_path_include
|
||||
\ . ' %t'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('cpp', {
|
||||
\ 'name': 'cppcheck',
|
||||
\ 'output_stream': 'both',
|
||||
\ 'executable': {b -> ale#Var(b, 'cpp_cppcheck_executable')},
|
||||
\ 'cwd': function('ale#handlers#cppcheck#GetCwd'),
|
||||
\ 'command': function('ale_linters#cpp#cppcheck#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#cppcheck#HandleCppCheckFormat',
|
||||
\})
|
20
sources_non_forked/ale/ale_linters/cpp/cpplint.vim
Normal file
20
sources_non_forked/ale/ale_linters/cpp/cpplint.vim
Normal file
|
@ -0,0 +1,20 @@
|
|||
" Author: Dawid Kurek https://github.com/dawikur
|
||||
" Description: cpplint for cpp files
|
||||
|
||||
call ale#Set('cpp_cpplint_executable', 'cpplint')
|
||||
call ale#Set('cpp_cpplint_options', '')
|
||||
|
||||
function! ale_linters#cpp#cpplint#GetCommand(buffer) abort
|
||||
let l:options = ale#Var(a:buffer, 'cpp_cpplint_options')
|
||||
|
||||
return '%e' . ale#Pad(l:options) . ' %s'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('cpp', {
|
||||
\ 'name': 'cpplint',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': {b -> ale#Var(b, 'cpp_cpplint_executable')},
|
||||
\ 'command': function('ale_linters#cpp#cpplint#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#cpplint#HandleCppLintFormat',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
30
sources_non_forked/ale/ale_linters/cpp/cquery.vim
Normal file
30
sources_non_forked/ale/ale_linters/cpp/cquery.vim
Normal file
|
@ -0,0 +1,30 @@
|
|||
" Author: Ben Falconer <ben@falconers.me.uk>
|
||||
" Description: A language server for C++
|
||||
|
||||
call ale#Set('cpp_cquery_executable', 'cquery')
|
||||
call ale#Set('cpp_cquery_cache_directory', expand('~/.cache/cquery'))
|
||||
|
||||
function! ale_linters#cpp#cquery#GetProjectRoot(buffer) abort
|
||||
" Try to find cquery configuration files first.
|
||||
let l:config = ale#path#FindNearestFile(a:buffer, '.cquery')
|
||||
|
||||
if !empty(l:config)
|
||||
return fnamemodify(l:config, ':h')
|
||||
endif
|
||||
|
||||
" Fall back on default project root detection.
|
||||
return ale#c#FindProjectRoot(a:buffer)
|
||||
endfunction
|
||||
|
||||
function! ale_linters#cpp#cquery#GetInitializationOptions(buffer) abort
|
||||
return {'cacheDirectory': ale#Var(a:buffer, 'cpp_cquery_cache_directory')}
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('cpp', {
|
||||
\ 'name': 'cquery',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': {b -> ale#Var(b, 'cpp_cquery_executable')},
|
||||
\ 'command': '%e',
|
||||
\ 'project_root': function('ale_linters#cpp#cquery#GetProjectRoot'),
|
||||
\ 'initialization_options': function('ale_linters#cpp#cquery#GetInitializationOptions'),
|
||||
\})
|
5
sources_non_forked/ale/ale_linters/cpp/cspell.vim
Normal file
5
sources_non_forked/ale/ale_linters/cpp/cspell.vim
Normal file
|
@ -0,0 +1,5 @@
|
|||
scriptencoding utf-8
|
||||
" Author: David Houston <houstdav000>
|
||||
" Description: cspell support for C++ files.
|
||||
|
||||
call ale#handlers#cspell#DefineLinter('cpp')
|
25
sources_non_forked/ale/ale_linters/cpp/flawfinder.vim
Normal file
25
sources_non_forked/ale/ale_linters/cpp/flawfinder.vim
Normal file
|
@ -0,0 +1,25 @@
|
|||
" Author: Christian Gibbons <cgibbons@gmu.edu>
|
||||
" Description: flawfinder linter for c++ files
|
||||
|
||||
call ale#Set('cpp_flawfinder_executable', 'flawfinder')
|
||||
call ale#Set('cpp_flawfinder_options', '')
|
||||
call ale#Set('cpp_flawfinder_minlevel', 1)
|
||||
call ale#Set('c_flawfinder_error_severity', 6)
|
||||
|
||||
function! ale_linters#cpp#flawfinder#GetCommand(buffer) abort
|
||||
" Set the minimum vulnerability level for flawfinder to bother with
|
||||
let l:minlevel = ' --minlevel=' . ale#Var(a:buffer, 'cpp_flawfinder_minlevel')
|
||||
|
||||
return '%e -CDQS'
|
||||
\ . ale#Var(a:buffer, 'cpp_flawfinder_options')
|
||||
\ . l:minlevel
|
||||
\ . ' %t'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('cpp', {
|
||||
\ 'name': 'flawfinder',
|
||||
\ 'output_stream': 'stdout',
|
||||
\ 'executable': {b -> ale#Var(b, 'cpp_flawfinder_executable')},
|
||||
\ 'command': function('ale_linters#cpp#flawfinder#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#flawfinder#HandleFlawfinderFormat',
|
||||
\})
|
57
sources_non_forked/ale/ale_linters/crystal/ameba.vim
Normal file
57
sources_non_forked/ale/ale_linters/crystal/ameba.vim
Normal file
|
@ -0,0 +1,57 @@
|
|||
" Author: Harrison Bachrach - https://github.com/HarrisonB
|
||||
" Description: Ameba, a linter for crystal files
|
||||
|
||||
call ale#Set('crystal_ameba_executable', 'bin/ameba')
|
||||
|
||||
function! ale_linters#crystal#ameba#GetCommand(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'crystal_ameba_executable')
|
||||
|
||||
return ale#Escape(l:executable)
|
||||
\ . ' --format json '
|
||||
\ . ale#Escape(expand('#' . a:buffer . ':p'))
|
||||
endfunction
|
||||
|
||||
" Handle output from ameba
|
||||
function! ale_linters#crystal#ameba#HandleAmebaOutput(buffer, lines) abort
|
||||
if len(a:lines) == 0
|
||||
return []
|
||||
endif
|
||||
|
||||
let l:errors = ale#util#FuzzyJSONDecode(a:lines[0], {})
|
||||
|
||||
if !has_key(l:errors, 'summary')
|
||||
\|| l:errors['summary']['issues_count'] == 0
|
||||
\|| empty(l:errors['sources'])
|
||||
return []
|
||||
endif
|
||||
|
||||
let l:output = []
|
||||
|
||||
for l:error in l:errors['sources'][0]['issues']
|
||||
let l:start_col = str2nr(l:error['location']['column'])
|
||||
let l:end_col = str2nr(l:error['end_location']['column'])
|
||||
|
||||
if !l:end_col
|
||||
let l:end_col = l:start_col + 1
|
||||
endif
|
||||
|
||||
call add(l:output, {
|
||||
\ 'lnum': str2nr(l:error['location']['line']),
|
||||
\ 'col': l:start_col,
|
||||
\ 'end_col': l:end_col,
|
||||
\ 'code': l:error['rule_name'],
|
||||
\ 'text': l:error['message'],
|
||||
\ 'type': 'W',
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('crystal', {
|
||||
\ 'name': 'ameba',
|
||||
\ 'executable': {b -> ale#Var(b, 'crystal_ameba_executable')},
|
||||
\ 'command': function('ale_linters#crystal#ameba#GetCommand'),
|
||||
\ 'callback': 'ale_linters#crystal#ameba#HandleAmebaOutput',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
35
sources_non_forked/ale/ale_linters/crystal/crystal.vim
Normal file
35
sources_non_forked/ale/ale_linters/crystal/crystal.vim
Normal file
|
@ -0,0 +1,35 @@
|
|||
" Author: Jordan Andree <https://github.com/jordanandree>, David Alexander <opensource@thelonelyghost.com>
|
||||
" Description: This file adds support for checking Crystal with crystal build
|
||||
|
||||
function! ale_linters#crystal#crystal#Handle(buffer, lines) abort
|
||||
let l:output = []
|
||||
|
||||
for l:error in ale#util#FuzzyJSONDecode(a:lines, [])
|
||||
if !has_key(l:error, 'file')
|
||||
continue
|
||||
endif
|
||||
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:error.line + 0,
|
||||
\ 'col': l:error.column + 0,
|
||||
\ 'text': l:error.message,
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
function! ale_linters#crystal#crystal#GetCommand(buffer) abort
|
||||
return 'crystal build -f json --no-codegen --no-color -o '
|
||||
\ . ale#Escape(g:ale#util#nul_file)
|
||||
\ . ' %s'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('crystal', {
|
||||
\ 'name': 'crystal',
|
||||
\ 'executable': 'crystal',
|
||||
\ 'output_stream': 'both',
|
||||
\ 'lint_file': 1,
|
||||
\ 'command': function('ale_linters#crystal#crystal#GetCommand'),
|
||||
\ 'callback': 'ale_linters#crystal#crystal#Handle',
|
||||
\})
|
90
sources_non_forked/ale/ale_linters/cs/csc.vim
Normal file
90
sources_non_forked/ale/ale_linters/cs/csc.vim
Normal file
|
@ -0,0 +1,90 @@
|
|||
call ale#Set('cs_csc_options', '')
|
||||
call ale#Set('cs_csc_source', '')
|
||||
call ale#Set('cs_csc_assembly_path', [])
|
||||
call ale#Set('cs_csc_assemblies', [])
|
||||
|
||||
function! ale_linters#cs#csc#GetCwd(buffer) abort
|
||||
let l:cwd = ale#Var(a:buffer, 'cs_csc_source')
|
||||
|
||||
return !empty(l:cwd) ? l:cwd : expand('#' . a:buffer . ':p:h')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#cs#csc#GetCommand(buffer) abort
|
||||
" Pass assembly paths via the -lib: parameter.
|
||||
let l:path_list = ale#Var(a:buffer, 'cs_csc_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_csc_assemblies')
|
||||
|
||||
let l:r_option = !empty(l:assembly_list)
|
||||
\ ? '/r:' . join(map(copy(l:assembly_list), 'ale#Escape(v:val)'), ',')
|
||||
\ : ''
|
||||
|
||||
" register temporary module target file with ale
|
||||
" register temporary module target file with ALE.
|
||||
let l:out = ale#command#CreateFile(a:buffer)
|
||||
|
||||
" The code is compiled as a module and the output is redirected to a
|
||||
" temporary file.
|
||||
return 'csc /unsafe'
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'cs_csc_options'))
|
||||
\ . ale#Pad(l:lib_option)
|
||||
\ . ale#Pad(l:r_option)
|
||||
\ . ' /out:' . l:out
|
||||
\ . ' /t:module'
|
||||
\ . ' /recurse:' . ale#Escape('*.cs')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#cs#csc#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:patterns = [
|
||||
\ '^\v(.+\.cs)\((\d+),(\d+)\)\:\s+([^ ]+)\s+([cC][sS][^ ]+):\s(.+)$',
|
||||
\ '^\v([^ ]+)\s+([Cc][sS][^ ]+):\s+(.+)$',
|
||||
\]
|
||||
let l:output = []
|
||||
let l:dir = ale_linters#cs#csc#GetCwd(a:buffer)
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:patterns)
|
||||
if len(l:match) > 6 && strlen(l:match[5]) > 2 && l:match[5][:1] is? 'CS'
|
||||
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] ,
|
||||
\})
|
||||
elseif strlen(l:match[2]) > 2 && l:match[2][:1] is? 'CS'
|
||||
call add(l:output, {
|
||||
\ 'filename':'<csc>',
|
||||
\ 'lnum': -1,
|
||||
\ 'col': -1,
|
||||
\ 'type': l:match[1] is# 'error' ? 'E' : 'W',
|
||||
\ 'code': l:match[2],
|
||||
\ 'text': l:match[3],
|
||||
\})
|
||||
endif
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('cs',{
|
||||
\ 'name': 'csc',
|
||||
\ 'output_stream': 'stdout',
|
||||
\ 'executable': 'csc',
|
||||
\ 'cwd': function('ale_linters#cs#csc#GetCwd'),
|
||||
\ 'command': function('ale_linters#cs#csc#GetCommand'),
|
||||
\ 'callback': 'ale_linters#cs#csc#Handle',
|
||||
\ 'lint_file': 1
|
||||
\})
|
5
sources_non_forked/ale/ale_linters/cs/cspell.vim
Normal file
5
sources_non_forked/ale/ale_linters/cs/cspell.vim
Normal file
|
@ -0,0 +1,5 @@
|
|||
scriptencoding utf-8
|
||||
" Author: David Houston <houstdav000>
|
||||
" Description: cspell support for C# files.
|
||||
|
||||
call ale#handlers#cspell#DefineLinter('cs')
|
37
sources_non_forked/ale/ale_linters/cs/mcs.vim
Normal file
37
sources_non_forked/ale/ale_linters/cs/mcs.vim
Normal file
|
@ -0,0 +1,37 @@
|
|||
let g:ale_cs_mcs_options = get(g:, 'ale_cs_mcs_options', '')
|
||||
|
||||
function! ale_linters#cs#mcs#GetCommand(buffer) abort
|
||||
let l:options = ale#Var(a:buffer, 'cs_mcs_options')
|
||||
|
||||
return 'mcs -unsafe --parse'
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . ' %t'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#cs#mcs#Handle(buffer, lines) abort
|
||||
" Look for lines like the following.
|
||||
"
|
||||
" Tests.cs(12,29): error CSXXXX: ; expected
|
||||
let l:pattern = '^\v(.+\.cs)\((\d+),(\d+)\)\: ([^ ]+) ([^ ]+): (.+)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'col': l:match[3] + 0,
|
||||
\ 'type': l:match[4] is# 'error' ? 'E' : 'W',
|
||||
\ 'code': l:match[5],
|
||||
\ 'text': l:match[6],
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('cs',{
|
||||
\ 'name': 'mcs',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': 'mcs',
|
||||
\ 'command': function('ale_linters#cs#mcs#GetCommand'),
|
||||
\ 'callback': 'ale_linters#cs#mcs#Handle',
|
||||
\})
|
91
sources_non_forked/ale/ale_linters/cs/mcsc.vim
Normal file
91
sources_non_forked/ale/ale_linters/cs/mcsc.vim
Normal file
|
@ -0,0 +1,91 @@
|
|||
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! ale_linters#cs#mcsc#GetCwd(buffer) abort
|
||||
let l:cwd = ale#Var(a:buffer, 'cs_mcsc_source')
|
||||
|
||||
return !empty(l:cwd) ? l:cwd : expand('#' . a:buffer . ':p:h')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#cs#mcsc#GetCommand(buffer) abort
|
||||
" Pass assembly paths via the -lib: parameter.
|
||||
let l:path_list = ale#Var(a:buffer, 'cs_mcsc_assembly_path')
|
||||
|
||||
let l:lib_option = !empty(l:path_list)
|
||||
\ ? '-lib:' . join(map(copy(l:path_list), 'ale#Escape(v:val)'), ',')
|
||||
\ : ''
|
||||
|
||||
" Pass paths to DLL files via the -r: parameter.
|
||||
let l:assembly_list = ale#Var(a:buffer, 'cs_mcsc_assemblies')
|
||||
|
||||
let l:r_option = !empty(l:assembly_list)
|
||||
\ ? '-r:' . join(map(copy(l:assembly_list), 'ale#Escape(v:val)'), ',')
|
||||
\ : ''
|
||||
|
||||
" register temporary module target file with ale
|
||||
" register temporary module target file with ALE.
|
||||
let l:out = ale#command#CreateFile(a:buffer)
|
||||
|
||||
" The code is compiled as a module and the output is redirected to a
|
||||
" temporary file.
|
||||
return 'mcs -unsafe'
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'cs_mcsc_options'))
|
||||
\ . ale#Pad(l:lib_option)
|
||||
\ . ale#Pad(l:r_option)
|
||||
\ . ' -out:' . l:out
|
||||
\ . ' -t:module'
|
||||
\ . ' -recurse:' . ale#Escape('*.cs')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#cs#mcsc#Handle(buffer, lines) abort
|
||||
" Look for lines like the following.
|
||||
"
|
||||
" Tests.cs(12,29): error CSXXXX: ; expected
|
||||
"
|
||||
" NOTE: pattern also captures file name as linter compiles all
|
||||
" files within the source tree rooted at the specified source
|
||||
" path and not just the file loaded in the buffer
|
||||
let l:patterns = [
|
||||
\ '^\v(.+\.cs)\((\d+),(\d+)\)\:\s+([^ ]+)\s+([cC][sS][^ ]+):\s(.+)$',
|
||||
\ '^\v([^ ]+)\s+([Cc][sS][^ ]+):\s+(.+)$',
|
||||
\]
|
||||
let l:output = []
|
||||
|
||||
let l:dir = ale_linters#cs#mcsc#GetCwd(a:buffer)
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:patterns)
|
||||
if len(l:match) > 6 && strlen(l:match[5]) > 2 && l:match[5][:1] is? 'CS'
|
||||
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] ,
|
||||
\})
|
||||
elseif strlen(l:match[2]) > 2 && l:match[2][:1] is? 'CS'
|
||||
call add(l:output, {
|
||||
\ 'filename':'<mcs>',
|
||||
\ 'lnum': -1,
|
||||
\ 'col': -1,
|
||||
\ 'type': l:match[1] is# 'error' ? 'E' : 'W',
|
||||
\ 'code': l:match[2],
|
||||
\ 'text': l:match[3],
|
||||
\})
|
||||
endif
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('cs',{
|
||||
\ 'name': 'mcsc',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': 'mcs',
|
||||
\ 'cwd': function('ale_linters#cs#mcsc#GetCwd'),
|
||||
\ 'command': function('ale_linters#cs#mcsc#GetCommand'),
|
||||
\ 'callback': 'ale_linters#cs#mcsc#Handle',
|
||||
\ 'lint_file': 1
|
||||
\})
|
5
sources_non_forked/ale/ale_linters/css/cspell.vim
Normal file
5
sources_non_forked/ale/ale_linters/css/cspell.vim
Normal file
|
@ -0,0 +1,5 @@
|
|||
scriptencoding utf-8
|
||||
" Author: David Houston <houstdav000>
|
||||
" Description: cspell support for CSS files.
|
||||
|
||||
call ale#handlers#cspell#DefineLinter('css')
|
18
sources_non_forked/ale/ale_linters/css/csslint.vim
Normal file
18
sources_non_forked/ale/ale_linters/css/csslint.vim
Normal file
|
@ -0,0 +1,18 @@
|
|||
" Author: w0rp <devw0rp@gmail.com>
|
||||
" Description: This file adds support for checking CSS code with csslint.
|
||||
|
||||
function! ale_linters#css#csslint#GetCommand(buffer) abort
|
||||
let l:csslintrc = ale#path#FindNearestFile(a:buffer, '.csslintrc')
|
||||
let l:config_option = !empty(l:csslintrc)
|
||||
\ ? '--config=' . ale#Escape(l:csslintrc)
|
||||
\ : ''
|
||||
|
||||
return 'csslint --format=compact ' . l:config_option . ' %t'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('css', {
|
||||
\ 'name': 'csslint',
|
||||
\ 'executable': 'csslint',
|
||||
\ 'command': function('ale_linters#css#csslint#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#css#HandleCSSLintFormat',
|
||||
\})
|
9
sources_non_forked/ale/ale_linters/css/fecs.vim
Normal file
9
sources_non_forked/ale/ale_linters/css/fecs.vim
Normal file
|
@ -0,0 +1,9 @@
|
|||
" Author: harttle <yangjvn@126.com>
|
||||
" Description: fecs for CSS files
|
||||
|
||||
call ale#linter#Define('css', {
|
||||
\ 'name': 'fecs',
|
||||
\ 'executable': function('ale#handlers#fecs#GetExecutable'),
|
||||
\ 'command': function('ale#handlers#fecs#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#fecs#Handle',
|
||||
\})
|
19
sources_non_forked/ale/ale_linters/css/stylelint.vim
Normal file
19
sources_non_forked/ale/ale_linters/css/stylelint.vim
Normal file
|
@ -0,0 +1,19 @@
|
|||
" Author: diartyz <diartyz@gmail.com>
|
||||
|
||||
call ale#Set('css_stylelint_executable', 'stylelint')
|
||||
call ale#Set('css_stylelint_options', '')
|
||||
call ale#Set('css_stylelint_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
|
||||
function! ale_linters#css#stylelint#GetCommand(buffer) abort
|
||||
return '%e ' . ale#Pad(ale#Var(a:buffer, 'css_stylelint_options'))
|
||||
\ . ' --stdin-filename %s'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('css', {
|
||||
\ 'name': 'stylelint',
|
||||
\ 'executable': {b -> ale#path#FindExecutable(b, 'css_stylelint', [
|
||||
\ 'node_modules/.bin/stylelint',
|
||||
\ ])},
|
||||
\ 'command': function('ale_linters#css#stylelint#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#css#HandleStyleLintFormat',
|
||||
\})
|
16
sources_non_forked/ale/ale_linters/css/vscodecss.vim
Normal file
16
sources_non_forked/ale/ale_linters/css/vscodecss.vim
Normal file
|
@ -0,0 +1,16 @@
|
|||
" Author: Dalius Dobravolskas <dalius.dobravolskas@gmail.com>
|
||||
" Description: VSCode css language server
|
||||
|
||||
function! ale_linters#css#vscodecss#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('css', {
|
||||
\ 'name': 'vscodecss',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': 'vscode-css-language-server',
|
||||
\ 'command': '%e --stdio',
|
||||
\ 'project_root': function('ale_linters#css#vscodecss#GetProjectRoot'),
|
||||
\})
|
46
sources_non_forked/ale/ale_linters/cucumber/cucumber.vim
Normal file
46
sources_non_forked/ale/ale_linters/cucumber/cucumber.vim
Normal file
|
@ -0,0 +1,46 @@
|
|||
" Author: Eddie Lebow https://github.com/elebow
|
||||
" Description: Cucumber, a BDD test tool
|
||||
|
||||
function! ale_linters#cucumber#cucumber#GetCommand(buffer) abort
|
||||
let l:features_dir = ale#path#FindNearestDirectory(a:buffer, 'features')
|
||||
|
||||
if !empty(l:features_dir)
|
||||
let l:features_arg = '-r ' . ale#Escape(l:features_dir)
|
||||
else
|
||||
let l:features_arg = ''
|
||||
endif
|
||||
|
||||
return 'cucumber --dry-run --quiet --strict --format=json '
|
||||
\ . l:features_arg . ' %t'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#cucumber#cucumber#Handle(buffer, lines) abort
|
||||
try
|
||||
let l:json = ale#util#FuzzyJSONDecode(a:lines, {})[0]
|
||||
catch
|
||||
return []
|
||||
endtry
|
||||
|
||||
let l:output = []
|
||||
|
||||
for l:element in get(l:json, 'elements', [])
|
||||
for l:step in l:element['steps']
|
||||
if l:step['result']['status'] is# 'undefined'
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:step['line'],
|
||||
\ 'code': 'E',
|
||||
\ 'text': 'Undefined step'
|
||||
\})
|
||||
endif
|
||||
endfor
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('cucumber', {
|
||||
\ 'name': 'cucumber',
|
||||
\ 'executable': 'cucumber',
|
||||
\ 'command': function('ale_linters#cucumber#cucumber#GetCommand'),
|
||||
\ 'callback': 'ale_linters#cucumber#cucumber#Handle'
|
||||
\})
|
23
sources_non_forked/ale/ale_linters/cuda/clangd.vim
Normal file
23
sources_non_forked/ale/ale_linters/cuda/clangd.vim
Normal file
|
@ -0,0 +1,23 @@
|
|||
" Author: Tommy Chiang <ty1208chiang@gmail.com>
|
||||
" Description: Clangd language server for CUDA (modified from Andrey
|
||||
" Melentyev's implementation for C++)
|
||||
|
||||
call ale#Set('cuda_clangd_executable', 'clangd')
|
||||
call ale#Set('cuda_clangd_options', '')
|
||||
call ale#Set('c_build_dir', '')
|
||||
|
||||
function! ale_linters#cuda#clangd#GetCommand(buffer) abort
|
||||
let l:build_dir = ale#c#GetBuildDirectory(a:buffer)
|
||||
|
||||
return '%e'
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'cuda_clangd_options'))
|
||||
\ . (!empty(l:build_dir) ? ' -compile-commands-dir=' . ale#Escape(l:build_dir) : '')
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('cuda', {
|
||||
\ 'name': 'clangd',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': {b -> ale#Var(b, 'cuda_clangd_executable')},
|
||||
\ 'command': function('ale_linters#cuda#clangd#GetCommand'),
|
||||
\ 'project_root': function('ale#c#FindProjectRoot'),
|
||||
\})
|
46
sources_non_forked/ale/ale_linters/cuda/nvcc.vim
Normal file
46
sources_non_forked/ale/ale_linters/cuda/nvcc.vim
Normal file
|
@ -0,0 +1,46 @@
|
|||
" Author: blahgeek <i@blahgeek.com>
|
||||
" Description: NVCC linter for cuda files
|
||||
|
||||
call ale#Set('cuda_nvcc_executable', 'nvcc')
|
||||
call ale#Set('cuda_nvcc_options', '-std=c++11')
|
||||
|
||||
function! ale_linters#cuda#nvcc#GetCommand(buffer) abort
|
||||
return '%e -cuda'
|
||||
\ . ale#Pad(ale#c#IncludeOptions(ale#c#FindLocalHeaderPaths(a:buffer)))
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'cuda_nvcc_options'))
|
||||
\ . ' %s -o ' . g:ale#util#nul_file
|
||||
endfunction
|
||||
|
||||
function! ale_linters#cuda#nvcc#HandleNVCCFormat(buffer, lines) abort
|
||||
" Look for lines like the following.
|
||||
"
|
||||
" test.cu(8): error: argument of type "void *" is incompatible with parameter of type "int *"
|
||||
let l:pattern = '\v^([^:\(\)]+):?\(?(\d+)\)?:(\d+)?:?\s*\w*\s*(error|warning): (.+)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
let l:item = {
|
||||
\ 'lnum': str2nr(l:match[2]),
|
||||
\ 'type': l:match[4] =~# 'error' ? 'E' : 'W',
|
||||
\ 'text': l:match[5],
|
||||
\ 'filename': fnamemodify(l:match[1], ':p'),
|
||||
\}
|
||||
|
||||
if !empty(l:match[3])
|
||||
let l:item.col = str2nr(l:match[3])
|
||||
endif
|
||||
|
||||
call add(l:output, l:item)
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('cuda', {
|
||||
\ 'name': 'nvcc',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': {b -> ale#Var(b, 'cuda_nvcc_executable')},
|
||||
\ 'command': function('ale_linters#cuda#nvcc#GetCommand'),
|
||||
\ 'callback': 'ale_linters#cuda#nvcc#HandleNVCCFormat',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
26
sources_non_forked/ale/ale_linters/cypher/cypher_lint.vim
Normal file
26
sources_non_forked/ale/ale_linters/cypher/cypher_lint.vim
Normal file
|
@ -0,0 +1,26 @@
|
|||
" Author: Francisco Lopes <francisco@oblita.com>
|
||||
" Description: Linting for Neo4j's Cypher
|
||||
|
||||
function! ale_linters#cypher#cypher_lint#Handle(buffer, lines) abort
|
||||
let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):(\d+): (.*)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'col': l:match[3] + 0,
|
||||
\ 'text': l:match[4],
|
||||
\ 'type': 'E',
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('cypher', {
|
||||
\ 'name': 'cypher_lint',
|
||||
\ 'executable': 'cypher-lint',
|
||||
\ 'command': 'cypher-lint',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'callback': 'ale_linters#cypher#cypher_lint#Handle',
|
||||
\})
|
22
sources_non_forked/ale/ale_linters/d/dls.vim
Normal file
22
sources_non_forked/ale/ale_linters/d/dls.vim
Normal file
|
@ -0,0 +1,22 @@
|
|||
" Author: aurieh <me@aurieh.me>
|
||||
" Description: A Language Server implementation for D
|
||||
|
||||
call ale#Set('d_dls_executable', 'dls')
|
||||
|
||||
function! ale_linters#d#dls#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'd_dls_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#d#dls#FindProjectRoot(buffer) abort
|
||||
" Note: this will return . if dub config is empty
|
||||
" dls can run outside DUB projects just fine
|
||||
return fnamemodify(ale#d#FindDUBConfig(a:buffer), ':h')
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('d', {
|
||||
\ 'name': 'dls',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': function('ale_linters#d#dls#GetExecutable'),
|
||||
\ 'command': function('ale_linters#d#dls#GetExecutable'),
|
||||
\ 'project_root': function('ale_linters#d#dls#FindProjectRoot'),
|
||||
\})
|
116
sources_non_forked/ale/ale_linters/d/dmd.vim
Normal file
116
sources_non_forked/ale/ale_linters/d/dmd.vim
Normal file
|
@ -0,0 +1,116 @@
|
|||
" Author: w0rp <devw0rp@gmail.com>
|
||||
" Description: "dmd for D files"
|
||||
|
||||
function! s:GetDUBCommand(buffer) abort
|
||||
" If we can't run dub, then skip this command.
|
||||
if executable('dub')
|
||||
" Returning an empty string skips to the DMD command.
|
||||
let l:config = ale#d#FindDUBConfig(a:buffer)
|
||||
|
||||
" 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.
|
||||
if !empty(l:config)
|
||||
return [fnamemodify(l:config, ':h'), 'dub describe --data-list
|
||||
\ --data=import-paths
|
||||
\ --data=string-import-paths
|
||||
\ --data=versions
|
||||
\ --data=debug-versions
|
||||
\']
|
||||
endif
|
||||
endif
|
||||
|
||||
return ['', '']
|
||||
endfunction
|
||||
|
||||
function! ale_linters#d#dmd#RunDUBCommand(buffer) abort
|
||||
let [l:cwd, l:command] = s:GetDUBCommand(a:buffer)
|
||||
|
||||
if empty(l:command)
|
||||
" If we can't run DUB, just run DMD.
|
||||
return ale_linters#d#dmd#DMDCommand(a:buffer, [], {})
|
||||
endif
|
||||
|
||||
return ale#command#Run(
|
||||
\ a:buffer,
|
||||
\ l:command,
|
||||
\ function('ale_linters#d#dmd#DMDCommand'),
|
||||
\ {'cwd': l:cwd},
|
||||
\)
|
||||
endfunction
|
||||
|
||||
function! ale_linters#d#dmd#DMDCommand(buffer, dub_output, meta) abort
|
||||
let l:import_list = []
|
||||
let l:str_import_list = []
|
||||
let l:versions_list = []
|
||||
let l:deb_versions_list = []
|
||||
let l:list_ind = 1
|
||||
let l:seen_line = 0
|
||||
|
||||
" Build a list of options generated from DUB, if available.
|
||||
" DUB output each path or version on a single line.
|
||||
" Each list is separated by a blank line.
|
||||
" Empty list are represented by a blank line (followed and/or
|
||||
" preceded by a separation blank line)
|
||||
for l:line in a:dub_output
|
||||
" line still has end of line char on windows
|
||||
let l:line = substitute(l:line, '[\r\n]*$', '', '')
|
||||
|
||||
if !empty(l:line)
|
||||
if l:list_ind == 1
|
||||
call add(l:import_list, '-I' . ale#Escape(l:line))
|
||||
elseif l:list_ind == 2
|
||||
call add(l:str_import_list, '-J' . ale#Escape(l:line))
|
||||
elseif l:list_ind == 3
|
||||
call add(l:versions_list, '-version=' . ale#Escape(l:line))
|
||||
elseif l:list_ind == 4
|
||||
call add(l:deb_versions_list, '-debug=' . ale#Escape(l:line))
|
||||
endif
|
||||
|
||||
let l:seen_line = 1
|
||||
elseif !l:seen_line
|
||||
" if list is empty must skip one empty line
|
||||
let l:seen_line = 1
|
||||
else
|
||||
let l:seen_line = 0
|
||||
let l:list_ind += 1
|
||||
endif
|
||||
endfor
|
||||
|
||||
return 'dmd ' . join(l:import_list) . ' ' .
|
||||
\ join(l:str_import_list) . ' ' .
|
||||
\ join(l:versions_list) . ' ' .
|
||||
\ join(l:deb_versions_list) . ' -o- -wi -vcolumns -c %t'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#d#dmd#Handle(buffer, lines) abort
|
||||
" Matches patterns lines like the following:
|
||||
" /tmp/tmp.qclsa7qLP7/file.d(1): Error: function declaration without return type. (Note that constructors are always named 'this')
|
||||
" /tmp/tmp.G1L5xIizvB.d(8,8): Error: module weak_reference is in file 'dstruct/weak_reference.d' which cannot be read
|
||||
let l:pattern = '\v^(\f+)\((\d+)(,(\d+))?\): (\w+): (.+)$'
|
||||
let l:output = []
|
||||
let l:dir = expand('#' . a:buffer . ':p:h')
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
" If dmd was invoked with relative path, match[1] is relative, otherwise it is absolute.
|
||||
" As we invoke dmd with the buffer path (in /tmp), this will generally be absolute already
|
||||
let l:fname = ale#path#GetAbsPath(l:dir, l:match[1])
|
||||
call add(l:output, {
|
||||
\ 'filename': l:fname,
|
||||
\ 'lnum': l:match[2],
|
||||
\ 'col': l:match[4],
|
||||
\ 'type': l:match[5] is# 'Warning' || l:match[5] is# 'Deprecation' ? 'W' : 'E',
|
||||
\ 'text': l:match[6],
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('d', {
|
||||
\ 'name': 'dmd',
|
||||
\ 'executable': 'dmd',
|
||||
\ 'command': function('ale_linters#d#dmd#RunDUBCommand'),
|
||||
\ 'callback': 'ale_linters#d#dmd#Handle',
|
||||
\ 'output_stream': 'stderr',
|
||||
\})
|
41
sources_non_forked/ale/ale_linters/dafny/dafny.vim
Normal file
41
sources_non_forked/ale/ale_linters/dafny/dafny.vim
Normal file
|
@ -0,0 +1,41 @@
|
|||
" Author: Taylor Blau <me@ttaylorr.com>
|
||||
|
||||
function! ale_linters#dafny#dafny#Handle(buffer, lines) abort
|
||||
let l:pattern = '\v(.*)\((\d+),(\d+)\): (.*): (.*)'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'filename': l:match[1],
|
||||
\ 'col': l:match[3] + 0,
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'text': l:match[5],
|
||||
\ 'type': l:match[4] =~# '^Error' ? 'E' : 'W'
|
||||
\ })
|
||||
endfor
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, '\v(.*)\((\d+),(\d+)\): (Verification of .{-} timed out after \d+ seconds)')
|
||||
call add(l:output, {
|
||||
\ 'filename': l:match[1],
|
||||
\ 'col': l:match[3] + 0,
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'text': l:match[4],
|
||||
\ 'type': 'E',
|
||||
\ })
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
function! ale_linters#dafny#dafny#GetCommand(buffer) abort
|
||||
return printf('dafny %%s /compile:0 /timeLimit:%d', ale#Var(a:buffer, 'dafny_dafny_timelimit'))
|
||||
endfunction
|
||||
|
||||
call ale#Set('dafny_dafny_timelimit', 10)
|
||||
call ale#linter#Define('dafny', {
|
||||
\ 'name': 'dafny',
|
||||
\ 'executable': 'dafny',
|
||||
\ 'command': function('ale_linters#dafny#dafny#GetCommand'),
|
||||
\ 'callback': 'ale_linters#dafny#dafny#Handle',
|
||||
\ 'lint_file': 1,
|
||||
\ })
|
29
sources_non_forked/ale/ale_linters/dart/analysis_server.vim
Normal file
29
sources_non_forked/ale/ale_linters/dart/analysis_server.vim
Normal file
|
@ -0,0 +1,29 @@
|
|||
" Author: Nelson Yeung <nelsyeung@gmail.com>
|
||||
" Description: Check Dart files with dart analysis server LSP
|
||||
|
||||
call ale#Set('dart_analysis_server_executable', 'dart')
|
||||
|
||||
function! ale_linters#dart#analysis_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
|
||||
|
||||
function! ale_linters#dart#analysis_server#GetCommand(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'dart_analysis_server_executable')
|
||||
let l:dart = resolve(exepath(l:executable))
|
||||
|
||||
return '%e '
|
||||
\ . fnamemodify(l:dart, ':h') . '/snapshots/analysis_server.dart.snapshot'
|
||||
\ . ' --lsp'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('dart', {
|
||||
\ 'name': 'analysis_server',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': {b -> ale#Var(b, 'dart_analysis_server_executable')},
|
||||
\ 'command': function('ale_linters#dart#analysis_server#GetCommand'),
|
||||
\ 'project_root': function('ale_linters#dart#analysis_server#GetProjectRoot'),
|
||||
\})
|
29
sources_non_forked/ale/ale_linters/dart/dart_analyze.vim
Normal file
29
sources_non_forked/ale/ale_linters/dart/dart_analyze.vim
Normal file
|
@ -0,0 +1,29 @@
|
|||
" Author: ghsang <gwonhyuksang@gmail.com>
|
||||
" Description: Check Dart files with dart analyze
|
||||
|
||||
call ale#Set('dart_analyze_executable', 'dart')
|
||||
|
||||
function! ale_linters#dart#dart_analyze#Handle(buffer, lines) abort
|
||||
let l:pattern = '\v([a-z]+) - (.+):(\d+):(\d+) - (.+) - (.+)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
let [l:type, l:filename, l:lnum, l:col, l:message, l:code] = l:match[1:6]
|
||||
call add(l:output, {
|
||||
\ 'type': l:type is# 'error' ? 'E' : l:type is# 'info' ? 'I' : 'W',
|
||||
\ 'text': l:code . ': ' . l:message,
|
||||
\ 'lnum': str2nr(l:lnum),
|
||||
\ 'col': str2nr(l:col),
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('dart', {
|
||||
\ 'name': 'dart_analyze',
|
||||
\ 'executable': {b -> ale#Var(b, 'dart_analyze_executable')},
|
||||
\ 'command': '%e analyze --fatal-infos %s',
|
||||
\ 'callback': 'ale_linters#dart#dart_analyze#Handle',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
20
sources_non_forked/ale/ale_linters/dart/language_server.vim
Normal file
20
sources_non_forked/ale/ale_linters/dart/language_server.vim
Normal file
|
@ -0,0 +1,20 @@
|
|||
" Author: aurieh <me@aurieh.me>
|
||||
" Description: A language server for dart
|
||||
|
||||
call ale#Set('dart_language_server_executable', 'dart_language_server')
|
||||
|
||||
function! ale_linters#dart#language_server#GetProjectRoot(buffer) abort
|
||||
" Note: pub only looks for pubspec.yaml, there's no point in adding
|
||||
" support for pubspec.yml
|
||||
let l:pubspec = ale#path#FindNearestFile(a:buffer, 'pubspec.yaml')
|
||||
|
||||
return !empty(l:pubspec) ? fnamemodify(l:pubspec, ':h:h') : ''
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('dart', {
|
||||
\ 'name': 'language_server',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': {b -> ale#Var(b, 'dart_language_server_executable')},
|
||||
\ 'command': '%e',
|
||||
\ 'project_root': function('ale_linters#dart#language_server#GetProjectRoot'),
|
||||
\})
|
|
@ -0,0 +1,31 @@
|
|||
call ale#Set('desktop_desktop_file_validate_options', '')
|
||||
|
||||
" Example matches for pattern:
|
||||
"
|
||||
" foo.desktop: warning: key "TerminalOptions" in group ...
|
||||
" foo.desktop: error: action "new-private-window" is defined, ...
|
||||
let s:pattern = '\v^(.+): ([a-z]+): (.+)$'
|
||||
|
||||
function! ale_linters#desktop#desktop_file_validate#Handle(buffer, lines) abort
|
||||
" The error format doesn't specify lines, so we can just put all of the
|
||||
" errors on line 1.
|
||||
return ale#util#MapMatches(a:lines, s:pattern, {match -> {
|
||||
\ 'lnum': 1,
|
||||
\ 'col': 1,
|
||||
\ 'type': match[2] is? 'error' ? 'E' : 'W',
|
||||
\ 'text': match[3],
|
||||
\}})
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('desktop', {
|
||||
\ 'name': 'desktop_file_validate',
|
||||
\ 'aliases': ['desktop-file-validate'],
|
||||
\ 'executable': 'desktop-file-validate',
|
||||
\ 'command': {b ->
|
||||
\ '%e'
|
||||
\ . ale#Pad(ale#Var(b, 'desktop_desktop_file_validate_options'))
|
||||
\ . ' %t'
|
||||
\ },
|
||||
\ 'callback': 'ale_linters#desktop#desktop_file_validate#Handle',
|
||||
\ 'output_stream': 'both',
|
||||
\})
|
|
@ -0,0 +1,76 @@
|
|||
" Author: Alexander Olofsson <alexander.olofsson@liu.se>
|
||||
|
||||
call ale#Set('dockerfile_dockerfile_lint_executable', 'dockerfile_lint')
|
||||
call ale#Set('dockerfile_dockerfile_lint_options', '')
|
||||
|
||||
function! ale_linters#dockerfile#dockerfile_lint#GetType(type) abort
|
||||
if a:type is? 'error'
|
||||
return 'E'
|
||||
elseif a:type is? 'warn'
|
||||
return 'W'
|
||||
endif
|
||||
|
||||
return 'I'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#dockerfile#dockerfile_lint#Handle(buffer, lines) abort
|
||||
try
|
||||
let l:data = json_decode(join(a:lines, ''))
|
||||
catch
|
||||
return []
|
||||
endtry
|
||||
|
||||
if empty(l:data)
|
||||
" Should never happen, but it's better to be on the safe side
|
||||
return []
|
||||
endif
|
||||
|
||||
let l:messages = []
|
||||
|
||||
for l:type in ['error', 'warn', 'info']
|
||||
for l:object in l:data[l:type]['data']
|
||||
let l:line = get(l:object, 'line', -1)
|
||||
let l:message = l:object['message']
|
||||
|
||||
let l:link = get(l:object, 'reference_url', '')
|
||||
|
||||
if type(l:link) == v:t_list
|
||||
" Somehow, reference_url is returned as two-part list.
|
||||
" Anchor markers in that list are sometimes duplicated.
|
||||
" See https://github.com/projectatomic/dockerfile_lint/issues/134
|
||||
let l:link = join(l:link, '')
|
||||
let l:link = substitute(l:link, '##', '#', '')
|
||||
endif
|
||||
|
||||
let l:detail = l:message
|
||||
|
||||
if get(l:object, 'description', 'None') isnot# 'None'
|
||||
let l:detail .= "\n\n" . l:object['description']
|
||||
endif
|
||||
|
||||
let l:detail .= "\n\n" . l:link
|
||||
|
||||
call add(l:messages, {
|
||||
\ 'lnum': l:line,
|
||||
\ 'text': l:message,
|
||||
\ 'type': ale_linters#dockerfile#dockerfile_lint#GetType(l:type),
|
||||
\ 'detail': l:detail,
|
||||
\})
|
||||
endfor
|
||||
endfor
|
||||
|
||||
return l:messages
|
||||
endfunction
|
||||
|
||||
function! ale_linters#dockerfile#dockerfile_lint#GetCommand(buffer) abort
|
||||
return '%e' . ale#Pad(ale#Var(a:buffer, 'dockerfile_dockerfile_lint_options'))
|
||||
\ . ' -p -j -f'
|
||||
\ . ' %t'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('dockerfile', {
|
||||
\ 'name': 'dockerfile_lint',
|
||||
\ 'executable': {b -> ale#Var(b, 'dockerfile_dockerfile_lint_executable')},
|
||||
\ 'command': function('ale_linters#dockerfile#dockerfile_lint#GetCommand'),
|
||||
\ 'callback': 'ale_linters#dockerfile#dockerfile_lint#Handle',
|
||||
\})
|
123
sources_non_forked/ale/ale_linters/dockerfile/hadolint.vim
Normal file
123
sources_non_forked/ale/ale_linters/dockerfile/hadolint.vim
Normal file
|
@ -0,0 +1,123 @@
|
|||
" 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')
|
||||
call ale#Set('dockerfile_hadolint_options', '')
|
||||
|
||||
function! ale_linters#dockerfile#hadolint#Handle(buffer, lines) abort
|
||||
" Matches patterns line the following:
|
||||
"
|
||||
" -:19 DL3001 warning: 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
|
||||
|
||||
" Shellcheck knows a 'style' severity - pin it to info level as well.
|
||||
if l:match[7] is# 'style'
|
||||
let l:type = 'I'
|
||||
elseif l:match[7] is# 'info'
|
||||
let l:type = 'I'
|
||||
elseif l:match[7] is# 'warning'
|
||||
let l:type = 'W'
|
||||
else
|
||||
let l:type = 'E'
|
||||
endif
|
||||
|
||||
let l:text = l:match[8]
|
||||
let l:detail = l:match[8]
|
||||
let l:domain = 'https://github.com/hadolint/hadolint/wiki/'
|
||||
let l:code = ''
|
||||
let l:link = ''
|
||||
|
||||
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:text = l:code . ': ' . l:detail
|
||||
let l:detail = l:code . l:link . "\n\n" . l:detail
|
||||
else
|
||||
let l:type = 'E'
|
||||
let l:detail = 'hadolint could not parse the file because of a syntax error.'
|
||||
endif
|
||||
|
||||
let l:line_output = {
|
||||
\ 'lnum': l:lnum,
|
||||
\ 'col': l:colnum,
|
||||
\ 'type': l:type,
|
||||
\ 'text': l:text,
|
||||
\ 'detail': l:detail
|
||||
\}
|
||||
|
||||
if l:code isnot# ''
|
||||
let l:line_output['code'] = l:code
|
||||
endif
|
||||
|
||||
call add(l:output, l:line_output)
|
||||
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)
|
||||
let l:opts = ale#Var(a:buffer, 'dockerfile_hadolint_options') . ' --no-color -'
|
||||
|
||||
if l:command is# 'docker'
|
||||
return printf('docker run --rm -i %s hadolint %s',
|
||||
\ ale#Var(a:buffer, 'dockerfile_hadolint_docker_image'),
|
||||
\ l:opts)
|
||||
endif
|
||||
|
||||
return 'hadolint ' . l:opts
|
||||
endfunction
|
||||
|
||||
|
||||
call ale#linter#Define('dockerfile', {
|
||||
\ 'name': 'hadolint',
|
||||
\ 'executable': function('ale_linters#dockerfile#hadolint#GetExecutable'),
|
||||
\ 'command': function('ale_linters#dockerfile#hadolint#GetCommand'),
|
||||
\ 'callback': 'ale_linters#dockerfile#hadolint#Handle',
|
||||
\})
|
71
sources_non_forked/ale/ale_linters/elixir/credo.vim
Normal file
71
sources_non_forked/ale/ale_linters/elixir/credo.vim
Normal file
|
@ -0,0 +1,71 @@
|
|||
" Author: hauleth - https://github.com/hauleth
|
||||
|
||||
function! ale_linters#elixir#credo#Handle(buffer, lines) abort
|
||||
" Matches patterns line the following:
|
||||
"
|
||||
" lib/filename.ex:19:7: F: Pipe chain should start with a raw value.
|
||||
let l:pattern = '\v:(\d+):?(\d+)?: (.): (.+)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
let l:type = l:match[3]
|
||||
let l:text = l:match[4]
|
||||
|
||||
" Refactoring opportunities
|
||||
if l:type is# 'F'
|
||||
let l:type = 'W'
|
||||
" Consistency
|
||||
elseif l:type is# 'C'
|
||||
let l:type = 'W'
|
||||
" Software Design
|
||||
elseif l:type is# 'D'
|
||||
let l:type = 'I'
|
||||
" Code Readability
|
||||
elseif l:type is# 'R'
|
||||
let l:type = 'I'
|
||||
endif
|
||||
|
||||
call add(l:output, {
|
||||
\ 'bufnr': a:buffer,
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'col': l:match[2] + 0,
|
||||
\ 'type': l:type,
|
||||
\ 'text': l:text,
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
function! ale_linters#elixir#credo#GetMode() abort
|
||||
if get(g:, 'ale_elixir_credo_strict', 0)
|
||||
return '--strict'
|
||||
else
|
||||
return 'suggest'
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! ale_linters#elixir#credo#GetConfigFile() abort
|
||||
let l:config_file = get(g:, 'ale_elixir_credo_config_file', '')
|
||||
|
||||
if empty(l:config_file)
|
||||
return ''
|
||||
endif
|
||||
|
||||
return ' --config-file ' . l:config_file
|
||||
endfunction
|
||||
|
||||
function! ale_linters#elixir#credo#GetCommand(buffer) abort
|
||||
return 'mix help credo && '
|
||||
\ . 'mix credo ' . ale_linters#elixir#credo#GetMode()
|
||||
\ . ale_linters#elixir#credo#GetConfigFile()
|
||||
\ . ' --format=flycheck --read-from-stdin %s'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('elixir', {
|
||||
\ 'name': 'credo',
|
||||
\ 'executable': 'mix',
|
||||
\ 'cwd': function('ale#handlers#elixir#FindMixUmbrellaRoot'),
|
||||
\ 'command': function('ale_linters#elixir#credo#GetCommand'),
|
||||
\ 'callback': 'ale_linters#elixir#credo#Handle',
|
||||
\})
|
5
sources_non_forked/ale/ale_linters/elixir/cspell.vim
Normal file
5
sources_non_forked/ale/ale_linters/elixir/cspell.vim
Normal file
|
@ -0,0 +1,5 @@
|
|||
scriptencoding utf-8
|
||||
" Author: David Houston <houstdav000>
|
||||
" Description: cspell support for Elixir files.
|
||||
|
||||
call ale#handlers#cspell#DefineLinter('elixir')
|
34
sources_non_forked/ale/ale_linters/elixir/dialyxir.vim
Normal file
34
sources_non_forked/ale/ale_linters/elixir/dialyxir.vim
Normal file
|
@ -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',
|
||||
\ 'cwd': function('ale#handlers#elixir#FindMixProjectRoot'),
|
||||
\ 'command': 'mix help dialyzer && mix dialyzer',
|
||||
\ 'callback': 'ale_linters#elixir#dialyxir#Handle',
|
||||
\})
|
39
sources_non_forked/ale/ale_linters/elixir/dogma.vim
Normal file
39
sources_non_forked/ale/ale_linters/elixir/dogma.vim
Normal file
|
@ -0,0 +1,39 @@
|
|||
" 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',
|
||||
\ 'cwd': function('ale#handlers#elixir#FindMixProjectRoot'),
|
||||
\ 'command': 'mix help dogma && mix dogma %s --format=flycheck',
|
||||
\ 'lint_file': 1,
|
||||
\ 'callback': 'ale_linters#elixir#dogma#Handle',
|
||||
\})
|
21
sources_non_forked/ale/ale_linters/elixir/elixir_ls.vim
Normal file
21
sources_non_forked/ale/ale_linters/elixir/elixir_ls.vim
Normal file
|
@ -0,0 +1,21 @@
|
|||
" Author: Jon Parise <jon@indelible.org>
|
||||
" Description: ElixirLS integration (https://github.com/JakeBecker/elixir-ls)
|
||||
|
||||
call ale#Set('elixir_elixir_ls_release', 'elixir-ls')
|
||||
call ale#Set('elixir_elixir_ls_config', {})
|
||||
|
||||
function! ale_linters#elixir#elixir_ls#GetExecutable(buffer) abort
|
||||
let l:dir = ale#path#Simplify(ale#Var(a:buffer, 'elixir_elixir_ls_release'))
|
||||
let l:cmd = has('win32') ? '\language_server.bat' : '/language_server.sh'
|
||||
|
||||
return l:dir . l:cmd
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('elixir', {
|
||||
\ 'name': 'elixir-ls',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': function('ale_linters#elixir#elixir_ls#GetExecutable'),
|
||||
\ 'command': function('ale_linters#elixir#elixir_ls#GetExecutable'),
|
||||
\ 'project_root': function('ale#handlers#elixir#FindMixUmbrellaRoot'),
|
||||
\ 'lsp_config': {b -> ale#Var(b, 'elixir_elixir_ls_config')},
|
||||
\})
|
45
sources_non_forked/ale/ale_linters/elixir/mix.vim
Normal file
45
sources_non_forked/ale/ale_linters/elixir/mix.vim
Normal file
|
@ -0,0 +1,45 @@
|
|||
" Author: evnu - https://github.com/evnu
|
||||
" Author: colbydehart - https://github.com/colbydehart
|
||||
" Description: Mix compile checking for Elixir files
|
||||
|
||||
function! ale_linters#elixir#mix#Handle(buffer, lines) abort
|
||||
" Matches patterns like the following:
|
||||
"
|
||||
" Error format
|
||||
" ** (CompileError) apps/sim/lib/sim/server.ex:87: undefined function update_in/4
|
||||
"
|
||||
" TODO: Warning format
|
||||
" warning: variable "foobar" does not exist and is being expanded to "foobar()", please use parentheses to remove the ambiguity or change the variable name
|
||||
let l:pattern = '\v\(([^\)]+Error)\) ([^:]+):([^:]+): (.+)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
let l:type = 'E'
|
||||
let l:text = l:match[4]
|
||||
|
||||
call add(l:output, {
|
||||
\ 'bufnr': a:buffer,
|
||||
\ 'lnum': l:match[3] + 0,
|
||||
\ 'col': 0,
|
||||
\ 'type': l:type,
|
||||
\ 'text': l:text,
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
function! ale_linters#elixir#mix#GetCommand(buffer) abort
|
||||
let l:temp_dir = ale#command#CreateDirectory(a:buffer)
|
||||
|
||||
return ale#Env('MIX_BUILD_PATH', l:temp_dir) . 'mix compile %s'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('elixir', {
|
||||
\ 'name': 'mix',
|
||||
\ 'executable': 'mix',
|
||||
\ 'cwd': function('ale#handlers#elixir#FindMixProjectRoot'),
|
||||
\ 'command': function('ale_linters#elixir#mix#GetCommand'),
|
||||
\ 'callback': 'ale_linters#elixir#mix#Handle',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
40
sources_non_forked/ale/ale_linters/elm/elm_ls.vim
Normal file
40
sources_non_forked/ale/ale_linters/elm/elm_ls.vim
Normal file
|
@ -0,0 +1,40 @@
|
|||
" Author: antew - https://github.com/antew
|
||||
" Description: elm-language-server integration for elm (diagnostics, formatting, and more)
|
||||
|
||||
call ale#Set('elm_ls_executable', 'elm-language-server')
|
||||
call ale#Set('elm_ls_use_global', get(g:, 'ale_use_global_executables', 1))
|
||||
|
||||
" elm-language-server will search for local and global binaries, if empty
|
||||
call ale#Set('elm_ls_elm_path', '')
|
||||
call ale#Set('elm_ls_elm_format_path', '')
|
||||
call ale#Set('elm_ls_elm_test_path', '')
|
||||
call ale#Set('elm_ls_elm_analyse_trigger', 'change')
|
||||
|
||||
function! elm_ls#GetRootDir(buffer) abort
|
||||
let l:elm_json = ale#path#FindNearestFile(a:buffer, 'elm.json')
|
||||
|
||||
return !empty(l:elm_json) ? fnamemodify(l:elm_json, ':p:h') : ''
|
||||
endfunction
|
||||
|
||||
function! elm_ls#GetOptions(buffer) abort
|
||||
return {
|
||||
\ 'elmPath': ale#Var(a:buffer, 'elm_ls_elm_path'),
|
||||
\ 'elmFormatPath': ale#Var(a:buffer, 'elm_ls_elm_format_path'),
|
||||
\ 'elmTestPath': ale#Var(a:buffer, 'elm_ls_elm_test_path'),
|
||||
\ 'elmAnalyseTrigger': ale#Var(a:buffer, 'elm_ls_elm_analyse_trigger'),
|
||||
\}
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('elm', {
|
||||
\ 'name': 'elm_ls',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': {b -> ale#path#FindExecutable(b, 'elm_ls', [
|
||||
\ 'node_modules/.bin/elm-language-server',
|
||||
\ 'node_modules/.bin/elm-lsp',
|
||||
\ 'elm-lsp'
|
||||
\ ])},
|
||||
\ 'command': '%e --stdio',
|
||||
\ 'project_root': function('elm_ls#GetRootDir'),
|
||||
\ 'language': 'elm',
|
||||
\ 'initialization_options': function('elm_ls#GetOptions')
|
||||
\})
|
242
sources_non_forked/ale/ale_linters/elm/make.vim
Normal file
242
sources_non_forked/ale/ale_linters/elm/make.vim
Normal file
|
@ -0,0 +1,242 @@
|
|||
" Author: buffalocoder - https://github.com/buffalocoder, soywod - https://github.com/soywod, hecrj - https://github.com/hecrj
|
||||
" Description: Elm linting in Ale. Closely follows the Syntastic checker in https://github.com/ElmCast/elm-vim.
|
||||
|
||||
call ale#Set('elm_make_executable', 'elm')
|
||||
call ale#Set('elm_make_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
|
||||
function! ale_linters#elm#make#Handle(buffer, lines) abort
|
||||
let l:output = []
|
||||
let l:unparsed_lines = []
|
||||
|
||||
for l:line in a:lines
|
||||
if l:line[0] is# '{'
|
||||
" Elm 0.19
|
||||
call ale_linters#elm#make#HandleElm019Line(l:line, l:output)
|
||||
elseif l:line[0] is# '['
|
||||
" Elm 0.18
|
||||
call ale_linters#elm#make#HandleElm018Line(l:line, l:output)
|
||||
elseif l:line isnot# 'Successfully generated /dev/null'
|
||||
call add(l:unparsed_lines, l:line)
|
||||
endif
|
||||
endfor
|
||||
|
||||
if len(l:unparsed_lines) > 0
|
||||
call add(l:output, {
|
||||
\ 'lnum': 1,
|
||||
\ 'type': 'E',
|
||||
\ 'text': l:unparsed_lines[0],
|
||||
\ 'detail': join(l:unparsed_lines, "\n")
|
||||
\})
|
||||
endif
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
function! ale_linters#elm#make#HandleElm019Line(line, output) abort
|
||||
let l:report = json_decode(a:line)
|
||||
|
||||
if l:report.type is? 'error'
|
||||
" General problem
|
||||
let l:details = ale_linters#elm#make#ParseMessage(l:report.message)
|
||||
|
||||
if empty(l:report.path)
|
||||
let l:report.path = 'Elm'
|
||||
endif
|
||||
|
||||
if ale_linters#elm#make#FileIsBuffer(l:report.path)
|
||||
call add(a:output, {
|
||||
\ 'lnum': 1,
|
||||
\ 'type': 'E',
|
||||
\ 'text': l:details,
|
||||
\})
|
||||
else
|
||||
call add(a:output, {
|
||||
\ 'lnum': 1,
|
||||
\ 'type': 'E',
|
||||
\ 'text': l:report.path .' - '. l:details,
|
||||
\ 'detail': l:report.path ." ----------\n\n". l:details,
|
||||
\})
|
||||
endif
|
||||
else
|
||||
" Compilation errors
|
||||
for l:error in l:report.errors
|
||||
let l:file_is_buffer = ale_linters#elm#make#FileIsBuffer(l:error.path)
|
||||
|
||||
for l:problem in l:error.problems
|
||||
let l:details = ale_linters#elm#make#ParseMessage(l:problem.message)
|
||||
|
||||
if l:file_is_buffer
|
||||
" Buffer module has problems
|
||||
call add(a:output, {
|
||||
\ 'lnum': l:problem.region.start.line,
|
||||
\ 'col': l:problem.region.start.column,
|
||||
\ 'end_lnum': l:problem.region.end.line,
|
||||
\ 'end_col': l:problem.region.end.column,
|
||||
\ 'type': 'E',
|
||||
\ 'text': l:details,
|
||||
\})
|
||||
else
|
||||
" Imported module has problems
|
||||
let l:location = l:error.path .':'. l:problem.region.start.line
|
||||
call add(a:output, {
|
||||
\ 'lnum': 1,
|
||||
\ 'type': 'E',
|
||||
\ 'text': l:location .' - '. l:details,
|
||||
\ 'detail': l:location ." ----------\n\n". l:details,
|
||||
\})
|
||||
endif
|
||||
endfor
|
||||
endfor
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! ale_linters#elm#make#HandleElm018Line(line, output) abort
|
||||
let l:errors = json_decode(a:line)
|
||||
|
||||
for l:error in l:errors
|
||||
let l:file_is_buffer = ale_linters#elm#make#FileIsBuffer(l:error.file)
|
||||
|
||||
if l:file_is_buffer
|
||||
" Current buffer has problems
|
||||
call add(a:output, {
|
||||
\ 'lnum': l:error.region.start.line,
|
||||
\ 'col': l:error.region.start.column,
|
||||
\ 'end_lnum': l:error.region.end.line,
|
||||
\ 'end_col': l:error.region.end.column,
|
||||
\ 'type': (l:error.type is? 'error') ? 'E' : 'W',
|
||||
\ 'text': l:error.overview,
|
||||
\ 'detail': l:error.overview . "\n\n" . l:error.details
|
||||
\})
|
||||
elseif l:error.type is? 'error'
|
||||
" Imported module has errors
|
||||
let l:location = l:error.file .':'. l:error.region.start.line
|
||||
|
||||
call add(a:output, {
|
||||
\ 'lnum': 1,
|
||||
\ 'type': 'E',
|
||||
\ 'text': l:location .' - '. l:error.overview,
|
||||
\ 'detail': l:location ." ----------\n\n". l:error.overview . "\n\n" . l:error.details
|
||||
\})
|
||||
endif
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
function! ale_linters#elm#make#FileIsBuffer(path) abort
|
||||
return ale#path#IsTempName(a:path)
|
||||
endfunction
|
||||
|
||||
function! ale_linters#elm#make#ParseMessage(message) abort
|
||||
return join(map(copy(a:message), 'ale_linters#elm#make#ParseMessageItem(v:val)'), '')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#elm#make#ParseMessageItem(item) abort
|
||||
if type(a:item) is v:t_string
|
||||
return a:item
|
||||
else
|
||||
return a:item.string
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! ale_linters#elm#make#GetPackageFile(buffer) abort
|
||||
let l:elm_json = ale#path#FindNearestFile(a:buffer, 'elm.json')
|
||||
|
||||
if empty(l:elm_json)
|
||||
" Fallback to Elm 0.18
|
||||
let l:elm_json = ale#path#FindNearestFile(a:buffer, 'elm-package.json')
|
||||
endif
|
||||
|
||||
return l:elm_json
|
||||
endfunction
|
||||
|
||||
function! ale_linters#elm#make#IsVersionGte19(buffer) abort
|
||||
let l:elm_json = ale_linters#elm#make#GetPackageFile(a:buffer)
|
||||
|
||||
if l:elm_json =~# '-package'
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! ale_linters#elm#make#GetRootDir(buffer) abort
|
||||
let l:elm_json = ale_linters#elm#make#GetPackageFile(a:buffer)
|
||||
|
||||
if empty(l:elm_json)
|
||||
return ''
|
||||
else
|
||||
return fnamemodify(l:elm_json, ':p:h')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! ale_linters#elm#make#IsTest(buffer) abort
|
||||
let l:root_dir = ale_linters#elm#make#GetRootDir(a:buffer)
|
||||
|
||||
if empty(l:root_dir)
|
||||
return 0
|
||||
endif
|
||||
|
||||
let l:tests_dir = join([l:root_dir, 'tests', ''], has('win32') ? '\' : '/')
|
||||
|
||||
let l:buffer_path = fnamemodify(bufname(a:buffer), ':p')
|
||||
|
||||
if stridx(l:buffer_path, l:tests_dir) == 0
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! ale_linters#elm#make#GetCwd(buffer) abort
|
||||
let l:root_dir = ale_linters#elm#make#GetRootDir(a:buffer)
|
||||
|
||||
return !empty(l:root_dir) ? l:root_dir : ''
|
||||
endfunction
|
||||
|
||||
" Return the command to execute the linter in the projects directory.
|
||||
" If it doesn't, then this will fail when imports are needed.
|
||||
function! ale_linters#elm#make#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#elm#make#GetExecutable(a:buffer)
|
||||
let l:is_v19 = ale_linters#elm#make#IsVersionGte19(a:buffer)
|
||||
let l:is_using_elm_test = l:executable =~# 'elm-test$'
|
||||
|
||||
" elm-test needs to know the path of elm-make if elm isn't installed globally.
|
||||
" https://github.com/rtfeldman/node-test-runner/blob/57728f10668f2d2ab3179e7e3208bcfa9a1f19aa/README.md#--compiler
|
||||
if l:is_v19 && l:is_using_elm_test
|
||||
let l:elm_make_executable = ale#path#FindExecutable(a:buffer, 'elm_make', ['node_modules/.bin/elm'])
|
||||
let l:elm_test_compiler_flag = ' --compiler ' . l:elm_make_executable . ' '
|
||||
else
|
||||
let l:elm_test_compiler_flag = ' '
|
||||
endif
|
||||
|
||||
" The elm compiler, at the time of this writing, uses '/dev/null' as
|
||||
" a sort of flag to tell the compiler not to generate an output file,
|
||||
" which is why this is hard coded here.
|
||||
" Source: https://github.com/elm-lang/elm-compiler/blob/19d5a769b30ec0b2fc4475985abb4cd94cd1d6c3/builder/src/Generate/Output.hs#L253
|
||||
return '%e make --report=json --output=/dev/null'
|
||||
\ . l:elm_test_compiler_flag
|
||||
\ . '%t'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#elm#make#GetExecutable(buffer) abort
|
||||
let l:is_test = ale_linters#elm#make#IsTest(a:buffer)
|
||||
let l:is_v19 = ale_linters#elm#make#IsVersionGte19(a:buffer)
|
||||
|
||||
if l:is_test && l:is_v19
|
||||
return ale#path#FindExecutable(
|
||||
\ a:buffer,
|
||||
\ 'elm_make',
|
||||
\ ['node_modules/.bin/elm-test', 'node_modules/.bin/elm']
|
||||
\)
|
||||
else
|
||||
return ale#path#FindExecutable(a:buffer, 'elm_make', ['node_modules/.bin/elm'])
|
||||
endif
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('elm', {
|
||||
\ 'name': 'make',
|
||||
\ 'executable': function('ale_linters#elm#make#GetExecutable'),
|
||||
\ 'output_stream': 'both',
|
||||
\ 'cwd': function('ale_linters#elm#make#GetCwd'),
|
||||
\ 'command': function('ale_linters#elm#make#GetCommand'),
|
||||
\ 'callback': 'ale_linters#elm#make#Handle'
|
||||
\})
|
97
sources_non_forked/ale/ale_linters/erlang/dialyzer.vim
Normal file
97
sources_non_forked/ale/ale_linters/erlang/dialyzer.vim
Normal file
|
@ -0,0 +1,97 @@
|
|||
" Author: Autoine Gagne - https://github.com/AntoineGagne
|
||||
" Description: Define a checker that runs dialyzer on Erlang files.
|
||||
|
||||
let g:ale_erlang_dialyzer_executable =
|
||||
\ get(g:, 'ale_erlang_dialyzer_executable', 'dialyzer')
|
||||
let g:ale_erlang_dialyzer_options =
|
||||
\ get(g:, 'ale_erlang_dialyzer_options', '-Wunmatched_returns'
|
||||
\ . ' -Werror_handling'
|
||||
\ . ' -Wrace_conditions'
|
||||
\ . ' -Wunderspecs')
|
||||
let g:ale_erlang_dialyzer_plt_file =
|
||||
\ get(g:, 'ale_erlang_dialyzer_plt_file', '')
|
||||
let g:ale_erlang_dialyzer_rebar3_profile =
|
||||
\ get(g:, 'ale_erlang_dialyzer_rebar3_profile', 'default')
|
||||
|
||||
function! ale_linters#erlang#dialyzer#GetRebar3Profile(buffer) abort
|
||||
return ale#Var(a:buffer, 'erlang_dialyzer_rebar3_profile')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#erlang#dialyzer#FindPlt(buffer) abort
|
||||
let l:plt_file = ''
|
||||
let l:rebar3_profile = ale_linters#erlang#dialyzer#GetRebar3Profile(a:buffer)
|
||||
let l:plt_file_directory = ale#path#FindNearestDirectory(a:buffer, '_build/' . l:rebar3_profile)
|
||||
|
||||
if !empty(l:plt_file_directory)
|
||||
let l:plt_file = globpath(l:plt_file_directory, '*_plt', 0, 1)
|
||||
endif
|
||||
|
||||
if !empty(l:plt_file)
|
||||
return l:plt_file[0]
|
||||
endif
|
||||
|
||||
if !empty($REBAR_PLT_DIR)
|
||||
return expand('$REBAR_PLT_DIR/dialyzer/plt')
|
||||
endif
|
||||
|
||||
return expand('$HOME/.dialyzer_plt')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#erlang#dialyzer#GetPlt(buffer) abort
|
||||
let l:plt_file = ale#Var(a:buffer, 'erlang_dialyzer_plt_file')
|
||||
|
||||
if !empty(l:plt_file)
|
||||
return l:plt_file
|
||||
endif
|
||||
|
||||
return ale_linters#erlang#dialyzer#FindPlt(a:buffer)
|
||||
endfunction
|
||||
|
||||
function! ale_linters#erlang#dialyzer#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'erlang_dialyzer_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#erlang#dialyzer#GetCommand(buffer) abort
|
||||
let l:options = ale#Var(a:buffer, 'erlang_dialyzer_options')
|
||||
|
||||
let l:command = ale#Escape(ale_linters#erlang#dialyzer#GetExecutable(a:buffer))
|
||||
\ . ' -n'
|
||||
\ . ' --plt ' . ale#Escape(ale_linters#erlang#dialyzer#GetPlt(a:buffer))
|
||||
\ . ' ' . l:options
|
||||
\ . ' %s'
|
||||
|
||||
return l:command
|
||||
endfunction
|
||||
|
||||
function! ale_linters#erlang#dialyzer#Handle(buffer, lines) abort
|
||||
" Match patterns like the following:
|
||||
"
|
||||
" erl_tidy_prv_fmt.erl:3: Callback info about the provider behaviour is not available
|
||||
let l:pattern = '^\S\+:\(\d\+\): \(.\+\)$'
|
||||
let l:output = []
|
||||
|
||||
for l:line in a:lines
|
||||
let l:match = matchlist(l:line, l:pattern)
|
||||
|
||||
if len(l:match) != 0
|
||||
let l:code = l:match[2]
|
||||
|
||||
call add(l:output, {
|
||||
\ 'lnum': str2nr(l:match[1]),
|
||||
\ 'lcol': 0,
|
||||
\ 'text': l:code,
|
||||
\ 'type': 'W'
|
||||
\})
|
||||
endif
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('erlang', {
|
||||
\ 'name': 'dialyzer',
|
||||
\ 'executable': function('ale_linters#erlang#dialyzer#GetExecutable'),
|
||||
\ 'command': function('ale_linters#erlang#dialyzer#GetCommand'),
|
||||
\ 'callback': function('ale_linters#erlang#dialyzer#Handle'),
|
||||
\ 'lint_file': 1
|
||||
\})
|
40
sources_non_forked/ale/ale_linters/erlang/elvis.vim
Normal file
40
sources_non_forked/ale/ale_linters/erlang/elvis.vim
Normal file
|
@ -0,0 +1,40 @@
|
|||
" Author: Dmitri Vereshchagin <dmitri.vereshchagin@gmail.com>
|
||||
" Description: Elvis linter for Erlang files
|
||||
|
||||
call ale#Set('erlang_elvis_executable', 'elvis')
|
||||
|
||||
function! ale_linters#erlang#elvis#Handle(buffer, lines) abort
|
||||
let l:pattern = '\v:(\d+):[^:]+:(.+)'
|
||||
let l:loclist = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:loclist, {
|
||||
\ 'lnum': str2nr(l:match[1]),
|
||||
\ 'text': s:AbbreviateMessage(l:match[2]),
|
||||
\ 'type': 'W',
|
||||
\ 'sub_type': 'style',
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:loclist
|
||||
endfunction
|
||||
|
||||
function! s:AbbreviateMessage(text) abort
|
||||
let l:pattern = '\v\c^(line \d+ is too long):.*$'
|
||||
|
||||
return substitute(a:text, l:pattern, '\1.', '')
|
||||
endfunction
|
||||
|
||||
function! s:GetCommand(buffer) abort
|
||||
let l:file = ale#Escape(expand('#' . a:buffer . ':.'))
|
||||
|
||||
return '%e rock --output-format=parsable ' . l:file
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('erlang', {
|
||||
\ 'name': 'elvis',
|
||||
\ 'callback': 'ale_linters#erlang#elvis#Handle',
|
||||
\ 'executable': {b -> ale#Var(b, 'erlang_elvis_executable')},
|
||||
\ 'command': function('s:GetCommand'),
|
||||
\ 'lint_file': 1,
|
||||
\})
|
49
sources_non_forked/ale/ale_linters/erlang/erlang_ls.vim
Normal file
49
sources_non_forked/ale/ale_linters/erlang/erlang_ls.vim
Normal file
|
@ -0,0 +1,49 @@
|
|||
" Author: Dmitri Vereshchagin <dmitri.vereshchagin@gmail.com>
|
||||
" Description: LSP linter for Erlang files
|
||||
|
||||
call ale#Set('erlang_erlang_ls_executable', 'erlang_ls')
|
||||
call ale#Set('erlang_erlang_ls_log_dir', '')
|
||||
call ale#Set('erlang_erlang_ls_log_level', 'info')
|
||||
|
||||
function! s:GetCommand(buffer) abort
|
||||
let l:log_dir = ale#Var(a:buffer, 'erlang_erlang_ls_log_dir')
|
||||
let l:log_level = ale#Var(a:buffer, 'erlang_erlang_ls_log_level')
|
||||
|
||||
let l:command = '%e'
|
||||
|
||||
if !empty(l:log_dir)
|
||||
let l:command .= ' --log-dir=' . ale#Escape(l:log_dir)
|
||||
endif
|
||||
|
||||
let l:command .= ' --log-level=' . ale#Escape(l:log_level)
|
||||
|
||||
return l:command
|
||||
endfunction
|
||||
|
||||
function! s:FindProjectRoot(buffer) abort
|
||||
let l:markers = ['_build/', 'erlang_ls.config', 'rebar.lock']
|
||||
|
||||
" This is a way to find Erlang/OTP root (the one that is managed
|
||||
" by kerl or asdf). Useful if :ALEGoToDefinition takes us there.
|
||||
let l:markers += ['.kerl_config']
|
||||
|
||||
for l:marker in l:markers
|
||||
let l:path = l:marker[-1:] is# '/'
|
||||
\ ? ale#path#FindNearestDirectory(a:buffer, l:marker)
|
||||
\ : ale#path#FindNearestFile(a:buffer, l:marker)
|
||||
|
||||
if !empty(l:path)
|
||||
return ale#path#Dirname(l:path)
|
||||
endif
|
||||
endfor
|
||||
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('erlang', {
|
||||
\ 'name': 'erlang_ls',
|
||||
\ 'executable': {b -> ale#Var(b, 'erlang_erlang_ls_executable')},
|
||||
\ 'command': function('s:GetCommand'),
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'project_root': function('s:FindProjectRoot'),
|
||||
\})
|
104
sources_non_forked/ale/ale_linters/erlang/erlc.vim
Normal file
104
sources_non_forked/ale/ale_linters/erlang/erlc.vim
Normal file
|
@ -0,0 +1,104 @@
|
|||
" Author: Magnus Ottenklinger - https://github.com/evnu
|
||||
|
||||
let g:ale_erlang_erlc_executable = get(g:, 'ale_erlang_erlc_executable', 'erlc')
|
||||
let g:ale_erlang_erlc_options = get(g:, 'ale_erlang_erlc_options', '')
|
||||
|
||||
function! ale_linters#erlang#erlc#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'erlang_erlc_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#erlang#erlc#GetCommand(buffer) abort
|
||||
let l:output_file = ale#util#Tempname()
|
||||
call ale#command#ManageFile(a:buffer, l:output_file)
|
||||
|
||||
let l:command = ale#Escape(ale_linters#erlang#erlc#GetExecutable(a:buffer))
|
||||
\ . ' -o ' . ale#Escape(l:output_file)
|
||||
\ . ' ' . ale#Var(a:buffer, 'erlang_erlc_options')
|
||||
\ . ' %t'
|
||||
|
||||
return l:command
|
||||
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+):(\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[4]
|
||||
let l:text = l:match[5]
|
||||
|
||||
" 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': function('ale_linters#erlang#erlc#GetExecutable'),
|
||||
\ 'command': function('ale_linters#erlang#erlc#GetCommand'),
|
||||
\ 'callback': 'ale_linters#erlang#erlc#Handle',
|
||||
\})
|
42
sources_non_forked/ale/ale_linters/erlang/syntaxerl.vim
Normal file
42
sources_non_forked/ale/ale_linters/erlang/syntaxerl.vim
Normal file
|
@ -0,0 +1,42 @@
|
|||
" Author: Dmitri Vereshchagin <dmitri.vereshchagin@gmail.com>
|
||||
" Description: SyntaxErl linter for Erlang files
|
||||
|
||||
call ale#Set('erlang_syntaxerl_executable', 'syntaxerl')
|
||||
|
||||
function! ale_linters#erlang#syntaxerl#RunHelpCommand(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'erlang_syntaxerl_executable')
|
||||
|
||||
return ale#command#Run(
|
||||
\ a:buffer,
|
||||
\ ale#Escape(l:executable) . ' -h',
|
||||
\ function('ale_linters#erlang#syntaxerl#GetCommand'),
|
||||
\)
|
||||
endfunction
|
||||
|
||||
function! ale_linters#erlang#syntaxerl#GetCommand(buffer, output, meta) abort
|
||||
let l:use_b_option = match(a:output, '\C\V-b, --base\>') > -1
|
||||
|
||||
return '%e' . (l:use_b_option ? ' -b %s %t' : ' %t')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#erlang#syntaxerl#Handle(buffer, lines) abort
|
||||
let l:pattern = '\v\C:(\d+):( warning:)? (.+)'
|
||||
let l:loclist = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:loclist, {
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'text': l:match[3],
|
||||
\ 'type': empty(l:match[2]) ? 'E' : 'W',
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:loclist
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('erlang', {
|
||||
\ 'name': 'syntaxerl',
|
||||
\ 'executable': {b -> ale#Var(b, 'erlang_syntaxerl_executable')},
|
||||
\ 'command': {b -> ale_linters#erlang#syntaxerl#RunHelpCommand(b)},
|
||||
\ 'callback': 'ale_linters#erlang#syntaxerl#Handle',
|
||||
\})
|
25
sources_non_forked/ale/ale_linters/eruby/erb.vim
Normal file
25
sources_non_forked/ale/ale_linters/eruby/erb.vim
Normal file
|
@ -0,0 +1,25 @@
|
|||
" Author: Matthias Guenther - https://wikimatze.de, Eddie Lebow https://github.com/elebow
|
||||
" Description: ERB from the Ruby standard library, for eruby/erb files
|
||||
|
||||
function! ale_linters#eruby#erb#GetCommand(buffer) abort
|
||||
let l:rails_root = ale#ruby#FindRailsRoot(a:buffer)
|
||||
|
||||
if empty(l:rails_root)
|
||||
return 'erb -P -T - -x %t | ruby -c'
|
||||
endif
|
||||
|
||||
" Rails-flavored eRuby does not comply with the standard as understood by
|
||||
" ERB, so we'll have to do some substitution. This does not reduce the
|
||||
" effectiveness of the linter—the translated code is still evaluated.
|
||||
return 'ruby -r erb -e ' . ale#Escape('puts ERB.new($stdin.read.gsub(%{<%=},%{<%}), nil, %{-}).src') . '< %t | ruby -c'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('eruby', {
|
||||
\ 'name': 'erb',
|
||||
\ 'aliases': ['erubylint'],
|
||||
\ 'executable': 'erb',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'command': function('ale_linters#eruby#erb#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#ruby#HandleSyntaxErrors',
|
||||
\})
|
||||
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue