Revert "Minor: extract new line allowance check"
This reverts commit e2f0b76e
This commit is contained in:
@@ -63,8 +63,9 @@ class TrailingCommaInspection(
|
|||||||
}
|
}
|
||||||
|
|
||||||
val last = TrailingCommaHelper.elementAfterLastElement(commaOwner)
|
val last = TrailingCommaHelper.elementAfterLastElement(commaOwner)
|
||||||
|
val whenEntryWithoutTrailingComma =
|
||||||
if (last?.prevLeaf(true)?.isLineBreak() == false && !allowMissingLineBreak(commaOwner)) {
|
commaOwner is KtWhenEntry && TrailingCommaHelper.trailingCommaOrLastElement(commaOwner)?.isComma != true
|
||||||
|
if (last?.prevLeaf(true)?.isLineBreak() == false && !whenEntryWithoutTrailingComma) {
|
||||||
registerProblemForLineBreak(
|
registerProblemForLineBreak(
|
||||||
commaOwner,
|
commaOwner,
|
||||||
last,
|
last,
|
||||||
@@ -73,11 +74,6 @@ class TrailingCommaInspection(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun allowMissingLineBreak(commaOwner: KtElement): Boolean {
|
|
||||||
return commaOwner is KtWhenEntry
|
|
||||||
&& TrailingCommaHelper.trailingCommaOrLastElement(commaOwner)?.isComma != true
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun checkCommaPosition(commaOwner: KtElement) {
|
private fun checkCommaPosition(commaOwner: KtElement) {
|
||||||
for (invalidComma in TrailingCommaHelper.findInvalidCommas(commaOwner)) {
|
for (invalidComma in TrailingCommaHelper.findInvalidCommas(commaOwner)) {
|
||||||
reportProblem(
|
reportProblem(
|
||||||
|
|||||||
Reference in New Issue
Block a user