summaryrefslogtreecommitdiff
path: root/ale_linters
diff options
context:
space:
mode:
authorw0rp <w0rp@users.noreply.github.com>2018-01-02 13:32:59 +0000
committerGitHub <noreply@github.com>2018-01-02 13:32:59 +0000
commit80342b119aa1e8fda62ca24cc0000ae3e9709dd1 (patch)
treea15d9b3673b36e4007872c2633a73b29bec19cc0 /ale_linters
parentd9a3722e060a52d92e5a95fa3a10c1b51ef6b5b4 (diff)
parent3b0c67e42c4bffbe90edb98a181497a9791d9de4 (diff)
downloadale-80342b119aa1e8fda62ca24cc0000ae3e9709dd1.zip
Merge pull request #1252 from nthapaliya/fish-shell-linter
Fish shell linter
Diffstat (limited to 'ale_linters')
-rw-r--r--ale_linters/fish/fish.vim36
1 files changed, 36 insertions, 0 deletions
diff --git a/ale_linters/fish/fish.vim b/ale_linters/fish/fish.vim
new file mode 100644
index 00000000..19158cb0
--- /dev/null
+++ b/ale_linters/fish/fish.vim
@@ -0,0 +1,36 @@
+" Author: Niraj Thapaliya - https://github.com/nthapaliya
+" Description: Lints fish files using fish -n
+
+function! ale_linters#fish#fish#Handle(buffer, lines) abort
+ " Matches patterns such as:
+ "
+ " home/.config/fish/functions/foo.fish (line 1): Missing end to balance this function definition
+ " function foo
+ " ^
+ " <W> fish: Error while reading file .config/fish/functions/foo.fish
+ let l:pattern = '^.* (line \(\d\+\)): \(.*\)$'
+ let l:output = []
+
+ let l:i = 0
+ while l:i < len(a:lines)
+ let l:match = matchlist(a:lines[l:i], l:pattern)
+ if len(l:match) && len(l:match[2])
+ call add(l:output, {
+ \ 'col': len(a:lines[l:i + 2]),
+ \ 'lnum': str2nr(l:match[1]),
+ \ 'text': l:match[2],
+ \})
+ endif
+ let l:i += 1
+ endwhile
+
+ return l:output
+endfunction
+
+call ale#linter#Define('fish', {
+\ 'name': 'fish',
+\ 'output_stream': 'stderr',
+\ 'executable': 'fish',
+\ 'command': 'fish -n %t',
+\ 'callback': 'ale_linters#fish#fish#Handle',
+\})