Thanks for considering a contribution! This document describes how to propose changes and what is required for a contribution to be accepted.
- Fork kucherenko/jscpd and clone your fork.
- Create a feature branch from
master. - Make your changes (see the workflow below).
- Open a pull request against
masterdescribing what the change does and why.
Bug reports and feature requests go through GitHub Issues. Security vulnerabilities must not be reported publicly — see SECURITY.md.
master contains the Rust engine (v5) in rust/: the jscpd / cpd
binary, its four library crates, and the npm wrapper packages.
cd rust
cargo build
cargo nextest run --workspace # full test suite (cargo install cargo-nextest)
cargo test --workspace # equivalent without nextest
cargo clippy --workspace --all-targets -- -D warnings
cargo fmt --all # formatting is enforcedEnd-to-end check against the multi-format corpus in fixtures/
(the same run CI performs in the smoke job):
cd rust
cargo build --release -p jscpd
./target/release/jscpd ../fixtures --reporters console,json --output ../smoke-report --min-tokens 50A Rust API example lives in examples/rust-cpd-finder.
After changing the tokenizer's format table, regenerate
FORMATS.md with node rust/scripts/gen-formats-md.mjs.
The Rust test suite is not run in PR CI — run it locally before submitting.
The TypeScript engine is maintained on the
master-v4 branch and
receives security and critical fixes only. Open v4 pull requests against
master-v4; its own CONTRIBUTING.md describes the pnpm-based workflow.
- Tests are required. New functionality must come with tests that exercise
it, and bug fixes should include a test that fails without the fix. As a
rule of thumb, look at the existing tests next to the code you touch
(
#[cfg(test)]modules andtests/directories) and follow their patterns. - CI must be green. Lints and formatting are enforced:
cargo clippy -D warningsandcargo fmt --check. - Match the surrounding style — naming, comment density, and idioms of the file you are editing.
- Keep changes focused. One logical change per pull request; unrelated refactoring belongs in its own PR.
- By submitting a contribution you agree that it is licensed under the project's MIT license.
All interactions are covered by the Code of Conduct.