Contributing
Thank you for your interest in contributing to Moonriver!
Development Setup
Prerequisites
- Rust 1.70 or later
- Cargo (comes with Rust)
- A Moonraker/Klipper instance for testing (optional but recommended)
Clone and Build
# Fork and clone the repository
git clone https://github.com/willpuckett/moonriver.git
cd moonriver
# Build the project
cargo build
# Run tests
cargo test
# Run locally
cargo run -- --host localhost --port 7125Making Changes
Create a branch:
bashgit checkout -b feature/your-feature-nameMake your changes
Format code:
bashcargo fmtLint code:
bashcargo clippy -- -D warningsTest changes:
bashcargo test cargo build --releaseCommit:
bashgit commit -m "Add: your feature description"
Code Style
- Follow standard Rust conventions
- Use
cargo fmtfor formatting - Use
cargo clippyfor linting - Write documentation for public APIs
- Add tests for new functionality
Naming Conventions
- Use snake_case for functions and variables
- Use PascalCase for types and traits
- Use SCREAMING_SNAKE_CASE for constants
Documentation
Document public APIs:
/// Connects to a Moonraker instance via WebSocket
///
/// # Arguments
///
/// * `url` - WebSocket URL of the Moonraker instance
///
/// # Examples
///
/// ```
/// let client = MoonrakerClient::connect("ws://localhost:7125/websocket").await?;
/// ```
pub async fn connect(url: &str) -> Result<Self> {
// Implementation
}Commit Guidelines
Write clear, concise commit messages:
- Add: New features
- Fix: Bug fixes
- Update: Changes to existing features
- Refactor: Code improvements without behavior changes
- Docs: Documentation changes
- Test: Test additions or changes
- Chore: Maintenance tasks
Examples:
Add: tab completion for user macros
Fix: connection timeout on slow networks
Update: improve error messages
Docs: add scripting mode examplesPull Request Process
Update documentation if needed
Update CHANGELOG.md with your changes
Ensure all tests pass:
bashcargo test cargo clippy -- -D warnings cargo fmt --checkPush to your fork:
bashgit push origin feature/your-feature-nameCreate a Pull Request on GitHub
Wait for review - maintainers will review your PR
PR Checklist
- [ ] Code compiles without warnings
- [ ] Tests pass
- [ ] Code is formatted (
cargo fmt) - [ ] Code passes clippy (
cargo clippy) - [ ] Documentation is updated
- [ ] CHANGELOG.md is updated
- [ ] Commit messages are clear
Testing
Unit Tests
Write unit tests for new functionality:
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_parse_gcode() {
let result = parse_gcode("G28");
assert_eq!(result, Command::Home);
}
}Integration Tests
Add integration tests in tests/:
// tests/integration_test.rs
use moonriver::moonraker::MoonrakerClient;
#[tokio::test]
async fn test_connection() {
// Test code
}Manual Testing
Test with a real Moonraker instance:
cargo run -- --host localhost --port 7125Feature Requests
Have an idea? Open an issue on GitHub:
- Go to Issues
- Click "New Issue"
- Select "Feature Request"
- Describe:
- The use case
- Why it would be beneficial
- Implementation ideas (if any)
Bug Reports
Found a bug? Report it:
- Go to Issues
- Click "New Issue"
- Select "Bug Report"
- Include:
- Steps to reproduce
- Expected behavior
- Actual behavior
- Your environment (OS, Rust version, etc.)
- Relevant logs or screenshots
Questions
Have questions? Feel free to:
- Open a Discussion
- Join our community chat (if available)
- Ask in an issue with the
questionlabel
Code of Conduct
Be respectful and inclusive. We welcome contributors from all backgrounds.
License
By contributing, you agree that your contributions will be licensed under the MIT License.
Recognition
Contributors will be recognized in:
- The project README
- Release notes
- CHANGELOG.md
Thank you for contributing to Moonriver! 🌙