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(ibm-use-date-based-format): tighten heuristic for flagging date-time values #717

Merged
merged 1 commit into from
Jan 24, 2025

Conversation

dpopp07
Copy link
Member

@dpopp07 dpopp07 commented Jan 23, 2025

PR summary

The regular expressions used to determine if a value should be considered a date-time value are too loose and allow false positives to sneak in. It's a tricky problem, but this commit makes an attempt to tighten them by dismissing the possibility of a date-time value if any letters are found that are not relevant to a date-time value.

PR Checklist

General checklist

Please make sure that your PR fulfills the following requirements:

  • The commit message follows the Angular Commit Message Guidelines.
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • Dependencies have been updated as needed
  • .secrets.baseline has been updated as needed
  • npm run generate-utilities-docs has been run if any files in packages/utilities/src have been updated

@dpopp07 dpopp07 requested review from hudlow and padamstx January 23, 2025 22:02
Copy link
Member

@padamstx padamstx left a comment

Choose a reason for hiding this comment

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

I think we need to use ? instead of * in the new regex's

packages/ruleset/src/utils/date-based-utils.js Outdated Show resolved Hide resolved
packages/ruleset/src/utils/date-based-utils.js Outdated Show resolved Hide resolved
@dpopp07 dpopp07 force-pushed the dp/tighten-date-time-regex branch from fefa97b to b53d97c Compare January 24, 2025 16:45
@dpopp07 dpopp07 requested a review from padamstx January 24, 2025 16:45
Copy link
Member

@padamstx padamstx left a comment

Choose a reason for hiding this comment

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

LGTM

…ime values

The regular expressions used to determine if a value should be considered a
date-time value are too loose and allow false positives to sneak in. It's a
tricky problem, but this commit makes an attempt to tighten them by dismissing
the possibility of a date-time value if any letters are found that are not
relevant to a date-time value.

Signed-off-by: Dustin Popp <[email protected]>
@dpopp07 dpopp07 force-pushed the dp/tighten-date-time-regex branch from b53d97c to 4f99241 Compare January 24, 2025 17:17
@dpopp07 dpopp07 merged commit 542d6b0 into main Jan 24, 2025
7 checks passed
@dpopp07 dpopp07 deleted the dp/tighten-date-time-regex branch January 24, 2025 17:22
ibm-devx-sdk pushed a commit that referenced this pull request Jan 24, 2025
## @ibm-cloud/openapi-ruleset [1.28.3](https://github.com/IBM/openapi-validator/compare/@ibm-cloud/[email protected]...@ibm-cloud/[email protected]) (2025-01-24)

### Bug Fixes

* **ibm-use-date-based-format:** tighten heuristic for flagging date-time values ([#717](#717)) ([542d6b0](542d6b0))
@ibm-devx-sdk
Copy link

🎉 This PR is included in version 1.28.3 🎉

The release is available on npm package (@latest dist-tag)

Your semantic-release bot 📦🚀

@ibm-devx-sdk
Copy link

🎉 This PR is included in version 1.32.3 🎉

The release is available on npm package (@latest dist-tag)

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.

3 participants