Skip to content

Indentation issue #787

@mosheavni

Description

@mosheavni

I see some indentation issues
when calling a function that's defined like so:

def myFunc(Map args=[:]) {
    println args.foo
    println args.bar
    println args.baz
}

and splitting the parameters in the function call like so:

desired output:

myFunc(
    foo: 1,
    bar: 2,
    baz: 3,
)

actual output:

myFunc(
foo: 1,
bar: 2,
baz: 3,
)

The parameters are not indented correctly.

Also, on a multiline string, it's not indented, maybe that is intentional to avoid adding unwanted indentation in multi line text blocks.

code:

def myFunc() {
def multiLineText = '''
hello
line
another line
'''
}

desired output:

def myFunc() {
    def multiLineText = '''
        hello
        line
        another line
    '''
}

actual:

def myFunc() {
    def multiLineText = '''
hello
line
another line
'''
}

Maybe there's a rule to indent multiline text blocks?

related:
nvuillam/npm-groovy-lint#379

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions