-
Notifications
You must be signed in to change notification settings - Fork 114
Change default number of errors for 2.0.0 #78
Comments
Since I personally have no interest in tracking errors, I would start adding Now, when I imagine users who do want to track errors, they most likely have a specific need like writing an actual HTML validator. Such user will likely want to increase the number to something like 50 or 100. I can imagine someone doing development / testing with small HTML documents, always being under the 10 errors default, but then when running in production, end users get weird behavior and report that “not all errors are detected”. If it was 100, then it’s more likely end users will figure that must be a hard application limit. That’s sums my thoughts. I tend to think 5-10 can’t be optimal for anyone. It’s either too much (unneeded) or not enough.
That’s a good point. A solution could be to raise something like In any case, there should be small “Tracking parse errors” section in the README, which is thankfully very short. So most people will likely see this bit of documentation and know what to do with it. |
@rafbm I'd prefer not to add an exception. I'm not sure I agree with your rationale that 5–10 is not optimal for anyone. Maybe I'm alone in thinking this, but when a compiler, for example, shows me hundreds of errors, I don't find that particularly useful. I only need to see the first few errors which I'm then going to fix. I think a small number of errors is good for a human, a large number is probably good for a machine to act on. I guess there are two questions to address:
For the first question, the options I see are
For the second question, the options are
That leaves 1B, 1C, 2B, 2C, 3A, 3B, 3C. |
I agree that doc.errors will be empty even if there were parse errors is confusing. Changing this so that I think it would be hard to defend any default for
|
A default of 1 seems good. I don't like having My guess is the third one is an error. I admit, I can't understand what the error is. There are three tokens, a DOCTYPE token, a start tag token whose tag name is
One consumes the But gumbo reports an error with the stack of open elements being just html. Is this a bug in gumbo or am I misunderstanding the HTML spec? Anyway, I think my preference among your options is to default to 1 and always have |
I think this is a bug in gumbo. An informational portion of the standard says
In fact, gumbo seems to miss self-closing end tags entirely! I think the fix for both is not too hard though. |
My observation is that it would not be difficult to find bugs in Gumbo in this area. My personal feeling is that this is an experimental feature, and as such users should opt in to get errors. That being said, I don't strongly object to Also +1 to there should be small “Tracking parse errors” section in the README |
How about we make 1 the new default, add a parse errors section where we note that it's experimental (and we welcome bug reports regarding missing or incorrect errors)? |
Okay, after having spent a bunch of time integrating the html5lib tests, I agree that the error situation here is not great. I'll leave 0 as the default and add some documentation. |
I realize it’s kinda late and I know I’m the one who introduced |
That's not a bad idea. Maybe supporting both for a few releases but only document |
I let you see if you think backward compatibility is needed, given documentation is only ~30 minutes old. |
Oh, I wasn't worried about the documentation. But we've mentioned |
In #65 we decided that 0 was a good default for the maximum number of errors. I'm starting to think that's not a good choice and I think we should change it for 2.0.0. I propose 10 (although any small, nonzero number seems reasonable).
My rationale is that it's useful to be able to check if there were errors at all, even if you don't care about any specific number of them. That is, something like
is nicer than
Plus, I think it's unintuitive that if the maximum number of errors is not set, then
doc.errors
will be empty even if there were parse errors.10 or 5 errors seem reasonable (and we should document what we choose). It shouldn't lead to a massive amount of memory usage as can happen with an unbounded number of errors.
@rafbm, you raised the original issue. Would 5 or 10 work for you?
The text was updated successfully, but these errors were encountered: