-
Notifications
You must be signed in to change notification settings - Fork 80
fix(gradle): Correctly parse wildcard configuration properties (IDETECT-4853) #1570
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
base: master
Are you sure you want to change the base?
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.
Pull Request Overview
This PR fixes a Gradle init script parsing error that occurred when property values contained wildcards. The issue was caused by single quotes in the template causing Groovy to misinterpret wildcard characters as multiplication operators, resulting in MissingPropertyException.
Key changes:
- Modified string literal quoting in the Gradle init script template to use triple-double quotes instead of single quotes
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
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.
Change seems okay. I'm seeing similar single quote code on lines 11 to 14. Not sure if these need to be addressed as well?
I tried to understand the full cause of the issue but I'm finding it difficult to do so because there are layers of complexity: how Groovy interprets what is given to it, and how the template engine interprets and renders what is given to it. The main benefits of triple quotes seem to be that they allow for multi-line strings? I'm guessing the list of filters was getting rendered across multiple lines? Also, I'm curious if you tested this with longer lists of filters - something like |
@andrian-sevastyanov
The build failed because it tried to find a property named By changing the template to use triple-double quotes ("""..."""): |
Thanks, @bd-samratmuk. Any idea where the extra inner |
@andrian-sevastyanov I tried investigating that. My guess is that the value passed was wrapped in single quote and then the template also wrapped in single quote hence the quote appeared twice. When using triple quotes that extra quote is not appearing by ensuring the final output is a single, well-formed string literal regardless of what the input value contains. |
@bd-samratmuk, I haven't been able to find anything in FTL documentation that would suggest that inner quotes would be rendered differently in such cases. |
@andrian-sevastyanov |
Thanks, @bd-samratmuk. While this change can be merged as-is, I'm not convinced that the originally-reported issue has been addressed. I've shared some info in other channels for you to consider. |
This change addresses a parsing error in the Gradle init script that occurred when property values contained wildcards.
Issue:
When a property like detect.gradle.included.configurations was set to a value with wildcards (e.g., ompile), the Groovy script failed. The template used single quotes, causing Groovy to interpret the * as a multiplication operator instead of a character in a string, which resulted in a MissingPropertyException.
Fix:
The template has been modified to wrap the filter properties in triple-double quotes ("""..."""). This ensures that Groovy correctly interprets the value as a single string literal, allowing wildcards to be processed as intended by the matching logic.