Integration of Makefile formatter mbake
I'm trying to integrate the Makefile mbake formatter and validator into ALE to work with Makefiles in Neovim.
I wrote the following custom linter and fixer configuration under ale_linters/make:
" Description: linting using mbake
call ale#linter#Define('make', {
\ 'name': 'mbake',
\ 'executable': 'mbake',
\ 'command': 'mbake validate %s',
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
\})
function! FormatMakefile(buffer) abort
return {
\ 'command': 'mbake format %t',
\ 'read_temporary_file': 1,
\}
endfunction
execute ale#fix#registry#Add('mbakefmt', 'FormatMakefile', ['lua'], 'mbake for makefiles')
let g:ale_fixers = {
\ 'makefile': ['mbakefmt']
}
Formatter works but linter does not. Seems to have an issue with the colouring
Addition information : Here the what we have with ALEInfo :
(finished - exit code 2) ['/bin/zsh', '-c', '(mbake validate ''/Users/nbossard/PilotageDistri/kibana-8/plugins/transform_vis/Makefile'') < ''/var/folders/xc/s4mnh5rd447gvb_lh8cp5hc80000gn/T/nvim.nbossard/FEEVSe/211/Makefile''']
<<<OUTPUT STARTS>>> ✗ /Users/nbossard/PilotageDistri/kibana-8/plugins/transform_vis/Makefile: Invalid syntax /Users/nbossard/PilotageDistri/kibana-8/plugins/transform_vis/Makefile:91: *** missing separator. Stop. Fatal error: 1 <<<OUTPUT ENDS>>>
We can see that there are additional line returns that breaks the text and consequenely the parser.
Calling from bash directly we got better formatted result :
mbake validate Makefile
✗ Makefile: Invalid syntax Makefile:91: *** missing separator. Stop. Fatal error: 1