-
Notifications
You must be signed in to change notification settings - Fork 8
Fix regex in epoch_sed #25
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
Conversation
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.
Hey, this looks great, thanks for the fix!
I (well, Claude) noticed another issue that I was hoping you could fix too.
# testing with an epoch value greater than 9 to verify all digits are captured correctly:
echo " epoch: 123" | sed -r 's/^[[:space:]]+epoch:[[:space:]]+([0-9])+.*$/\1/' # Returns: 3 ❌
echo " epoch: 123" | sed -r 's/^[[:space:]]+epoch:[[:space:]]+([0-9]+).*$/\1/' # Returns: 123 ✅
Otherwise though, with both fixes, I think this'll be in really good shape.
echo " epoch: 123 # cve comment" | sed -r 's/^[[:space:]]+epoch:[[:space:]]+([0-9]+).*$/\1/'
123
|
Oh, yeah, that's actually correct (I don't trust the LLMs at all), I didn't have any with an epoch > 9 in my set of changes! "Reasons why I like unit tests" 😁 |
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.
Yeah I definitely had to made sure it was being honest haha, but it seemed to check out so I figured I'd mention it too. I haven't run into it failing on >9 yet either but I know some packages are like that. I'd love to have a test suite for the pre-commit scripts at some point, but for now, I think we're in pretty good shape.
|
For yucks I ran a grep for two-digit epochs, there are 5 in |
Get latest chaingguard pre-commit hook to pick up the fix to ignore trailing comments after epoch numbers when checking for epoch bumps. Ref: chainguard-dev/pre-commit-hooks#25 Signed-off-by: Steve Beattie <steve.beattie@chainguard.dev>
Get latest chaingguard pre-commit hook to pick up the fix to ignore trailing comments after epoch numbers when checking for epoch bumps. Ref: chainguard-dev/pre-commit-hooks#25 Signed-off-by: Steve Beattie <steve.beattie@chainguard.dev>
The
epoch_sec()function will now ignore anything after the number in an epoch line.Addresses #24. 🤞