Pedant icon indicating copy to clipboard operation
Pedant copied to clipboard

Pedant should produce a report, not exceptions

Open dhasenan opened this issue 8 years ago • 3 comments

Right now, I get one error and then processing aborts. This is unfriendly to someone trying to fix problems in a document of nontrivial size. It's much worse if I'm writing a service to analyze uploaded books, say epub documents -- I can give you one bit of feedback per split, roughly per chapter.

I understand that you can't get things back into a known state for things like parentheticals and quotes. But for some things, you can do better without much work -- things that aren't as stateful.

dhasenan avatar Jul 23 '16 16:07 dhasenan

I have had a couple of users who wanted a report-like format too. I would love to implement it but I want to make sure I do it properly. Do you mean like having a summary of the errors in a tabular format, and references to the errors (like line 1 character 12?)

For example:

Too much whitespace: line 1, char 12 line 10, char 55 line 20, char 2

Another error: line x, char y

alexyorke avatar Jul 24 '16 00:07 alexyorke

An array of tuples <message, type, line, column> would work pretty well.

dhasenan avatar Jul 24 '16 00:07 dhasenan

I just pushed to the dev branch https://github.com/Decagon/Pedant/blob/dev/pedant.js which is a partial rewrite of the tokenizer; let me know if this fixes the bugs that you were experiencing or if any regressions have been introduced. The report does generate a lot of duplicates, though.

alexyorke avatar Jul 24 '16 02:07 alexyorke