GitHub Action:自动检测 PR 中的过度工程信号。零依赖,即插即用。 A GitHub Action that detects over-engineering signals in your pull requests. Zero dependencies.
创建 .github/workflows/moyu-lint.yml:
Create .github/workflows/moyu-lint.yml:
检测为已有函数添加的 docstring / JSDoc,而非新函数。Docstrings added to existing functions, not new ones.
新增代码中 try/catch/except 占比过高(>20%)。High ratio of try/catch/except in added code (>20%).
PR 中创建了全新文件,可能超出需求范围。Entirely new files that may exceed the requested scope.
过多的 isinstance / typeof / type() 检查。Excessive isinstance / typeof / type() checks.
新增 class / interface / 设计模式命名(Factory、Strategy 等)。New class/interface declarations or design pattern names (Factory, Strategy, etc).
变更文件数远超 PR 标题/描述所涉及的范围。Many files changed relative to PR title/description scope.
| 分数Score | 等级Grade | 含义Meaning |
|---|---|---|
| 0 | 🐟 Perfect | 无过度工程信号No over-engineering detected |
| 1-3 | 🐠 Minor | 少量信号,通常没问题A few signals, probably fine |
| 4-6 | 🐠 Moderate | 建议简化Consider simplifying |
| 7+ | 🐡 High | PR 可能过度工程PR may be over-engineered |
Score: 10 — High — this PR may be over-engineered
| Signal | Score | Details |
|---|---|---|
| New files created | 1 | task_factory.py: new file (+30 lines) |
| Type-check bloat | 1 | task_factory.py: 3 type-checking lines added |
| Unnecessary abstractions | 8 | task_factory.py: 4 new class declarations |
Moyu says: The best code is the code you didn't write.