Skip to content
This repository was archived by the owner on Aug 26, 2023. It is now read-only.
This repository was archived by the owner on Aug 26, 2023. It is now read-only.

Change default number of errors for 2.0.0 #78

Closed
@stevecheckoway

Description

@stevecheckoway

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

html = ...
doc = Nokogiri::HTML5.parse(html)
if doc.errors.any?
  puts(doc.errors[0])
end

is nicer than

html = ...
doc = Nokogiri::HTML5.parse(html, max_parse_errors: 1)
if doc.errors.any?
  puts(doc.errors[0])
end

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?

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions