Contributing¶
Getting started¶
- Fork the repository
- Clone your fork:
- Set up the development environment:
- Verify everything works:
Development workflow¶
- Create a branch from
main - Make your changes
- Add tests for new functionality
- Run the full check suite:
- Commit and open a Pull Request
Code style¶
- Python 3.10+ with type annotations
- Formatted with
ruff(line-length 100) - Type checked with
mypy(strict mode) - Structured logging via
logging.getLogger("crossfire.<module>") - Fail-fast by default, lenient by opt-in (
--skip-invalid)
Tests¶
- Tests live in
tests/and use pytest - Test fixtures go in
tests/fixtures/ - Run a single test file:
pytest tests/test_loader.py -v - Run a single test:
pytest tests/test_loader.py::TestLoadJson::test_load_array -v
Adding a format adapter¶
Crossfire uses a plugin system for format adapters. To add support for a new tool:
- Create
crossfire/plugins/your_tool.py - Implement the
RuleAdapterprotocol: - Register it in
crossfire/plugins/__init__.py(_register_builtin_adapters) - Add a test fixture in
tests/fixtures/ - Add tests in
tests/test_plugins.py
See crossfire/plugins/gitleaks.py for a reference implementation.
Pull request guidelines¶
- Keep PRs focused on a single change
- Include tests for new functionality
- Update
CHANGELOG.mdfor user-visible changes - Ensure all checks pass (
pre-commit run --all-files)