]> git.madduck.net Git - etc/vim.git/blob - ale_linters/scss/scsslint.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:

Squashed '.vim/bundle/ale/' content from commit 22185c4c
[etc/vim.git] / ale_linters / scss / scsslint.vim
1 " Author: w0rp <devw0rp@gmail.com>
2 " Description: This file add scsslint support for SCSS support
3
4 function! ale_linters#scss#scsslint#Handle(buffer, lines) abort
5     " Matches patterns like the following:
6     "
7     " test.scss:2:1 [W] Indentation: Line should be indented 2 spaces, but was indented 4 spaces
8     let l:pattern = '^.*:\(\d\+\):\(\d*\) \[\([^\]]\+\)\] \(.\+\)$'
9     let l:output = []
10
11     for l:match in ale#util#GetMatches(a:lines, l:pattern)
12         if !ale#Var(a:buffer, 'warn_about_trailing_whitespace')
13         \&& l:match[4] =~# '^TrailingWhitespace'
14             " Skip trailing whitespace warnings if that option is off.
15             continue
16         endif
17
18         call add(l:output, {
19         \   'lnum': l:match[1] + 0,
20         \   'col': l:match[2] + 0,
21         \   'text': l:match[4],
22         \   'type': l:match[3] is# 'E' ? 'E' : 'W',
23         \})
24     endfor
25
26     return l:output
27 endfunction
28
29 call ale#linter#Define('scss', {
30 \   'name': 'scsslint',
31 \   'executable': 'scss-lint',
32 \   'command': 'scss-lint --stdin-file-path=%s',
33 \   'callback': 'ale_linters#scss#scsslint#Handle',
34 \})