apertium / apertium-lint

Linter for Apertium source files
GNU General Public License v3.0
3 stars 1 forks source link

--linewise output-format with filename:line(:column)?:(warning|info|error): message #7

Open unhammer opened 9 months ago

unhammer commented 9 months ago

This would let e.g. M-x compile Just Work in Emacs, and is also easier to parse with scripts and such than the default human-readable section-per-file-output.

E.g. instead of

$ ~/.local/bin/apertium-lint
apertium-nno.nno.dix
Warning (repeat-entry) on line 18186: Stem "inntil" appears more than once with paradigm fordi__cnjsub. First use on line 18171.
Warning (repeat-entry) on line 20967: Stem "framtidsplanane" appears more than once with paradigm dagevis__adv. First use on line 19698.
Warning (repeat-entry) on line 21496: Stem "ss" appears more than once with paradigm dagevis__adv. First use on line 21495.
Warning (wrong-stem) on line 21847: Stem is "båndl", but based on paradigm name, should be "bandl". lm: bandlegge stem: båndl par: l/egge__vblex_adj
./dev/genitive-prepositions-new-unmerged.t1x
Error (invalid-xml) on line 2267: Invalid XML: Extra content at the end of the document, line 2267, column 1.

we'd have

$ ~/.local/bin/apertium-lint 
apertium-nno.nno.dix:18186: warning: (repeat-entry) Stem "inntil" appears more than once with paradigm fordi__cnjsub. First use on line 18171.
apertium-nno.nno.dix:20967: warning: (repeat-entry) Stem "framtidsplanane" appears more than once with paradigm dagevis__adv. First use on line 19698.
apertium-nno.nno.dix:21496: warning: (repeat-entry) Stem "ss" appears more than once with paradigm dagevis__adv. First use on line 21495.
apertium-nno.nno.dix:21847: warning: (wong-stem) Stem is "båndl", but based on paradigm name, should be "bandl". lm: bandlegge stem: båndl par: l/egge__vblex_adj
./dev/genitive-prepositions-new-unmerged.t1x:2267:1: error: (invalid-xml) Extra content at the end of the document.

(This would match the gnu format built in with compilation-error-regexp-alist-alist in Emacs, but also fits with the output of many other compilers and linters.)

mr-martian commented 9 months ago

If the error description contains linebreaks, does that cause any problems? A few of the lexd messages do that. If that's not a problem, I've got the change implemented and ready to push.

unhammer commented 9 months ago

Well, in the Emacs case it just won't match past the first line, giving a shorter tooltip when you hover your mouse … I'd say push and deal with such details later :)