summaryrefslogtreecommitdiff
path: root/ale_linters/terraform
diff options
context:
space:
mode:
authorHoracio Sanson <hsanson@gmail.com>2021-03-04 20:45:33 +0900
committerGitHub <noreply@github.com>2021-03-04 20:45:33 +0900
commit8c5081f6316183c97298ec4a819fd94c2a2a9516 (patch)
treeb9cdeb0f2b68ce5d8ee8ae01e3892faba272883c /ale_linters/terraform
parent826878c41e546a93919aba08e5a134433222b3a5 (diff)
downloadale-8c5081f6316183c97298ec4a819fd94c2a2a9516.zip
Fix 3605 - set fallback for error detail (#3606)
* Fix 3605 - set fallback for error detail * Add use case with no detail key Co-authored-by: Horacio Sanson <horacio@allm.inc>
Diffstat (limited to 'ale_linters/terraform')
-rw-r--r--ale_linters/terraform/terraform.vim8
1 files changed, 6 insertions, 2 deletions
diff --git a/ale_linters/terraform/terraform.vim b/ale_linters/terraform/terraform.vim
index 623fc2fd..cf134460 100644
--- a/ale_linters/terraform/terraform.vim
+++ b/ale_linters/terraform/terraform.vim
@@ -20,6 +20,10 @@ function! ale_linters#terraform#terraform#GetType(severity) abort
return 'E'
endfunction
+function! ale_linters#terraform#terraform#GetDetail(error) abort
+ return get(a:error, 'detail', get(a:error, 'summary', ''))
+endfunction
+
function! ale_linters#terraform#terraform#Handle(buffer, lines) abort
let l:output = []
@@ -33,7 +37,7 @@ function! ale_linters#terraform#terraform#Handle(buffer, lines) abort
\ 'filename': ale#path#GetAbsPath(l:dir, l:error['range']['filename']),
\ 'lnum': l:error['range']['start']['line'],
\ 'col': l:error['range']['start']['column'],
- \ 'text': l:error['detail'],
+ \ 'text': ale_linters#terraform#terraform#GetDetail(l:error),
\ 'type': ale_linters#terraform#terraform#GetType(l:error['severity']),
\})
else
@@ -41,7 +45,7 @@ function! ale_linters#terraform#terraform#Handle(buffer, lines) abort
\ 'filename': l:file,
\ 'lnum': 0,
\ 'col': 0,
- \ 'text': l:error['detail'],
+ \ 'text': ale_linters#terraform#terraform#GetDetail(l:error),
\ 'type': ale_linters#terraform#terraform#GetType(l:error['severity']),
\})
endif