Compare commits

...

13 Commits

Author SHA1 Message Date
Maksim Pozdeev e05b0df331 Changed listOf to emptyList 2022-08-04 15:58:27 +04:00
Maksim Pozdeev 427d838a12 Added reuse report file parameter 2022-08-04 15:14:09 +04:00
Maksim Pozdeev 71765283c1 Changed try/catch to check file existence 2022-08-04 15:12:34 +04:00
Maksim Pozdeev 0014ddbc0c Merge branch 'build_scripts_ubrr_android/disabled_cpd' into ubrir_linters_fix 2022-08-04 14:39:58 +04:00
Maksim Pozdeev f7983756c2
Merge pull request #318 from TouchInstinct/merge_master_to_ubrr
master -> build_scripts_ubrr_android/disabled_cpd
2022-08-04 14:38:28 +04:00
Maksim Pozdeev 063545f64a Merge branch 'build_scripts_ubrr_android/disabled_cpd' into merge_master_to_ubrr 2022-08-04 14:22:43 +04:00
Maksim Pozdeev 89f7c81b71 Merge branch 'build_scripts_ubrr_android/disabled_cpd' into ubrir_linters_fix 2022-08-04 14:05:02 +04:00
Maksim Pozdeev 731e68403e Fixed cdp linter and android linter 2022-08-04 14:04:35 +04:00
kostikum 67c2f87567
Merge pull request #283 from TouchInstinct/build_scripts_ubrr_android/fix_task_list_for_android_linter
fix correct task search for android linter
2021-10-28 16:08:15 +07:00
Konstantin Kuzhim 2a8093a96b fix correct task search for android linter 2021-10-27 23:19:26 +07:00
sysoevi cbef9230ce
Merge pull request #262 from TouchInstinct/static_analysis/disable_cpd
Build script ubrr android/disable cpd
2021-05-19 16:29:23 +04:00
Igor Sysoev ac24ca6340 added todo to createLinters() method in StaticAnalysisAndroidPlugin 2021-05-19 16:28:23 +04:00
Igor Sysoev 2996e2674e removed cpd 2021-05-19 15:59:29 +04:00
3 changed files with 31 additions and 19 deletions

View File

@ -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
}
}

View File

@ -39,6 +39,7 @@ class CpdLinter : Linter {
isSkipLexicalErrors = true
language = "kotlin"
minimumTokenCount = 60
encoding = "UTF-8"
}
tasks.withType<Cpd> {
reports.xml.required.set(true)

View File

@ -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()
)