View Source mix credo_diff (BlitzCredoChecks v0.1.4)

Checks all files that have been changed from trunk. Great for gradually introducing conventions through enforcement on new code only.

Run this task with mix credo_diff

Flags

  • --trunk the branch that the current one will be compared against for files. Defaults to main.
  • --name The configuration in .credo.exs to use, defaults to default.

Link to this section Summary

Functions

It's clunky but each file name has to be appended one at a time

There will be other files but we only want to check Elixir

Print any errors we see and error if there is a non-zero exit code

If we don't get files then there is nothing to check

Link to this section Functions

Link to this function

build_credo_args(files, name)

View Source
@spec build_credo_args([String.t()], String.t()) :: [String.t()]

It's clunky but each file name has to be appended one at a time

Link to this function

filter_elixir_files(file_list)

View Source
@spec filter_elixir_files([String.t()]) :: {:exit, String.t()} | {:ok, [String.t()]}

There will be other files but we only want to check Elixir

Link to this function

parse_credo_output(arg, opts \\ [print: true])

View Source
@spec parse_credo_output({String.t(), non_neg_integer()}, keyword()) ::
  :ok | {:error, String.t()}

Print any errors we see and error if there is a non-zero exit code

Link to this function

parse_git_diff_output(string)

View Source
@spec parse_git_diff_output(String.t()) :: {:exit, String.t()} | {:ok, [String.t()]}

If we don't get files then there is nothing to check