Skip to content

Commit

Permalink
chore: pre-commit format all (TS, Rust)
Browse files Browse the repository at this point in the history
Signed-off-by: Martichou <[email protected]>
  • Loading branch information
Martichou committed Feb 26, 2024
1 parent 4bd3e83 commit c401a48
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 8 deletions.
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
repos:
- repo: local
hooks:
- id: rust-format
name: Rust Format
entry: ./rs_fmt.sh
- id: project-format
name: Project Format
entry: ./fmt.sh
language: script
stages: [commit]
18 changes: 18 additions & 0 deletions fmt.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

for dir in core_lib frontend/src-tauri; do
find "$dir" -name '*.rs' -not -path "*/target/*" -exec rustfmt {} +
done

# Check if there are changes in the /frontend/src directory
if git diff --name-only HEAD | grep '^frontend/src/' >/dev/null; then
echo "Changes detected in /frontend/src. Executing script..."

# Navigate to the frontend/src-tauri directory
cd frontend/src-tauri

# Run your commands
pnpm lint --fix
else
echo "No changes detected in /frontend/src."
fi
5 changes: 0 additions & 5 deletions rs_fmt.sh

This file was deleted.

0 comments on commit c401a48

Please sign in to comment.