Skip to content

Create a custom modifier using a composable modifier factory is now recommended, however it is still failing "Avoid Modifier extension factory functions" #130

Description

@YingChen0605

Describe the bug

https://twitter.github.io/compose-rules/rules/#avoid-modifier-extension-factory-functions is no longer true now. Refer to the official documentation:

Note: In previous versions of Compose, we recommended against this approach and suggested using composed {} instead via a lint rule. Now that composed {} is not recommended, the lint rule has been removed.

To Reproduce
Steps to reproduce the behavior:
Adding a new Composable:

@Composable
private fun Modifier.modify(viewModel: xxViewModel) =  this then Modifier.viewable(onView = viewModel.onView)
        .margin(margin = viewModel.margin)

Expected behavior
It should not be flagged as a violation.

Screenshots
Screenshot 2024-08-05 at 12 21 31 PM

Environment
com.twitter.compose.rules.detekt of 0.0.26

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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