appKODE / detekt-rules-compose

A collection of Detekt rules for Jetpack Compose
MIT License
136 stars 8 forks source link

False positive in ModifierHeightWithText rule #25

Open dimsuz opened 1 year ago

dimsuz commented 1 year ago

This piece of code

Row(
  modifier = Modifier
    .height(IntrinsicSize.Min),
) {
  Text(
    modifier = Modifier
      .fillMaxHeight(),
    text = "Hello world",
  )
}

results in an error:

Composable uses "height" modifier and contains a Text child. Use heightIn(min = N.dp) instead [ModifierHeightWithText]

which is incorrect as this doesn't make sense for IntrinsicSize overload of height.

Exception is needed for this specific usage.