-
Notifications
You must be signed in to change notification settings - Fork 39
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
Fix logic "BinaryExpression" in "LineLength" Rule #1292
Conversation
…d files in fix tested
…d files in fix tested
…d files in fix tested
…d files in fix tested
diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/chapter3/LineLength.kt
Outdated
Show resolved
Hide resolved
diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/chapter3/LineLength.kt
Outdated
Show resolved
Hide resolved
diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/chapter3/LineLength.kt
Outdated
Show resolved
Hide resolved
diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/LineLengthFixTest.kt
Outdated
Show resolved
Hide resolved
diktat-rules/src/test/resources/test/paragraph3/long_line/LongLineCommentExpected2.kt
Show resolved
Hide resolved
Codecov Report
@@ Coverage Diff @@
## master #1292 +/- ##
============================================
- Coverage 82.07% 81.97% -0.10%
- Complexity 2525 2527 +2
============================================
Files 105 105
Lines 7195 7169 -26
Branches 2057 2053 -4
============================================
- Hits 5905 5877 -28
- Misses 344 346 +2
Partials 946 946
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
…_binary # Conflicts: # diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/chapter1/PackageNaming.kt
…d files in fix tested
…d files in fix tested
Alexey, please start naming PR properly :( "Condition" - bad name ❌ |
diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/chapter3/LineLength.kt
Outdated
Show resolved
Hide resolved
…d files in fix tested, delete comment code
…d files in fix tested, delete comment code
…d files in fix tested, delete comment code
…d files in fix tested, delete comment code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please keep an eye on how your branch is called! It should start with feature/
, bugfix/
, hotfix/
of infra/
(if I am not mistaken).
diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/LineLengthFixTest.kt
Outdated
Show resolved
Hide resolved
@Suppress("KDOC_NO_CONSTRUCTOR_PROPERTY", "MISSING_KDOC_CLASS_ELEMENTS") // todo add proper docs | ||
sealed class LongLineFixableCases { | ||
object None : LongLineFixableCases() | ||
open class LongLineFixableCases(val node: ASTNode) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you change sealed
for open
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you're right, I changed it back
/** | ||
* Class None show error long line have unidentified type or something else that we can't analyze | ||
*/ | ||
class None : LongLineFixableCases(KotlinParser().createNode("ERROR")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It still can be an object
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I do that, there will be something breaking in the logic
…d files in fix tested, delete comment code
…d files in fix tested, delete comment code
diktat-rules/src/test/resources/test/paragraph3/long_line/LongBinaryExpressionExpected.kt
Show resolved
Hide resolved
diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/chapter3/LineLength.kt
Outdated
Show resolved
Hide resolved
diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/chapter3/LineLength.kt
Show resolved
Hide resolved
diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/LineLengthFixTest.kt
Outdated
Show resolved
Hide resolved
diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/chapter3/LineLength.kt
Outdated
Show resolved
Hide resolved
diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/chapter3/LineLength.kt
Show resolved
Hide resolved
diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/chapter3/LineLength.kt
Outdated
Show resolved
Hide resolved
diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/chapter3/LineLength.kt
Outdated
Show resolved
Hide resolved
val indexLastSpace = wrongProperty.indexLastSpace | ||
val text = wrongProperty.text | ||
splitTextAndCreateNode(node, text, indexLastSpace) | ||
@Suppress("TYPE_ALIAS", "UnsafeCallOnNullableType") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strange, that diktat doesn't trigger on this line, because there is no whitespaces, between suppress
and previous method, probably this is because annotation type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/chapter3/LineLength.kt
Show resolved
Hide resolved
diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/chapter3/LineLength.kt
Outdated
Show resolved
Hide resolved
diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/LineLengthFixTest.kt
Outdated
Show resolved
Hide resolved
diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/chapter3/LineLength.kt
Outdated
Show resolved
Hide resolved
diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/chapter3/LineLength.kt
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When more tasks with this rule are done, you will need to add tests that cover all the LongLine
rule
Fix logic of the line split in BinaryExpression in rule LineLength
This pull request closes #1244
Actions checklist