# `AnalyzerModule`
[🔗](https://github.com/gtri/lowendinsight/blob/main/lib/analyzer_module.ex#L5)

Analyzer takes in a valid repo URL and coordinates the analysis,
returning a simple JSON report.  The URL can be one of "https", "http",
or "file".  Note, that the latter scheme will only work an existing clone
and won't remove the directory structure upon completion of analysis.

# `analyze`

```elixir
@spec analyze(binary() | maybe_improper_list(), any(), any()) :: {:ok, map()}
```

# `analyze`

```elixir
@spec analyze([binary()], any(), any(), any()) :: {:ok, map()}
```

analyze/3: returns the LowEndInsight report as JSON for multiple_repos.  Takes in a "list" of
urls, a source id for the calling client, and the start_time of analysis as an optional way
to capture the time actually started at whatever the client is (e.g. an async API).

Returns Map.

## Examples
  ```
  iex> {:ok, report} = AnalyzerModule.analyze(["https://github.com/kitplummer/xmpp4rails","https://github.com/kitplummer/lita-cron"], "iex")
  iex> _count = report[:metadata][:repo_count]
  2
  ```

# `create_empty_report`

```elixir
@spec create_empty_report(String.t(), [String.t()], any()) :: map()
```

create_empty_report/3: takes in a uuid, list of urls, and a start time and
produces the repo report object to be returned immediately by asynchronous
requestors (e.g. LowEndInsight-Get HTTP endpoint)

# `determine_risk_counts`

```elixir
@spec determine_risk_counts(RepoReport.t()) :: map()
```

determine_risk_counts/1: takes in a full report of n-repo reports, and calculates
the number or risk ratings, given the number of repos.  It returns a new report
with the risk_counts object populated with the count table.  Have to accommodate
both the atom and string elements, because the JSON gets parsed into the string
format - so caching can be supported (as reports are stored in JSON).

# `determine_toplevel_risk`

```elixir
@spec determine_toplevel_risk(RepoReport.t()) :: map()
```

determine_toplevel_risk/1: takes in a report and determines the highest
criticality, and assigns it to the "risk" element for the repo report.

---

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