included Precommit hooks
Summary
This MR introduces pre-commit enforcement, formatting standardization, and fixes for local ASR model support.
It establishes a quality gate at commit time, ensuring code consistency, security compliance, and improved reliability without altering existing application behavior.
Key Outcomes
- Enforced linting, formatting, and security checks via pre-commit
- Restored and stabilized local ASR model loading
- Improved compliance with Ruff and Bandit
Changes Overview
| Component | Change Type | Details |
|---|---|---|
.pre-commit-config.yaml |
Added | Defines hooks for Ruff, formatting, and Bandit |
.husky/pre-commit |
Added | Executes pre-commit pipeline before commits |
.husky/commit-msg |
Added | Enforces commit message conventions |
pyproject.toml |
Updated | Centralized linting/formatting configuration |
package.json |
Updated | Added Husky integration |
app/asr_service.py |
Modified | Fixed local ASR model loading and punctuation handling |
app/config.py |
Modified | Added flags for local model configuration |
app/main.py |
Modified | Minor refactors for compliance and testability |
| Documentation | Added | Setup guide + compliance notes |
Motivation
This change addresses three critical gaps:
1. Code Quality Enforcement
- Prevents inconsistent formatting and lint violations
- Ensures all commits pass standardized checks
2. Security Hardening
- Integrates Bandit to catch common Python vulnerabilities early
3. ASR Reliability Fix
- Resolves failures in local ASR model initialization
- Restores expected transcription pipeline behavior
Technical Notes
- Ruff is used as the primary linter/formatter (fast, unified toolchain)
- Hooks run locally → reduces CI load and feedback latency
- ASR fix ensures:
- Proper model path resolution
- Stable inference pipeline
- Correct punctuation post-processing
Testing Performed
-
✅ Pre-commit hooks triggered successfully on commit -
✅ Ruff + Bandit checks passed with no critical issues -
✅ Local ASR model:- Loads without runtime errors
- Produces valid real-time transcription output
Verification Steps
1. Checkout Branch
git fetch origin
git checkout pre_commit_work_review
## 2. Install Hooks
pip install pre-commit
pre-commit install
## 3. Validate Hook Execution
git add .
git commit -m "test: verify pre-commit hooks"
## 4. Run ASR Locally
./start.sh