sfox_credo

Hex.pm Hex Docs Apache-2.0

Credo checks used for Elixir projects at sFOX.

Installation

Add sfox_credo to your dependencies in mix.exs:

def deps do
  [
    {:sfox_credo, "~> 0.2"}
  ]
end

Documentation is found on HexDocs.

Usage

sfox_credo provides two plugins to add to the profile plugins list in .credo.exs:

When using these plugins, it is strongly recommended that the enabled configuration block be omitted from your .credo.exs. Checks to be disabled should be added to the disabled list and additional or reconfigured checks should be placed in the extra list. Otherwise, it will be necessary for you to manually configure everything.

Selecting custom checks

Each check in SfoxCredo.Custom belongs to one group.

Change the selection with the include and exclude plugin params. exclude wins when a group is in both. Any other param, or an unknown group, stops Credo with an error.

plugins: [{SfoxCredo.Custom, include: [:ecto], exclude: [:docs]}]

Checks outside the selection aren't registered. Enable or configure a single check in your own extra list:

checks: %{
  extra: [
    {SfoxCredo.Check.Readability.DocListStyle, []},
    {SfoxCredo.Check.Warning.LoggerMessageInspect, extra_loggers: [MyApp.Logger]}
  ]
}

If SfoxCredo.Custom is listed in more than one config file (a project's .credo.exs and its umbrella's, say), the params of the config closest to the project are used, as with every other Credo setting.

Both plugins register their checks under the config name in effect, so they also apply with mix credo --config-name.

If you use enabled in your check configuration, Credo ignores the plugin's checks; list the checks you want from the groups above in enabled yourself.

Semantic Versioning

sfox_credo follows Semantic Versioning 2.0.