Merge pull request #317 from TouchInstinct/ubrir_linters_fix
Ubrir linters fix
This commit is contained in:
commit
eb65ee351d
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ class CpdLinter : Linter {
|
|||
isSkipLexicalErrors = true
|
||||
language = "kotlin"
|
||||
minimumTokenCount = 60
|
||||
encoding = "UTF-8"
|
||||
}
|
||||
tasks.withType<Cpd> {
|
||||
reports.xml.required.set(true)
|
||||
|
|
|
|||
Loading…
Reference in New Issue