View Source CredoGitlab

Generate GitLab Code Quality report for Credo.

Installation

This package available in Hex and can be installed by adding credo_gitlab to your list of dependencies in mix.exs:

def deps do
  [
    {:credo_gitlab, "~> 0.1.0", only: [:dev, :test], runtime: false}
  ]
end

Scope

This package is used to generate a code quality report compatible with GitLab format.

Configuration

To generate a report a plugin should be added to your .credo.exs file. This is the basic configuration:

%{
  configs: [
    name: "default",
    plugins: [
      {CredoGitlab, []}
    ]
  ]
}

With this configuration, a gl-code-quality-report.json will be created in the root of your project. To move it to another position, a :path param could be added:

%{
  configs: [
    name: "default",
    plugins: [
      {CredoGitlab, [path: "credo/gitlab-report.json"]}
    ]
  ]
}

This will create a gitlab-report.json file in the credo directory.

By default, this plugin uses Jason to JSON-encode the issues, but you may use another lib, as long as it exports one of these functions:

  • encode_to_iodata!/1
  • encode_to_iodata/1
  • encode!/1
  • encode/1

E.g. you may use Jsonrs like this:

%{
  configs: [
    name: "default",
    plugins: [
      {CredoGitlab, [json_library: Jsonrs]}
    ]
  ]
}