Thanks for your interest in contributing to Ruff — a fast, expressive programming language built in Rust with Result-based error handling, pattern matching, and clean syntax.
We welcome contributions from everyone: beginners, experienced Rust developers, compiler enthusiasts, language design experts, and curious explorers.
- Read the README for language overview and features
- Check the ROADMAP for planned features and priorities
- Review the INSTALLATION guide to set up your development environment
- Browse existing Issues to see what needs work
- Fix parsing errors or interpreter crashes
- Improve error messages
- Resolve edge cases in pattern matching or error handling
- Implement features from ROADMAP
- Enhance existing features (loops, functions, enums)
- Add new operators or control flow constructs
- Improve code comments and documentation
- Write tutorials or guides
- Create example
.ruffprograms demonstrating language features
- Add test cases for edge cases
- Improve test coverage
- Create integration tests
- Enhance CLI functionality
- Build REPL features
- Improve error reporting
- Add language server features (future)
- Create example programs showcasing Ruff features
- Write practical demos (file I/O, data processing, etc.)
- Document best practices
# Fork the repo on GitHub, then:
git clone https://github.com/YOUR_USERNAME/ruff.git
cd ruff# Development build (faster compile, slower runtime)
cargo build
# Release build (optimized)
cargo build --release# Run all tests
cargo run -- test
# Or use the binary directly
./target/debug/ruff test
# Run a specific example
cargo run -- run examples/hello.ruff# Run tests
cargo test
# Format code
cargo fmt
# Check for issues
cargo clippy
# Build release
cargo build --releaseRuff uses snapshot testing with .ruff and .ruff.out files in the tests/ directory.
# Run all tests
ruff test
# Update test snapshots after changes
ruff test --update-
Create a
.rufffile intests/directory:tests/test_my_feature.ruff
-
Run the test to generate output:
ruff test --update -
Verify the
.ruff.outfile is correct -
Commit both
.ruffand.ruff.outfiles
Use descriptive names that indicate what's being tested:
test_enum_ok.ruff- Tests enum with Ok varianttest_try_except.ruff- Tests try/except error handlingtest_arithmetic.ruff- Tests arithmetic operations
Follow standard Rust conventions:
// ✅ Good - idiomatic Rust
pub fn eval_expr(&mut self, expr: &Expr) -> Value {
match expr {
Expr::Number(n) => Value::Number(*n),
Expr::String(s) => Value::String(s.clone()),
_ => Value::Error("Unsupported expression".to_string()),
}
}
// ❌ Avoid - unclear names, poor structure
pub fn e(&mut self, x: &Expr) -> Value {
if let Expr::Number(n) = expr { return Value::Number(*n); }
if let Expr::String(s) = expr { return Value::String(s.clone()); }
Value::Error("err".to_string())
}Always run cargo fmt before committing:
cargo fmtAddress clippy warnings:
cargo clippyDocument public APIs and complex logic:
/// Evaluates an expression and returns the resulting value.
///
/// # Arguments
/// * `expr` - The expression to evaluate
///
/// # Returns
/// The value produced by evaluating the expression, or an error value if evaluation fails.
pub fn eval_expr(&mut self, expr: &Expr) -> Value {
// Implementation
}Ruff has a structured error system in src/errors.rs. When adding features that can fail:
use crate::errors::{RuffError, ErrorKind, SourceLocation};
// Create structured errors
let error = RuffError::undefined_variable(
var_name.clone(),
SourceLocation::new(line, column)
);
// Report errors with context
self.report_error(error);Guidelines:
- Use
RuffErrorfor structured errors with location info - Provide clear, actionable error messages
- Include source location when available
- Add source line context for better debugging
- Use appropriate ErrorKind for different error types
Use descriptive branch names:
feature/add-for-loops- New featuresfix/parser-crash- Bug fixesdocs/improve-readme- Documentationtest/add-enum-tests- Tests
Write clear, concise commit messages in present tense:
# ✅ Good
git commit -m "Add support for for-in loops"
git commit -m "Fix parser crash on nested match expressions"
git commit -m "Update README with enum examples"
# ❌ Avoid
git commit -m "changes"
git commit -m "Fixed stuff"
git commit -m "WIP"- Create a PR with a clear title and description
- Link related issues using "Fixes #123" or "Closes #456"
- Describe your changes:
- What problem does this solve?
- How does it work?
- Any breaking changes?
- Ensure tests pass:
cargo test ruff test cargo clippy
- Keep commits clean - squash fixup commits before merging
- Respond to feedback - address review comments promptly
When adding a new feature:
- Implement the feature in appropriate module(s)
- Add parser support if needed
- Add interpreter/evaluation logic
- Write comprehensive tests (
.rufffiles) - Update documentation (README, ROADMAP)
- Add example usage to
examples/ - Run all tests:
ruff testandcargo test - Format code:
cargo fmt - Check for issues:
cargo clippy - Update ROADMAP.md status if implementing a roadmap item
When filing a bug report, include:
- Ruff version: Output of
ruff --version - Operating system: macOS, Linux, Windows (include version)
- Rust version: Output of
rustc --version - Minimal reproduction:
# Paste the smallest code that reproduces the bug - Expected behavior: What should happen
- Actual behavior: What actually happens
- Error messages: Full error output if applicable
When proposing a new feature:
- Check the roadmap - Is it already planned?
- Describe the use case - Why is this needed?
- Provide syntax examples - How would it look?
# Example of proposed syntax - Consider alternatives - Are there other approaches?
- Estimate complexity - Small, Medium, Large?
Current focus areas (in order):
- Core Language Stability - Fix bugs, improve error handling
- Error Messages - Better diagnostics with line numbers
- Data Structures - Arrays and dictionaries
- Control Flow - Break/continue, for loops
- Module System - Import/export functionality
See ROADMAP for detailed feature list and implementation order.
- GitHub Issues: Open an issue
- Discussions: Use GitHub Discussions for questions
- Documentation: Check README and ROADMAP for answers
Be respectful, inclusive, and constructive. We're building this together.
All contributors will be recognized in release notes and the project README. Thank you for helping make Ruff better!
Ruff is in active development — your contributions shape the language. Let's build something great together! 🐾