-
-
Notifications
You must be signed in to change notification settings - Fork 403
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: solve quantity false positives issue #2037 #2038
Conversation
@CharlesNepote could you provide some cases that the old regex matched and this one does not? Thank you! :-) |
lib/ProductOpener/SiteQuality_off.pm
Outdated
if ((defined $product_ref->{quantity}) | ||
and ($product_ref->{quantity} =~ /(?:.*e$)|(?:[0-9]+\s*[kmc]?[gl]?\s*e)/i) | ||
and ($product_ref->{quantity} =~ /(?:^e\s)|(?:\se[^a-z])|(?:\se$)/i) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The purpose of the more complex regexp was to flag things like this : "500 ge"
I think @VaiTon 's suggestion is a very good one: we should add test cases (both positives like "500 ge" and negatives like "1 litre") so that we don't break this later. There is already a test file : t/sitequality.t |
Yes, you're both right. I'm not very comfortable with test cases but I know it's important, so I'll do it. |
rebased. @CharlesNepote can you write the test so we can merge |
Can we close @CharlesNepote ? |
Codecov Report
@@ Coverage Diff @@
## main #2038 +/- ##
==========================================
+ Coverage 48.16% 48.25% +0.08%
==========================================
Files 109 109
Lines 21015 21046 +31
Branches 4739 4739
==========================================
+ Hits 10122 10155 +33
+ Misses 9618 9617 -1
+ Partials 1275 1274 -1
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Kudos, SonarCloud Quality Gate passed! |
@CharlesNepote , @stephanegigandet , @VaiTon , @teolemon Tests have been added. False positives such as "litre" or "verre" (ending by letter e) are not catch anymore with this regex. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect, thank you!
Description:
Change regexp to avoid many false positives.
Related issues and discussion: #2037