From 4c8d1448d45e1d22a10e3e502acede6fe88c8867 Mon Sep 17 00:00:00 2001 From: Nathan Woodhull Date: Wed, 2 Oct 2024 19:50:57 -0400 Subject: [PATCH 1/3] Add better line break issue handling. --- lib/csvlint/validate.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/csvlint/validate.rb b/lib/csvlint/validate.rb index 1ddb2899..f1b0782c 100644 --- a/lib/csvlint/validate.rb +++ b/lib/csvlint/validate.rb @@ -398,6 +398,16 @@ def fetch_error(error) rescue nil end + + if message.match(/^Unquoted fields do not allow new line/i) + return :line_breaks + end + + if message.match(/^New line must be/i) + return :inconsistent_line_breaks + end + + ERROR_MATCHERS.fetch(message, :unknown_error) end From 867a256f8099b0c3de13ff5bc0099098613392d4 Mon Sep 17 00:00:00 2001 From: Nathan Woodhull Date: Wed, 1 Jan 2025 17:10:28 -0500 Subject: [PATCH 2/3] Update csvlint.gemspec ruby version requirement --- csvlint.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/csvlint.gemspec b/csvlint.gemspec index d20f5b00..8ef61392 100644 --- a/csvlint.gemspec +++ b/csvlint.gemspec @@ -16,7 +16,7 @@ Gem::Specification.new do |spec| spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } spec.require_paths = ["lib"] - spec.required_ruby_version = [">= 2.5", "< 3.4"] + spec.required_ruby_version = [">= 2.5", "< 3.5"] spec.add_dependency "csv" spec.add_dependency "rainbow" From 682408bffbcb1836b8b7d2c494968e834bb66707 Mon Sep 17 00:00:00 2001 From: Nathan Woodhull Date: Thu, 13 Mar 2025 13:33:48 -0400 Subject: [PATCH 3/3] use match? to avoid issue --- lib/csvlint/validate.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/csvlint/validate.rb b/lib/csvlint/validate.rb index 33e8dd6c..3c549ae3 100644 --- a/lib/csvlint/validate.rb +++ b/lib/csvlint/validate.rb @@ -397,11 +397,11 @@ def fetch_error(error) nil end - if message.match(/^Unquoted fields do not allow new line/i) + if message.match?(/^Unquoted fields do not allow new line/i) return :line_breaks end - if message.match(/^New line must be/i) + if message.match?(/^New line must be/i) return :inconsistent_line_breaks end