mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-06 12:44:23 +08:00
fix(golangci-lint): incorrect filename concat preventing errors from being displayed (#4926)
Some checks failed
CI / build_image (push) Has been cancelled
CI / test_ale (--linters-only) (push) Has been cancelled
CI / test_ale (--neovim-07-only) (push) Has been cancelled
CI / test_ale (--neovim-08-only) (push) Has been cancelled
CI / test_ale (--vim-80-only) (push) Has been cancelled
CI / test_ale (--vim-90-only) (push) Has been cancelled
Some checks failed
CI / build_image (push) Has been cancelled
CI / test_ale (--linters-only) (push) Has been cancelled
CI / test_ale (--neovim-07-only) (push) Has been cancelled
CI / test_ale (--neovim-08-only) (push) Has been cancelled
CI / test_ale (--vim-80-only) (push) Has been cancelled
CI / test_ale (--vim-90-only) (push) Has been cancelled
Signed-off-by: k4yt3x <i@k4yt3x.com>
This commit is contained in:
@@ -45,7 +45,7 @@ function! ale_linters#go#golangci_lint#Handler(buffer, lines) abort
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
call add(l:output, {
|
call add(l:output, {
|
||||||
\ 'filename': ale#path#GetAbsPath(l:dir, l:match['Pos']['Filename']),
|
\ 'filename': ale#path#GetAbsPath(l:dir, fnamemodify(l:match['Pos']['Filename'], ':t')),
|
||||||
\ 'lnum': l:match['Pos']['Line'] + 0,
|
\ 'lnum': l:match['Pos']['Line'] + 0,
|
||||||
\ 'col': l:match['Pos']['Column'] + 0,
|
\ 'col': l:match['Pos']['Column'] + 0,
|
||||||
\ 'type': l:msg_type,
|
\ 'type': l:msg_type,
|
||||||
|
|||||||
@@ -108,3 +108,39 @@ Execute (The golangci-lint handler should handle only typecheck lines as errors)
|
|||||||
\ ' ]',
|
\ ' ]',
|
||||||
\ '}',
|
\ '}',
|
||||||
\ ])
|
\ ])
|
||||||
|
|
||||||
|
Execute (The golangci-lint handler should set proper filename):
|
||||||
|
call ale#test#SetFilename('app/cmd/server/main.go')
|
||||||
|
|
||||||
|
AssertEqual
|
||||||
|
\ [
|
||||||
|
\ {
|
||||||
|
\ 'lnum': 198,
|
||||||
|
\ 'col': 19,
|
||||||
|
\ 'text': 'funlen - Function getConfig has too many statements (51 > 50)',
|
||||||
|
\ 'type': 'W',
|
||||||
|
\ 'filename': ale#path#Simplify(expand('%:p:h') . '/main.go'),
|
||||||
|
\ },
|
||||||
|
\ ],
|
||||||
|
\ ale_linters#go#golangci_lint#Handler(bufnr(''), [
|
||||||
|
\ '{',
|
||||||
|
\ ' "Issues": [',
|
||||||
|
\ ' {',
|
||||||
|
\ ' "FromLinter": "funlen",',
|
||||||
|
\ ' "Text": "Function getConfig has too many statements (51 > 50)",',
|
||||||
|
\ ' "Severity": "",',
|
||||||
|
\ ' "SourceLines": [',
|
||||||
|
\ ' "package main"',
|
||||||
|
\ ' ],',
|
||||||
|
\ ' "Pos": {',
|
||||||
|
\ ' "Filename": "cmd/server/main.go",',
|
||||||
|
\ ' "Offset": 5374,',
|
||||||
|
\ ' "Line": 198,',
|
||||||
|
\ ' "Column": 19',
|
||||||
|
\ ' },',
|
||||||
|
\ ' "ExpectNoLint": false,',
|
||||||
|
\ ' "ExpectedNoLintLinter": ""',
|
||||||
|
\ ' }',
|
||||||
|
\ ' ]',
|
||||||
|
\ '}',
|
||||||
|
\ ])
|
||||||
|
|||||||
Reference in New Issue
Block a user