-
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
Bugfixes in Indentation Rule #376
Conversation
### What's done: * Increased indentation after an arrow in when expressions * Increased indentation before elvis * Fixed error in aligning parameters * Tests
Codecov Report
@@ Coverage Diff @@
## master #376 +/- ##
============================================
+ Coverage 82.97% 83.00% +0.02%
- Complexity 1251 1252 +1
============================================
Files 61 61
Lines 3078 3101 +23
Branches 976 986 +10
============================================
+ Hits 2554 2574 +20
+ Misses 170 169 -1
- Partials 354 358 +4
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
### What's done: * Code style
### What's done: * Logic of comments
### What's done: * Fixes
1073341
to
c55a224
Compare
### What's done: * Fixes * Code style
### What's done: * Code style
…ature/indentation#349
private fun ASTNode.getExceptionalIndentInitiator() = treeParent.let { parent -> | ||
when (parent.psi) { | ||
// fixme: custom logic for determining exceptional indent initiator, should be moved elsewhere | ||
is KtDotQualifiedExpression -> { |
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.
braces not needed?
and yes I would also move it away
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.
At first there was hack for only one case, but now that there are several I think it should be extracted to CheckResult
, for example. I think I'll better do it in the next PR, because this is for sure not the last bug in indentation logic.
val ktFile = whiteSpace.parents.last() as KtFile | ||
ktFile.text | ||
.lineSequence() | ||
.scan(0 to "") { (length, _), s -> length + s.length + 1 to s } |
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 add comments of what are you doing here or move to some method. Now it looks like some hack, I do not understand
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, I will add comments. Basically, I just find a particular line using node's offset and then calculate column number for this node. Ktlint does this already when formatting warning messages, but you can't access that method from visitors.
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.
approved
### What's done: * Code style
What's done:
as
,is
and other infix functions should increase indentationThis pull request closes #349