mirror of
https://github.com/dense-analysis/ale.git
synced 2026-10-24 22:57:21 +08:00
fix: linter fortitude: renamed location key from "row" to "line" (#5161)
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
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
This commit is contained in:
1 parent
e1789bc544
commit
ca4a4dd33c
2 files changed
+60
-2
No files matched your search
@@ -21,9 +21,13 @@ function! ale_linters#fortran#fortitude#Handle(buffer, lines) abort
|
||||
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:error['location']['row'],
|
||||
\ 'end_lnum': l:error['end_location']['row'],
|
||||
\ 'lnum': l:line,
|
||||
\ 'end_lnum': l:end_line,
|
||||
\ 'col': l:error['location']['column'],
|
||||
\ 'end_col': l:error['end_location']['column'],
|
||||
\ 'text': l:error['message'],
|
||||
|
||||
@@ -5,6 +5,60 @@ After:
|
||||
call ale#linter#Reset()
|
||||
|
||||
Execute(Simple fortitude handler run):
|
||||
AssertEqual
|
||||
\ [
|
||||
\ {
|
||||
\ 'lnum': 3,
|
||||
\ 'end_lnum': 3,
|
||||
\ 'col': 5,
|
||||
\ 'end_col': 18,
|
||||
\ 'text': '''implicit none'' missing ''external''',
|
||||
\ 'type': 'W',
|
||||
\ 'code': 'C003',
|
||||
\ },
|
||||
\ {
|
||||
\ 'col': 13,
|
||||
\ 'end_col': 14,
|
||||
\ 'end_lnum': 7,
|
||||
\ 'lnum': 7,
|
||||
\ 'text': 'Syntax error',
|
||||
\ 'type': 'E',
|
||||
\ 'code': 'E001',
|
||||
\ },
|
||||
\ ],
|
||||
\ ale_linters#fortran#fortitude#Handle(bufnr(''), [
|
||||
\ '[',
|
||||
\ json_encode({
|
||||
\ 'code': 'C003',
|
||||
\ 'end_location': {'column': 18, 'line': 3},
|
||||
\ 'filename': '/home/user/documents/somefortranfile.f90',
|
||||
\ 'fix': {
|
||||
\ 'applicability': 'unsafe',
|
||||
\ 'edits': [
|
||||
\ {
|
||||
\ 'content': ' (type, external)',
|
||||
\ 'end_location': {'column': 18, 'line': 3},
|
||||
\ 'location': {'column': 18, 'line': 3},
|
||||
\ },
|
||||
\ ],
|
||||
\ 'message': 'Add `(external)` to ''implicit none''',
|
||||
\ },
|
||||
\ 'location': {'column': 5, 'line': 3},
|
||||
\ 'message': '''implicit none'' missing ''external'''
|
||||
\ }),
|
||||
\ ',',
|
||||
\ json_encode({
|
||||
\ 'code': 'E001',
|
||||
\ 'end_location': {'column': 14, 'line': 7},
|
||||
\ 'filename': '/home/user/documents/somefortranfile.f90',
|
||||
\ 'fix': v:null,
|
||||
\ 'location': {'column': 13, 'line': 7},
|
||||
\ 'message': 'Syntax error',
|
||||
\ }),
|
||||
\ ']',
|
||||
\ ])
|
||||
|
||||
Execute(Old fortitude handler output with row):
|
||||
AssertEqual
|
||||
\ [
|
||||
\ {
|
||||
|
||||
Reference in new issue
Block a user