Skip to content

SpaceAfterOpeningBrace violates the switch statement first line in a trait. #733

@SergeyMormul

Description

@SergeyMormul

There is a violation of SpaceAfterOpeningBrace at the line switch (request) {. It says the opening brace of the closure is not followed by a space or whitespace. The class looks like the following:

trait MyTrait {
    String constructDateRange( Context context ) {
         def request = context.request
         switch ( request ) {
            case DateRangeRequest -> constructReportDate( request.isoStartDate, request.isoStopDate, context.dateFormat )
            case SingleDateRequest -> constructReportDate( request.isoReportDate, context.dateFormat )
            default -> null
        }
    }
  // ... constructReportDate methods
}

SpaceInsideParentheses is turned off.
JDK 17
Groovy 4.0.12
CodeNarc 3.2.0-groovy-4.0
Gradle 7.6

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