Created
May 18, 2024 12:12
-
-
Save softwaredoug/abc2404ada475d458a580fe62a22b4a3 to your computer and use it in GitHub Desktop.
Revisions
-
softwaredoug created this gist
May 18, 2024 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,42 @@ " cython-lint ALE linter (assumes you have cython lint installedhttps://github.com/MarcoGorelli/cython-lint) " " Usage, place under ale_linters/pyrex/cython-lint.vim " Configure the following in your vim config (e.g. .vimrc) " " let g:ale_linters = { " \ 'pyrex': ['cython-lint', 'cython'], " \} " let g:ale_cython_cython_lint_executable = 'cython-lint' call ale#Set('pyrex_cython_executable', 'cython-lint') function! ALE_cython_lint_handle(buffer, lines) abort " Regex from flake8 let l:pattern = '\v^[a-zA-Z]?:?[^:]+:(\d+):?(\d+)?: ([[:alnum:]]+):? (.*)$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { \ 'lnum': l:match[1] + 0, \ 'col': l:match[2] + 0, \ 'text': l:match[4], \ 'type': 'W', \}) endfor return l:output endfunction function! s:build_cython_lint_command(buffer) abort let l:executable = ale#Var(a:buffer, 'pyrex_cython_lint_executable') return l:executable . ' %t 2>&1' endfunction call ale#linter#Define('pyrex', { \ 'name': 'cython-lint', \ 'output_stream': 'stdout', \ 'executable': {b -> ale#Var(b, 'pyrex_cython_lint_executable')}, \ 'command': function('s:build_cython_lint_command'), \ 'callback': 'ALE_cython_lint_handle', \})