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(validation): support multilines regex #466

Merged
merged 3 commits into from May 26, 2021

Conversation

GuillaumeCisco
Copy link
Contributor

@GuillaumeCisco GuillaumeCisco commented May 25, 2021

Pull Request checklist:

  • Write an explicit title for the Pull Request, following Conventional Commits specification
  • Create automatic tests
  • No automatic tests failures
  • Test manually the implemented changes
  • Review my own code (indentation, syntax, style, simplicity, readability)
  • Wonder if you can improve the existing code

@codeclimate
Copy link

codeclimate bot commented May 26, 2021

Code Climate has analyzed commit ecdf652 and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 100.0% (45% is the threshold).

This pull request will bring the total coverage in the repository to 38.2%.

View more on Code Climate.

Copy link
Member

@Thenkei Thenkei left a comment

Choose a reason for hiding this comment

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

✅ Code review
✅ Automatic tests
✅ Manual tests

Great work on this one. 🥇

@@ -479,7 +479,7 @@ def add_validations(column_schema, column)
regex = value.source

# NOTICE: Transform a Ruby regex into a JS one
regex = regex.sub('\\A' , '^').sub('\\Z' , '$').sub('\\z' , '$')
regex = regex.sub('\\A' , '^').sub('\\Z' , '$').sub('\\z' , '$').gsub(/\n+|\s+/, '')
Copy link
Member

Choose a reason for hiding this comment

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

The fix 🏆 !


uri_field = collection.fields.find { |field| field[:field] == 'uri' }
uri_regex_validation = uri_field[:validations].find { |validation| validation[:type] == "is like"}
expect(uri_regex_validation[:value].match('\n')).to eq(nil)
Copy link
Member

Choose a reason for hiding this comment

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

🤝

@GuillaumeCisco GuillaumeCisco merged commit 1daf0b1 into master May 26, 2021
@GuillaumeCisco GuillaumeCisco deleted the fix-support-multilines-regex branch May 26, 2021 11:59
forest-bot added a commit that referenced this pull request May 26, 2021
## [6.3.8](v6.3.7...v6.3.8) (2021-05-26)

### Bug Fixes

* **validation:** support multilines regex ([#466](#466)) ([1daf0b1](1daf0b1))
@forest-bot
Copy link
Member

🎉 This PR is included in version 6.3.8 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

None yet

3 participants