You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We're using Spotless with greclipse() to format Groovy scripts and Jenkinsfiles. We ran into a behaviour where multiple consecutive bare @Library annotations get reformatted unexpectedly.
The second and third @Library lines get indented as if they are continuations of the previous expression (greclipse appears not to recognise that each annotation is a standalone statement without an immediately following class/method declaration).
Workaround we used:
Merging into a single statement with the array form satisfies greclipse: @Library(["pipeline-abc@1.0", "pipeline-def@2.0", "pipeline-hij@3.0"]) _
Is this a known limitation of how greclipse handles annotation sequences without a following declaration?
Is there a greclipse configuration option (e.g., formatter preferences) that prevents it from merging/indenting such annotation sequences?
Would it be feasible for Spotless to detect this pattern (bare annotation not followed by a declaration) and leave it untouched, or is this entirely a greclipse concern?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
We're using Spotless with greclipse() to format Groovy scripts and Jenkinsfiles. We ran into a behaviour where multiple consecutive bare @Library annotations get reformatted unexpectedly.
Original Jenkinsfile:
or
formatting works with following but not valid Jenkinsfile syntax
After spotlessApply:
The second and third @Library lines get indented as if they are continuations of the previous expression (greclipse appears not to recognise that each annotation is a standalone statement without an immediately following class/method declaration).
Workaround we used:
Merging into a single statement with the array form satisfies greclipse:
@Library(["pipeline-abc@1.0", "pipeline-def@2.0", "pipeline-hij@3.0"]) _This works, but it changes the meaning of the file structurally (it is the https://www.jenkins.io/doc/book/pipeline/shared-libraries/#using-libraries for multiple libraries, but not everyone uses it).
Questions:
Configuration used:
Beta Was this translation helpful? Give feedback.
All reactions