]> git.madduck.net Git - etc/vim.git/blob - .vim/bundle/ale/ale_linters/pyrex/cython.vim

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Do not set EDITOR/VISUAL for shell
[etc/vim.git] / .vim / bundle / ale / ale_linters / pyrex / cython.vim
1 " Author: w0rp <devw0rp@gmail.com>,
2 " Nicolas Pauss <https://github.com/nicopauss>
3 " Description: cython syntax checking for cython files.
4
5 call ale#Set('pyrex_cython_executable', 'cython')
6 call ale#Set('pyrex_cython_options', '--warning-extra')
7
8 function! ale_linters#pyrex#cython#GetCommand(buffer) abort
9     return '%e --working %s:h --include-dir %s:h'
10     \   . ale#Pad(ale#Var(a:buffer, 'pyrex_cython_options'))
11     \   . ' --output-file ' . g:ale#util#nul_file . ' %t'
12 endfunction
13
14 function! ale_linters#pyrex#cython#Handle(buffer, lines) abort
15     let l:pattern = '\v^(\w+: )?[^:]+:(\d+):?(\d+)?:? ?(.+)$'
16     let l:output = []
17
18     for l:match in ale#util#GetMatches(a:lines, l:pattern)
19         call add(l:output, {
20         \   'lnum': l:match[2] + 0,
21         \   'col': l:match[3] + 0,
22         \   'text': l:match[4],
23         \   'type': l:match[1][0] is# 'w' ? 'W' : 'E',
24         \})
25     endfor
26
27     return l:output
28 endfunction
29
30 call ale#linter#Define('pyrex', {
31 \   'name': 'cython',
32 \   'output_stream': 'stderr',
33 \   'executable': {b -> ale#Var(b, 'pyrex_cython_executable')},
34 \   'command': function('ale_linters#pyrex#cython#GetCommand'),
35 \   'callback': 'ale_linters#pyrex#cython#Handle',
36 \})