Credo plugin for writing CodeClimate-compatible JSON

This is simple plugin that will output CodeClimate-compatible JSON containing messages from Credo. This is useful when used together with GitLab Code Quality reporting, like that:

lint:credo:
  stage: lint
  script:
    - mix credo
  dependencies:
    - compile:test
  artifacts:
    reports:
      codequality: codeclimate.json
  allow_failure: true
  needs: ['compile:test']

Hex:

Source:

Usage is super simple:

  1. Add {:credo_code_climate, "~> 0.1.0", only: :dev, runtime: false} to dependencies list in mix.exs.
  2. Add {CredoCodeClimate, []} to plugin list in .credo.exs (you may need to generate that file with mix credo.gen.config first).

Now when you will run mix credo it will produce file codeclimate.json in your current working directory, that contain CodeClimate-compatible JSON result of lint.

4 Likes

BTW @rrrene it the documentation about plugins would require some love, because it is very nice feature, however it is very hard to find anything how to use it and I ended digging through codebase for anything.

1 Like