Contributing¶
Thank you for your interest in contributing to Cloudrift! This guide covers the workflow for submitting changes.
Getting Started¶
- Fork the repository on GitHub
-
Clone your fork locally:
-
Create a branch for your feature or fix:
-
Build and test to verify everything works:
Development Workflow¶
Code Changes¶
- Make your changes in the appropriate package
- Format your code:
go fmt ./... - Run tests:
go test ./... - Build:
go build -o cloudrift main.go
Adding Features¶
- New AWS service — See Adding Services
- New OPA policy — See Adding Policies
- New output format — Implement the
Formatterinterface ininternal/output/
Code Standards¶
Go Conventions¶
- Follow Effective Go guidelines
- Use
go fmtfor formatting (enforced in CI) - Keep packages focused and small
- Use descriptive variable names
- Add comments for exported functions
Testing¶
- Write tests for all new functionality
- Place tests in
tests/internal/mirroring the package structure - Use
testifyfor assertions - Aim for table-driven tests where applicable
Policy Conventions¶
- Follow the existing
.regofile patterns - Include all metadata fields (
policy_id,policy_name,msg,severity,remediation,category,frameworks) - Place in the correct category directory (
security/,tagging/,cost/)
Commit Messages¶
Use clear, concise commit messages:
Add RDS drift detection support
Implements drift detection for aws_db_instance resources including
storage encryption, public access, and backup retention checks.
- Use imperative mood ("Add" not "Added")
- First line: summary under 72 characters
- Optional body: explain why, not what
Pull Request Process¶
- Ensure all tests pass:
go test ./... - Ensure code is formatted:
go fmt ./... - Push your branch:
git push origin feature/my-feature - Open a pull request against
main - Describe what changed and why
- Link any related issues
PR Checklist¶
- [ ] Tests pass (
go test ./...) - [ ] Code is formatted (
go fmt ./...) - [ ] New features have tests
- [ ] New policies include all metadata fields
- [ ] Documentation updated if needed
Reporting Issues¶
Found a bug or have a feature request? Open an issue on GitHub.
Include:
- Expected behavior vs actual behavior
- Steps to reproduce
- Cloudrift version (
cloudrift --help) - Go version (
go version) - OS and architecture
License¶
By contributing, you agree that your contributions will be licensed under the Apache License 2.0.