diff options
author | Ryan <RyanSquared@users.noreply.github.com> | 2017-06-14 03:35:11 -0500 |
---|---|---|
committer | w0rp <w0rp@users.noreply.github.com> | 2017-06-14 09:35:11 +0100 |
commit | e8cc40b13985e17320437debca0426a1129e0f54 (patch) | |
tree | 8905fe359bfd7185af55e56aded9e4c65a2da200 /ale_linters/fuse | |
parent | ba83c476cde8bceef33bf959fa6d9d3334f5d2fc (diff) | |
download | ale-e8cc40b13985e17320437debca0426a1129e0f54.zip |
Add fusion-lint, documentation, and tests (#648)
* Add `fusion-lint` for first FusionScript linter
* Add documentation over `fusion-lint`
* Add tests for `fusion-lint` command callback
Diffstat (limited to 'ale_linters/fuse')
-rw-r--r-- | ale_linters/fuse/fusionlint.vim | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/ale_linters/fuse/fusionlint.vim b/ale_linters/fuse/fusionlint.vim new file mode 100644 index 00000000..968e801b --- /dev/null +++ b/ale_linters/fuse/fusionlint.vim @@ -0,0 +1,41 @@ +" Author: RyanSquared <vandor2012@gmail.com> +" Description: `fusion-lint` linter for FusionScript files + +let g:ale_fuse_fusionlint_executable = +\ get(g:, 'ale_fuse_fusionlint_executable', 'fusion-lint') + +let g:ale_fuse_fusionlint_options = +\ get(g:, 'ale_fuse_fusionlint_options', '') + +function! ale_linters#fuse#fusionlint#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'fuse_fusionlint_executable') +endfunction + +function! ale_linters#fuse#fusionlint#GetCommand(buffer) abort + return ale#Escape(ale_linters#fuse#fusionlint#GetExecutable(a:buffer)) + \ . ' ' . ale#Var(a:buffer, 'fuse_fusionlint_options') + \ . ' --filename %s -i' +endfunction + +function! ale_linters#fuse#fusionlint#Handle(buffer, lines) abort + let l:pattern = '^.*:\(\d\+\):\(\d\+\): (\([WE]\)\d\+) \(.\+\)$' + let l:output = [] + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + call add(l:output, { + \ 'lnum': l:match[1] + 0, + \ 'col': l:match[2] + 0, + \ 'text': l:match[4], + \ 'type': l:match[3], + \}) + endfor + + return l:output +endfunction + +call ale#linter#Define('fuse', { +\ 'name': 'fusionlint', +\ 'executable_callback': 'ale_linters#fuse#fusionlint#GetExecutable', +\ 'command_callback': 'ale_linters#fuse#fusionlint#GetCommand', +\ 'callback': 'ale_linters#fuse#fusionlint#Handle', +\}) |