mirror of
https://github.com/dense-analysis/ale.git
synced 2026-10-25 07:07:21 +08:00
CI / Build (push) Canceled after 0s
CI / Lint (push) Canceled after 0s
CI / Lua (push) Canceled after 0s
CI / Neovim 0.10 Linux (push) Canceled after 0s
CI / Neovim 0.12 Linux (push) Canceled after 0s
CI / Vim 8.2 Linux (push) Canceled after 0s
CI / Vim 9.2 Linux (push) Canceled after 0s
CI / Neovim 0.10 Windows (push) Canceled after 0s
CI / Neovim 0.12 Windows (push) Canceled after 0s
CI / Vim 8.2 Windows (push) Canceled after 0s
CI / Vim 9.2 Windows (push) Canceled after 0s
* fix: linter fortitude: renamed location key from "row" to "line" * fortitude try line first then row * fortitude add tests with row
52 lines
1.6 KiB
VimL
52 lines
1.6 KiB
VimL
" Author: gomfol12
|
|
" Desciption: A linter for fortran using fortitude.
|
|
|
|
call ale#Set('fortran_fortitude_executable', 'fortitude')
|
|
call ale#Set('fortran_fortitude_options', '')
|
|
|
|
let s:severity_map = {
|
|
\ 'E': 'E',
|
|
\ 'C': 'W',
|
|
\ 'OB': 'I',
|
|
\ 'MOD': 'I',
|
|
\ 'S': 'I',
|
|
\ 'PORT': 'I',
|
|
\ 'FORT': 'I',
|
|
\}
|
|
|
|
function! ale_linters#fortran#fortitude#Handle(buffer, lines) abort
|
|
let l:output = []
|
|
|
|
for l:error in ale#util#FuzzyJSONDecode(a:lines, [])
|
|
let l:prefix = matchstr(l:error['code'], '^\a\+')
|
|
let l:type = get(s:severity_map, l:prefix, 'I')
|
|
|
|
" Fortitude renamed `row` to `line` (PlasmaFAIR/fortitude@0eda11975096517b16bf30bf683011f83a24e55e)
|
|
let l:line = get(l:error['location'], 'line', get(l:error['location'], 'row'))
|
|
let l:end_line = get(l:error['end_location'], 'line', get(l:error['end_location'], 'row'))
|
|
|
|
call add(l:output, {
|
|
\ 'lnum': l:line,
|
|
\ 'end_lnum': l:end_line,
|
|
\ 'col': l:error['location']['column'],
|
|
\ 'end_col': l:error['end_location']['column'],
|
|
\ 'text': l:error['message'],
|
|
\ 'type': l:type,
|
|
\ 'code': l:error['code'],
|
|
\})
|
|
endfor
|
|
|
|
return l:output
|
|
endfunction
|
|
|
|
call ale#linter#Define('fortran', {
|
|
\ 'name': 'fortitude',
|
|
\ 'output_stream': 'stdout',
|
|
\ 'executable': {b -> ale#Var(b, 'fortran_fortitude_executable')},
|
|
\ 'command': {b ->
|
|
\ '%e' . ' check --output-format json' . ale#Pad(ale#Var(b, 'fortran_fortitude_options')) . ' %s'
|
|
\ },
|
|
\ 'callback': 'ale_linters#fortran#fortitude#Handle',
|
|
\ 'lint_file': 1,
|
|
\})
|