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