mirror of
https://github.com/dense-analysis/ale.git
synced 2026-02-07 02:11:05 +08:00
Add linter for Inko
This adds a linter for Inko (https://inko-lang.org/). The linter makes use of Inko's own compiler, and a newly introduced --check flag to only check for errors; instead of also compiling source code.
This commit is contained in:
37
autoload/ale/handlers/inko.vim
Normal file
37
autoload/ale/handlers/inko.vim
Normal file
@@ -0,0 +1,37 @@
|
||||
" Author: Yorick Peterse <yorick@yorickpeterse.com>
|
||||
" Description: output handlers for the Inko JSON format
|
||||
|
||||
function! ale#handlers#inko#GetType(severity) abort
|
||||
if a:severity is? 'warning'
|
||||
return 'W'
|
||||
endif
|
||||
|
||||
return 'E'
|
||||
endfunction
|
||||
|
||||
function! ale#handlers#inko#Handle(buffer, lines) abort
|
||||
try
|
||||
let l:errors = json_decode(join(a:lines, ''))
|
||||
catch
|
||||
return []
|
||||
endtry
|
||||
|
||||
if empty(l:errors)
|
||||
return []
|
||||
endif
|
||||
|
||||
let l:output = []
|
||||
let l:dir = expand('#' . a:buffer . ':p:h')
|
||||
|
||||
for l:error in l:errors
|
||||
call add(l:output, {
|
||||
\ 'filename': ale#path#GetAbsPath(l:dir, l:error['file']),
|
||||
\ 'lnum': l:error['line'],
|
||||
\ 'col': l:error['column'],
|
||||
\ 'text': l:error['message'],
|
||||
\ 'type': ale#handlers#inko#GetType(l:error['level']),
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
@@ -43,6 +43,7 @@ let s:default_ale_linters = {
|
||||
\ 'go': ['gofmt', 'golint', 'go vet'],
|
||||
\ 'hack': ['hack'],
|
||||
\ 'help': [],
|
||||
\ 'inko': ['inko'],
|
||||
\ 'perl': ['perlcritic'],
|
||||
\ 'perl6': [],
|
||||
\ 'python': ['flake8', 'mypy', 'pylint', 'pyright'],
|
||||
|
||||
Reference in New Issue
Block a user