Contributing to VisualVault
July 24, 2025 ยท View on GitHub
First off, thank you for considering contributing to VisualVault! It's people like you that make VisualVault such a great tool. ๐
Table of Contents
- Code of Conduct
- Getting Started
- How Can I Contribute?
- Development Setup
- Style Guidelines
- Testing Guidelines
- Project Structure
- Community
Code of Conduct
This project and everyone participating in it is governed by our Code of Conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to the project maintainers.
Getting Started
- Fork the repository on GitHub
- Clone your fork locally
- Create a new branch for your feature or bugfix
- Make your changes
- Run tests and ensure they pass
- Commit your changes
- Push to your fork
- Create a Pull Request
How Can I Contribute?
Reporting Bugs
Before creating bug reports, please check existing issues as you might find out that you don't need to create one. When you are creating a bug report, please include as many details as possible:
Bug Report Template:
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Environment:**
- OS: [e.g. Ubuntu 22.04, macOS 13, Windows 11]
- Rust version: [e.g. 1.85.0]
- VisualVault version/commit: [e.g. 0.1.0 or commit hash]
**Additional context**
Add any other context about the problem here.
Suggesting Enhancements
Enhancement suggestions are tracked as GitHub issues. When creating an enhancement suggestion, please include:
- Use a clear and descriptive title
- Provide a step-by-step description of the suggested enhancement
- Provide specific examples to demonstrate the steps
- Describe the current behavior and explain which behavior you expected to see instead
- Explain why this enhancement would be useful to most VisualVault users
Your First Code Contribution
Unsure where to begin contributing? You can start by looking through these issues:
- Issues labeled
good first issue- issues which should be relatively simple to implement - Issues labeled
help wanted- issues which need extra attention - Issues labeled
documentation- improvements or additions to documentation
Pull Requests
- Fork and clone the repository
- Create a new branch:
git checkout -b feature/your-feature-name - Make your changes and add tests for them
- Run the test suite:
cargo testandcargo nextest run - Run clippy:
cargo clippy -- -D warnings - Format your code:
cargo fmt - Commit your changes: Use a descriptive commit message
- Push to your fork:
git push origin feature/your-feature-name - Submit a pull request
Development Setup
Prerequisites
- Rust 1.85 or higher
- Git
- A terminal emulator with good Unicode support
Building the Project
# Clone the repository
git clone https://github.com/yourusername/visualvault.git
cd visualvault
# Build in debug mode
cargo build
# Build in release mode
cargo build --release
# Run the application
cargo run
# Run with debug logging
RUST_LOG=debug cargo run
Running Tests
# Run all tests
cargo test
# Run tests with output
cargo test -- --nocapture
# Run specific test module
cargo test core::scanner
# Run with nextest (recommended)
cargo nextest run
# Run with coverage
cargo tarpaulin --out Html
Development Tools
We recommend installing these tools for a better development experience:
# Install development tools
cargo install cargo-watch # Auto-rebuild on file changes
cargo install cargo-nextest # Better test runner
cargo install cargo-tarpaulin # Code coverage
cargo install cargo-audit # Security audit
# Watch for changes and run tests
cargo watch -x test
# Watch for changes and run the app
cargo watch -x run
Style Guidelines
Git Commit Messages
- Use the present tense ("Add feature" not "Added feature")
- Use the imperative mood ("Move cursor to..." not "Moves cursor to...")
- Limit the first line to 72 characters or less
- Reference issues and pull requests liberally after the first line
- Use conventional commits format when possible:
feat:for new featuresfix:for bug fixesdocs:for documentation changesstyle:for formatting changesrefactor:for code refactoringtest:for adding testschore:for maintenance tasks
Examples:
feat: add support for HEIC image format
- Add HEIC detection in media_types module
- Update scanner to handle HEIC files
- Add tests for HEIC file processing
Closes #123
Rust Style Guide
We follow the standard Rust style guidelines:
- Run
cargo fmtbefore committing - Ensure
cargo clippy -- -D warningspasses - Use descriptive variable names
- Add documentation comments for public APIs
- Keep functions focused and small
- Use
Result<T, E>for error handling - Prefer
&stroverStringfor function parameters when possible
Example:
/// Organizes files based on the specified organization mode.
///
/// # Arguments
///
/// * `files` - Vector of files to organize
/// * `settings` - Configuration settings for organization
///
/// # Returns
///
/// Returns `Ok(OrganizationResult)` on success, or an error if organization fails.
///
/// # Example
///
/// ```
/// let result = organizer.organize_files(files, &settings).await?;
/// println!("Organized {} files", result.files_organized);
/// ```
pub async fn organize_files(
&self,
files: Vec<MediaFile>,
settings: &Settings,
) -> Result<OrganizationResult> {
// Implementation
}
Documentation Style Guide
- Use triple-slash comments (
///) for public items - Include examples in documentation when helpful
- Document panic conditions with
# Panics - Document error conditions with
# Errors - Keep line length under 100 characters in documentation
Testing Guidelines
Writing Tests
- Write tests for all new functionality
- Place unit tests in the same file as the code they test
- Place integration tests in the
tests/directory - Use descriptive test names that explain what is being tested
- Use test fixtures and helper functions to reduce duplication
Example test structure:
#[cfg(test)]
mod tests {
use super::*;
use tempfile::TempDir;
// Helper function for test setup
async fn setup_test_environment() -> Result<(TempDir, Scanner)> {
let temp_dir = TempDir::new()?;
let scanner = Scanner::new();
Ok((temp_dir, scanner))
}
#[tokio::test]
async fn test_scanner_finds_jpeg_files() -> Result<()> {
let (temp_dir, scanner) = setup_test_environment().await?;
// Create test file
let test_file = temp_dir.path().join("test.jpg");
fs::write(&test_file, b"fake jpeg data").await?;
// Run scanner
let files = scanner.scan_directory(temp_dir.path(), false).await?;
// Assertions
assert_eq!(files.len(), 1);
assert_eq!(files[0].extension, "jpg");
Ok(())
}
}
Test Categories
- Unit Tests: Test individual functions and methods
- Integration Tests: Test complete workflows
- UI Tests: Test terminal UI components (when applicable)
- Performance Tests: Benchmark critical paths
Project Structure
visualvault/
โโโ src/
โ โโโ main.rs # Application entry point
โ โโโ app.rs # Main application state and logic
โ โโโ config/ # Configuration management
โ โ โโโ settings.rs # Settings structure and defaults
โ โโโ core/ # Core functionality
โ โ โโโ scanner.rs # File scanning logic
โ โ โโโ organizer.rs # File organization logic
โ โ โโโ duplicate.rs # Duplicate detection
โ โ โโโ file_cache.rs # File metadata caching
โ โโโ models/ # Data structures
โ โ โโโ file_type.rs # File type definitions
โ โ โโโ media_file.rs # Media file representation
โ โ โโโ filters.rs # Filter definitions
โ โโโ ui/ # Terminal UI components
โ โ โโโ dashboard.rs # Dashboard view
โ โ โโโ settings.rs # Settings view
โ โ โโโ help.rs # Help overlay
โ โโโ utils/ # Utility functions
โ โโโ datetime.rs # Date/time helpers
โ โโโ format.rs # Formatting utilities
โ โโโ media_types.rs # Media type detection
โโโ tests/ # Integration tests
โโโ Cargo.toml # Project dependencies
โโโ README.md # Project documentation
Community
- GitHub Issues: For bug reports and feature requests
- GitHub Discussions: For questions and general discussion
- Pull Requests: For code contributions
Getting Help
If you need help, you can:
- Check the README for usage information
- Look through existing issues
- Create a new issue with the
questionlabel - Start a discussion in the Discussions section
Recognition
Contributors who submit accepted pull requests will be added to the project's AUTHORS file and recognized in the release notes.
Thank you for contributing to VisualVault! ๐