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
|
||||
repositories {
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
google()
|
||||
}
|
||||
|
||||
|
|
@ -15,7 +15,7 @@ dependencies {
|
|||
// android gradle plugin, required by custom plugin
|
||||
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")
|
||||
|
||||
// kotlin plugin, required by custom plugin
|
||||
|
|
|
|||
|
|
@ -62,7 +62,11 @@ class AndroidLinter : Linter {
|
|||
.mapNotNull { subproject: Project ->
|
||||
subproject
|
||||
.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
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,11 +43,11 @@ class DetektLinter : Linter {
|
|||
|
||||
config.setFrom(project.files("${extension.buildScriptDir!!}/static_analysis_configs/detekt-config.yml"))
|
||||
reports {
|
||||
txt.enabled = false
|
||||
html.enabled = false
|
||||
txt.required.set(false)
|
||||
html.required.set(false)
|
||||
xml {
|
||||
enabled = true
|
||||
destination = project.getDetektReportFile()
|
||||
required.set(true)
|
||||
outputLocation.set(project.getDetektReportFile())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,9 +4,9 @@ import com.android.build.gradle.AppExtension
|
|||
import org.gradle.api.Project
|
||||
import org.gradle.kotlin.dsl.getByType
|
||||
import static_analysis.linters.AndroidLinter
|
||||
import static_analysis.linters.CpdLinter
|
||||
import static_analysis.linters.DetektLinter
|
||||
import static_analysis.linters.Linter
|
||||
import java.util.Locale
|
||||
|
||||
class StaticAnalysisAndroidPlugin : StaticAnalysisPlugin() {
|
||||
|
||||
|
|
@ -17,26 +17,25 @@ class StaticAnalysisAndroidPlugin : StaticAnalysisPlugin() {
|
|||
extensions.getByType<AppExtension>().apply {
|
||||
applicationVariants.forEach { variant ->
|
||||
project.tasks.register("staticAnalysis${variant.name.capitalize()}") {
|
||||
setupStaticAnalysisTask(linters, variant.name)
|
||||
setupStaticAnalysisTask(linters, variant.name)
|
||||
}
|
||||
}
|
||||
|
||||
project.tasks.register("staticAnalysis") {
|
||||
setupStaticAnalysisTask(
|
||||
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(
|
||||
DetektLinter(),
|
||||
CpdLinter(),
|
||||
AndroidLinter()
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -73,7 +73,8 @@ complexity:
|
|||
threshold: 40
|
||||
LongParameterList:
|
||||
active: true
|
||||
threshold: 10
|
||||
functionThreshold: 10
|
||||
constructorThreshold: 10
|
||||
ignoreDefaultParameters: false
|
||||
MethodOverloading:
|
||||
active: false
|
||||
|
|
@ -268,7 +269,7 @@ potential-bugs:
|
|||
active: false
|
||||
LateinitUsage:
|
||||
active: false
|
||||
excludeAnnotatedProperties: ""
|
||||
ignoreAnnotated: []
|
||||
ignoreOnClassesPattern: ""
|
||||
UnconditionalJumpStatementInLoop:
|
||||
active: false
|
||||
|
|
@ -369,7 +370,7 @@ style:
|
|||
active: true
|
||||
UnnecessaryAbstractClass:
|
||||
active: false
|
||||
excludeAnnotatedClasses: "dagger.Module"
|
||||
ignoreAnnotated: ["dagger.Module"]
|
||||
UnnecessaryApply:
|
||||
active: true
|
||||
UnnecessaryInheritance:
|
||||
|
|
@ -389,7 +390,7 @@ style:
|
|||
allowedNames: "(_|ignored|expected|serialVersionUID)"
|
||||
UseDataClass:
|
||||
active: true
|
||||
excludeAnnotatedClasses: ""
|
||||
ignoreAnnotated: []
|
||||
UtilityClassWithPublicConstructor:
|
||||
active: false
|
||||
VarCouldBeVal:
|
||||
|
|
|
|||
Loading…
Reference in New Issue