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

Added is_valid_email_address.rs #783

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

lyqio
Copy link

@lyqio lyqio commented Aug 26, 2024

Changes

  • add is_valid_email_address.rs

Type of change

  • New feature (non-breaking change which adds functionality)

Checklist:

  • I ran bellow commands using the latest version of rust nightly.
  • I ran cargo clippy --all -- -D warnings just before my last commit and fixed any issue that was found.
  • I ran cargo fmt just before my last commit.
  • I ran cargo test just before my last commit and all tests passed.
  • I added my algorithm to the corresponding mod.rs file within its own folder, and in any parent folder(s).
  • I added my algorithm to DIRECTORY.md with the correct link.
  • I checked COUNTRIBUTING.md and my code follows its guidelines.

@codecov-commenter
Copy link

codecov-commenter commented Aug 26, 2024

Codecov Report

Attention: Patch coverage is 96.95122% with 5 lines in your changes missing coverage. Please review.

Project coverage is 95.34%. Comparing base (b2acfd2) to head (5460340).

Files with missing lines Patch % Lines
src/string/is_valid_email_address.rs 96.95% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #783      +/-   ##
==========================================
+ Coverage   95.33%   95.34%   +0.01%     
==========================================
  Files         310      311       +1     
  Lines       22657    22821     +164     
==========================================
+ Hits        21600    21759     +159     
- Misses       1057     1062       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@vil02 vil02 left a comment

Choose a reason for hiding this comment

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

The definition of the valid email address is slightly more involved, cf. https://en.wikipedia.org/wiki/Email_address#Examples
in particular, "john..doe"@example.org is perfectly fine.

This can be merged only if all of the edge cases are covered.

Copy link
Author

@lyqio lyqio left a comment

Choose a reason for hiding this comment

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

I rewrote some of the code and now passes all of the tests on https://en.wikipedia.org/wiki/Email_address#Examples

src/string/is_valid_email_address.rs Outdated Show resolved Hide resolved
src/string/is_valid_email_address.rs Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

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

Please make sure that tests cover all of the lines.

@lyqio
Copy link
Author

lyqio commented Sep 8, 2024

I handled all the things that you requested.

src/string/is_valid_email_address.rs Outdated Show resolved Hide resolved
src/string/is_valid_email_address.rs Outdated Show resolved Hide resolved
@vil02
Copy link
Member

vil02 commented Sep 13, 2024

Please make sure to update your branch (cf. #789) - otherwise the CI will fail.

@lyqio lyqio force-pushed the email-address branch 2 times, most recently from 0c45ece to 2d4da60 Compare September 14, 2024 11:15
@lyqio
Copy link
Author

lyqio commented Sep 14, 2024

I think I fixed all the issues and made the IP checking better.

src/string/is_valid_email_address.rs Outdated Show resolved Hide resolved
Copy link
Member

@vil02 vil02 left a comment

Choose a reason for hiding this comment

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

Please consider using more consistent naming: sometime the valid part is in the middle and sometimes at the end. Perhaps it is not needed at all?

src/string/is_valid_email_address.rs Outdated Show resolved Hide resolved
src/string/is_valid_email_address.rs Outdated Show resolved Hide resolved
@lyqio lyqio force-pushed the email-address branch 2 times, most recently from 05040a6 to 88d09e3 Compare September 19, 2024 21:15
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