← 返回
未分类 中文

Elixir Code Review

Reviews Elixir code for idiomatic patterns, OTP basics, and documentation. Use when reviewing .ex/.exs files, checking pattern matching, GenServer usage, or...
审查 Elixir 代码的惯用模式、OTP 基础和文档。用于审查 .ex/.exs 文件、检查模式匹配、GenServer 使用等。
anderskev anderskev 来源
未分类 clawhub v1.2.1 1 版本 100000 Key: 无需
★ 0
Stars
📥 445
下载
💾 1
安装
1
版本
#latest

概述

Elixir Code Review

Quick Reference

Issue TypeReference
-----------------------
Naming, formatting, module structurereferences/code-style.md
With clauses, guards, destructuringreferences/pattern-matching.md
GenServer, Supervisor, Applicationreferences/otp-basics.md
@moduledoc, @doc, @spec, doctestsreferences/documentation.md

Review Checklist

Code Style

  • [ ] Module names are CamelCase, function names are snake_case
  • [ ] Pipe chains start with raw data, not function calls
  • [ ] Private functions grouped after public functions
  • [ ] No unnecessary parentheses in function calls without arguments

Pattern Matching

  • [ ] Functions use pattern matching over conditionals where appropriate
  • [ ] With clauses have else handling for error cases
  • [ ] Guards used instead of runtime checks where possible
  • [ ] Destructuring used in function heads, not body

OTP Basics

  • [ ] GenServers use handle_continue for expensive init work
  • [ ] Supervisors use appropriate restart strategies
  • [ ] No blocking calls in GenServer callbacks
  • [ ] Proper use of call vs cast (sync vs async)

Documentation

  • [ ] All public functions have @doc and @spec
  • [ ] Modules have @moduledoc describing purpose
  • [ ] Doctests for pure functions where appropriate
  • [ ] No @doc false on genuinely public functions

Security

  • [ ] No String.to_atom/1 on user input (use to_existing_atom/1)
  • [ ] No Code.eval_string/1 on untrusted input
  • [ ] No :erlang.binary_to_term/1 without :safe option

Valid Patterns (Do NOT Flag)

  • Empty function clause for pattern match - def foo(nil), do: nil is valid guard
  • Using |> with single transformation - Readability choice, not wrong
  • @doc false on callback implementations - Callbacks documented at behaviour level
  • Private functions without @spec - @spec optional for internals
  • Using Kernel.apply/3 - Valid for dynamic dispatch with known module/function

Context-Sensitive Rules

IssueFlag ONLY IF
---------------------
Missing @specFunction is public AND exported
Generic rescueSpecific exception types available
Nested case/condMore than 2 levels deep

When to Load References

  • Reviewing module/function naming → code-style.md
  • Reviewing with/case/cond statements → pattern-matching.md
  • Reviewing GenServer/Supervisor code → otp-basics.md
  • Reviewing @doc/@moduledoc → documentation.md

Gates — before reporting

Do these in order for the review batch. Do not publish findings until each step passes.

  1. Protocol loaded — Read review-verification-protocol and apply its checks for each finding category you use (unused, validation, security, performance, etc.). Pass: For every substantive finding, you can name which protocol subsection you satisfied or state N/A with reason (pure style).
  2. Anchored evidencePass: Each finding includes a concrete locator: path:line (or line range), or Module.function/arity plus a short quoted snippet from the file.
  3. Claims backed by artifacts — For assertions like unused code, missing validation, or security risk, Pass: You attach the supporting artifact (e.g. search results, file read scope) or downgrade the item to an explicit question / uncertain with what you did not verify.

Before Submitting Findings

Complete Gates — before reporting (section above) first; the verification protocol is mandatory input to those gates.

版本历史

共 1 个版本

  • v1.2.1 当前
    2026-05-03 08:09 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

dev-programming

Github

steipete
使用 `gh` CLI 与 GitHub 交互,通过 `gh issue`、`gh pr`、`gh run` 和 `gh api` 管理议题、PR、CI 运行及高级查询。
★ 679 📥 328,109
dev-programming

Mcporter

steipete
使用 mcporter CLI 直接列出、配置、认证及调用 MCP 服务器/工具(支持 HTTP 或 stdio),涵盖临时服务器、配置编辑及 CLI/类型生成功能。
★ 195 📥 67,747
ai-agent

Deepagents Implementation

anderskev
使用 Deep Agents 实现代理,适用于创建代理、配置后端、定义子代理、添加中间件或设置...
★ 0 📥 692