Skip to content

Commit

Permalink
Update precommit hook
Browse files Browse the repository at this point in the history
  • Loading branch information
pmendelski committed Jan 11, 2025
1 parent c000d98 commit c4760c4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```

Expand All @@ -32,7 +32,7 @@ That are enforced by ktlint and [.editorconfig](../.editorconfig).

You can check style with:

```
```sh
./gradlew ktlintCheck
```

Expand All @@ -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
```

Expand Down
4 changes: 2 additions & 2 deletions scripts/git/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c4760c4

Please sign in to comment.