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

Incorrect fix mode in LongLine rule #1385

Closed
Arrgentum opened this issue Jun 21, 2022 · 0 comments · Fixed by #1389
Closed

Incorrect fix mode in LongLine rule #1385

Arrgentum opened this issue Jun 21, 2022 · 0 comments · Fixed by #1389
Assignees
Labels
bug Something isn't working

Comments

@Arrgentum
Copy link
Member

Arrgentum commented Jun 21, 2022

Test

maximum linelength = 151

Initial code:

val elem = (hasExplicitNotUnitReturnType || isFunWithExpressionBody && !hasExplicitUnitReturnType && hasNotExpressionBodyTypes) && !hasReturnKdoc && !isReferenceExpressionWithSameName

Expected behavior

val elem = (hasExplicitNotUnitReturnType || isFunWithExpressionBody && !hasExplicitUnitReturnType && hasNotExpressionBodyTypes) && !hasReturnKdoc && 
        !isReferenceExpressionWithSameName

Observed behavior

val elem = 
    (hasExplicitNotUnitReturnType || isFunWithExpressionBody && !hasExplicitUnitReturnType && hasNotExpressionBodyTypes) && !hasReturnKdoc && !isReferenceExpressionWithSameName

With other values of maximum length, the rule gives the correct result

Result - error in incorrect analysis first symbol in need to split word in BinaryExpression

Environment information

  • diktat version: 1.1.0
  • kotlin version 1.6
@Arrgentum Arrgentum added the bug Something isn't working label Jun 21, 2022
@Arrgentum Arrgentum self-assigned this Jun 21, 2022
Arrgentum pushed a commit that referenced this issue Jun 21, 2022
 * Corrected analysis if maximum lineLength drop in first symbol last word long binary expression
 * Delete 2 unused test in DiktatSmokeTest
 * Added 1 fix test split long binary expression with maximum lineLength = offset last word in binary expression
 * install
 * fix

### Issue(#1385)
Arrgentum added a commit that referenced this issue Jun 22, 2022
* Corrected analysis if maximum lineLength drop in first symbol last word long binary expression
* Delete 2 unused test in DiktatSmokeTest
* Added 1 fix test split long binary expression with maximum lineLength = offset last word in binary expression

### Issue(#1385)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
1 participant