forked from mihonapp/mihon
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding Detekt in the project (mihonapp#216)
* Removing ktlint * Removing compose lint * Adding initial Detekt config * Setting up detekt config * Adding detekt baseline * Fixing workflows * Moving to a module based solution * Adding new line * Adding new line * Updating baseline * Addressing PR suggestions * Regenerating baseline.xml * Cleanup --------- Co-authored-by: AntsyLich <[email protected]> (cherry picked from commit cc09230) # Conflicts: # .github/workflows/build_pull_request.yml # .github/workflows/build_push.yml
- Loading branch information
Showing
11 changed files
with
1,401 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import io.gitlab.arturbosch.detekt.Detekt | ||
import io.gitlab.arturbosch.detekt.DetektCreateBaselineTask | ||
import org.gradle.accessors.dm.LibrariesForLibs | ||
|
||
plugins { | ||
id("io.gitlab.arturbosch.detekt") | ||
} | ||
|
||
val libs = the<LibrariesForLibs>() | ||
dependencies { | ||
detektPlugins(libs.detekt.rules.formatting) | ||
detektPlugins(libs.detekt.rules.compose) | ||
} | ||
|
||
private val configFile = files("$rootDir/config/detekt/detekt.yml") | ||
private val baselineFile = file("$rootDir/config/detekt/baseline.xml") | ||
private val kotlinFiles = "**/*.kt" | ||
private val resourceFiles = "**/resources/**" | ||
private val buildFiles = "**/build/**" | ||
private val generatedFiles = "**/generated/**" | ||
private val scriptsFiles = "**/*.kts" | ||
|
||
detekt { | ||
buildUponDefaultConfig = true | ||
parallel = true | ||
autoCorrect = false | ||
ignoreFailures = false | ||
config.setFrom(configFile) | ||
baseline = file(baselineFile) | ||
} | ||
|
||
tasks.withType<Detekt>().configureEach { | ||
include(kotlinFiles) | ||
exclude(resourceFiles, buildFiles, generatedFiles, scriptsFiles) | ||
reports { | ||
html.required.set(true) | ||
xml.required.set(false) | ||
txt.required.set(false) | ||
} | ||
} | ||
|
||
tasks.withType<Detekt>().configureEach { | ||
jvmTarget = JavaVersion.VERSION_17.toString() | ||
} | ||
tasks.withType<DetektCreateBaselineTask>().configureEach { | ||
jvmTarget = JavaVersion.VERSION_17.toString() | ||
} |
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
naming: | ||
FunctionNaming: | ||
functionPattern: '[a-z][a-zA-Z0-9]*' | ||
ignoreAnnotated: [ 'Composable' ] | ||
TopLevelPropertyNaming: | ||
constantPattern: '[A-Z][A-Za-z0-9]*' | ||
|
||
complexity: | ||
LongParameterList: | ||
functionThreshold: 6 | ||
constructorThreshold: 7 | ||
ignoreDefaultParameters: true | ||
|
||
style: | ||
MagicNumber: | ||
ignorePropertyDeclaration: true | ||
ignoreCompanionObjectPropertyDeclaration: true | ||
UnusedPrivateMember: | ||
ignoreAnnotated: [ 'Preview' ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters