Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added this operator references to the list with similar operator references #1393

Merged
merged 6 commits into from
Jun 22, 2022
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -598,13 +600,13 @@ class LineLength(configRules: List<RulesConfig>) : DiktatRule(
* This method stored all the nodes that have BINARY_EXPRESSION or PREFIX_EXPRESSION element type.
* Return List of the Pair <node, offset>
* First elem in List - Logic Binary Expression (&& ||)
* Second elem in List - Comparison Binary Expression (> < == >= <= !=)
* Other types (Arithmetical and Bit operation) (+ - * / % >> << *= += -= /= %= ++ -- ! in !in etc)
* Second elem in List - Comparison Binary Expression (> < == >= <= != === !==)
* Other types (Arithmetical and Bitwise operation) (+ - * / % >> << *= += -= /= %= ++ -- & ~ ^ | in !in etc)
Arrgentum marked this conversation as resolved.
Show resolved Hide resolved
*/
@Suppress("TYPE_ALIAS")
private fun searchSomeSplitInBinaryExpression(parent: ASTNode, configuration: LineLengthConfiguration): List<Pair<ASTNode, Int>?> {
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<ASTNode> = mutableListOf()
searchBinaryExpression(parent, binList)
val rightBinList = binList.map {
Expand Down