-
Notifications
You must be signed in to change notification settings - Fork 547
feat: add multiline string finder in helper script #1690
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.
I like the idea. Is there any way we could add a test for this functionality?
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.
Looks good!
There are some scenarios where the script could possibly improve
- Catching version string when the lines that matter are not adjacent but is after a couple lines. Example:
r"var PACKAGE_NAME = 'gnome\-shell';\r?\n/\* The version of this package \*/\r?\nvar PACKAGE_VERSION = '([0-9]+\.[0-9]+(\.[0-9]+)?)';" - Catching version string when the line with version is before and the other relevant string (with package name) is after.
Co-authored-by: Bread Genie <[email protected]>
what should be the maximum line gap between the product string and version string? if the line gap is too high then the signature won't be that good, right? @BreadGenie |
@b31ngd3v We could give a maximum line gap but we can also do without it. Example: The |
@BreadGenie don't you think we should use non-greedy mode |
@b31ngd3v yep |
Codecov Report
@@ Coverage Diff @@
## main #1690 +/- ##
==========================================
+ Coverage 78.55% 81.86% +3.30%
==========================================
Files 298 298
Lines 6216 6258 +42
Branches 1011 1023 +12
==========================================
+ Hits 4883 5123 +240
+ Misses 1115 931 -184
+ Partials 218 204 -14
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more |
jackson-databind gnome-shell @BreadGenie what do you think? |
|
@b31ngd3v it looks nice, but do we need multiline pattern when a single line pattern exist? Or we could mark the single line pattern as a better choice in the output? |
good idea! if a single line pattern exists, then we should only print that one. |
@BreadGenie btw what do you think about this? |
Yep |
We will only need one of those and should be used if we don't have any other choices. Multiline patterns could end up being expensive. Also I didn't get what you meant by bare version |
by bare version, i meant the second part (after |
It could work in multiline mode but it could also generate false positives, so we can remove that. |
cleaned up the output, previously it was printing all combinations of version strings and product strings after comparing the line numbers, now it's only printing the combinations of version strings and the closest product string line to that version string after comparing the line numbers. and also if a one line signature exists then it's going to ignore all multi-line signatures. gnome-shell [it's printing the same signature two times, because those two are in different lines in the binary] jackson-databind |
thanks @BreadGenie for helping me out with this PR |
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.
This is going to be a very helpful feature, thank you! I have a feeling we might want to do some more precise tests later making sure it found specific expected patterns rather than "just not the max glob" but this should at least get us some basic coverage on the code.
Uh oh!
There was an error while loading. Please reload this page.