mrtazz / checkmake

experimental linter/analyzer for Makefiles
MIT License
1.02k stars 44 forks source link

No newlines in ALE output - side effect of 8838750? #60

Closed danduril closed 2 years ago

danduril commented 2 years ago

Expected behaviour

ALE seems to expect each error/warning on its own line.

(finished - exit code 3) ['/bin/bash', '-c', 'checkmake ''/home/dan/projects/pandion/makefile'' --format="{{.LineNumber}}:{{.Rule}}:{{.Violation}}{{\"\n\"}}" < ''/tmp/vEQBFzm/31/makefile''']                                                                               
<<<OUTPUT STARTS>>>                                                                                                                                                                                                                                                          
4:phonydeclared:Target "another" should be declared PHONY.
0:minphony:Missing required phony target "all"                                                                                                                                                                                                                               
0:minphony:Missing required phony target "clean"                                                                                                                                                                                                                             
0:minphony:Missing required phony target "test"                                                                                                                                                                                                                              
<<<OUTPUT ENDS>>>

ALE marks each error line and shows the first error for that line, if more than one.

Actual behaviour

(finished - exit code 4) ['/bin/bash', '-c', 'checkmake ''/home/dan/projects/pandion/makefile'' --format="{{.LineNumber}}:{{.Rule}}:{{.Violation}}" < ''/tmp/vALBAMS/3/makefile''']                                                                                          
<<<OUTPUT STARTS>>>                                                                                                                                                                                                                                                          
4:phonydeclared:Target "another" should be declared PHONY.0:minphony:Missing required phony target "all"0:minphony:Missing required phony target "clean"0:minphony:Missing required phony target "test"                                                                      
<<<OUTPUT ENDS>>>

ALE marks only one error line, even when errors on more than one line, and displays the entire list on a single line of output.

Sample Makefile to reproduce issue

echo:
    @echo do nothing

another: another.c

Perhaps I'm missing some way to configure golang to insert newline for each template line? Otherwise, changing the format string to include the newline worked:

call ale#linter#Define('make', {
\   'name': 'checkmake',
\   'executable': 'checkmake',
\   'command': 'checkmake %s --format="{{.LineNumber}}:{{.Rule}}:{{.Violation}}{{\"\n\"}}"',
\   'callback': 'ale_linters#make#checkmake#Handle',
\})
dgeorge83616 commented 2 years ago

Please close: i will change ale#linter#Define() in ale repo, as suggested in https://github.com/mrtazz/checkmake/pull/55.