Contributing
Contributions to RustQC are welcome. This page covers how to build, test, and submit changes.
Building
Section titled “Building”git clone https://github.com/seqeralabs/RustQC.gitcd RustQC
# Debug buildcargo build
# Release build (optimized, used for benchmarking)cargo build --releaseSee the Installation page for system dependency requirements (cmake, zlib, bz2, lzma, curl, ssl, clang).
Running tests
Section titled “Running tests”# Run all tests (unit + integration)cargo test
# Run in release mode (matches CI)cargo test --release
# Run only unit testscargo test --lib
# Run only integration testscargo test --test integration_test
# Run a specific test by namecargo test test_dup_rate_calculationIntegration tests in tests/integration_test.rs run the compiled binary as a
subprocess and compare output against R-generated reference files in
tests/expected/. Do not modify files in tests/expected/ by hand — they are
generated by tests/create_test_data.R.
Code formatting and linting
Section titled “Code formatting and linting”Both checks are enforced in CI and must pass before merging:
# Auto-format codecargo fmt
# Check formatting without modifying filescargo fmt --check
# Run clippy (all warnings are errors)cargo clippy -- -D warningsRustQC uses default rustfmt settings (no rustfmt.toml) and default clippy
settings with -D warnings.
Project structure
Section titled “Project structure”RustQC is a binary crate with a nested module structure. Top-level modules
are declared in main.rs with no lib.rs. Each reimplemented tool lives in its
own submodule under src/rna/. Inter-module access uses crate:: paths.
Code style
Section titled “Code style”Key conventions:
- Default
rustfmtformatting, 4-space indentation, trailing commas on multi-line constructs. anyhow::Result<T>for all fallible functions. Propagate with?, add context with.context(). No custom error types.- Every source file starts with
//!module doc comments. All public items have///doc comments. - Types are
CamelCase, functions/variables aresnake_case, constants areSCREAMING_SNAKE_CASE. u64for counts/positions,f64for metrics,u8for flags.IndexMapwhen insertion order matters,HashMapotherwise.- Unit tests are co-located in each source file inside
#[cfg(test)] mod tests. Test names followtest_<description>. unwrap()/expect()are restricted to test code only. In production code, use?withanyhowcontext.
CI pipeline
Section titled “CI pipeline”GitHub Actions runs on push to main and all pull requests:
- Test —
cargo test --releaseon Ubuntu and macOS - Format —
cargo fmt --check - Clippy —
cargo clippy -- -D warnings
All three checks must pass. The CI uses dtolnay/rust-toolchain@stable and
Swatinem/rust-cache@v2.
Submitting changes
Section titled “Submitting changes”- Fork the repository and create a feature branch.
- Make your changes, ensuring
cargo test,cargo fmt --check, andcargo clippy -- -D warningsall pass locally. - Open a pull request against
mainwith a clear description of the changes.