Compare commits
14 Commits
master
...
build_scri
| Author | SHA1 | Date |
|---|---|---|
|
|
eb65ee351d | |
|
|
e05b0df331 | |
|
|
427d838a12 | |
|
|
71765283c1 | |
|
|
0014ddbc0c | |
|
|
f7983756c2 | |
|
|
063545f64a | |
|
|
89f7c81b71 | |
|
|
731e68403e | |
|
|
67c2f87567 | |
|
|
2a8093a96b | |
|
|
cbef9230ce | |
|
|
ac24ca6340 | |
|
|
2996e2674e |
|
|
@ -14,23 +14,30 @@ class AndroidLinter : Linter {
|
|||
|
||||
override val name: String = "Android lint"
|
||||
|
||||
override fun getErrors(project: Project): List<StaticAnalysisError> = xmlParser(project.getLintReportFile())
|
||||
.typedChildren()
|
||||
.filter { it.name() == "issue" && (it.attribute("severity") as String) == "Error" }
|
||||
.map { errorNode ->
|
||||
errorNode
|
||||
.typedChildren()
|
||||
.filter { it.name() == "location" }
|
||||
.map { locationNode ->
|
||||
AndroidLintError(
|
||||
filePath = locationNode.attribute("file") as String,
|
||||
fileLine = locationNode.attribute("line") as String?,
|
||||
errorId = errorNode.attribute("id") as String,
|
||||
description = errorNode.attribute("message") as String
|
||||
)
|
||||
}
|
||||
}
|
||||
.flatten()
|
||||
override fun getErrors(project: Project): List<StaticAnalysisError> {
|
||||
val lintRepostFile = project.getLintReportFile()
|
||||
return if (lintRepostFile.exists()) {
|
||||
xmlParser(lintRepostFile)
|
||||
.typedChildren()
|
||||
.filter { it.name() == "issue" && (it.attribute("severity") as String) == "Error" }
|
||||
.map { errorNode ->
|
||||
errorNode
|
||||
.typedChildren()
|
||||
.filter { it.name() == "location" }
|
||||
.map { locationNode ->
|
||||
AndroidLintError(
|
||||
filePath = locationNode.attribute("file") as String,
|
||||
fileLine = locationNode.attribute("line") as String?,
|
||||
errorId = errorNode.attribute("id") as String,
|
||||
description = errorNode.attribute("message") as String
|
||||
)
|
||||
}
|
||||
}
|
||||
.flatten()
|
||||
} else {
|
||||
emptyList()
|
||||
}
|
||||
}
|
||||
|
||||
override fun setupForProject(project: Project, extension: StaticAnalysisExtension) {
|
||||
project.beforeEvaluate {
|
||||
|
|
@ -62,7 +69,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
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ class CpdLinter : Linter {
|
|||
isSkipLexicalErrors = true
|
||||
language = "kotlin"
|
||||
minimumTokenCount = 60
|
||||
encoding = "UTF-8"
|
||||
}
|
||||
tasks.withType<Cpd> {
|
||||
reports.xml.required.set(true)
|
||||
|
|
|
|||
|
|
@ -32,9 +32,9 @@ class StaticAnalysisAndroidPlugin : StaticAnalysisPlugin() {
|
|||
}
|
||||
}
|
||||
|
||||
//TODO: return CpdLinter after finding better way to disable it
|
||||
override fun createLinters(): List<Linter> = listOf(
|
||||
DetektLinter(),
|
||||
CpdLinter(),
|
||||
AndroidLinter()
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue