summaryrefslogtreecommitdiff
path: root/ale_linters/systemd
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2021-03-14 23:34:38 +0000
committerw0rp <devw0rp@gmail.com>2021-03-14 23:34:38 +0000
commitf43e4abc8872a10519309d78f44ad2fc276ad596 (patch)
treeaf7d8f7b161ded500fc3698d02ea97d5b49d3793 /ale_linters/systemd
parentb45ee8ec6c760089c68fb28a5436ec8275ca5381 (diff)
downloadale-f43e4abc8872a10519309d78f44ad2fc276ad596.zip
Check user systemd unit files with systemd-analyze
Diffstat (limited to 'ale_linters/systemd')
-rw-r--r--ale_linters/systemd/systemd_analyze.vim25
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,
+\})