Shared Credo policy and custom checks for Elixir codebases.
CodeStyle is intended to be used alongside ExDNA and Styler. Those tools are not bundled with this library and should be configured separately in consuming projects.
Installation
Add code_style to a consuming Mix project:
{:code_style, "~> 0.1.0", only: [:dev, :test], runtime: false}Then load the Credo plugin in .credo.exs:
%{
configs: [
%{
name: "default",
plugins: [{CodeStyle, []}]
}
]
}The plugin registers the shared Credo policy, ExSlop checks, migration safety,
and the custom checks below. It does not override Credo's file discovery;
consuming projects can define their own files configuration when needed.
Custom Checks
CodeStyle.Check.Design.NoDatabaseConstraintsflags business-logic column options in Ecto migration table blocks.CodeStyle.Check.Warning.RepoInsideLoopflags direct Repo operations that can execute once per element across collection and concurrency boundaries.
Development
Run the package checks with Mix:
mix check