Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Ktlint check pre-commit hook includes unstaged changes #490

Closed
Kantis opened this issue May 27, 2021 · 3 comments
Closed

Ktlint check pre-commit hook includes unstaged changes #490

Kantis opened this issue May 27, 2021 · 3 comments

Comments

@Kantis
Copy link

Kantis commented May 27, 2021

Reproduction:

  1. Add an unused import to a file
  2. Stage the file and try to commit -> precommit hook will fail the commit
  3. Remove the import
  4. Without staging the file, try to commit -> commit will be allowed with unused import being commited

Behaviour is inconsistent with manually running ./gradlew ktlintCheck while having unstaged fixes, which will correctly complain about the unused import.

@Kantis
Copy link
Author

Kantis commented Jun 4, 2021

Could probably be solved similar to #470

@KotlinIsland
Copy link
Contributor

This is exactly the issue that was fixed in #470.

@Kantis Kantis closed this as completed Jun 15, 2021
@Kantis
Copy link
Author

Kantis commented Jun 15, 2021

Thanks for the info @KotlinIsland! 10.1.0 came out after the issue was created and I haven't gotten around to testing it. Thanks for fixing it 👍🏼

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants