Skip to content

Commit

Permalink
Update warning message
Browse files Browse the repository at this point in the history
### What's done:
* Update warning message
  • Loading branch information
kgevorkyan committed Sep 14, 2021
1 parent e469d96 commit 1ccf274
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ enum class Warnings(
WRONG_NEWLINES(true, "3.6.2", "incorrect line breaking"),
TRAILING_COMMA(true, "3.6.2", "use trailing comma"),
COMPLEX_EXPRESSION(false, "3.6.3", "complex dot qualified expression should be replaced with variable"),
COMPLEX_BOOLEAN_EXPRESSION(true, "3.6.4", "too complex boolean expression, that can be simplified"),
COMPLEX_BOOLEAN_EXPRESSION(true, "3.6.4", "simplification could be produced for the too complex boolean expression"),

// FixMe: autofixing will be added for this rule
STRING_CONCATENATION(true, "3.15.1", "strings should not be concatenated using plus operator - use string templates instead if the statement fits one line"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ class BooleanExpressionsRule(configRules: List<RulesConfig>) : DiktatRule(
node: ASTNode,
simplifiedExpr: Expression<String>,
mapOfExpressionToChar: HashMap<String, Char>) {
println("simplifiedExpr ${simplifiedExpr}")

var correctKotlinBooleanExpression = simplifiedExpr
.toString()
.replace("&", "&&")
Expand All @@ -170,7 +170,7 @@ class BooleanExpressionsRule(configRules: List<RulesConfig>) : DiktatRule(
mapOfExpressionToChar.forEach { (key, value) ->
correctKotlinBooleanExpression = correctKotlinBooleanExpression.replace(value.toString(), key)
}
println("correct node ${correctKotlinBooleanExpression}")

node.replaceChild(node.firstChildNode, KotlinParser().createNode(correctKotlinBooleanExpression))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ fun foo() {
} else {
true
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ fun foo() {
} else {
true
}
}
}

0 comments on commit 1ccf274

Please sign in to comment.