Skip to content

Conversation

woodhull
Copy link

@woodhull woodhull commented Oct 2, 2024

It's probably best to treat this as a feature request / bug report rather than a traditional PR.

We ran into a couple of validation issues that were coded as unknown_error when they were better understood with a more specific error type in customer provided CSVs.

This adds better error classification for those cases, and allows us to move forward but we do not understand enough of the overall structure of the program or how to add good specs for this behavior. We're just moving fast and sharing this code in the hope that knowing someone might need better classification in this case is helpful to you upstream.

Thank you for your work, and sorry we're not able to put together a better PR at this time. I did not quite understand how this method is supposed to work.

@Floppy
Copy link
Member

Floppy commented Oct 3, 2024

Thanks! We'll check it over :)

@Floppy
Copy link
Member

Floppy commented Oct 3, 2024

It looks fine, we could just do with adding tests for it before merging in. Do you have any sample data that causes the failures?

Comment on lines 402 to 408
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!

spec.require_paths = ["lib"]

spec.required_ruby_version = [">= 2.5", "< 3.4"]
spec.required_ruby_version = [">= 2.5", "< 3.5"]
Copy link
Contributor

Choose a reason for hiding this comment

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

Please create another PR for this change.
It is out of scope.

Copy link
Member

Choose a reason for hiding this comment

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

No need for another PR, there's already one open to make that change, but it's waiting on a bugfix for cucumber.

Copy link
Member

Choose a reason for hiding this comment

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

I've merged that now, might be able to just rebase this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants