Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Verified Commit ebd18c48 authored by Fahim M. Choudhury's avatar Fahim M. Choudhury
Browse files

chore: add detekt plugin and rules for Compose code

parent bde91e0d
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ detekt {

dependencies {
    detektPlugins libs.detekt.formatting
    detektPlugins libs.detekt.compose
}

tasks.register('clean', Delete) {
+131 −0
Original line number Diff line number Diff line
@@ -7,6 +7,11 @@ naming:
  VariableNaming:
    active: false

  FunctionNaming:
    active: true
    ignoreAnnotated:
      - Composable


# Style rules
style:
@@ -14,8 +19,134 @@ style:
  ForbiddenComment:
    active: false

  MagicNumber:
    active: true
    ignorePropertyDeclaration: true

  UnusedPrivateMember:
    active: true
    ignoreAnnotated:
      - Preview

# Complexity rules
complexity:

  TooManyFunctions:
    ignorePrivate: true

  LongMethod:
    active: true
    ignoreAnnotated:
      - Composable

  CyclomaticComplexMethod:
    active: true
    ignoreAnnotated:
      - Composable

  LongParameterList:
    active: true
    ignoreAnnotated:
      - Composable

  NestedBlockDepth:
    active: true
    ignoreAnnotated:
      - Composable

Compose:
  ComposableAnnotationNaming:
    active: true

  ComposableNaming:
    active: true

  ComposableParamOrder:
    active: true

  CompositionLocalAllowlist:
    active: true

  CompositionLocalNaming:
    active: true

  ContentEmitterReturningValues:
    active: true

  ContentTrailingLambda:
    active: true

  ContentSlotReused:
    active: true

  DefaultsVisibility:
    active: true

  LambdaParameterEventTrailing:
    active: true

  LambdaParameterInRestartableEffect:
    active: true

  Material2:
    active: false

  ModifierClickableOrder:
    active: true

  ModifierComposed:
    active: true

  ModifierMissing:
    active: true

  ModifierNaming:
    active: true

  ModifierNotUsedAtRoot:
    active: true

  ModifierReused:
    active: true

  ModifierWithoutDefault:
    active: true

  MultipleEmitters:
    active: true

  MutableParams:
    active: true

  MutableStateAutoboxing:
    active: true

  MutableStateParam:
    active: true

  ParameterNaming:
    active: true

  PreviewAnnotationNaming:
    active: true

  PreviewNaming:
    active: false

  PreviewPublic:
    active: true

  RememberMissing:
    active: true

  RememberContentMissing:
    active: true

  UnstableCollections:
    active: false

  ViewModelForwarding:
    active: true

  ViewModelInjection:
    active: true
+2 −0
Original line number Diff line number Diff line
@@ -12,6 +12,7 @@ coreKtx = "1.15.0"
coreTesting = "2.2.0"
datastorePreferences = "1.1.2"
detektFormatting = "1.23.8"
detektCompose = "0.4.23"
elib = "0.0.1-alpha11"
espressoCore = "3.6.1"
hiltCompiler = "1.2.0"
@@ -79,6 +80,7 @@ core-ktx = { module = "androidx.core:core-ktx", version.ref = "coreKtx" }
core-testing = { module = "androidx.arch.core:core-testing", version.ref = "coreTesting" }
datastore-preferences = { module = "androidx.datastore:datastore-preferences", version.ref = "datastorePreferences" }
detekt-formatting = { module = "io.gitlab.arturbosch.detekt:detekt-formatting", version.ref = "detektFormatting" }
detekt-compose = { module = "io.nlopez.compose.rules:detekt", version.ref = "detektCompose" }
elib = { module = "foundation.e:elib", version.ref = "elib" }
ext-junit = { module = "androidx.test.ext:junit", version.ref = "junitVersion" }
espresso-core = { module = "androidx.test.espresso:espresso-core", version.ref = "espressoCore" }