Running ktlintFormat twice deletes files
See original GitHub issueSteps to reproduce the bug
- Use ktlint-gradle version
9.1.0
and ktlint version0.35.0
with the following configuration:
ktlint {
version = "0.35.0"
debug = true
verbose = true
android = true
outputToConsole = true
outputColorName = "RED"
enableExperimentalRules = false
}
- Run
./gradlew ktlintFormat --continue
once. (Then rungit status
, and observe that the auto-formatted files were modified) - Run
./gradlew ktlintFormat --continue
a second time
Expected Behavior
Running ./gradlew ktlintFormat --continue
the second time should not making any additional changes. The previously modified files should still show up as modified in git status
, and no files should be deleted.
Actual Behavior
All the files that were previously marked as modified are now deleted
(observed via git status
).
I also tried the gradle integration recommended in https://github.com/pinterest/ktlint without plugins, and running the non-plugin ktlintFormat
task multiple times did not delete any files. This makes me suspect that the bug is in ktlint-gradle
.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:5 (1 by maintainers)
Top Results From Across the Web
android - Problems running ktlint from module - Stack Overflow
So, this is how i resolved my problem and run ktlint. First I was update my root build.gradle : // Top-level build file...
Read more >Squash Kotlin bugs quickly with ktlint and detekt static analysis
The ktlint.gradle task is a verifier: It checks all your Kotlin files to ensure you are following the right code style. To run...
Read more >Diff - platform/external/ktlint - Google Git
To run formatter - `gradle ktlintFormat`. -**Another option** is to use Gradle plugin (in order of appearance): -- [jlleitschuh/ktlint-gradle](https ...
Read more >Configuring and running Ktlin on Android Studio
To do it you can go to File->Sync project with gradle files on Android Studio or click on the sync shortcut button as...
Read more >Static Analysis Tools - ktlint - The Android Arsenal
(without a plugin) ... To check code style - gradle ktlint (it's also bound to gradle check ). To run formatter - gradle...
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
Thank you for the report, I’ve successfully reproduced it 🤔
That is my plan I want to do tomorrow…