mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-14 18:05:27 +07:00
QD-7556 Fix ancestor calculation for groups
GitOrigin-RevId: c58c27f3f5e16e5aa0774b1831dc89f4f4446103
This commit is contained in:
committed by
intellij-monorepo-bot
parent
3a436c20c6
commit
ade3723be1
@@ -16,7 +16,7 @@ class InspectionCategoryGroupProvider : InspectionGroupProvider {
|
||||
|
||||
override fun includesInspection(tool: InspectionToolWrapper<*, *>): Boolean {
|
||||
return try {
|
||||
tool.groupPath.makeCategoryId().startsWith(category)
|
||||
category.isAncestor(tool.groupPath.makeCategoryId())
|
||||
}
|
||||
catch (e: AssertionError) {
|
||||
false
|
||||
@@ -26,8 +26,15 @@ class InspectionCategoryGroupProvider : InspectionGroupProvider {
|
||||
}
|
||||
}
|
||||
|
||||
private fun String.isAncestor(categoryId: String): Boolean {
|
||||
if (this.isEmpty() || categoryId.isEmpty()) return false
|
||||
val normalizedAncestor = this.removeSuffix("/") + "/"
|
||||
val normalizedCategoryId = categoryId.removeSuffix("/") + "/"
|
||||
return normalizedCategoryId.startsWith(normalizedAncestor)
|
||||
}
|
||||
|
||||
fun Array<String>.makeCategoryId(): String {
|
||||
return map { escapeToolGroupPathElement(it) }.joinToString("/")
|
||||
return joinToString("/") { escapeToolGroupPathElement(it) }
|
||||
}
|
||||
|
||||
fun escapeToolGroupPathElement(path: String): String {
|
||||
|
||||
Reference in New Issue
Block a user