theodi/csvlint.rb — pull request #33 by ldodds (2014-01-14 17:56:27+00:00)
Title: Change from parsing CSV line by line to using CSV.new and trapping errors

This Fixes #31

* Simplify `validate` method, extracting it into two smaller chunks
* Changed to use `CSV.new` instead of parsing lines individually. This allows the CSV parser to deal with new lines in quoted fields
* Individually check rows using `csv.shift`, trapping exceptions
* Add new check for "Unquoted fields do not allow \r and \n" error message
* Enforce a default line separator "\n". This avoids problems with CSV.new which otherwise tries to guess the line endings, triggered encoding exceptions before we're ready to trap them
* Changed tests to trap multiple empty lines at end of file, but single empty line is OK