Skip to content

Add maximum nesting rule per composable #617

@ursusursus

Description

@ursusursus

I'd like to enforce maximum nesting per @Composable function to force dedicated @Composable sub functions for better readibility

I.e for this to be banned (obviously nonsensical, but the point is amount of nesting per named @Composable)

@Composable
fun Foo() {
    Box {
        Box {
            Box {
                Box {
                    Box {
                        Text("")
                    }
                }
            }
        }
    }
}

and therefore encouraging

Composable
fun Foo() {
    Box {
        Box {
            Box {
                Bar()
            }
        }
    }
}

@Composable
private fun Bar() {
    Box {
        Box {
            Text("")
        }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions