Data-Liberation-Front / csvlint.rb

The gem behind http://csvlint.io
MIT License
283 stars 86 forks source link

Duplicate errors #230

Open nimashariatian opened 4 years ago

nimashariatian commented 4 years ago

Please provide a general summary of the issue in the Issue Title above fill out the headings below as applicable to the issue you are reporting, deleting as appropriate but offering us as much detail as you can to help us resolve the issue

Expected Behaviour

What should happen?

calling .validate multiple times should not increase the error count

Desired Behaviour (for improvement suggestions only)

if relevant include images or hyperlinks to other resources that clarify the enhancement you're seeking

v = Csvlint::Validator.new(..)
v.validate
v.errors.count => 1 
v.validate
v.errors.count = > 1
v.validate
v.errors.count = > 1

Current Behaviour (for problems)

What currently happens that isn't expected behaviour?

v = Csvlint::Validator.new(..)
v.validate
v.errors.count => 1 
v.valid?
v.errors.count = > 2
v.validate
v.errors.count = > 3

Steps to Reproduce (for problems)

Provide a link to a live example, or an unambiguous set of steps to reproduce this bug. Include code to reproduce, if relevant

data = StringIO.new(%Q{"Foo","Bar","Baz"\r\n"1","2","3"\r\n"1","2","3"\r\n"3","2","1""})
validator = Csvlint::Validator.new(data)
validator.validate
puts "validator.errors.count => #{validator.errors.count}"
validator.validate
puts "validator.errors.count => #{validator.errors.count}"
validator.validate
puts "validator.errors.count => #{validator.errors.count}"

Your Environment

Include as many relevant details about the environment you experienced the bug in - this will help us resolve the bug more expediently

  • Environment name and version (e.g. Chrome 39, node.js 5.4):
  • Operating System and version (desktop or mobile): Ruby 2.5.0 Rails 5.2.0