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

Ensure that checkSync() and check() do not stall without the flags parameter #1383

Merged
merged 1 commit into from
Mar 1, 2025

Conversation

MegaManSec
Copy link
Contributor

This patch fixes an issue where the two functions would never finish if called without a second parameter. For example, check("^(a|a+)+$")

@makenowjust
Copy link
Contributor

We assume the TypeScript definition is always guaranteed, so the current implementation does not consider the issue of missing the 2nd parameter of check and variations.

However, some programming languages may not have a regular expression flag, so this argument may be made optional. Let me give this some thought.

@MegaManSec
Copy link
Contributor Author

Let me give this some thought.

Thank you. The context of this PR is that it took me a good amount of time to work out why, in JS, checkSync(expression) was hanging forever. Since no error message occurred, it was quite confusing. Maybe it would be better to error-out instead of assuming an empty-string 2nd parameter.

@makenowjust makenowjust added the feature New Features label Feb 25, 2025
@makenowjust
Copy link
Contributor

Maybe it would be better to error-out instead of assuming an empty-string 2nd parameter.

That sounds good to me. It helps us as a safety net.

@MegaManSec
Copy link
Contributor Author

I've made it check that both parameters are strings, to be sure.

Copy link

codecov bot commented Feb 27, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (6e64b2f) to head (f87e827).
Report is 40 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #1383   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           69        69           
  Lines         3080      3106   +26     
  Branches       499       503    +4     
=========================================
+ Hits          3080      3106   +26     

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

@makenowjust
Copy link
Contributor

@MegaManSec Please run yarn lerna run format. CI failed due to the format.

@MegaManSec
Copy link
Contributor Author

should be ok now

@makenowjust
Copy link
Contributor

@MegaManSec Codecov reported the coverage is decreased. Could you add c8 ignore comments or tests for new lines?

@MegaManSec
Copy link
Contributor Author

sure, hope that's fine.

Copy link
Contributor

@makenowjust makenowjust left a comment

Choose a reason for hiding this comment

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

Your fix seems wrong. I added a review and suggestions.

This patch fixes an issue where the two functions would never finish if called without a second parameter.

Signed-off-by: Joshua Rogers <joshua-github-recheck@joshua.hu>
@makenowjust makenowjust merged commit cd2a651 into makenowjust-labs:main Mar 1, 2025
15 checks passed
@makenowjust
Copy link
Contributor

@MegaManSec Thank you for your contribution! I will release a new version.

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

Successfully merging this pull request may close these issues.

2 participants