Compare commits
6 Commits
master
...
build_scri
| Author | SHA1 | Date |
|---|---|---|
|
|
4301c79e8c | |
|
|
67c2f87567 | |
|
|
2a8093a96b | |
|
|
cbef9230ce | |
|
|
ac24ca6340 | |
|
|
2996e2674e |
|
|
@ -7,7 +7,7 @@ plugins {
|
||||||
|
|
||||||
// The kotlin-dsl plugin requires a repository to be declared
|
// The kotlin-dsl plugin requires a repository to be declared
|
||||||
repositories {
|
repositories {
|
||||||
jcenter()
|
mavenCentral()
|
||||||
google()
|
google()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -15,7 +15,7 @@ dependencies {
|
||||||
// android gradle plugin, required by custom plugin
|
// android gradle plugin, required by custom plugin
|
||||||
implementation("com.android.tools.build:gradle:4.0.1")
|
implementation("com.android.tools.build:gradle:4.0.1")
|
||||||
|
|
||||||
implementation("io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.10.0")
|
implementation("io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.19.0")
|
||||||
implementation("de.aaschmid:gradle-cpd-plugin:3.1")
|
implementation("de.aaschmid:gradle-cpd-plugin:3.1")
|
||||||
|
|
||||||
// kotlin plugin, required by custom plugin
|
// kotlin plugin, required by custom plugin
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,11 @@ class AndroidLinter : Linter {
|
||||||
.mapNotNull { subproject: Project ->
|
.mapNotNull { subproject: Project ->
|
||||||
subproject
|
subproject
|
||||||
.tasks
|
.tasks
|
||||||
.find { task -> task.name.contains(buildType, ignoreCase = true) && task.name.contains("lint") }
|
.find { task ->
|
||||||
|
task.name.contains(buildType, ignoreCase = true)
|
||||||
|
&& task.name.contains("lint")
|
||||||
|
&& !task.name.contains("lintVital")
|
||||||
|
}
|
||||||
?.path
|
?.path
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,11 +43,11 @@ class DetektLinter : Linter {
|
||||||
|
|
||||||
config.setFrom(project.files("${extension.buildScriptDir!!}/static_analysis_configs/detekt-config.yml"))
|
config.setFrom(project.files("${extension.buildScriptDir!!}/static_analysis_configs/detekt-config.yml"))
|
||||||
reports {
|
reports {
|
||||||
txt.enabled = false
|
txt.required.set(false)
|
||||||
html.enabled = false
|
html.required.set(false)
|
||||||
xml {
|
xml {
|
||||||
enabled = true
|
required.set(true)
|
||||||
destination = project.getDetektReportFile()
|
outputLocation.set(project.getDetektReportFile())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,9 @@ import com.android.build.gradle.AppExtension
|
||||||
import org.gradle.api.Project
|
import org.gradle.api.Project
|
||||||
import org.gradle.kotlin.dsl.getByType
|
import org.gradle.kotlin.dsl.getByType
|
||||||
import static_analysis.linters.AndroidLinter
|
import static_analysis.linters.AndroidLinter
|
||||||
import static_analysis.linters.CpdLinter
|
|
||||||
import static_analysis.linters.DetektLinter
|
import static_analysis.linters.DetektLinter
|
||||||
import static_analysis.linters.Linter
|
import static_analysis.linters.Linter
|
||||||
|
import java.util.Locale
|
||||||
|
|
||||||
class StaticAnalysisAndroidPlugin : StaticAnalysisPlugin() {
|
class StaticAnalysisAndroidPlugin : StaticAnalysisPlugin() {
|
||||||
|
|
||||||
|
|
@ -17,26 +17,25 @@ class StaticAnalysisAndroidPlugin : StaticAnalysisPlugin() {
|
||||||
extensions.getByType<AppExtension>().apply {
|
extensions.getByType<AppExtension>().apply {
|
||||||
applicationVariants.forEach { variant ->
|
applicationVariants.forEach { variant ->
|
||||||
project.tasks.register("staticAnalysis${variant.name.capitalize()}") {
|
project.tasks.register("staticAnalysis${variant.name.capitalize()}") {
|
||||||
setupStaticAnalysisTask(linters, variant.name)
|
setupStaticAnalysisTask(linters, variant.name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
project.tasks.register("staticAnalysis") {
|
project.tasks.register("staticAnalysis") {
|
||||||
setupStaticAnalysisTask(
|
setupStaticAnalysisTask(
|
||||||
linters = linters,
|
linters = linters,
|
||||||
buildVariant = applicationVariants.first { it.name.contains("Debug") }.name
|
buildVariant = applicationVariants.first { it.name.toLowerCase(Locale.ROOT).contains("debug") }.name
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//TODO: return CpdLinter after finding better way to disable it
|
||||||
override fun createLinters(): List<Linter> = listOf(
|
override fun createLinters(): List<Linter> = listOf(
|
||||||
DetektLinter(),
|
DetektLinter(),
|
||||||
CpdLinter(),
|
|
||||||
AndroidLinter()
|
AndroidLinter()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,8 @@ complexity:
|
||||||
threshold: 40
|
threshold: 40
|
||||||
LongParameterList:
|
LongParameterList:
|
||||||
active: true
|
active: true
|
||||||
threshold: 10
|
functionThreshold: 10
|
||||||
|
constructorThreshold: 10
|
||||||
ignoreDefaultParameters: false
|
ignoreDefaultParameters: false
|
||||||
MethodOverloading:
|
MethodOverloading:
|
||||||
active: false
|
active: false
|
||||||
|
|
@ -268,7 +269,7 @@ potential-bugs:
|
||||||
active: false
|
active: false
|
||||||
LateinitUsage:
|
LateinitUsage:
|
||||||
active: false
|
active: false
|
||||||
excludeAnnotatedProperties: ""
|
ignoreAnnotated: []
|
||||||
ignoreOnClassesPattern: ""
|
ignoreOnClassesPattern: ""
|
||||||
UnconditionalJumpStatementInLoop:
|
UnconditionalJumpStatementInLoop:
|
||||||
active: false
|
active: false
|
||||||
|
|
@ -369,7 +370,7 @@ style:
|
||||||
active: true
|
active: true
|
||||||
UnnecessaryAbstractClass:
|
UnnecessaryAbstractClass:
|
||||||
active: false
|
active: false
|
||||||
excludeAnnotatedClasses: "dagger.Module"
|
ignoreAnnotated: ["dagger.Module"]
|
||||||
UnnecessaryApply:
|
UnnecessaryApply:
|
||||||
active: true
|
active: true
|
||||||
UnnecessaryInheritance:
|
UnnecessaryInheritance:
|
||||||
|
|
@ -389,7 +390,7 @@ style:
|
||||||
allowedNames: "(_|ignored|expected|serialVersionUID)"
|
allowedNames: "(_|ignored|expected|serialVersionUID)"
|
||||||
UseDataClass:
|
UseDataClass:
|
||||||
active: true
|
active: true
|
||||||
excludeAnnotatedClasses: ""
|
ignoreAnnotated: []
|
||||||
UtilityClassWithPublicConstructor:
|
UtilityClassWithPublicConstructor:
|
||||||
active: false
|
active: false
|
||||||
VarCouldBeVal:
|
VarCouldBeVal:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue