diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 5020ff4..f726112 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -21,7 +21,7 @@ Before writing a commit message read [this article](https://chris.beams.io/posts Before pushing any changes make sure project builds without errors with: -``` +```sh ./gradlew build ``` @@ -32,7 +32,7 @@ That are enforced by ktlint and [.editorconfig](../.editorconfig). You can check style with: -``` +```sh ./gradlew ktlintCheck ``` @@ -42,7 +42,7 @@ Use [JUnit 5](https://junit.org/junit5/docs/current/user-guide/) for testing. Uou can check coverage in `build/reports/kover/` after running: -``` +```sh ./gradlew test coverage ``` diff --git a/scripts/git/pre-commit b/scripts/git/pre-commit index dc27014..74220fd 100755 --- a/scripts/git/pre-commit +++ b/scripts/git/pre-commit @@ -7,11 +7,11 @@ function run_ktlint { exit 1 fi # https://pinterest.github.io/ktlint/0.49.0/install/cli/#git-hooks - KT_FILES=$(git diff --name-only --cached --relative --diff-filter=ACMR -- '*.kt' '*.kts' | sed 's| |\\ |g') + KT_FILES=$(git diff --name-only --cached --relative --diff-filter=ACMR -- '*.kt' '*.kts') if [ -n "$KT_FILES" ]; then echo -e "${BLUE}Ktlint: linting $(echo "$KT_FILES" | wc -l) files${ENDCOLOR}" start="$(date +%s)" - echo -n "$KT_FILES" | ktlint --relative --format --patterns-from-stdin + echo -n "$KT_FILES" | tr '\n' ',' | ktlint --relative --format --patterns-from-stdin=',' echo -e "${GREEN}Ktlint: finished in $(($(date +%s) - start))s${ENDCOLOR}" echo "$KT_FILES" | xargs git add fi