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

properties are not formatted #169

Open
ubmarco opened this issue Jan 16, 2023 · 2 comments
Open

properties are not formatted #169

ubmarco opened this issue Jan 16, 2023 · 2 comments

Comments

@ubmarco
Copy link

ubmarco commented Jan 16, 2023

I have this simple Jenkinsfile where properties are not properly indented. The formatter does nothing on the properties section:

properties(
            [
        parameters(
            [
                booleanParam(defaultValue: true, description: '', name: 'bool1'),
                booleanParam(defaultValue: false, description: '', name: 'bool2'),
            choice(choices: ['a', 'b', 'c'], description: '', name: 'choice1'),
                string(defaultValue: 'important input', description: '', name: 'string1', trim: false)
            ]
        ),
            ]
)

def printParams() {
    params.each { param, value ->
        print "Parameter: ${param}, Value: ${value}"
    }
}

stage('Check jenkins') {
    printParams()
}

The code in def printParams() { and stage('Check jenkins') { is properly indented, however.
Generally it seems like the formatter does not really deal well with brackets. Those are almost never touched.

@nvuillam
Copy link
Owner

formatting relies on IndentationRule CodeNarc rule results -> https://codenarc.org/codenarc-rules-formatting.html#indentation-rule

Unfortunately is does not catch all indentation issues, but npm-groovy-lint uses CodeNarc v3.10, maybe in 3.20 it will be better, we'll see once after npm-groovy-lint will be upgraded :/

Copy link

This issue has been automatically marked as stale because it has not had recent activity.
It will be closed in 14 days if no further activity occurs.
Thank you for your contributions.

If you think this issue should stay open, please remove the O: stale 🤖 label or comment on the issue.

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

No branches or pull requests

2 participants