Contributing¶
Getting Started¶
git clone https://github.com/SMART-Dal/codegreen.git
cd codegreen
pip install -e ".[dev]"
pre-commit install
Code Style¶
- Formatting: ruff (
ruff check --fix .) - Methods: snake_case
- Classes: PascalCase
- Constants: UPPER_CASE
Adding Language Support¶
CodeGreen uses a config-driven design. To add a new language:
- Add a Tree-sitter grammar to
third_party/ - Create
src/instrumentation/configs/<language>.jsonwith function patterns - Add a runtime bridge in
src/instrumentation/language_runtimes/<language>/ - Register the language in
src/cli/cli.pyLanguage enum
No changes needed to the core instrumentation engine.
Project Structure¶
src/
cli/ # Python CLI (Typer + Rich)
instrumentation/ # Tree-sitter engine + language configs
measurement/ # C++ NEMB backend
analyzer/ # Post-measurement visualization
benchmark/ # Benchmark suite
docs/website/ # MkDocs documentation
Submitting Changes¶
- Fork the repository
- Create a feature branch
- Ensure
ruff check .passes - Open a pull request with a clear description