@@ -28,8 +28,10 @@ import com.pinterest.ktlint.core.ast.ElementType.ELVIS
28
28
import com.pinterest.ktlint.core.ast.ElementType.EOL_COMMENT
29
29
import com.pinterest.ktlint.core.ast.ElementType.EQ
30
30
import com.pinterest.ktlint.core.ast.ElementType.EQEQ
31
+ import com.pinterest.ktlint.core.ast.ElementType.EQEQEQ
31
32
import com.pinterest.ktlint.core.ast.ElementType.EXCL
32
33
import com.pinterest.ktlint.core.ast.ElementType.EXCLEQ
34
+ import com.pinterest.ktlint.core.ast.ElementType.EXCLEQEQEQ
33
35
import com.pinterest.ktlint.core.ast.ElementType.FILE
34
36
import com.pinterest.ktlint.core.ast.ElementType.FLOAT_CONSTANT
35
37
import com.pinterest.ktlint.core.ast.ElementType.FUN
@@ -570,8 +572,8 @@ class LineLength(configRules: List<RulesConfig>) : DiktatRule(
570
572
) : LongLineFixableCases(node) {
571
573
/* *
572
574
* Fix a binary expression -
573
- * If the transfer is done on the Elvis operator, then transfers it to a new line
574
- * If not on the Elvis operator, then transfers it to a new line after the operation reference
575
+ * - If the transfer is done on the Elvis operator, then transfers it to a new line
576
+ * - If not on the Elvis operator, then transfers it to a new line after the operation reference
575
577
*/
576
578
@Suppress(" UnsafeCallOnNullableType" )
577
579
override fun fix () {
@@ -595,16 +597,18 @@ class LineLength(configRules: List<RulesConfig>) : DiktatRule(
595
597
}
596
598
597
599
/* *
598
- * This method stored all the nodes that have BINARY_EXPRESSION or PREFIX_EXPRESSION element type.
599
- * Return List of the Pair <node, offset>
600
- * First elem in List - Logic Binary Expression (&& ||)
601
- * Second elem in List - Comparison Binary Expression (> < == >= <= !=)
602
- * Other types (Arithmetical and Bit operation) (+ - * / % >> << *= += -= /= %= ++ -- ! in !in etc)
600
+ * This method stored all the nodes that have [BINARY_EXPRESSION] or [PREFIX_EXPRESSION] element type.
601
+ * - First elem in List - Logic Binary Expression (`&&`, `||`)
602
+ * - Second elem in List - Comparison Binary Expression (`>`, `<`, `==`, `>=`, `<=`, `!=`, `===`, `!==`)
603
+ * - Other types (Arithmetical and Bitwise operation) (`+`, `-`, `*`, `/`, `%`, `>>`, `<<`, `&`, `|`, `~`, `^`, `>>>`, `<<<`,
604
+ * `*=`, `+=`, `-=`, `/=`, `%=`, `++`, `--`, `in` `!in`, etc.)
605
+ *
606
+ * @return the list of node-to-offset pairs.
603
607
*/
604
608
@Suppress(" TYPE_ALIAS" )
605
609
private fun searchSomeSplitInBinaryExpression (parent : ASTNode , configuration : LineLengthConfiguration ): List <Pair <ASTNode , Int >? > {
606
610
val logicListOperationReference = listOf (OROR , ANDAND )
607
- val compressionListOperationReference = listOf (GT , LT , EQEQ , GTEQ , LTEQ , EXCLEQ )
611
+ val compressionListOperationReference = listOf (GT , LT , EQEQ , GTEQ , LTEQ , EXCLEQ , EQEQEQ , EXCLEQEQEQ )
608
612
val binList: MutableList <ASTNode > = mutableListOf ()
609
613
searchBinaryExpression(parent, binList)
610
614
val rightBinList = binList.map {
@@ -752,8 +756,8 @@ class LineLength(configRules: List<RulesConfig>) : DiktatRule(
752
756
753
757
/* *
754
758
* Class WhenEntry show that line should be split in WhenEntry node:
755
- * Added [LBRACE] and [RBRACE] nodes
756
- * Split line in space after [LBRACE] node and before [RBRACE] node
759
+ * - Added [LBRACE] and [RBRACE] nodes
760
+ * - Split line in space after [LBRACE] node and before [RBRACE] node
757
761
*/
758
762
private class WhenEntry (node : ASTNode ) : LongLineFixableCases(node) {
759
763
override fun fix () {
0 commit comments