# `RedirectMapCheck`
[🔗](https://github.com/jaizendra-netizen/redirect_map_check/blob/main/lib/redirect_map_check.ex#L1)

Check a redirect map given as a CSV with the columns `from_path` and `to_path`.

Both cells are trimmed and then compared exactly as strings: case and a trailing slash
are significant, so `/Pricing` and `/pricing/` are different paths. The tool never
fetches a URL and cannot know a final status code; it only reads the map you give it.

Checks:

  * self redirects (from equals to). They are reported on their own and are left out
    of the chain and loop checks.
  * duplicates: a source listed more than once with the same target.
  * conflicts: a source listed with more than one different target. The target of the
    first row is the one used for the chain and loop checks.
  * chains: a source whose target is itself a source. One line per chain start (a
    source that no other source points at) with the hops and the final target.
  * loops: a cycle among two or more sources, each loop listed once.

Walks use a visited set and stop after 100 hops, so long chains and loops never recurse
without end.

# `row`

```elixir
@type row() :: %{from: String.t(), to: String.t(), row: pos_integer()}
```

# `analyze`

Analyse the rows. Returns a map with `:rows`, `:sources`, `:self`, `:duplicates`,
`:conflicts`, `:chains` and `:loops`.

# `max_hops`

The hop limit for a chain walk.

# `parse`

```elixir
@spec parse(String.t()) :: {:ok, [row()]} | {:error, String.t()}
```

Parse the CSV text into a list of rows.

# `render`

Render the report as text.

# `strict_problems?`

True when --strict should fail: a self redirect, conflict, chain or loop exists.

---

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