-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Parsing Bug in Bazel Extract #8785
Comments
This issue has been labeled with This label will be replaced with If it's not clear what is missing to move this issue forward, ask for clarification in a new comment. If you think we already have what we need to move forward, mention this in a new comment. |
Hi there, The Renovate team needs your help! To fix the problem, we first need to know exactly what's causing the bug. A minimal reproduction help us to pinpoint the exact cause of the bug. To get started, please read our guide on minimal reproductions to understand what is needed. We may close the issue if you have not provided a minimal reproduction within two weeks. If you need more time, or are stuck, please ask for help or more time in a comment. Good luck, The Renovate team |
Hi @cpsauer, happy to accept a fix or reproduction |
1 similar comment
Hi @cpsauer, happy to accept a fix or reproduction |
Thanks @rarkins. I think I got you the repro info for both, right? I assume you'd want the "unit test" equivalent for the parsing issue ( For the two sub issues separately:
|
I'm ok with removing the current code if it's unhelpful. And if a unit test can successfully reproduce then that's fine too. We try to avoid adding any parsing that requires using child process, because that has always caused us pain before (setup.py, Gradle..). As a general rule: we don't aspire or need to fully parse any package file - just enough to correctly extract the dependencies most of the time. In rare cases where we fail to detect if people utilize weird syntax in a package file because they "can" and not "need", I'm not keen to add code to handle that. I think that making package definitions more semantic or parseable in order to utilize the benefits of Renovate's automation is hopefully a good-enough trade-off for most, although understand that sometimes the person wanting to add Renovate may not be empowered to make the modifications necessary in a big company. |
Thank you for providing a reproduction! 🎉 🚀 The Renovate team will take a look at the reproduction repository. Once we confirm the provided repository reproduces the problem, the label will be changed to |
Hi @cpsauer, don't you mind if I'll use your reproduction case as the test fixture in our code base? |
Wow! I was coming back to clean out the problematic code--that philosophy totally makes sense, @rarkins; thanks for explaining. But it looks like @zharinov has already taken things quite far in the better lexing/parsing direction. Awesome! @zharinov, of course you can. Thanks for digging into it and for asking :) Did you find the source of the problematic PR while working on the code? When I was looking, it seemed like it might be be a separate parsing bug from another layer, since I think it should have parsed correctly even with the problematic code in findBalancedParenIndex(). Ignoring commented lines will sidestep the issue, of course, but I'm wondering if there might be something else there. Three things that might be handy in the PR: |
🎉 This issue has been resolved in version 24.78.3 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
Hey awesome Renovate folks,
I was trying to track down a misparsing error that showed up in a Renovate PR. Along the way, I noticed what I'm pretty sure is a bug in the parser--though perhaps not the one causing my issue.
In particular, the comment says the parser should "if ["""] found then ignore all [)] until closing ["""] parsed." but doesn't seem to actually ignore ')' inside of a doctoring comment. Not sure how much this really matters, but it definitely doesn't do as the comment says.
A test case that shows the issue is
findBalancedParenIndex('""")""")')
. It returns -1, but should return 7 (the last index) after ignoring the first paren in the docstring. Could also add an assert checking that the parenNestingDepth is never negative.Here's the function in question:
https://github.com/renovatebot/renovate/blob/d2a71472223ce2cae3ffaa5ade6ad5f8c1a29423/lib/manager/bazel/extract.ts#L56:58
I think this is different from the parsing problem causing my real issue. In the real issue, Renovate tries to update an external dependency in a comment (which is nice, actually), but misparses somewhere and tries to eat the next function definition. The code in extract.ts looks to me like it handles this fine--I'm not sure where in the code is causing this bug.
Easiest way to show the error case was a screenshot:
Raw text for debugging:
Update: Yep, some different bug at work. findBalancedParenthases finds the right thing there.
Happy to help track down more tm, but it's late enough in my time zone that I better head to bed for now.
Thanks so much,
Chris
The text was updated successfully, but these errors were encountered: