Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/AAT-32/more_setup_cleanup' into …
Browse files Browse the repository at this point in the history
…AAT-32/more_setup_cleanup
  • Loading branch information
AdamMc331 committed Apr 29, 2023
2 parents 95440d9 + 3437b33 commit a5bf0b3
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/android_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ jobs:
run: ./gradlew test

- name: Lint Checks
run: ./gradlew detekt lintKotlin lint
run: ./gradlew detektAll lintKotlin lint
21 changes: 21 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ buildscript {
plugins {
// https://github.com/jeremymailen/kotlinter-gradle/releases
id("org.jmailen.kotlinter") version "3.13.0" apply false
id("io.gitlab.arturbosch.detekt").version(libs.versions.detektGradlePlugin)
}

apply(from = "buildscripts/githooks.gradle")
Expand All @@ -41,3 +42,23 @@ afterEvaluate {
dependsOn(":installGitHooks")
}
}

tasks {
/**
* The detektAll tasks enables parallel usage for detekt so if this project
* expands to multi module support, detekt can continue to run quickly.
*
* https://proandroiddev.com/how-to-use-detekt-in-a-multi-module-android-project-6781937fbef2
*/
@Suppress("UnusedPrivateMember")
val detektAll by registering(io.gitlab.arturbosch.detekt.Detekt::class) {
parallel = true
setSource(files(projectDir))
include("**/*.kt")
include("**/*.kts")
exclude("**/resources/**")
exclude("**/build/**")
config.setFrom(files("$rootDir/config/detekt/detekt.yml"))
buildUponDefaultConfig = false
}
}
5 changes: 3 additions & 2 deletions documentation/StaticAnalysis.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ This project leverages static analysis to ensure that the codebase meets certain

[Detekt](https://github.com/detekt/detekt) is a static analysis tool that checks for code smells. Examples include magic numbers, complicated conditionals, long methods, long parameter lists, and so much more. It is highly configurable, and if you choose to turn off any checks or customize thresholds you can do so in the [config file](/config/detekt/detekt.yml).

To run a detekt validation, use the following Gradle command:
To run a detekt validation, use the one of the following Gradle commands:

```
./gradlew detekt
./gradlew detekt # Runs over each module synchronously
./gradlew detektAll # Runs over each module in parallel.
```

## Ktlint
Expand Down
2 changes: 1 addition & 1 deletion git-hooks/pre-push.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
echo "Running static analysis."

./gradlew lintKotlin
./gradlew detekt
./gradlew detektAll

0 comments on commit a5bf0b3

Please sign in to comment.