Skip to content

(groovy) strings are not allowed inside ternary clauses #2217

@paladox

Description

@paladox

If you do for example:

def createCodeStyleMsgBody(build, label) {
    def codeStyleFiles = findCodestyleFilesInLog(build)
    def formattingMsg = label < 0 ? ('The following files need formatting:\n    ' +
        codeStyleFiles.join('\n    ')) : 'All files are correctly formatted'
    def url = build.url + "consoleText"

    return "${Globals.resTicks[build.result]} $formattingMsg\n    (${url})"
}

'The following files need formatting:\n ' is not highlighted correctly as a string, secondly everything after ' + is coloured in blue (so if you create another def after, it colours all that in blue).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions