summaryrefslogtreecommitdiff
path: root/ale_linters
diff options
context:
space:
mode:
authorUtkarsh Verma <utkarshverma@protonmail.com>2021-11-15 16:11:03 +0530
committerGitHub <noreply@github.com>2021-11-15 19:41:03 +0900
commit1e0e76bf9619a3ce21663165283f9971556c95b3 (patch)
treef54e5099ef6b248502a039e07d840348c3a9a05a /ale_linters
parent76c2293e68a6cad3b192062743d25b8daa082205 (diff)
downloadale-1e0e76bf9619a3ce21663165283f9971556c95b3.zip
Add support for AVRA linting (#3950)
* Add support for AVRA linting * Add tests for AVRA linting and improve code * Fix test * Fix warning detection * Fix test * Fix test * Add AVRA as a supported language in docs
Diffstat (limited to 'ale_linters')
-rw-r--r--ale_linters/avra/avra.vim36
1 files changed, 36 insertions, 0 deletions
diff --git a/ale_linters/avra/avra.vim b/ale_linters/avra/avra.vim
new file mode 100644
index 00000000..edf15c09
--- /dev/null
+++ b/ale_linters/avra/avra.vim
@@ -0,0 +1,36 @@
+" Author: Utkarsh Verma <utkarshverma@protonmail.com>
+" Description: AVRA linter for avra syntax.
+
+call ale#Set('avra_avra_executable', 'avra')
+call ale#Set('avra_avra_options', '')
+
+function! ale_linters#avra#avra#GetCommand(buffer) abort
+ return '%e'
+ \ . ' %t'
+ \ . ale#Pad(ale#Var(a:buffer, 'avra_avra_options'))
+ \ . ' -o ' . g:ale#util#nul_file
+endfunction
+
+function! ale_linters#avra#avra#Handle(buffer, lines) abort
+ " Note that we treat 'fatal' as errors.
+ let l:pattern = '^\S\+(\(\d\+\))\s\+:\s\+\(\S\+\)\s\+:\s\+\(.\+\)$'
+ let l:output = []
+
+ for l:match in ale#util#GetMatches(a:lines, l:pattern)
+ call add(l:output, {
+ \ 'lnum': l:match[1] + 0,
+ \ 'type': l:match[2] =~? 'Error' ? 'E' : 'W',
+ \ 'text': l:match[3],
+ \})
+ endfor
+
+ return l:output
+endfunction
+
+call ale#linter#Define('avra', {
+\ 'name': 'avra',
+\ 'output_stream': 'stderr',
+\ 'executable': {b -> ale#Var(b, 'avra_avra_executable')},
+\ 'command': function('ale_linters#avra#avra#GetCommand'),
+\ 'callback': 'ale_linters#avra#avra#Handle',
+\})