-
Notifications
You must be signed in to change notification settings - Fork 414
/
credo.ex
42 lines (33 loc) · 1.11 KB
/
credo.ex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
defmodule Credo do
@moduledoc """
Credo builds upon four building blocks:
- `Credo.CLI` - everything related to the command line interface (CLI), which orchestrates the analysis
- `Credo.Execution` - a struct which is handed down the pipeline during analysis
- `Credo.Check` - the default Credo checks
- `Credo.Code` - all analysis tools used by Credo during analysis
"""
alias Credo.Execution
alias Credo.Execution.Task.WriteDebugReport
@version Mix.Project.config()[:version] |> Credo.BuildInfo.version()
@doc """
Runs Credo with the given `argv` and returns its final `Credo.Execution` struct.
Example:
iex> exec = Credo.run(["--only", "Readability"])
iex> issues = Credo.Execution.get_issues(exec)
iex> Enum.count(issues) > 0
true
"""
def run(argv_or_exec) do
argv_or_exec
|> Execution.build()
|> Execution.run()
|> WriteDebugReport.call([])
end
def run(argv_or_exec, files_that_changed) do
argv_or_exec
|> Execution.build(files_that_changed)
|> Execution.run()
|> WriteDebugReport.call([])
end
def version, do: @version
end