Contributing to BunnyFarm¶
We welcome contributions to BunnyFarm! This guide will help you get started with contributing code, documentation, and other improvements.
Getting Started¶
Prerequisites¶
- Ruby 2.5 or higher
- RabbitMQ server for testing
- Git for version control
- Bundler for dependency management
Setting Up Development Environment¶
- Fork the repository on GitHub
-
Clone your fork locally:
-
Install dependencies:
-
Set up RabbitMQ for testing:
-
Run the tests to ensure everything works:
Development Philosophy¶
BunnyFarm follows the K.I.S.S. (Keep It Simple, Stupid) design principle:
- Simplicity over complexity - Choose simple solutions over elaborate ones
- Clarity over cleverness - Write code that's easy to understand
- Convention over configuration - Provide sensible defaults
- Edge cases are not priorities - Focus on common use cases
Code Style Guidelines¶
Ruby Style¶
Follow standard Ruby conventions:
# Good: Clear, descriptive names
class OrderProcessingMessage < BunnyFarm::Message
fields :order_id, :customer_email, :items
actions :validate, :process, :ship
def validate
validate_order_data
validate_customer_info
success! if errors.empty?
end
end
# Avoid: Unclear or overly clever code
class OPM < BF::Msg
flds :oid, :ce, :its
acts :v, :p, :s
def v; vod; vci; suc! if ers.empty?; end
end
Documentation Style¶
- Clear examples - Provide runnable code examples
- Practical focus - Show real-world usage patterns
- Progressive complexity - Start simple, build up
- Consistent format - Follow established patterns
Types of Contributions¶
๐ Bug Fixes¶
Found a bug? We'd love your help fixing it!
- Search existing issues to avoid duplicates
- Create an issue describing the bug with:
- Ruby version
- BunnyFarm version
- RabbitMQ version
- Minimal reproduction case
- Expected vs actual behavior
- Submit a pull request with the fix
โจ Feature Additions¶
Have an idea for a new feature?
- Discuss first - Open an issue to discuss the feature
- Keep it simple - Align with BunnyFarm's philosophy
- Consider the common case - Focus on widely useful features
- Include tests - New features need test coverage
- Update documentation - Include usage examples
๐ Documentation Improvements¶
Documentation improvements are always welcome:
- Fix typos and grammar
- Add missing examples
- Clarify confusing sections
- Create new guides and tutorials
- Update API documentation
๐งช Testing Enhancements¶
Help improve test coverage:
- Add missing test cases
- Improve test reliability
- Add integration tests
- Performance testing
- Cross-platform testing
Pull Request Process¶
Before Submitting¶
-
Run the tests:
-
Check code style:
-
Update documentation if needed
-
Add tests for new functionality
Submitting Your PR¶
-
Create a feature branch:
-
Make your changes with clear, atomic commits:
-
Push to your fork:
-
Create a pull request with:
- Clear title describing the change
- Detailed description of what was changed and why
- Link to related issues
- Screenshots/examples if applicable
PR Review Process¶
- Automated checks run (tests, style, etc.)
- Maintainer review - We'll provide feedback
- Address feedback - Make requested changes
- Final review - Maintainer approval
- Merge - Your contribution is included!
Testing Guidelines¶
Writing Tests¶
BunnyFarm uses Minitest for testing. Follow these patterns:
# test/test_your_feature.rb
require 'minitest_helper'
class TestYourFeature < Minitest::Test
def setup
@message = TestMessage.new
end
def test_basic_functionality
@message[:field] = 'value'
@message.your_action
assert @message.successful?
end
def test_error_handling
@message[:field] = nil # Invalid value
@message.your_action
assert @message.failed?
assert_includes @message.errors, 'Field is required'
end
end
Test Organization¶
- Unit tests - Test individual methods and classes
- Integration tests - Test end-to-end message flows
- Performance tests - Verify performance characteristics
- Edge case tests - Test boundary conditions
Running Tests¶
# Run all tests
bundle exec rake test
# Run specific test file
bundle exec ruby test/test_message.rb
# Run specific test method
bundle exec ruby test/test_message.rb -n test_basic_functionality
Issue Reporting¶
Bug Reports¶
When reporting bugs, include:
**Bug Description**
Clear description of the bug
**Environment**
- Ruby version: X.X.X
- BunnyFarm version: X.X.X
- RabbitMQ version: X.X.X
- OS: macOS/Linux/Windows
**Reproduction Steps**
1. Step one
2. Step two
3. Bug occurs
**Expected Behavior**
What should happen
**Actual Behavior**
What actually happens
**Minimal Code Example**
```ruby
# Code that reproduces the bug
Feature Requests¶
For feature requests, provide:
- Use case - What problem does this solve?
- Proposed solution - How should it work?
- Alternatives considered - What other approaches did you consider?
- Examples - Show how it would be used
Code Review Guidelines¶
For Contributors¶
- Keep PRs focused - One feature/fix per PR
- Write clear commit messages - Explain what and why
- Be responsive - Address feedback promptly
- Test thoroughly - Ensure changes work correctly
For Reviewers¶
- Be constructive - Provide helpful feedback
- Focus on the code - Not the person
- Explain reasoning - Help contributors learn
- Recognize good work - Acknowledge quality contributions
Release Process¶
BunnyFarm follows semantic versioning:
- Major version (X.0.0) - Breaking changes
- Minor version (0.X.0) - New features, backwards compatible
- Patch version (0.0.X) - Bug fixes, backwards compatible
Release Criteria¶
- All tests passing
- Documentation updated
- CHANGELOG.md updated
- Version number updated
Community Guidelines¶
Be Respectful¶
- Inclusive environment - Welcome contributors of all backgrounds
- Professional communication - Keep discussions constructive
- Patient teaching - Help newcomers learn
Be Helpful¶
- Answer questions - Help other users and contributors
- Share knowledge - Contribute to discussions
- Mentor newcomers - Guide new contributors
Getting Help¶
Need help contributing? Reach out:
- GitHub Issues - For bugs and feature requests
- GitHub Discussions - For questions and general discussion
- Pull Request Comments - For specific code feedback
Recognition¶
Contributors are recognized in:
- CHANGELOG.md - For significant contributions
- README.md - In the contributors section
- Release notes - For notable features and fixes
Next Steps¶
Ready to contribute?
- Browse open issues - Find something to work on
- Join discussions - Participate in the community
- Start small - Begin with documentation or small bug fixes
- Ask questions - Don't hesitate to ask for help
Thank you for contributing to BunnyFarm! ๐ฐ