Fix bug in sqlfluff implementation & implement fixer support (#4365)

* Account for no sqlfluff output

Avoid crashes when there isn't any output from sqlfluff.

* Add supplort for sqlfluff as a fixer
This commit is contained in:
Carl Smedstad
2022-11-23 11:58:49 +01:00
committed by GitHub
parent 0b25d712b7
commit 590352304e
3 changed files with 37 additions and 1 deletions

View File

@@ -37,7 +37,13 @@ endfunction
function! ale_linters#sql#sqlfluff#Handle(buffer, lines) abort
let l:output = []
let l:json = ale#util#FuzzyJSONDecode(a:lines, {})[0]
let l:json_lines = ale#util#FuzzyJSONDecode(a:lines, [])
if empty(l:json_lines)
return l:output
endif
let l:json = l:json_lines[0]
" if there's no warning, 'result' is `null`.
if empty(get(l:json, 'violations'))