Skip to content

compose:naming-check is not honored in subclasses #129

Closed as not planned
Closed as not planned
@Goooler

Description

@Goooler

Describe the bug

Code sample:

import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier

sealed interface Screen {

  @Suppress("ktlint:compose:naming-check")
  @Composable
  fun content(modifier: Modifier)

  data object Main : Screen {
    @Composable
    override fun content(modifier: Modifier) {}
  }
}

run ktlint check:

Step 'ktlint' found problem in 'src/main/java/Screen.kt':
Error on line: 12, column: 18
rule: compose:naming-check
Composable functions that return Unit should start with an uppercase letter.
They are considered declarative entities that can be either present or absent in a composition and therefore follow the naming rules for classes.

To Reproduce

Try with the sample above.

Expected behavior

No warning thrown like in AS

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions