ktfmt rearranges comments on top of imports statements
See original GitHub issueLet’s say I have
import x
import y
//noinspection BannedImport
import z
ktfmt reformats it as
//noinspection BannedImport
import x
import y
import z
This is problematic because some linting tools use a comment to opt out of errors on an import statement. (for example android lint allows you to opt out of a import error with a comment, but then you run ktfmt and it rearranges the comments therefore causing lint to break again.
Issue Analytics
- State:
- Created 2 years ago
- Comments:13 (10 by maintainers)
Top Results From Across the Web
Issues · facebook/ktfmt - GitHub
How can i get ktfmt to add missing full stops at the end of java doc sentences ... ktfmt rearranges comments on top...
Read more >New blog-post => Organise imports with Prettier and friends
I would use an ESLint plugin instead of a Prettier plugin to sort imports. Semantically, Prettier really should be about making formatting ...
Read more >Facebook Ktfmt Statistics & Issues - Codesti
Facebook Ktfmt: A program that reformats Kotlin source code to comply with the common community ... ktfmt rearranges comments on top of imports...
Read more >ktfmt - IntelliJ IDEs Plugin - JetBrains Marketplace
ktfmt is a program that reformats Kotlin source code to comply with the common community standard for Kotlin code conventions. Plugin Site. Issue...
Read more >Import order coding standard - python - Stack Overflow
and puts them all at the top of the file grouped together by the type of ... Broadly, You need to structure your...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
That comment was from me. Both the AL team and I work at Google.
From talking to the current maintainers:
At this point, if someone wants to make ktfmt behave like GJF, with gluing, that seems fine to me. As long as ktfmt doesn’t crash, or delete the comments, it works for us. Just be aware that there’s also weirdness in that approach.
Fundamentally, associating comments with other syntax is unspecified, so there will always be tools that chose to do it in a different way.