mirror of
https://github.com/damus-io/notedeck.git
synced 2024-09-07 23:43:30 +00:00
Add precommit hook to suggest proper formatting
Signed-off-by: kernelkind <kernelkind@gmail.com> Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
parent
c76f322a48
commit
dae57d78ef
@ -75,3 +75,11 @@ The app should appear on the emulator
|
||||
|
||||
[direnv]: https://direnv.net/
|
||||
[nix]: https://nixos.org/download/
|
||||
|
||||
## Contributing
|
||||
Configure the developer environment:
|
||||
```bash
|
||||
./scripts/dev_setup.sh
|
||||
```
|
||||
|
||||
This will add the pre-commit hook to your local repository to suggest proper formatting before commits.
|
||||
|
19
scripts/dev_setup.sh
Executable file
19
scripts/dev_setup.sh
Executable file
@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
HOOK_SCRIPTS_DIR="scripts"
|
||||
GIT_HOOKS_DIR=".git/hooks"
|
||||
|
||||
# Ensure the necessary directories exist and are accessible
|
||||
if [ ! -d "$HOOK_SCRIPTS_DIR" ] || [ ! -d "$GIT_HOOKS_DIR" ]; then
|
||||
echo "Error: Required directories are missing. Please ensure you are in the project's root directory."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Copy the pre-commit hook script
|
||||
cp -p "$HOOK_SCRIPTS_DIR/pre_commit_hook.sh" "$GIT_HOOKS_DIR/pre-commit"
|
||||
|
||||
# Make the hook script executable
|
||||
chmod +x "$GIT_HOOKS_DIR/pre-commit"
|
||||
|
||||
echo "Pre-commit hook has been set up successfully."
|
||||
|
4
scripts/pre_commit_hook.sh
Normal file
4
scripts/pre_commit_hook.sh
Normal file
@ -0,0 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
cargo fmt --all --check
|
||||
|
Loading…
Reference in New Issue
Block a user