diff --git a/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/chapter3/LineLength.kt b/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/chapter3/LineLength.kt index ca5460ed3c..37c2cb0c53 100644 --- a/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/chapter3/LineLength.kt +++ b/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/chapter3/LineLength.kt @@ -28,8 +28,10 @@ import com.pinterest.ktlint.core.ast.ElementType.ELVIS import com.pinterest.ktlint.core.ast.ElementType.EOL_COMMENT import com.pinterest.ktlint.core.ast.ElementType.EQ import com.pinterest.ktlint.core.ast.ElementType.EQEQ +import com.pinterest.ktlint.core.ast.ElementType.EQEQEQ import com.pinterest.ktlint.core.ast.ElementType.EXCL import com.pinterest.ktlint.core.ast.ElementType.EXCLEQ +import com.pinterest.ktlint.core.ast.ElementType.EXCLEQEQEQ import com.pinterest.ktlint.core.ast.ElementType.FILE import com.pinterest.ktlint.core.ast.ElementType.FLOAT_CONSTANT import com.pinterest.ktlint.core.ast.ElementType.FUN @@ -570,8 +572,8 @@ class LineLength(configRules: List) : DiktatRule( ) : LongLineFixableCases(node) { /** * Fix a binary expression - - * If the transfer is done on the Elvis operator, then transfers it to a new line - * If not on the Elvis operator, then transfers it to a new line after the operation reference + * - If the transfer is done on the Elvis operator, then transfers it to a new line + * - If not on the Elvis operator, then transfers it to a new line after the operation reference */ @Suppress("UnsafeCallOnNullableType") override fun fix() { @@ -595,16 +597,18 @@ class LineLength(configRules: List) : DiktatRule( } /** - * This method stored all the nodes that have BINARY_EXPRESSION or PREFIX_EXPRESSION element type. - * Return List of the Pair - * First elem in List - Logic Binary Expression (&& ||) - * Second elem in List - Comparison Binary Expression (> < == >= <= !=) - * Other types (Arithmetical and Bit operation) (+ - * / % >> << *= += -= /= %= ++ -- ! in !in etc) + * This method stored all the nodes that have [BINARY_EXPRESSION] or [PREFIX_EXPRESSION] element type. + * - First elem in List - Logic Binary Expression (`&&`, `||`) + * - Second elem in List - Comparison Binary Expression (`>`, `<`, `==`, `>=`, `<=`, `!=`, `===`, `!==`) + * - Other types (Arithmetical and Bitwise operation) (`+`, `-`, `*`, `/`, `%`, `>>`, `<<`, `&`, `|`, `~`, `^`, `>>>`, `<<<`, + * `*=`, `+=`, `-=`, `/=`, `%=`, `++`, `--`, `in` `!in`, etc.) + * + * @return the list of node-to-offset pairs. */ @Suppress("TYPE_ALIAS") private fun searchSomeSplitInBinaryExpression(parent: ASTNode, configuration: LineLengthConfiguration): List?> { val logicListOperationReference = listOf(OROR, ANDAND) - val compressionListOperationReference = listOf(GT, LT, EQEQ, GTEQ, LTEQ, EXCLEQ) + val compressionListOperationReference = listOf(GT, LT, EQEQ, GTEQ, LTEQ, EXCLEQ, EQEQEQ, EXCLEQEQEQ) val binList: MutableList = mutableListOf() searchBinaryExpression(parent, binList) val rightBinList = binList.map { @@ -752,8 +756,8 @@ class LineLength(configRules: List) : DiktatRule( /** * Class WhenEntry show that line should be split in WhenEntry node: - * Added [LBRACE] and [RBRACE] nodes - * Split line in space after [LBRACE] node and before [RBRACE] node + * - Added [LBRACE] and [RBRACE] nodes + * - Split line in space after [LBRACE] node and before [RBRACE] node */ private class WhenEntry(node: ASTNode) : LongLineFixableCases(node) { override fun fix() {