Contributing to CodeGraphContext
Thank you for your interest in contributing to CodeGraphContext (CGC). We welcome contributions from the community to improve the performance, language support, and tooling capabilities of the engine.
Development Principles
- Code Quality: Adhere to PEP 8 standards for Python codebase.
- Robust Testing: Every bug fix, driver implementation, or parser extension must be accompanied by unit or integration tests.
- Focused Commits: Keep pull requests focused on a single change set.
- Maintain Documentation: Update references and guides if code changes alter command arguments or configurations.
Setting Up the Development Workspace
-
Clone the Repository:
git clone https://github.com/CodeGraphContext/CodeGraphContext.git cd CodeGraphContext -
Initialize Virtual Environment: Initialize an isolated python environment and install dependencies:
python -m venv .venv source .venv/bin/activate pip install -e ".[dev]"
Development Workflows
Debug Logging
Enable verbose debug logs during execution by setting the environment variable:
export CGC_LOG_LEVEL=DEBUG
cgc index
Running the Test Suite
The testing pipeline utilizes pytest. Ensure all checks pass locally before pushing changes:
# Run all unit and integration tests
pytest
# Test a specific driver module
pytest tests/unit/core/test_database_kuzu_compat.py
# Run tests bypassing re-indexing cache
CGC_SKIP_REINDEX=true pytest
Note: Integration tests for remote databases like Neo4j require a running local database instance (refer to docker-compose.yml).
Formatting & Linting
We enforce formatting and static checks via ruff. Run linting checks before committing:
ruff check .
ruff format .
Pull Request Guidelines
- Feature Branches: Branch from
mainusing descriptive naming (e.g.,feat/ladybug-concurrencyorfix/mcp-json-rpc). - Commit Styling: Write clear, descriptive commit logs.
- Submission: Open a pull request against the
mainbranch. Detail the modification, verify unit test runs, and link to open issue tickets if applicable.