Skip to content

Instantly share code, notes, and snippets.

@oalders
Created September 9, 2022 22:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oalders/179d60173ff178d199f06711729d73e7 to your computer and use it in GitHub Desktop.
Save oalders/179d60173ff178d199f06711729d73e7 to your computer and use it in GitHub Desktop.
perlimports ALE config
" Author: Olaf Alders <https://github.com/oalders>
" Description: This file adds support for perlimports
call ale#Set('perl_perlimports_executable', 'perlimports')
function! ale_linters#perl#perlimports#Handle(buffer, lines) abort
let l:pattern = '\(.\+\) at \(.\+\) line \(\d\+\)'
let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:pattern)
call add(l:output, {
\ 'lnum': l:match[3],
\ 'text': l:match[1],
\})
endfor
return l:output
endfunction
call ale#linter#Define('perl', {
\ 'name': 'perlimports',
\ 'output_stream': 'stderr',
\ 'executable': {b -> ale#Var(b, 'perl_perlimports_executable')},
\ 'command': 'perlimports --lint --read-stdin --filename %s',
\ 'callback': 'ale_linters#perl#perlimports#Handle',
\})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment