in relation to
JENKINS-51813, and the improvement of code, the PipelineSnippetGenerator code use some tests. But also, maybe even more important than the tests is to make the code more readable.
this if statement in particular:
is hard to follow.
These articles don't directly solve that example but should be reviewed on the different techniques that can be applied to make the code more readable.