# `mix ex_dna`
[🔗](https://github.com/elixir-vibe/ex_dna/blob/main/lib/mix/tasks/ex_dna.ex#L1)

Scans your project for duplicated code blocks using AST analysis.

    $ mix ex_dna
    $ mix ex_dna lib/my_app/accounts
    $ mix ex_dna --min-mass 20 --literal-mode abstract
    $ mix ex_dna --min-similarity 0.85

## Command-line options

  * `--min-mass` — minimum AST node count (default: 30)
  * `--min-occurrences` — minimum number of code occurrences to report a clone (default: 2)
  * `--min-similarity` — similarity threshold 0.0–1.0 (default: 1.0).
    Values below 1.0 enable Type-III near-miss detection.
  * `--max-window-size` — max consecutive sibling functions combined into
    a single fingerprint (default: 4). Raise to catch larger cross-module clones.
  * `--mass-tolerance` — max relative size difference for Type-III comparison,
    0.0–1.0 (default: 0.3). Raise to compare fragments of more different sizes.
  * `--min-fuzzy-mass` — minimum AST node count for Type-III candidates
    (default: `min_mass * 2`).
  * `--max-module-forms` — max top-level module forms eligible for sibling
    window detection (default: 200).
  * `--literal-mode` — `keep` (Type-I only) or `abstract` (also Type-II). Default: `keep`
  * `--normalize-pipes` — treat `x |> f()` the same as `f(x)`. Default: false
  * `--exclude-macro` — macro name to skip during analysis (repeatable).
    Common: `schema`, `pipe_through`, `plug`
  * `--ignore-attribute` — additional attribute name to ignore (repeatable).
    Documentation/type attributes (`moduledoc`, `doc`, `type`, `spec`, etc.)
    are ignored by default. Use this for project-specific noise.
  * `--ignore` — glob pattern to exclude (repeatable)
  * `--format` — output format: `console` (default), `json`, `html`, or `sarif`
  * `--output` — output file for `html` or `sarif` reports
  * `--max-clones` — maximum allowed clones. Exits with code 1 only when
    exceeded. Useful for gradual adoption in brownfield projects.

Exits with code 1 if clones are found (or exceed `--max-clones`).

---

*Consult [api-reference.md](api-reference.md) for complete listing*
