Find Every Clone.
Miss Nothing.
AST-based code duplication detection with suffix tree algorithms and semantic awareness. Detects renamed clones, filters generated code, gates your CI, and speaks 7 output formats.
$ art-dupl
Found 23 clone groups (148 duplicate statements)
Group 1 [Type 2 — renamed] 42 tokens 3 occurrences
├─ internal/handler/user.go:45-67
├─ internal/handler/order.go:38-60
└─ internal/handler/product.go:51-73
Group 2 [Type 1 — exact] 28 tokens 2 occurrences
├─ pkg/cache/lru.go:112-125
└─ pkg/cache/ttl.go:98-111
... 21 more groups
Health: B | 12 files affected | 2,840 tokens duplicated
$ art-dupl --html > report.html # Interactive HTML report
$ art-dupl stats # Project health statistics go install github.com/LarsArtmann/art-dupl/cmd/art-dupl@latest Built for serious codebases.
Everything you need to find and eliminate code duplication.
Suffix Tree Detection
Ukkonen's algorithm on serialized ASTs finds exact and near-miss clones that regex tools miss. O(n) with O(1) map-based transitions.
Semantic Awareness
Alpha-normalization detects renamed-variable clones (Type 2). Three modes: semantic (default), exact, and structural.
7 Output Formats
Text, rich-text, HTML with diffs, JSON, Simple-JSON, SARIF for GitHub Security, and machine-readable plumbing.
Smart Generated-Code Filtering
Auto-detects and filters sqlc, protobuf, mockgen, stringer, templ, and generic generated code. Override per-category.
CI/CD Baseline Gating
Record accepted clones, then gate on new ones. Pre-commit hook, GitHub Actions template, and SARIF upload included.
Programmatic SDK
Detector interface with streaming, progress callbacks, and 20+ sentinel errors. Zero config imports — fully independent types.
From source to clones in four steps.
A concurrent pipeline transforms your Go source into actionable clone detection results.
Parse
Scan .go and .templ files, parse into ASTs with concurrent workers.
go/parser + templ parser Serialize
Transform AST into unified token sequences with semantic encoding.
syntax.Node[] Detect
Build compressed suffix tree, find repeating patterns above threshold.
Ukkonen O(n) Classify & Output
Label clone types, score extractability, filter boilerplate, format output.
7 output formats Why art-dupl?
The original dupl is a solid suffix tree library. art-dupl is a professional clone detection platform built on top of it.
| dupl (original) | jscpd | art-dupl | |
|---|---|---|---|
| AST-level analysis | |||
| Semantic matching (Type 2) | |||
| Generated-code filtering | ~ | ||
| CI baseline gating | |||
| Templ support | |||
| SARIF output | |||
| Stats + health grades | ~ | ||
| Programmatic SDK |
Seven formats. One tool.
From quick terminal review to GitHub Security tab integration.
(default) Text
Quick terminal review
--rich-text Rich Text
Priority badges and suggestions
--html HTML
Syntax highlighting and diffs
--json JSON
CI/CD with metadata and summary
--simple-json Simple JSON
Lightweight with impact scores
--sarif SARIF
GitHub Advanced Security
--plumbing Plumbing
Machine-readable file:line format
--all All Formats
Generate everything to a directory at once
From terminal to CI pipeline.
Drop it into any stage of your development workflow.
Terminal Workflow
Quick scan during development to catch duplication before it spreads
CI/CD Pipeline
Gate merges on new clones with baseline + check workflow
Code Review
HTML reports with side-by-side diffs for thorough review sessions
Refactoring
Extractability scores and clone classification prioritize what to fix
Health Monitoring
Stats subcommand tracks duplication trends with A-F health grades
Start finding clones.
One install. Zero configuration. Real results in seconds.
go install github.com/LarsArtmann/art-dupl/cmd/art-dupl@latest