Skip to content

Commit

Permalink
Invoke dprint in pre-commit hook (#191)
Browse files Browse the repository at this point in the history
  • Loading branch information
khssnv authored Dec 10, 2023
1 parent eb8488d commit 9345f34
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
14 changes: 4 additions & 10 deletions dprint.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
{
"includes": [
"**/*.{toml}"
],
"excludes": [
"**/target"
],
"plugins": [
"https://plugins.dprint.dev/toml-0.5.3.wasm"
]
}
"includes": ["**/*.{toml}"],
"excludes": ["**/target"],
"plugins": ["https://plugins.dprint.dev/toml-0.5.3.wasm"]
}
7 changes: 7 additions & 0 deletions scripts/pre-commit.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
#!/bin/sh

# Prevent committing badly formatted code

cargo fmt -- --check
if [ $? -ne 0 ]; then
echo "Run \`cargo fmt\` to fix formatting issues before committing."
exit 1
fi

dprint check
if [ $? -ne 0 ]; then
echo "Run \`dprint fmt\` to fix formatting issues before committing."
exit 1
fi

0 comments on commit 9345f34

Please sign in to comment.