Some checks failed
Detach Plugins / check (FlyGrep.vim) (push) Has been cancelled
Detach Plugins / check (GitHub.vim) (push) Has been cancelled
Detach Plugins / check (JavaUnit.vim) (push) Has been cancelled
Detach Plugins / check (SourceCounter.vim) (push) Has been cancelled
Detach Plugins / check (cpicker.nvim) (push) Has been cancelled
Detach Plugins / check (dein-ui.vim) (push) Has been cancelled
Detach Plugins / check (git.vim) (push) Has been cancelled
Detach Plugins / check (iedit.vim) (push) Has been cancelled
Detach Plugins / check (scrollbar.vim) (push) Has been cancelled
Detach Plugins / check (vim-chat) (push) Has been cancelled
Detach Plugins / check (vim-cheat) (push) Has been cancelled
Detach Plugins / check (vim-todo) (push) Has been cancelled
Detach Plugins / check (xmake.vim) (push) Has been cancelled
test / Linux (nvim, nightly) (push) Has been cancelled
test / Linux (nvim, v0.3.8) (push) Has been cancelled
test / Linux (nvim, v0.4.0) (push) Has been cancelled
test / Linux (nvim, v0.4.2) (push) Has been cancelled
test / Linux (nvim, v0.4.3) (push) Has been cancelled
test / Linux (nvim, v0.4.4) (push) Has been cancelled
test / Linux (nvim, v0.5.0) (push) Has been cancelled
test / Linux (nvim, v0.5.1) (push) Has been cancelled
test / Linux (nvim, v0.6.0) (push) Has been cancelled
test / Linux (nvim, v0.6.1) (push) Has been cancelled
test / Linux (nvim, v0.7.0) (push) Has been cancelled
test / Linux (nvim, v0.7.2) (push) Has been cancelled
test / Linux (nvim, v0.8.0) (push) Has been cancelled
test / Linux (nvim, v0.8.1) (push) Has been cancelled
test / Linux (nvim, v0.8.2) (push) Has been cancelled
test / Linux (nvim, v0.8.3) (push) Has been cancelled
test / Linux (nvim, v0.9.0) (push) Has been cancelled
test / Linux (nvim, v0.9.1) (push) Has been cancelled
test / Linux (true, vim, v7.4.052) (push) Has been cancelled
test / Linux (true, vim, v7.4.1689) (push) Has been cancelled
test / Linux (true, vim, v7.4.629) (push) Has been cancelled
test / Linux (true, vim, v8.0.0027) (push) Has been cancelled
test / Linux (true, vim, v8.0.0183) (push) Has been cancelled
test / Linux (vim, nightly) (push) Has been cancelled
test / Linux (vim, v8.0.0184) (push) Has been cancelled
test / Linux (vim, v8.0.1453) (push) Has been cancelled
test / Linux (vim, v8.1.2269) (push) Has been cancelled
test / Linux (vim, v8.2.2434) (push) Has been cancelled
test / Linux (vim, v8.2.3995) (push) Has been cancelled
test / Windows (nvim, nightly) (push) Has been cancelled
test / Windows (nvim, v0.3.8) (push) Has been cancelled
test / Windows (nvim, v0.4.2) (push) Has been cancelled
test / Windows (nvim, v0.4.3) (push) Has been cancelled
test / Windows (nvim, v0.4.4) (push) Has been cancelled
test / Windows (nvim, v0.5.0) (push) Has been cancelled
test / Windows (nvim, v0.5.1) (push) Has been cancelled
test / Windows (nvim, v0.6.0) (push) Has been cancelled
test / Windows (nvim, v0.6.1) (push) Has been cancelled
test / Windows (nvim, v0.7.0) (push) Has been cancelled
test / Windows (nvim, v0.7.2) (push) Has been cancelled
test / Windows (nvim, v0.8.0) (push) Has been cancelled
test / Windows (nvim, v0.8.1) (push) Has been cancelled
test / Windows (nvim, v0.8.2) (push) Has been cancelled
test / Windows (nvim, v0.8.3) (push) Has been cancelled
test / Windows (nvim, v0.9.0) (push) Has been cancelled
test / Windows (nvim, v0.9.1) (push) Has been cancelled
test / Windows (vim, nightly) (push) Has been cancelled
test / Windows (vim, v7.4.1185) (push) Has been cancelled
test / Windows (vim, v7.4.1689) (push) Has been cancelled
test / Windows (vim, v8.0.0027) (push) Has been cancelled
test / Windows (vim, v8.0.1453) (push) Has been cancelled
test / Windows (vim, v8.1.2269) (push) Has been cancelled
test / Windows (vim, v8.2.2434) (push) Has been cancelled
test / Windows (vim, v8.2.3995) (push) Has been cancelled
docker / docker (push) Has been cancelled
mirror / check (coding) (push) Has been cancelled
mirror / check (gitee) (push) Has been cancelled
mirror / check (gitlab) (push) Has been cancelled
106 lines
3.2 KiB
VimL
106 lines
3.2 KiB
VimL
" Author: Nat Williams <nat.williams@gmail.com>
|
|
" Description: tflint for Terraform files
|
|
"
|
|
" See: https://www.terraform.io/
|
|
" https://github.com/wata727/tflint
|
|
|
|
call ale#Set('terraform_tflint_options', '')
|
|
call ale#Set('terraform_tflint_executable', 'tflint')
|
|
|
|
function! ale_linters#terraform#tflint#Handle(buffer, lines) abort
|
|
let l:output = []
|
|
let l:pattern = '\v^(.*):(\d+),(\d+)-(\d+)?,?(\d+): (.{-1,}); (.+)$'
|
|
let l:json = ale#util#FuzzyJSONDecode(a:lines, {})
|
|
|
|
" This is a rough test for tflint's output format
|
|
" On versions prior to 0.11 it outputs all errors as a single level list
|
|
if type(l:json) is v:t_list
|
|
for l:error in l:json
|
|
if l:error.type is# 'ERROR'
|
|
let l:type = 'E'
|
|
elseif l:error.type is# 'NOTICE'
|
|
let l:type = 'I'
|
|
else
|
|
let l:type = 'W'
|
|
endif
|
|
|
|
call add(l:output, {
|
|
\ 'lnum': l:error.line,
|
|
\ 'text': l:error.message,
|
|
\ 'type': l:type,
|
|
\ 'code': l:error.detector,
|
|
\})
|
|
endfor
|
|
else
|
|
for l:error in get(l:json, 'errors', [])
|
|
for l:match in ale#util#GetMatches(l:error.message, [l:pattern])
|
|
if l:match[4] is# ''
|
|
let l:match[4] = l:match[2]
|
|
endif
|
|
|
|
call add(l:output, {
|
|
\ 'filename': l:match[1],
|
|
\ 'lnum': str2nr(l:match[2]),
|
|
\ 'col': str2nr(l:match[3]),
|
|
\ 'end_lnum': str2nr(l:match[4]),
|
|
\ 'end_col': str2nr(l:match[5]),
|
|
\ 'text': l:match[7],
|
|
\ 'code': l:match[6],
|
|
\ 'type': 'E',
|
|
\})
|
|
endfor
|
|
endfor
|
|
|
|
for l:error in get(l:json, 'issues', [])
|
|
if l:error.rule.severity is# 'ERROR'
|
|
let l:type = 'E'
|
|
elseif l:error.rule.severity is# 'NOTICE'
|
|
let l:type = 'I'
|
|
else
|
|
let l:type = 'W'
|
|
endif
|
|
|
|
call add(l:output, {
|
|
\ 'filename': l:error.range.filename,
|
|
\ 'lnum': l:error.range.start.line,
|
|
\ 'col': l:error.range.start.column,
|
|
\ 'end_lnum': l:error.range.end.line,
|
|
\ 'end_col': l:error.range.end.column,
|
|
\ 'text': l:error.message,
|
|
\ 'code': l:error.rule.name,
|
|
\ 'type': l:type,
|
|
\})
|
|
endfor
|
|
endif
|
|
|
|
return l:output
|
|
endfunction
|
|
|
|
function! ale_linters#terraform#tflint#GetCommand(buffer) abort
|
|
let l:cmd = '%e'
|
|
|
|
let l:config_file = ale#path#FindNearestFile(a:buffer, '.tflint.hcl')
|
|
|
|
if !empty(l:config_file)
|
|
let l:cmd .= ' --config ' . ale#Escape(l:config_file)
|
|
endif
|
|
|
|
let l:opts = ale#Var(a:buffer, 'terraform_tflint_options')
|
|
|
|
if !empty(l:opts)
|
|
let l:cmd .= ' ' . l:opts
|
|
endif
|
|
|
|
let l:cmd .= ' -f json'
|
|
|
|
return l:cmd
|
|
endfunction
|
|
|
|
call ale#linter#Define('terraform', {
|
|
\ 'name': 'tflint',
|
|
\ 'executable': {b -> ale#Var(b, 'terraform_tflint_executable')},
|
|
\ 'cwd': '%s:h',
|
|
\ 'command': function('ale_linters#terraform#tflint#GetCommand'),
|
|
\ 'callback': 'ale_linters#terraform#tflint#Handle',
|
|
\})
|