-
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
Fixing bug with lineNumber in autocorrect mode #400
Conversation
### What's done: * Use getLineNumber everywhere * Added test
Codecov Report
@@ Coverage Diff @@
## master #400 +/- ##
============================================
- Coverage 82.50% 82.49% -0.02%
- Complexity 1346 1347 +1
============================================
Files 65 65
Lines 3298 3313 +15
Branches 1053 1056 +3
============================================
+ Hits 2721 2733 +12
- Misses 178 179 +1
- Partials 399 401 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
} | ||
|
||
/** | ||
* This function calculates line number instead of using cached values. |
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.
I thought we discussed it and decided that ktlint calculates everything correctly.
So why it is needed?
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.
We discussed it regarding warning messages, but we also use line number in some rules (e.g., method ASTNode.isBefore
), and when AST has already been mutated by previous rules, it leads to ArrayIndexOutOfBoundsException
(see #371).
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.
lgtm
What's done:
This pull request closes #371