Welcome to the RepoAudit development guide! This document outlines how to set up your local environment, run tests, and contribute new features or auditors.
RepoAudit requires a distributed environment for both its API and background workers. You have two options for local development:
This is the easiest way to get everything running in a simulated production environment.
- Configure
.env:cp backend/.env.example backend/.env # Edit .env with your local or Upstash/Supabase keys - Start Services:
docker compose up --build
- Frontend: http://localhost:3000
- API: http://localhost:7860
- Worker: Logs will appear in the terminal.
Best for active development where you want faster reload times.
- Install Dependencies:
- Backend:
cd backend && pip install -r requirements.txt - Frontend:
cd frontend && npm install
- Backend:
- Start External Services:
- Ensure
valkey-server(orredis-server) is running on port 6379.
- Ensure
- Run Components:
- Worker:
celery -A worker worker --loglevel=info - API:
uvicorn main:app --reload --port 7860 - Frontend:
npm run dev(insidefrontend/)
- Worker:
backend/: FastAPI application and Celery worker.engine/: The core audit logic. Each auditor is a specialized module.routers/: API endpoint definitions.
frontend/: Next.js 15 application.app/: App router pages.components/: UI components (radar charts, score cards, Pipeline DAG).
To extend RepoAudit with a new reproducibility check:
- Create Auditor Module: Add a new file in
backend/engine/(e.g.,new_feature_auditor.py). - Define Audit Function: Implement the logic to scan the cloned repository path.
- Regenerate Report: Update
backend/engine/scoring.pyto include your new auditor and calculate how its results affect the category scores. - Update Models: If your auditor returns new types of issues or metadata, update
backend/models.py.
def audit_repo(repo_path: str) -> list[Issue]:
issues = []
# Core logic here...
return issuesRepoAudit uses pytest for backend testing. We prioritize unit tests for individual auditors and integration tests for the scoring logic.
Run All Tests:
cd backend
pytestRun Specific Audit Tests:
pytest tests/test_ast_auditor.py
pytest tests/test_pipeline_auditor.py- Python: Follow PEP 8. Use type hints for all function signatures.
- Frontend: Use TypeScript for all components. Prefer functional components with React Hooks.
- Commits: Use descriptive commit messages.