Skip to content

Releases: appKODE/detekt-rules-compose

v1.4.0

22 Aug 14:30
Compare
Choose a tag to compare
  • Merge ModifierParameterPosition rule into the ComposableParametersOrdering rule. After upgrading to the new version of this ruleset, ModifierParameterPosition should be removed from the detekt-config.yml file
  • Add support for building fat jars
  • Bugfixes

v1.3.0

27 Jul 14:08
Compare
Choose a tag to compare
  • 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 some Modifier 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

30 Sep 13:13
Compare
Choose a tag to compare
  • 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

14 Aug 13:16
Compare
Choose a tag to compare
  • Ignore composable functions in interfaces/abstract classes for MissingModifierDefaultValue

v1.2.0

14 Aug 12:26
Compare
Choose a tag to compare
  • New rule: TopLevelComposableFunctions ensures that all composable functions are top-level functions (disabled by default)
  • Ignore overridden functions in MissingModifierDefaultValue (#11)
  • Fix exception in UnnecessaryEventHandlerParameter (#14)

v1.1.0

02 Jul 21:43
Compare
Choose a tag to compare
  • New rule: ComposableParametersOrdering ensures the order of required and optional parameters: first required, then optional
  • New rule: ModifierDefaultValue ensures that modifier parameter has a correct default value
  • New rule: MissingModifierDefaultValue checks if modifier 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

v1.0.1

31 May 12:20
Compare
Choose a tag to compare
  • Update ModifierParameterPosition rule to better follow Compose style: modifier parameter should be a first optional parameter, i.e. it should come after required parameters and before optional parameters

v1.0.0

19 May 13:08
Compare
Choose a tag to compare
Add CHANGELOG.md