Thank you for your interest in contributing to RustyNES! This document provides guidelines for contributing code, documentation, and bug reports.
- Code of Conduct
- Getting Started
- Development Workflow
- Code Style
- Commit Messages
- Pull Request Process
- Testing Requirements
- Documentation
- Be respectful and inclusive
- Focus on constructive feedback
- Help others learn and grow
- Maintain professional communication
# Fork on GitHub, then:
git clone https://github.com/YOUR_USERNAME/rustynes.git
cd rustynes
git remote add upstream https://github.com/ORIGINAL_AUTHOR/rustynes.gitcargo build --workspace
cargo test --workspaceSee BUILD.md for detailed build instructions.
git checkout -b feature/my-new-featureBranch Naming:
feature/- New featuresfix/- Bug fixesdocs/- Documentationrefactor/- Code refactoringtest/- Test additions/improvements
- Write tests first (TDD approach)
- Implement feature/fix
- Run tests:
cargo test - Format code:
cargo fmt - Lint code:
cargo clippy -- -D warnings - Update documentation if needed
git add .
git commit -m "feat: Add MMC5 mapper support"See Commit Messages below.
Follow Rust conventions:
- Use
cargo fmt(rustfmt) - Pass
cargo clippywithout warnings - Use meaningful variable names
- Add documentation comments for public APIs
// Imports
use std::collections::HashMap;
// Constants
const MAX_SPRITES: usize = 64;
// Structures
pub struct Cpu {
pub a: u8,
pub x: u8,
// ...
}
// Implementation
impl Cpu {
pub fn new() -> Self {
// ...
}
pub fn step(&mut self) -> u8 {
// ...
}
}
// Tests
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_cpu_initialization() {
// ...
}
}/// Executes one CPU instruction
///
/// # Returns
///
/// Number of CPU cycles consumed
///
/// # Examples
///
/// ```
/// let mut cpu = Cpu::new();
/// let cycles = cpu.step();
/// assert!(cycles >= 2);
/// ```
pub fn step(&mut self) -> u8 {
// ...
}<type>(<scope>): <subject>
<body>
<footer>
- feat: New feature
- fix: Bug fix
- docs: Documentation changes
- style: Code style changes (formatting)
- refactor: Code refactoring
- test: Adding/updating tests
- chore: Build/tooling changes
Feature:
feat(mapper): Add MMC5 mapper support
Implements iNES mapper 5 with PRG/CHR banking,
expansion audio, and ExRAM functionality.
Closes #42
Bug Fix:
fix(ppu): Correct sprite zero hit timing
Sprite 0 hit was occurring one cycle too late,
causing SMB1 scrolling glitches. Fixed by adjusting
the hit detection to occur at cycle 257.
Fixes #85
Documentation:
docs(cpu): Add cycle timing tables
Documents cycle counts for all 6502 instructions
including page-crossing penalties.
-
Update from upstream:
git fetch upstream git rebase upstream/main
-
Run full test suite:
# NEVER --all-features: the `scripting` (mlua) and `script-wasm` (piccolo) # backends are mutually exclusive and cannot co-resolve. Use explicit features. cargo test --workspace cargo test --workspace --features test-roms cargo clippy --workspace --all-targets -- -D warnings cargo fmt --all --check
-
Update documentation:
- Update relevant
.mdfiles - Add/update code comments
- Update CHANGELOG.md if applicable
- Update relevant
-
Push branch:
git push origin feature/my-new-feature
-
Create Pull Request on GitHub
-
PR Description Template:
## Description Brief description of changes ## Type of Change - [ ] Bug fix - [ ] New feature - [ ] Breaking change - [ ] Documentation update ## Testing - [ ] Unit tests pass - [ ] Integration tests pass - [ ] Test ROMs pass (if applicable) ## Checklist - [ ] Code follows style guidelines - [ ] Self-reviewed code - [ ] Commented complex sections - [ ] Updated documentation - [ ] No new warnings
- Automated checks must pass
- Code review by maintainer(s)
- Requested changes should be addressed
- Approval from at least one maintainer
All PRs must:
- Pass existing unit tests
- Pass existing integration tests
- Include new tests for new functionality
- Maintain or improve test coverage
Aim for:
- 80%+ line coverage for new code
- 100% coverage for critical paths (CPU, PPU core)
Check coverage:
cargo tarpaulin --out Html
open tarpaulin-report.htmlFor mapper changes:
cargo test --test mapper_test_suiteFor CPU/PPU changes:
cargo test --test nestest
cargo test --test blargg_suiteFor new features:
- Code documentation (rustdoc comments)
- User-facing documentation (docs/ folder)
- Examples in docs/examples/ (if applicable)
For bug fixes:
- Comment explaining the fix
- Update relevant documentation if behavior changes
Clear and concise:
- Use simple language
- Provide examples
- Link to related documents
- Include diagrams where helpful (Mermaid format)
- GitHub Issues: For bugs and feature requests
- GitHub Discussions: For questions and general discussion
- Documentation: Check docs/ folder first
Thank you for contributing to RustyNES!