Guidelines for contributing to the QuantumVest project including code style, testing, and development workflow.
- Fork the repository
- Clone your fork:
git clone https://github.com/quantsingularity/QuantumVest.git cd QuantumVest - Add upstream remote:
git remote add upstream https://github.com/quantsingularity/QuantumVest.git
- Create a feature branch:
git checkout -b feature/your-feature-name
cd code/backend
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
# Install development dependencies
pip install pytest pytest-cov black flake8 mypy
# Run in development mode
FLASK_ENV=development python app.pycd web-frontend
npm install
npm startInstall pre-commit hooks to ensure code quality:
# Install pre-commit
pip install pre-commit
# Install hooks
pre-commit install
# Run manually
pre-commit run --all-files- Follow PEP 8 style guide
- Use Black for code formatting
- Use type hints for function signatures
- Maximum line length: 88 characters (Black default)
Format code:
black code/backend/Lint code:
flake8 code/backend/Type checking:
mypy code/backend/- Follow Airbnb JavaScript Style Guide
- Use Prettier for formatting
- Use ESLint for linting
Format code:
cd web-frontend
npm run formatLint code:
npm run lintUse conventional commit format:
type(scope): subject
body (optional)
footer (optional)
Types:
feat: New featurefix: Bug fixdocs: Documentation changesstyle: Code style changes (formatting)refactor: Code refactoringtest: Test changeschore: Build/config changes
Example:
feat(api): add portfolio optimization endpoint
Implement Modern Portfolio Theory optimization
using PyPortfolioOpt library.
Closes #123
cd code/backend
source venv/bin/activate
# Run all tests
pytest
# Run with coverage
pytest --cov=. --cov-report=html
# Run specific test file
pytest tests/test_endpoints.py
# Run specific test
pytest tests/test_endpoints.py::test_logincd web-frontend
# Run tests
npm test
# Run with coverage
npm test -- --coverage
# Watch mode
npm test -- --watch- All new features must include tests
- Maintain minimum 80% code coverage
- Tests must pass before PR approval
-
Sync with upstream:
git fetch upstream git rebase upstream/main
-
Ensure all tests pass:
./scripts/run_all_tests.sh
-
Ensure code is formatted:
./scripts/lint-all.sh --fix
-
Push to your fork:
git push origin feature/your-feature-name
-
Create Pull Request on GitHub with:
- Clear title and description
- Reference to related issues
- Screenshots (if UI changes)
- Test evidence
-
Address review feedback
-
Squash commits if requested
- New features or API endpoints
- Configuration changes
- Breaking changes
- Deprecated features
- Architecture changes
Documentation resides in /docs directory:
docs/
├── README.md # Documentation index
├── INSTALLATION.md # Installation guide
├── USAGE.md # Usage examples
├── API.md # API reference
├── CLI.md # CLI reference
├── CONFIGURATION.md # Configuration guide
├── FEATURE_MATRIX.md # Feature catalog
├── ARCHITECTURE.md # Architecture overview
├── CONTRIBUTING.md # This file
├── TROUBLESHOOTING.md # Common issues
├── MIGRATIONS.md # Migration guides
└── EXAMPLES/ # Code examples
├── portfolio-management.md
├── ai-prediction.md
└── risk-analysis.md
- Use Markdown format
- Include code examples for all features
- Use tables for parameters and configuration
- Add diagrams where helpful (Mermaid supported)
- Keep language clear and concise
- Include working examples that can be copy-pasted
# Check documentation links
markdown-link-check docs/*.md
# Verify code examples
python docs/verify_examples.py- Code follows style guidelines
- Tests added/updated
- Documentation updated
- All tests pass
- Code is self-documenting or commented
- No console.log or debug statements
- No hardcoded secrets or credentials
- Code is clear and maintainable
- Tests are comprehensive
- Documentation is complete
- No security vulnerabilities
- Performance considerations addressed
- Breaking changes documented
- Never commit secrets, API keys, or passwords
- Use environment variables for configuration
- Validate all user inputs
- Use parameterized SQL queries
- Follow OWASP security guidelines
- Update version in
package.json - Update CHANGELOG.md
- Create release branch:
release/vX.Y.Z - Run full test suite
- Create release tag
- Deploy to staging
- Verify staging deployment
- Deploy to production
- Create GitHub release
By contributing to QuantumVest, you agree that your contributions will be licensed under the MIT License.