Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions doc/docusaurus/docs/3_other_notable_packages.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,38 @@ providing an objective way to find and fix overly complex logic and routines.

- **Links**: [pub.dev](https://pub.dev/packages/cognitive_complexity) ·
[GitHub](https://github.com/kevmoo/analytica.dart/tree/main/packages/cognitive_complexity)

---

## [dedupe](https://pub.dev/packages/dedupe)

[![pub package](https://img.shields.io/pub/v/dedupe.svg)](https://pub.dev/packages/dedupe)

High-performance code duplication and clone detection engine and CLI tool for
Dart and Flutter.

It scans codebases to detect token-level, structural, and near-miss code clones
across files and packages with fast incremental analysis.

- **Links**: [pub.dev](https://pub.dev/packages/dedupe) ·
[GitHub](https://github.com/kevmoo/analytica.dart/tree/main/packages/dedupe)

### Comparison: [`avoid_duplicate_code`](2_custom_lints/avoid_duplicate_code.md) vs `dedupe`

| Feature / Scenario | `avoid_duplicate_code` | `dedupe` |
| :--- | :--- | :--- |
| **Tool type** | Dart Analyzer / Linter plugin rule | Standalone CLI tool & Dart library/API |
| **Primary workflow** | Real-time in-IDE feedback and `dart analyze` | Repository auditing, CI/CD checks, PR gating, batch analysis |
| **Detection approach** | **Block-level (AST):** Analyzes complete syntactic structures (functions, methods, closures, `if`/`for` bodies) | **Sequence-level (Tokens):** Analyzes continuous sequences of code anywhere across files |
| **Whole functions & blocks**<br/>*(e.g., duplicated methods with renamed variables)* | ✅ **Detected** | ✅ **Detected** |
| **Sub-method fragments**<br/>*(e.g., 5–10 copied lines inside a 50-line method)* | ❌ **Skipped** (only evaluates complete blocks/methods) | ✅ **Detected** (flags duplicate snippets regardless of block boundaries) |
| **Near-miss / modified clones**<br/>*(e.g., copy-paste with an extra line or minor edit)* | ❌ **Skipped** (requires matching syntactic block structure) | ✅ **Detected** (fuzzy matching detects clones with insertions/deletions) |
| **Differing literals diffing** | ✅ **Detailed in-IDE diff** (pinpoints exact differing values, e.g. `'email'` vs `'sms'`) | ❌ **No per-value diff** (flags clone locations without a detailed literal breakdown) |
| **Reporting & diagnostics** | IDE Problems & Related Locations | Markdown, JSON, GitHub Actions annotations, % duplication metrics |
| **Disk cache usage** | ✅ | ✅ |

> **💡 Best Together:** Use `avoid_duplicate_code` for instant IDE feedback,
> and `dedupe` for CI/CD quality gates and repository-wide code clone audits.