question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Speed up Git Hook by running ktlint via command line

See original GitHub issue

From 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:closed
  • Created 4 years ago
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
Tapchicomacommented, Feb 5, 2020

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.

0reactions
JLLeitschuhcommented, Feb 13, 2020

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).

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found