Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions lib/csvlint/validate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I read the linter correctly .match does not return a boolean therefore it is creating a object for nothing.
To fix it, we should use .match?.

Suggested change
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
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

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're probably right, yes!



ERROR_MATCHERS.fetch(message, :unknown_error)
end

Expand Down