-
Notifications
You must be signed in to change notification settings - Fork 53
fix(eherbs.lic): v2.1.9 regex improvements #2149
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Contributor
Author
|
@ellipsis remove previous comments and review again |
Contributor
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.
Important
Looks good to me! 👍
Reviewed everything up to d1c38a5 in 3 minutes and 5 seconds. Click for details.
- Reviewed
46lines of code in1files - Skipped
0files when reviewing. - Skipped posting
3draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. scripts/eherbs.lic:1975
- Draft comment:
Consider wrapping the alternation in a non‐capturing group so that the entire pattern for container lookup is treated as one alternative. - Reason this comment was not posted:
Comment was on unchanged code.
2. scripts/eherbs.lic:2222
- Draft comment:
Apply similar non‐capturing grouping for the alternation in the survival_contents regex to ensure correct matching. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% The diff shows that the changes were specifically about replacing the generic ID capture(-?\d+)with a specific container ID interpolation(#{container.id}). The comment suggests making the first capture group non-capturing(?:In|On|Under|Behind), but this is unrelated to the actual changes made. The first capture group was already there before the changes and wasn't modified. This appears to be a general code quality suggestion rather than something related to the actual changes. According to the rules, comments should be about changes made by the diff, not about unchanged code. Additionally, making this change would shift the capture group numbers, which could break code that relies onRegexp.last_match(2),Regexp.last_match(3), etc. The comment might be technically correct that using non-capturing groups is a best practice, but it's not about the changes made in this PR. Also, changing capture group numbering could break existing code that uses numbered backreferences. This comment should be deleted because: 1) It's about unchanged code (the alternation pattern was already there), 2) Making this change would alter capture group indices and potentially break code that usesRegexp.last_match(n), and 3) It's a stylistic suggestion unrelated to the actual changes which were about using specific container IDs instead of generic ID patterns. Delete this comment. It's about code that wasn't changed in the diff, and implementing the suggestion could break existing code that relies on the current capture group numbering.
3. scripts/eherbs.lic:1975
- Draft comment:
Consider using Regexp.escape on the interpolated container id to guard against potential regex injection if the id ever isn’t strictly numeric. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 20% vs. threshold = 50% The comment raises a valid concern about regex injection. However, I need to consider: 1) Are container IDs always numeric in this context? Looking at GameObj in Lich, IDs are typically numeric strings from the game. 2) Is this speculative ("if the id ever isn't strictly numeric") or a real concern? The comment uses "if...ever" language which suggests speculation. 3) The original code explicitly matched numeric IDs with(-?\d+), and the new code interpolates the specific ID. If the ID is always numeric (which it should be from GameObj), then regex escaping wouldn't change behavior. 4) This feels like a "what if" scenario rather than identifying a concrete bug. The rules say not to make speculative comments like "If X, then Y is an issue". The comment is speculative ("if the id ever isn't strictly numeric"). In the Lich/GemStone context, GameObj IDs are always numeric strings provided by the game engine. The change from a generic numeric pattern to a specific ID interpolation is actually more restrictive, not less. If there were a real injection risk, we'd need to see evidence that non-numeric IDs can occur. While regex escaping is generally good practice, this comment is speculative about a scenario that shouldn't occur in this codebase. GameObj IDs are always numeric in the Lich environment. The comment uses conditional language ("if the id ever isn't") which indicates it's not identifying an actual issue but rather a hypothetical one. This violates the rule against speculative comments. This comment should be deleted. It's speculative about a scenario that doesn't apply to this codebase (non-numeric GameObj IDs), and uses "if...ever" language that indicates it's not identifying a concrete issue.
Workflow ID: wflow_4RAcbLHTBurRsMOO
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Important
Improved regex in
eherbs.licfor container lookups to match specific herb sack IDs, ensuring accurate content matching.eherbs.licto match existing herb sack ID inUtility.get_lines()calls for container lookups.EHerbsmodule forresult,edible_result_contents, andliquid_result_contents.2.1.8to2.1.9ineherbs.licto reflect changes.This description was created by
for d1c38a5. You can customize this summary. It will automatically update as commits are pushed.