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

Wrong indentation text in functions with expression body #683

Closed
aktsay6 opened this issue Dec 31, 2020 · 2 comments · Fixed by #708
Closed

Wrong indentation text in functions with expression body #683

aktsay6 opened this issue Dec 31, 2020 · 2 comments · Fixed by #708
Labels
bug Something isn't working

Comments

@aktsay6
Copy link
Collaborator

aktsay6 commented Dec 31, 2020

  private fun ASTNode.extractLinesFromBlock(type: IElementType): List<String>? =
              treeParent
              .getFirstChildWithType(type)
              ?.text
              ?.trim('{', '}')
              ?.split("\n")
              ?.filter { it.isNotBlank() }
              ?.map { it.trim() }
              ?.toList()

If there are 12 spaces before method call, rule requires 16 spaces. If there are 16 spaces, rule requires 12.

Environment information

  • diktat version: 0.2.0
@aktsay6 aktsay6 added the bug Something isn't working label Dec 31, 2020
@petertrr
Copy link
Member

I believe, correct way would be

  private fun ASTNode.extractLinesFromBlock(type: IElementType): List<String>? =
          treeParent
              .getFirstChildWithType(type)
              ?.text
              ?.trim('{', '}')
              ?.split("\n")
              ?.filter { it.isNotBlank() }
              ?.map { it.trim() }
              ?.toList()

i.e. after = there are 8 spaces and each dot-qualified call is indented by 4 spaces more. Does it not fix like this or is there an error with warning text?

@aktsay6
Copy link
Collaborator Author

aktsay6 commented Jan 14, 2021

Actually it's fine, I just didn't see the correct indentation

aktsay6 added a commit that referenced this issue Jan 14, 2021
### What's done:
  * Deleted Suppress
aktsay6 added a commit that referenced this issue Jan 14, 2021
### What's done:
  * Fixed documentation
aktsay6 added a commit that referenced this issue Jan 14, 2021
### What's done:
  * Deleted suppress
aktsay6 added a commit that referenced this issue Jan 17, 2021
### What's done:
  * Deleted suppress
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
Development

Successfully merging a pull request may close this issue.

2 participants