Skip to content

ClassStartsWithBlankLineRule reports invalid violation when enums (or traits) have annotation on the same line as the definition #750

@s-ven

Description

@s-ven

After adding the following tests in ClassStartsWithBlankLineRuleTest I am getting violations when running ./gradlew test, (noticed the issue when migrating from v2.2.0 -> v3.3.0)

    @Test
    void test_Trait_BlankLineIsRequired() {
        final String SOURCE = '''
            import groovy.transform.CompileStatic
            
            @CompileStatic enum Foo {

                BAR, BAZ, BLAH
            }
        '''
        rule.blankLineRequired = true
        assertNoViolations(SOURCE)
    }

    @Test
    void test_Trait_BlankLineIsRequired() {
        final String SOURCE = '''
            import groovy.transform.CompileStatic
            
            @CompileStatic trait Foo {

                int getFoo() {
                    0
                }
            }
        '''
        rule.blankLineRequired = true
        assertNoViolations(SOURCE)
    }

Thank you

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