Skip to main content

Polyglot AST subtree DRY analyzer. A Rust port of unclebob/dry4go, extended to Rust, JavaScript, TypeScript, and Python.

Project description

drywall

Polyglot AST subtree DRY analyzer. Detects duplicate code across files using Jaccard similarity over normalized AST fingerprints.

A Rust port of unclebob/dry4go, extended to work across Rust, JavaScript, TypeScript, and Python (dry4go is Go-only).

Install

# Rust
cargo install drywall

# Python
pip install drywall
# or, without installing:
uvx drywall ./src

# Node.js
npm install --save-dev drywall-cli
# then: npx drywall ./src, or add a package.json script

Or download the binary for your platform from the latest release:

Platform Binary
Linux x86_64 drywall-linux-x86_64
macOS Apple Silicon drywall-macos-aarch64
macOS Intel drywall-macos-x86_64
# Linux
curl -sL https://github.com/gabadi/drywall/releases/latest/download/drywall-linux-x86_64 -o drywall
chmod +x ./drywall

# macOS Apple Silicon
curl -sL https://github.com/gabadi/drywall/releases/latest/download/drywall-macos-aarch64 -o drywall
chmod +x ./drywall

# macOS Intel
curl -sL https://github.com/gabadi/drywall/releases/latest/download/drywall-macos-x86_64 -o drywall
chmod +x ./drywall

The Linux binary is statically linked (musl) — no runtime dependencies.

Usage

drywall [--threshold 0.82] ./src

--threshold is the Jaccard similarity cutoff (default 0.82, same as dry4go). Pairs at or above the threshold are reported. Exit codes: 0 = no duplicates, 1 = duplicates found, 2 = bad arguments.

Use as a CI gate

Add to any project's CI pipeline:

- name: Install drywall
  run: |
    curl -sL https://github.com/gabadi/drywall/releases/latest/download/drywall-linux-x86_64 -o drywall
    chmod +x ./drywall

- name: DRY check
  run: ./drywall --threshold 0.82 ./src

--threshold sets the Jaccard similarity cutoff (default 0.82). Pairs at or above the threshold are flagged. The step fails (exit 1) if any duplicates are found.

Build from source

Requires Rust 1.96+:

cargo build --release
./target/release/drywall ./src

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

drywall-0.1.3-py3-none-manylinux_2_5_x86_64.manylinux1_x86_64.whl (2.1 MB view details)

Uploaded Python 3manylinux: glibc 2.5+ x86-64

drywall-0.1.3-py3-none-macosx_11_0_arm64.whl (1.9 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

drywall-0.1.3-py3-none-macosx_10_12_x86_64.whl (1.9 MB view details)

Uploaded Python 3macOS 10.12+ x86-64

File details

Details for the file drywall-0.1.3-py3-none-manylinux_2_5_x86_64.manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for drywall-0.1.3-py3-none-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 67c6bc7bf33f9ce0121b6f06b2348f92a8f5f15d714e9fa2bede84dab4b3bfc7
MD5 d089e370e2493f1411bf778398846f21
BLAKE2b-256 eda5930c33fb2e60581f9ce4debf84b46898de3da3dc985080660f366e91819b

See more details on using hashes here.

Provenance

The following attestation bundles were made for drywall-0.1.3-py3-none-manylinux_2_5_x86_64.manylinux1_x86_64.whl:

Publisher: release.yml on gabadi/drywall

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file drywall-0.1.3-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for drywall-0.1.3-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 41085eea046f68606fd65e742b8e696c858fd8af58f0fa4ee6b89535293bf803
MD5 da7fc8fa339d8171d03234b67c739ff1
BLAKE2b-256 a4aae40a0660d84b1eaa60f242a11ecc0d0661e1ce4ecd474160c17c4c12be7c

See more details on using hashes here.

Provenance

The following attestation bundles were made for drywall-0.1.3-py3-none-macosx_11_0_arm64.whl:

Publisher: release.yml on gabadi/drywall

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file drywall-0.1.3-py3-none-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for drywall-0.1.3-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 64061ce86f2108d364ad1937ccf9e7d055233bc67ef8d41b45c6083d02ea04d9
MD5 281d0108cd41722767e8c546ebaa28ef
BLAKE2b-256 dd7b18e67b7622cd8c0ebdd0455b9192dc1e8292623982f8a51376aa27888a9d

See more details on using hashes here.

Provenance

The following attestation bundles were made for drywall-0.1.3-py3-none-macosx_10_12_x86_64.whl:

Publisher: release.yml on gabadi/drywall

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page