Speed up Git Hook by running ktlint via command line
See original GitHub issueFrom a developer experience perspective, it would be much better if ktlint
was executed via the executable directly, to avoid having to start up Gradle.
Is there a way addKtlintCheckGitPreCommitHook
could be modified to use the ktlint
executable directly?
For example: I just committed via Sourcetree (which does not inherit Gradle JVM settings from the project) a single file
- no sourcetree Gradle JVM running:
1m49s
(likely due to memory thrashing with the project’s Gradle daemon - with sourcetree Gradle JVM running:
9s
- using ktlint directly:
1s
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (1 by maintainers)
Top Results From Across the Web
Setting up Git pre-commit/pre-push hook for Ktlint check
Git hooks are scripts that run automatically every time a particular event occurs in a Git repository. They let you customize Git's internal ......
Read more >Code Formatting in Kotlin using ktlint - MindOrks
If you want to use ktlint from the command line then you have to first ... Run "ktlint installGitPrePushHook" if you wish to...
Read more >Ktlint Checks with Git Hooks in your Android Project
Learn how to automate Ktlint with a Git hook in your Android project to run code checks before you commit your change list....
Read more >Supported hooks - pre-commit
pretty-format-ini - This hook sets a standard for formatting INI files. pretty-format-java - Runs Google Java Formatter over Java source files; pretty-format- ...
Read more >Ooga-chaka: Git hooks to enforce code quality - /dev/random
Use git hooks to prevent code formatting and static analysis from making ... our hooks needs to spin up Gradle, then run Detekt...
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
Sorry, but I think you your case is better to install your custom git-hook that uses
ktlint
directly.ktlint
has a command-line option to do that.Indeed current plugin performance is far from to be perfect, but this will be addressed in the future.
I think that this should be closed as a wont-fix. It seems like the ask is outside the scope of this project. (Unless I’m misunderstanding something).