Skip to content

Commit f3ee5a8

Browse files
committed
Update precommit hook
1 parent a54438b commit f3ee5a8

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

DEVELOPMENT.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# Development
22

3-
This is a development focused supplement
4-
to [CONTRIBUTING.md](https://github.com/coditory/.github/blob/main/CONTRIBUTING.md).
3+
This is a development focused supplement to [CONTRIBUTING.md](https://github.com/coditory/.github/blob/main/CONTRIBUTING.md).
54

65
## Pre commit hook (optional)
76

scripts/git/pre-commit

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ function run_ktlint {
77
exit 1
88
fi
99
# https://pinterest.github.io/ktlint/0.49.0/install/cli/#git-hooks
10-
KT_FILES=$(git diff --name-only --cached --relative --diff-filter=ACMR -- '*.kt' '*.kts' | sed 's| |\\ |g')
10+
KT_FILES=$(git diff --name-only --cached --relative --diff-filter=ACMR -- '*.kt' '*.kts')
1111
if [ -n "$KT_FILES" ]; then
1212
echo -e "${BLUE}Ktlint: linting $(echo "$KT_FILES" | wc -l) files${ENDCOLOR}"
1313
start="$(date +%s)"
14-
echo -n "$KT_FILES" | ktlint --relative --format --patterns-from-stdin
15-
echo -e "${GREEN}Ktlint: finished in $(($(date +%s) - start))s${ENDCOLOR}"
14+
echo -n "$KT_FILES" | tr '\n' ',' | ktlint --relative --format --patterns-from-stdin=','
15+
echo -e "${GREEN}Ktlint: finished in $(($(date +%s) - start))s${ENDCOLOR}"
1616
echo "$KT_FILES" | xargs git add
1717
fi
1818
}

0 commit comments

Comments
 (0)