File tree Expand file tree Collapse file tree 5 files changed +661
-2
lines changed
app/src/test/kotlin/com/fernandocejas/sample/features/movies Expand file tree Collapse file tree 5 files changed +661
-2
lines changed Original file line number Diff line number Diff line change @@ -55,6 +55,7 @@ Here are some useful Gradle/adb commands for executing this example:
5555 * ` ./gradlew runUnitTests ` - Execute unit tests (both unit and integration).
5656 * ` ./gradlew runAcceptanceTests ` - Execute acceptance and instrumentation tests in the connected device.
5757 * ` ./gradlew runTestCoverage ` - Reports code coverage on tests within the Android codebase.
58+ * ` ./gradlew runStaticCodeAnalysis ` - Run static analysis on the Android codebase.
5859
5960## Discussions
6061Refer to the issues section: https://github.com/android10/Android-CleanArchitecture-Kotlin/issues
Original file line number Diff line number Diff line change @@ -122,7 +122,7 @@ class MoviesRepositoryTest : UnitTest() {
122122 val movieDetails = networkRepository.movieDetails(1 )
123123
124124 movieDetails shouldEqual Right (MovieDetails .empty())
125- verify(exactly = 1 ) {service.movieDetails(1 ) }
125+ verify(exactly = 1 ) { service.movieDetails(1 ) }
126126 }
127127
128128 @Test fun `should get movie details from service` () {
Original file line number Diff line number Diff line change 11object Dependencies {
22 const val AndroidBuildTools = " com.android.tools.build:gradle:4.0.1"
3+ const val detektGradlePlugin = " io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.14.1"
34}
45
56plugins {
@@ -14,4 +15,5 @@ repositories {
1415
1516dependencies {
1617 implementation(Dependencies .AndroidBuildTools )
18+ implementation(Dependencies .detektGradlePlugin)
1719}
Original file line number Diff line number Diff line change 11package scripts
22
3+ import io.gitlab.arturbosch.detekt.Detekt
34import scripts.Variants_gradle.*
45
56plugins {
67 id(" com.android.application" ) apply false
78 id(" jacoco" )
9+ id(" io.gitlab.arturbosch.detekt" )
810}
911
1012android {
@@ -71,4 +73,29 @@ tasks.register("runTestCoverage") {
7173 group = " Quality"
7274 description = " Report code coverage on tests within the Android codebase."
7375 dependsOn(" jacocoReport" )
74- }
76+ }
77+
78+ val detektAll by tasks.registering(Detekt ::class ) {
79+ group = " Quality"
80+ description = " Runs a detekt code analysis ruleset on the Android codebase."
81+ parallel = true
82+ buildUponDefaultConfig = true
83+
84+ setSource(files(rootProject.projectDir))
85+ config.setFrom(project.rootDir.resolve(" config/detekt/detekt.yml" ))
86+
87+ include(" **/*.kt" )
88+ exclude(" **/*.kts" , " */build/*" , " /buildSrc" )
89+
90+ reports {
91+ xml.enabled = true
92+ html.enabled = true
93+ txt.enabled = false
94+ }
95+ }
96+
97+ tasks.register(" runStaticCodeAnalysis" ) {
98+ description = " Run static analysis on the Android codebase."
99+ dependsOn(detektAll)
100+ }
101+
You can’t perform that action at this time.
0 commit comments