Skip to content

Commit 991e999

Browse files
committed
refactor(CodeProblemAnalysis): simplify error list processing
Remove redundant conversion to MutableList before calling distinct() and directly use joinToString() on the distinct results.
1 parent 26a52fc commit 991e999

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/main/kotlin/cc/unitmesh/devti/actions/chat/base/CodeProblemAnalysis.kt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import com.intellij.openapi.project.Project
77
import com.intellij.psi.PsiElement
88

99
private val CANONICAL_NAME_REGEX_PATTERN = Regex("""\(([a-zA-Z]+(\.[a-zA-Z]+)+(\.[a-zA-Z0-9_]+))\)""")
10+
1011
/**
1112
* Extracts canonical names from the given item using regex.
1213
*
@@ -40,11 +41,7 @@ fun collectProblems(project: Project, editor: Editor, element: PsiElement): Stri
4041
}
4142

4243
val commentSymbol = commentPrefix(element)
43-
// remove dupcliated descriptions
44-
errors = errors.distinct().toMutableList()
45-
return errors.joinToString("\n") {
46-
"$commentSymbol - $it"
47-
}
44+
return errors.distinct().joinToString("\n") { "$commentSymbol - $it" }
4845
}
4946

5047
/**

0 commit comments

Comments
 (0)