Refactor code structure for improved readability and maintainability
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
@echo off
|
||||
REM Pre-commit test gate for Windows
|
||||
REM Inspects staged .rs files and runs affected crate tests
|
||||
|
||||
setlocal enabledelayedexpansion
|
||||
|
||||
REM Get staged .rs files
|
||||
set STAGED_FILES=
|
||||
for /f "delims=" %%f in ('git diff --cached --name-only --diff-filter=ACMR -- "*.rs"') do (
|
||||
if exist "%%f" set STAGED_FILES=!STAGED_FILES! %%f
|
||||
)
|
||||
|
||||
if "%STAGED_FILES%"=="" (
|
||||
echo No staged Rust files; commit regression tests are not required.
|
||||
exit /b 0
|
||||
)
|
||||
|
||||
echo Checking formatting...
|
||||
for %%f in (%STAGED_FILES%) do (
|
||||
rustfmt --edition 2021 --check "%%f"
|
||||
if errorlevel 1 (
|
||||
echo Formatting check failed for %%f
|
||||
exit /b 1
|
||||
)
|
||||
)
|
||||
|
||||
echo Running deterministic workspace tests...
|
||||
cargo check --locked --workspace --exclude hcie-io --examples
|
||||
if errorlevel 1 exit /b %errorlevel%
|
||||
|
||||
cargo test --locked --workspace --exclude hcie-io --lib --tests -- --skip benchmark_4k_stroke_on_multilayer_document
|
||||
if errorlevel 1 exit /b %errorlevel%
|
||||
|
||||
echo Mandatory Rust regression gate passed.
|
||||
exit /b 0
|
||||
Reference in New Issue
Block a user