credo

rrreneMIT活跃维护

Elixir 语言的静态代码分析工具,专注检查代码一致性并给出教学式修改建议,帮团队统一风格、提前发现坏味道。

A static code analysis tool for the Elixir language with a focus on code consistency and teaching.

v1.7.19发布于 2026-06-05 08:19 UTC5,230star458fork同步于 2026-11-10 17:37 UTC

怎么上手

由 README 提炼,执行前请确认
在 mix.exs 的 deps 中加入 {:credo, "~> 1.7", only: [:dev, :test], runtime: false},然后运行:
mix deps.get
mix credo
硬件要求按 README 说明

README 未说明

下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

Elixir 静态代码分析工具,帮你发现重构机会、复杂代码和命名不一致

Elixir 语言的静态代码分析工具,专注检查代码一致性并给出教学式修改建议,帮团队统一风格、提前发现坏味道。

核心能力

  • 静态分析 Elixir 代码,指出重构机会与复杂代码片段
  • 警告常见错误并检查命名风格的一致性
  • 可强制执行团队约定的编码风格
  • 支持 IntelliJ、VSCode、Emacs 等编辑器内联提示
  • 可接入 Codacy 做自动化代码审查

容易踩的坑

需作为 Mix 依赖加入项目后才能运行,不能独立使用;建议仅在 dev 和 test 环境引入并设 runtime: false

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

5 个版本v1.7.19
  1. v1.7.19最新正式版2026-06-05 · 2026-06-05 08:19 UTC

    Check it out on Hex: https://hex.pm/packages/credo/1.7.19

    • Fix compatibility & compiler warnings with Elixir 1.20.0
  2. v1.7.182026-04-10 · 2026-04-10 18:18 UTC
    查看更新说明

    Check it out on Hex: https://hex.pm/packages/credo/1.7.18

    • Fix compatibility & compiler warnings with Elixir 1.20.0-rc.4
    • Fix problem with transitive deps in umbrella apps
    • Credo.Check.Warning.UnusedMapOperation fix false positives
  3. v1.7.172026-03-03 · 2026-03-03 19:32 UTC
    查看更新说明

    Check it out on Hex: https://hex.pm/packages/credo/1.7.17

    • Credo.Check.Readability.ModuleDoc add new param :ignore_modules_using (defaults to [Credo.Check, Ecto.Schema, Phoenix.LiveView, ~r/\.Web$/])
    • Credo.Check.Warning.UnusedOperation update :modules param: instead of a list of functions to check, :all can be given to check all functions in a module
    • New Check: Credo.Check.Refactor.CondInsteadOfIfElse
    • New Check: Credo.Check.Warning.WrongTestFilename
  4. v1.7.162026-01-27 · 2026-01-27 09:36 UTC
    查看更新说明

    Check it out on Hex: https://hex.pm/packages/credo/1.7.16

    • Fix compatibility & compiler warnings with Elixir 1.20.0-rc.1
    • Credo.Check.Refactor.PassAsyncInTestCases add new param :force_comment_on_explicit_false (defaults to false)
    • Credo.Check.Warning.Dbg add new param :allow_captures (defaults to false)
    • New Check: Credo.Check.Warning.UnusedMapOperation
    • New Check: Credo.Check.Warning.UnusedOperation
  5. v1.7.152025-12-26 · 2025-12-26 08:14 UTC
    查看更新说明

    Check it out on Hex: https://hex.pm/packages/credo/1.7.15

    • Improve performance on large projects
    • Parse token_metadata for source files
    • Credo.Check.Warning.ExpensiveEmptyEnumCheck have better issue messages
    • Credo.Check.Refactor.MatchInCondition add new param :allow_operators
    • Credo.Check.Refactor.MatchInCondition fix false positive
    • Credo.Check.Readability.AliasOrder fix false positive
    • Credo.Check.Readability.FunctionNames fix false positive
    • Credo.Check.Readability.SinglePipe add new param :allow_blocks (defaults to true)
    • Credo.Check.Refactor.ModuleDependencies fix false positive

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    Credo CI Tests Inline docs

    Credo is a static code analysis tool for the Elixir language with a focus on teaching and code consistency.

    It can show you refactoring opportunities in your code, complex code fragments, warn you about common mistakes, show inconsistencies in your naming scheme and - if needed - help you enforce a desired coding style.

    Credo

    Installation and Usage

    The easiest way to add Credo to your project is by using Mix.

    Add :credo as a dependency to your project's mix.exs:

    defp deps do
      [
        {:credo, "~> 1.7", only: [:dev, :test], runtime: false}
      ]
    end
    

    And run:

    $ mix deps.get
    
    $ mix credo
    

    Documentation

    Documentation is available on Hexdocs

    Integrations

    IDE/Editor

    Some IDEs and editors are able to run Credo in the background and mark issues inline.

    Automated Code Review

    • Codacy - checks your code from style to security, duplication, complexity, and also integrates with coverage.

    Contributing

    1. Fork it!
    2. Create your feature branch (git checkout -b my-new-feature)
    3. Commit your changes (git commit -am 'Add some feature')
    4. Push to the branch (git push origin my-new-feature)
    5. Create new Pull Request

    Author

    René Föhring (@rrrene)

    License

    Credo is released under the MIT License. See the LICENSE file for further details.