copy and paste this google map to your website or blog!
Press copy button and paste into your blog or website.
(Please switch to 'HTML' mode when posting into your blog. Examples: WordPress Example, Blogger Example)
KtlintFormat Git Pre-Commit Hook stages entire file when changing any lines, even . . . When running the ktLintFormat pre-commit hook, if format changes any line in a file, it stages the entire file This happens in echo "$CHANGED_FILES" | while read -r file; do if [ -f $file ]; then git add $file fi when it adds all of $file instead of only the lines that were just changed by ktLintFormat
pre-commit Hook which formats your kotlin file with ktling puts "\nCheck if ktlint is installed " raise 'Ktlint is not available in the PATH Please install ktlint or add it to your PATH ' if ktlint_files empty? if files_needs_formatting empty? if ktlint_files empty?
Make git hooks run ktlint on changed files only #1339 ktlint git pre-commit and pre-push hooks run on all files of the current directory For instance, when I install the pre-commit hook via ktlint installGitPreCommitHook, it looks like this:
Automatically stage files changed by hook · Issue #806 · pre-commit pre-commit - GitHub For example black or prettier automatically reformat code and then pre-commit hook fails after detecting changed files After that I have to manually stage changed files and run commit once again, unnecessary friction since formatting just works and changes are expected
running single hook on a single file runs all hooks `pre-commit run --files [filename . . . Previously I was successfully able to use pre-commit to format markdown documents by using: pre-commit run --files "${FILE_PATH}" end-of-file-fixer > dev null However, since I hadn't been looking at the output of pre-commit and failed to notice that pre-commit was running all of my hooks until it failed a hook:
addKtlintFormatGitPreCommitHook does not run in all classes of a multi-module . . . Yes, I see that running git hook in this case does not modify all files with violations Running gradlew ktlintFormat on the other hand fixes all violations Probably the issues is in that your project has Gradle root project in the subdirectory and proper filtering is not applied on running format task Will investigate it further