# Contributing to NoEntropy Thank you for considering contributing to NoEntropy! This guide will help you get started with contributing to the project. ## Table of Contents - [Code of Conduct](#code-of-conduct) - [How Can I Contribute?](#how-can-i-contribute) - [Development Setup](#development-setup) - [Pull Request Process](#pull-request-process) - [Coding Standards](#coding-standards) - [Commit Message Guidelines](#commit-message-guidelines) - [Testing Guidelines](#testing-guidelines) - [Documentation Guidelines](#documentation-guidelines) ## Code of Conduct ### Our Pledge We are committed to providing a welcoming and inspiring community for everyone. Please be respectful and constructive in your interactions. ### Expected Behavior - Be respectful and inclusive - Accept constructive criticism gracefully - Focus on what's best for the community - Show empathy towards other community members ### Unacceptable Behavior - Harassment or discriminatory language - Trolling or insulting comments - Public or private harassment - Publishing others' private information ## How Can I Contribute? ### Reporting Bugs Before creating bug reports, please check existing issues to avoid duplicates. **How to submit a good bug report:** 1. **Use a clear and descriptive title** 2. **Describe the exact steps to reproduce the problem** 3. **Provide specific examples** 4. **Describe the behavior you observed and what you expected** 5. **Include system information**: - OS and version - Rust version - NoEntropy version **Bug report template:** ```markdown **Description** A clear description of the bug. **Steps to Reproduce** 1. Run command '...' 2. See error '...' **Expected Behavior** What you expected to happen. **Actual Behavior** What actually happened. **System Information** - OS: [e.g., Ubuntu 22.04] - Rust version: [e.g., 1.75.0] - NoEntropy version: [e.g., 1.0.0] **Additional Context** Any other relevant information. ``` ### Suggesting Enhancements Enhancement suggestions are welcome! Please provide: 1. **Clear use case**: Explain why this enhancement would be useful 2. **Detailed description**: Describe how it should work 3. **Examples**: Provide examples of how it would be used 4. **Alternatives considered**: Mention alternative solutions you've considered **Enhancement template:** ```markdown **Feature Description** A clear description of the feature. **Use Case** Why this feature would be useful. **Proposed Solution** How you think it should work. **Alternatives Considered** Other solutions you've thought about. **Additional Context** Any other relevant information. ``` ### Contributing Code We love code contributions! Here's how to get started: 1. **Fork the repository** 2. **Create a feature branch** 3. **Make your changes** 4. **Test thoroughly** 5. **Submit a pull request** See [Development Setup](#development-setup) below for details. ### Improving Documentation Documentation improvements are highly valued: - Fix typos or unclear explanations - Add examples or clarifications - Improve code comments - Write tutorials or guides ### Helping Others - Answer questions in GitHub Issues - Participate in discussions - Help review pull requests - Share your use cases and experiences ## Development Setup ### Prerequisites - **Rust 2024 Edition** or later - **Git** for version control - **Google Gemini API Key** for testing (get one at [https://ai.google.dev/](https://ai.google.dev/)) ### Setup Steps 1. **Fork and clone the repository**: ```bash git clone https://github.com/YOUR_USERNAME/noentropy.git cd noentropy ``` 2. **Add upstream remote**: ```bash git remote add upstream https://github.com/glitchySid/noentropy.git ``` 3. **Build the project**: ```bash cargo build ``` 4. **Run tests**: ```bash cargo test ``` 5. **Set up configuration** (for testing): ```bash cp config.example.toml ~/.config/noentropy/config.toml # Edit config.toml with your API key and test folder ``` 6. **Verify installation**: ```bash cargo run -- --dry-run ``` ### Keeping Your Fork Updated ```bash git fetch upstream git checkout main git merge upstream/main git push origin main ``` ## Pull Request Process ### Before Submitting 1. **Ensure tests pass**: ```bash cargo test ``` 2. **Run code formatter**: ```bash cargo fmt ``` 3. **Run linter**: ```bash cargo clippy ``` 4. **Test manually** with various scenarios 5. **Update documentation** if needed ### Creating a Pull Request 1. **Create a feature branch**: ```bash git checkout -b feature/your-feature-name ``` 2. **Make your changes** and commit: ```bash git add . git commit -m "Add feature: description" ``` 3. **Push to your fork**: ```bash git push origin feature/your-feature-name ``` 4. **Open a pull request** on GitHub 5. **Fill out the PR template** with: - Description of changes - Related issue number (if applicable) - Testing performed - Screenshots (if UI changes) ### PR Review Process 1. **Automated checks** will run (tests, linting, formatting) 2. **Maintainers will review** your code 3. **Address feedback** by making additional commits 4. **Once approved**, your PR will be merged ### PR Guidelines - **Keep PRs focused**: One feature or fix per PR - **Write clear descriptions**: Explain what and why - **Reference issues**: Use "Fixes #123" to link issues - **Be responsive**: Respond to review feedback promptly - **Be patient**: Reviews may take time ## Coding Standards ### Rust Style Guide Follow the official [Rust Style Guide](https://doc.rust-lang.org/nightly/style-guide/): - Use `cargo fmt` to format code - Use `cargo clippy` to catch common mistakes - Follow Rust naming conventions: - `snake_case` for functions and variables - `PascalCase` for types and traits - `SCREAMING_SNAKE_CASE` for constants ### Code Organization - Keep functions focused and small - Group related functionality in modules - Use meaningful variable and function names - Avoid deep nesting (prefer early returns) ### Error Handling - Use `Result` types for fallible operations - Provide meaningful error messages - Don't panic in library code - Use `?` operator for error propagation ### Comments and Documentation - Add doc comments (`///`) for public APIs - Explain "why" not "what" in comments - Keep comments up-to-date with code changes - Use examples in doc comments when helpful ### Example ```rust /// Calculates the destination path for a file based on its category. /// /// # Arguments /// /// * `file_path` - The original file path /// * `category` - The category to organize into /// * `subfolder` - Optional subfolder within category /// /// # Examples /// /// ``` /// let dest = calculate_destination("/downloads/file.txt", "Documents", Some("Work")); /// assert_eq!(dest, "/downloads/Documents/Work/file.txt"); /// ``` /// /// # Errors /// /// Returns an error if the path cannot be constructed. pub fn calculate_destination( file_path: &Path, category: &str, subfolder: Option<&str> ) -> Result { // Implementation } ``` ## Commit Message Guidelines ### Format ``` ():