Releases: appKODE/detekt-rules-compose
v1.4.0
v1.3.0
-
Several rules (
ReusedModifierInstance
,UnnecessaryEventHandlerParameter
) were switched to run only when Detekt is working in a type resolution mode. This is required to make these rules more robust and have less false positives (such as #5, #13). Expect more rules in this ruleset to support only running in the type resolution mode -
New experimental rule:
ConditionCouldBeLifted
It will detect cases when if-condition inside a composable layout call could be "lifted up" and the whole call could be moved into that
conditional expression, for example:Column { if (x == 3) { Text("1") Text("2") } }
could be turned into
if (x == 3) { Column { Text("1") Text("2") } }
At the moment it tries to be extra careful to avoid reporting any potentially side-effecting code (for example if
Column
in the example above would have someModifier
affecting a parent layout, this conditional-lifting change wouldn't be correct), and by being "extra" careful it can miss some potential cases for optimisation.This may be improved in future.
This rule is disabled by default due to its experimental state at the moment. If you want to try it, add the following rule to your
detektc-config.yaml
:compose: ConditionCouldBeLifted: active: true ignoreCallsWithArgumentNames: [ 'modifier', 'contentAlignment' ]
-
Bug fixes
v1.2.2
- New rule:
ComposeFunctionName
ensures that Composable functions which return Unit should start with upper-case while the ones that return a value should start with lower case - Improve
ReusedModifierInstance
to detect more cases, now it works correctly for cases when a composable call is wrapped in a conditional (and other expressions)
v1.2.1
v1.2.0
v1.1.0
- New rule:
ComposableParametersOrdering
ensures the order of required and optional parameters: first required, then optional - New rule:
ModifierDefaultValue
ensures thatmodifier
parameter has a correct default value - New rule:
MissingModifierDefaultValue
checks ifmodifier
default value is specified - Improved error messages (#2)
- Fixed false positive in
ComposableEventParameterNaming
(#6)
Enable new rules by adding them to your detekt-config.yml
:
compose:
# ...
ComposableParametersOrdering:
active: true
ModifierDefaultValue:
active: true
MissingModifierDefaultValue:
active: true