8080 echo " ... (output truncated, run 'reuse lint' for full report)"
8181 fi
8282 echo
83- print_warning " ⚠️ To skip checks: git push --no-verify"
83+ print_warning " ⚠️ To skip checks: git commit --no-verify"
8484 exit 1
8585 fi
8686fi
8787
8888# ============================================================================
8989# CHECK 2: Code Formatting
9090# ============================================================================
91- # Verify that all Rust code follows the project's formatting standards.
91+ # Verify that all Rust code and TOML files follow the project's formatting standards.
9292# Consistent formatting improves readability and reduces merge conflicts.
9393
9494print_header " 🎨 Checking code formatting"
@@ -98,23 +98,45 @@ if ! command -v cargo &> /dev/null; then
9898 exit 1
9999fi
100100
101- # Check if code needs formatting.
101+ # Check if Rust code needs formatting.
102102FMT_OUTPUT=$( cargo +nightly fmt --all -- --check 2>&1 )
103103FMT_EXIT_CODE=$?
104104
105105if [ $FMT_EXIT_CODE -eq 0 ]; then
106- print_success " ✅ Code formatting looks good"
106+ print_success " ✅ Rust code formatting looks good"
107107else
108- print_error " ❌ Code needs formatting"
108+ print_error " ❌ Rust code needs formatting"
109109 echo
110110 echo " $FMT_OUTPUT "
111111 echo
112112 print_info " 💡 Fix with: cargo +nightly fmt"
113113 echo
114- print_warning " ⚠️ To skip checks: git push --no-verify"
114+ print_warning " ⚠️ To skip checks: git commit --no-verify"
115115 exit 1
116116fi
117117
118+ # Check if TOML files need formatting.
119+ if ! command -v taplo & > /dev/null; then
120+ print_warning " ⚠️ taplo not found - skipping TOML formatting check."
121+ echo " Install from: https://github.com/tamasfe/taplo"
122+ else
123+ TAPLO_OUTPUT=$( taplo fmt --check 2>&1 )
124+ TAPLO_EXIT_CODE=$?
125+
126+ if [ $TAPLO_EXIT_CODE -eq 0 ]; then
127+ print_success " ✅ TOML formatting looks good"
128+ else
129+ print_error " ❌ TOML files need formatting"
130+ echo
131+ echo " $TAPLO_OUTPUT "
132+ echo
133+ print_info " 💡 Fix with: taplo fmt"
134+ echo
135+ print_warning " ⚠️ To skip checks: git commit --no-verify"
136+ exit 1
137+ fi
138+ fi
139+
118140# ============================================================================
119141# Success
120142# ============================================================================
0 commit comments