Skip to content

Commit

Permalink
### Whats added:
Browse files Browse the repository at this point in the history
 * corrected logic fix and warn String Template in Linelength rule
 * added logic fix and warn long Dot Qualified Expression in LineLength rule
 * added logic fix and warn Value Arguments List in LineLength rule
 * added and corrected fix and warn tests in LineLength rule
 * fix code with diktat:fix@diktat
 * added comments to classes and functions
 * correct code with running detect

 ### Issue (#1243)
  • Loading branch information
Arrgentum committed May 24, 2022
1 parent 6b0ba56 commit ebf05b1
Showing 1 changed file with 7 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,9 @@ class LineLength(configRules: List<RulesConfig>) : DiktatRule(
}
FUN, PROPERTY -> return checkFunAndProperty(parent)
CONDITION -> return checkCondition(parent, configuration)
VALUE_ARGUMENT_LIST -> {
parent.findParentNodeWithSpecificType(BINARY_EXPRESSION)?.let {
parent = it
} ?: return checkArgumentsList(parent, configuration)
}
VALUE_ARGUMENT_LIST -> parent.findParentNodeWithSpecificType(BINARY_EXPRESSION)?.let {
parent = it
} ?: return checkArgumentsList(parent, configuration)
WHEN_ENTRY -> return WhenEntry(parent)
WHEN_CONDITION_WITH_EXPRESSION -> return None()
EOL_COMMENT -> return checkComment(parent, configuration)
Expand Down Expand Up @@ -198,16 +196,15 @@ class LineLength(configRules: List<RulesConfig>) : DiktatRule(
return null
}

private fun checkArgumentsList(node: ASTNode, configuration: LineLengthConfiguration): LongLineFixableCases{
node.findParentNodeWithSpecificType(WHEN_ENTRY) ?. let {
it.findChildByType(BLOCK) ?. run {
private fun checkArgumentsList(node: ASTNode, configuration: LineLengthConfiguration): LongLineFixableCases {
node.findParentNodeWithSpecificType(WHEN_ENTRY)?.let {
it.findChildByType(BLOCK)?.run {
return ValueArgumentList(node, configuration)
} ?: return WhenEntry(it)
}
return ValueArgumentList(node, configuration)
}


/**
* Parses the existing binary expression and passes the necessary parameters to the fix function for splitting
*/
Expand All @@ -221,7 +218,7 @@ class LineLength(configRules: List<RulesConfig>) : DiktatRule(
return LongBinaryExpression(node, configuration, leftOffset, binList)
}

@Suppress("TOO_MANY_LINES_IN_LAMBDA")
@Suppress("TOO_MANY_LINES_IN_LAMBDA", "GENERIC_VARIABLE_WRONG_DECLARATION")
private fun checkStringTemplateAndDotQualifiedExpression(
node: ASTNode,
configuration: LineLengthConfiguration
Expand Down

0 comments on commit ebf05b1

Please sign in to comment.