Skip to content
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

MethodParamPad breaks Jenkinsfile #3783

Closed
hazendaz opened this issue Dec 7, 2023 · 3 comments · Fixed by #3792
Closed

MethodParamPad breaks Jenkinsfile #3783

hazendaz opened this issue Dec 7, 2023 · 3 comments · Fixed by #3792
Assignees
Labels
bug Something isn't working parser-groovy

Comments

@hazendaz
Copy link

hazendaz commented Dec 7, 2023

Using static analysis 1.1.2 and has been occurring last few versions best I can tell.

Using rewrite-maven-plugin 5.15.2

Only change picked up in repo I'm working with is that it touched my Jenkinsfile unexpectedly. It has taken the trailing space after every occurrence of 'library ' which causes it to be squashed to the next word and thus breaks Jenkins.

Only two recipe's ran as part of this

org.openrewrite.staticanalysis.CodeCleanup
org.openrewrite.java.RemoveUnusedImports

Broken items

library '...' becomes library'...'
library identifier becomes libraryidentifier

@hazendaz hazendaz added the bug Something isn't working label Dec 7, 2023
@timtebeek timtebeek transferred this issue from openrewrite/rewrite-static-analysis Dec 7, 2023
@timtebeek
Copy link
Contributor

hi @hazendaz ; sorry to hear about these issues! I've moved the issue as I think the problem lies in our Groovy handling, not as much the individual recipe. We had a similar report the other day in #3777 and #3737, after we started parsing Jenkinsfiles as Groovy in 4d74818 and 7ed7222. I've asked the team if there's a common fix we can apply to get this resolved, such that you can still target Jenkinsfiles with Java/Groovy recipes, without these issues.

As a workaround you can force Jenkinsfiles to be parsed as text by passing in a plaintext mask to the OSS Maven and Gradle plugins, or excluding Jenkinsfiles from parsing for now while we work through this issue.

timtebeek added a commit that referenced this issue Dec 7, 2023
knutwannheden added a commit that referenced this issue Dec 7, 2023
In Groovy method calls don't always have parentheses around the arguments. In that case the space between the method name and first argument must not be removed.

Fixes: #3783
@knutwannheden knutwannheden linked a pull request Dec 8, 2023 that will close this issue
@github-project-automation github-project-automation bot moved this from Backlog to Done in OpenRewrite Dec 8, 2023
@hazendaz
Copy link
Author

@timtebeek This issue is still not resolved. I think your PR that you closed #3789 would have solved by simply stop touching Jenkinsfile. Instead comment was made that others fixes correct but none of that did. I've updated every single version since including that from tonight and its still a problem right now.

@timtebeek
Copy link
Contributor

Sounds like a very similar case to what we discussed over on openrewrite/rewrite-static-analysis#233 (comment)
That was fixed in this PR, which I think applies here as well; thanks again for bringing this up and testing intermediate versions!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment