# Contributing to Marisa FFI
Thank you for your interest in contributing to Marisa FFI! This document provides guidelines and information for contributors.
## Code of Conduct
This project follows the [Rust Code of Conduct](https://www.rust-lang.org/policies/code-of-conduct). By participating, you are expected to uphold this code.
## Getting Started
### Prerequisites
- Rust 1.70+
- CMake 3.22+
- C++ compiler with C++20 support
- Git
### Setting Up Development Environment
1. Fork the repository on GitHub
2. Clone your fork locally:
```bash
git clone https://github.com/your-username/marisa-ffi.git
cd marisa-ffi
```
3. Add the upstream repository:
```bash
git remote add upstream https://github.com/shinecrazy/marisa-ffi.git
```
4. Build the project:
```bash
cargo build
```
5. Run tests:
```bash
cargo test
```
## Development Workflow
### Making Changes
1. Create a new branch for your feature or bugfix:
```bash
git checkout -b feature/your-feature-name
```
2. Make your changes following the coding standards below
3. Test your changes:
```bash
cargo test
cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release
cmake --build build
./build/marisa_ffi_test
cargo run --example basic_usage
```
4. Format and lint your code:
```bash
cargo fmt
cargo clippy --all-targets --all-features
```
5. Commit your changes with a clear message:
```bash
git commit -m "Add feature: brief description"
```
6. Push to your fork:
```bash
git push origin feature/your-feature-name
```
7. Create a Pull Request on GitHub
### Coding Standards
#### Rust Code
- Follow Rust naming conventions
- Use `cargo fmt` for formatting
- Use `cargo clippy` for linting
- Add documentation for public APIs
- Write tests for new functionality
- Use meaningful variable and function names
#### C++ Code
- Follow Google C++ Style Guide
- Use meaningful variable and function names
- Add comments for complex logic
- Handle errors gracefully
- Use RAII principles
#### Documentation
- Update README.md for user-facing changes
- Add doc comments for new public APIs
- Update examples if needed
- Keep CHANGELOG.md updated
## Types of Contributions
### Bug Reports
When reporting bugs, please include:
- Clear description of the issue
- Steps to reproduce
- Expected vs actual behavior
- Environment details (OS, Rust version, etc.)
- Minimal code example if applicable
### Feature Requests
For feature requests, please include:
- Clear description of the feature
- Use cases and motivation
- Proposed API design if applicable
- Implementation considerations
### Code Contributions
We welcome contributions in these areas:
- Bug fixes
- Performance improvements
- New features
- Documentation improvements
- Test coverage improvements
- Examples and tutorials
## Pull Request Guidelines
### Before Submitting
- [ ] Code compiles without warnings
- [ ] All tests pass
- [ ] Code is formatted (`cargo fmt`)
- [ ] No clippy warnings (`cargo clippy`)
- [ ] Documentation is updated
- [ ] CHANGELOG.md is updated
- [ ] Examples work correctly
### PR Description
Include:
- Summary of changes
- Motivation and context
- Testing performed
- Breaking changes (if any)
- Screenshots (for UI changes)
### Review Process
1. Automated checks must pass
2. Code review by maintainers
3. Discussion and iteration
4. Approval and merge
## Testing
### Running Tests
```bash
# All tests
cargo test
# Specific test
cargo test test_name
# With output
cargo test -- --nocapture
# C++ tests
cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release
cmake --build build
./build/marisa_ffi_test
```
### Adding Tests
- Unit tests for individual functions
- Integration tests for API usage
- Property-based tests for complex logic
- Performance benchmarks for critical paths
## Release Process
Releases are managed by maintainers:
1. Update version numbers
2. Update CHANGELOG.md
3. Create release tag
4. Publish to crates.io
5. Create GitHub release
## Getting Help
- Open an issue for questions
- Join discussions in GitHub Discussions
- Check existing issues and PRs
## License
By contributing, you agree that your contributions will be licensed under the BSD-2-Clause License.
## Recognition
Contributors will be recognized in:
- CONTRIBUTORS.md file
- Release notes
- Project documentation
Thank you for contributing to Marisa FFI! 🎉