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 and Safe Access 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 Jun 1, 2022
1 parent f8a817a commit dfcf81a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ class NewlinesRule(configRules: List<RulesConfig>) : DiktatRule(
val whiteSpaceBeforeDotOrSafeAccess = it.findChildByType(DOT)?.treePrev ?: it.findChildByType(SAFE_ACCESS)?.treePrev
whiteSpaceBeforeDotOrSafeAccess?.elementType == WHITE_SPACE && whiteSpaceBeforeDotOrSafeAccess.text.lines().size > 1
}
if (without.size != 1 || without[0] != listDot[0]) {
if (without.size > 1 || (without.size == 1 && without[0] != listDot[0])) {
WRONG_NEWLINES.warnAndFix(configRules, emitWarn, isFixMode, node.text, node.startOffset, node) {
fixDotQualifiedExpression(listDot)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,7 @@ class NewlinesRuleWarnTest : LintTestBase(::NewlinesRule) {
| }
| ?.qux()
|}
""".trimMargin(),
LintError(2, 5, ruleId, "${WRONG_NEWLINES.warnText()} list!!...", true)
""".trimMargin()
)
}

Expand Down Expand Up @@ -636,7 +635,7 @@ class NewlinesRuleWarnTest : LintTestBase(::NewlinesRule) {
| }
| }
|}
""".trimMargin(), LintError(22, 9, ruleId, "${WRONG_NEWLINES.warnText()} allProperties...", true)
""".trimMargin()
)
}

Expand Down

0 comments on commit dfcf81a

Please sign in to comment.