diff options
author | w0rp <devw0rp@gmail.com> | 2021-03-14 23:34:38 +0000 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2021-03-14 23:34:38 +0000 |
commit | f43e4abc8872a10519309d78f44ad2fc276ad596 (patch) | |
tree | af7d8f7b161ded500fc3698d02ea97d5b49d3793 /ale_linters/systemd | |
parent | b45ee8ec6c760089c68fb28a5436ec8275ca5381 (diff) | |
download | ale-f43e4abc8872a10519309d78f44ad2fc276ad596.zip |
Check user systemd unit files with systemd-analyze
Diffstat (limited to 'ale_linters/systemd')
-rw-r--r-- | ale_linters/systemd/systemd_analyze.vim | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/ale_linters/systemd/systemd_analyze.vim b/ale_linters/systemd/systemd_analyze.vim new file mode 100644 index 00000000..7e8bba2f --- /dev/null +++ b/ale_linters/systemd/systemd_analyze.vim @@ -0,0 +1,25 @@ +function! ale_linters#systemd#systemd_analyze#Handle(buffer, lines) abort + let l:re = '\v(.+):([0-9]+): (.+)' + let l:output = [] + + for l:match in ale#util#GetMatches(a:lines, l:re) + call add(l:output, { + \ 'lnum': str2nr(l:match[2]), + \ 'col': 1, + \ 'type': 'W', + \ 'text': l:match[3], + \}) + endfor + + return l:output +endfunction + +call ale#linter#Define('systemd', { +\ 'name': 'systemd_analyze', +\ 'aliases': ['systemd-analyze'], +\ 'executable': 'systemd-analyze', +\ 'command': 'SYSTEMD_LOG_COLOR=0 %e --user verify %s', +\ 'callback': 'ale_linters#systemd#systemd_analyze#Handle', +\ 'output_stream': 'both', +\ 'lint_file': 1, +\}) |