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

@YingChen0605

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

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