-
Notifications
You must be signed in to change notification settings - Fork 502
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
False positive for 'Missing newline after "->" (indent)' #1329
Comments
Interesting example. The bug is reported at line 19 while the example only contains 18 line (including the blank after the closing brace). Without the comment on line 15, the error disappears. |
Easy to mix up ... line 14, column 19 |
Oops, missed that. The interesting part of the example was however that the block comment lead to this result. Personally, I do think that using a block comment in this way should be avoided and that below should be preferred:
I expect that block comments also will break other wrapping rules for the same reason. So I am wondering whether it might be better to have a new comment rule that forces block comments and KDocs to start and end on a line that does not contain any other code element. |
New experimental rules
|
Add new experimental rules for wrapping of block comments and KDoc comments Closes #1329
My one observation is that a single-line block comment is the ONLY way to add a comment at the beginning of the line. Not common but sometimes necessary/preferred. We don't use it often (usually only to tag a line as inserted/modified for debugging). In fact, the bug made the missed ones easier to find afterwards. :-) Does disabling the new rule(s) (selectively or otherwise) also remove the false-positive in the Thanks for resolving this. |
True
We seem to disagree on the necessary/preferred part ;-)
No, the error will still be there when the new rules are disabled. Solving this error would add unwanted complexity to the Indent Rule whcih already is bloated with lots of functionality. |
Observed Behavior
Linting the code below reports:
Steps to Reproduce
Use standard
ktlint -v
command on this code:Your Environment
The text was updated successfully, but these errors were encountered: