Search documentation of Metastatic

# Metastatic.Analysis.Duplication.Reporter (Metastatic v0.13.2)

View Source

Reporting and formatting for code duplication detection results.

Provides multiple output formats:

- Text format (human-readable)
- JSON format (machine-readable)
- Detailed format (comprehensive analysis)

## Usage

    alias Metastatic.Analysis.Duplication.{Result, Reporter}

    # Format a single result
    Reporter.format(result, :text)
    Reporter.format(result, :json)
    Reporter.format(result, :detailed)

    # Format clone groups
    Reporter.format_groups(groups, :text)

## Examples

    iex> result = Metastatic.Analysis.Duplication.Result.exact_clone()
    iex> text = Metastatic.Analysis.Duplication.Reporter.format(result, :text)
    iex> String.contains?(text, "Type I")
    true

## Summary

### Types

format()

### Functions

format(result, format_type \\ :text)

Formats a duplication detection result in the specified format.

format_groups(groups, format_type \\ :text)

Formats multiple clone groups in the specified format.

## Types

# format()

    @type format() :: :text | :json | :detailed

## Functions

# format(result, format_type \\ :text)

    @spec format(Metastatic.Analysis.Duplication.Result.t(), format()) :: String.t()

Formats a duplication detection result in the specified format.

## Formats

- `:text` - Human-readable text format
- `:json` - JSON format for programmatic processing
- `:detailed` - Comprehensive text format with all metadata

## Examples

    iex> result = Metastatic.Analysis.Duplication.Result.exact_clone()
    iex> text = Metastatic.Analysis.Duplication.Reporter.format(result, :text)
    iex> is_binary(text)
    true

    iex> result = Metastatic.Analysis.Duplication.Result.no_duplicate()
    iex> text = Metastatic.Analysis.Duplication.Reporter.format(result, :text)
    iex> String.contains?(text, "No duplicate")
    true

# format_groups(groups, format_type \\ :text)

    @spec format_groups([map()], format()) :: String.t()

Formats multiple clone groups in the specified format.

## Examples

    iex> groups = []
    iex> text = Metastatic.Analysis.Duplication.Reporter.format_groups(groups, :text)
    iex> String.contains?(text, "No clone groups")
    true