Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Vehicle VIN containing dash character #2559

Closed

Conversation

ur5us
Copy link
Contributor

@ur5us ur5us commented Sep 6, 2022

The regression was introduced in #d113aabf33 when additional RuboCop
cops were enabled which resulted in 0-0 being corrected to 0- which
is not the same as the former denotes a range whereas the latter is
simply the chars 0 and -.

Looking at the Wikipedia page for plant identifiers it’s not clear what
characters position 11 should be limited to but using 0-9 is a rather
safe assumption. Though, using [A-Z0-9] would probably work as well.

The regression was introduced in #d113aabf33 when additional RuboCop
cops were enabled which resulted in `0-0` being corrected to `0-` which
is not the same as the former denotes a range whereas the latter is
simply the chars `0` and `-`.

Looking at the Wikipedia page for plant identifiers it’s not clear what
characters position 11 should be limited to but using `0-9` is a rather
safe assumption. Though, using `[A-Z0-9]` would probably work as well.
@ur5us
Copy link
Contributor Author

ur5us commented Sep 6, 2022

@koic Maybe you’re the right person to review this?

@ur5us
Copy link
Contributor Author

ur5us commented Sep 7, 2022

@stefannibrasil As you added the PR: Needs Tests tag, do you have a suggestion what exactly needs testing here? The existing tests use the VIN Regex to generate the fake data to begin with (s. Faker::Base#regexify) and then said Regex to verify the generated string matches. I could add a test to verify that the fake VIN does not contain any dashes but the generated strings are random after all; so how do I make such a test reliable, deterministic and meaningful?

@rmm5t
Copy link
Contributor

rmm5t commented Sep 14, 2022

See #2562

@rmm5t rmm5t mentioned this pull request Sep 14, 2022
@stefannibrasil
Copy link
Contributor

hi @ur5us thank you for initiating this discussion. I was short in time and didn't leave more context besides adding the label.

I am mainly concerned about those breaking changes not being caught up by the tests at all. I don't believe we need to test the regex in detail. But it would be nice to have some sort of checks that would help us identify potential issues that cause these types of bugs. I apologize as I don't have an answer right now. I am hoping to have more time this weekend to do that but it looks like @rmm5t is addressing this in a different PR.

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

Successfully merging this pull request may close these issues.

3 participants