nvuillam / vscode-groovy-lint

VSCode extension to lint , correct and format groovy and Jenkinsfile
https://nvuillam.github.io/vscode-groovy-lint/
MIT License
69 stars 18 forks source link

properties are not formatted #169

Open ubmarco opened 1 year ago

ubmarco commented 1 year ago

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 commented 1 year ago

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 :/

github-actions[bot] commented 11 months ago

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.