登录 注册

mutant

去点 Star
开发者工具AI 应用与 AI AgentAI 模型与开发框架 code-quality-analyzercode-reviewcoveragedynamic-analysisminitestmutant
2,213
Stars
163
Forks
30
Watchers
128
Open Issues
NOASSERTION
许可证
Ruby
语言
2012-07-23
创建时间
2026-11-06
最近更新

项目能做什么

Ruby 变异测试工具,专门用于检验测试用例本身的质量。
来源:基于仓库元数据 · 内容以仓库实际 README 为准

使用说明 查看原始 README 原仓库文档

中文使用说明暂未生成。下面保留原仓库 README 摘录,命令与配置均以原文为准。
原始 README 摘录(英文原文,节选前 3000 字符)
mutant
======

[![Build Status](https://github.com/mbj/mutant/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/mbj/mutant/actions/workflows/ci.yml)
[![Gem Version](https://img.shields.io/gem/v/mutant.svg)](https://rubygems.org/gems/mutant)
[![Gem Downloads](https://img.shields.io/gem/dt/mutant.svg)](https://rubygems.org/gems/mutant)
[![GitHub Stars](https://img.shields.io/github/stars/mbj/mutant.svg)](https://github.com/mbj/mutant)
[![Discord](https://img.shields.io/discord/767914934016802818.svg)](https://discord.gg/BSr62b4RkV)

## What is Mutant?

**AI writes your code. AI writes your tests. But who tests the tests?**

Copilot, Claude, and ChatGPT generate code faster than humans can review it. They'll even
write tests that pass. But passing tests aren't the same as *meaningful* tests.

Mutant is mutation testing for Ruby. It systematically modifies your code and verifies your
tests actually catch each change.

The more code AI writes for you, the more you need verification you can trust.

## What is an Alive Mutation?

Each surviving (alive) mutation is a call to action with exactly one of two options:

- **Keep the mutated code** - your tests already specify the correct semantics, and the
  original code is redundant. Accept the mutation as a simplification.
- **Add the missing test** - the original code is correct, but the tests don't verify the
  behavior the mutation removed.

## Author

Mutant was created and is developed by [Markus Schirp](https://schirp-dso.com).
It is the subject of [IEEE-published research](https://ieeexplore.ieee.org/document/7107453/)
and is included in the [Trail of Bits Ruby Security Field Guide](https://trailofbits.github.io/rubysec/mutant/index.html).

## Quick Start

```ruby
# lib/person.rb
class Person
  def initialize(age:)
    @age = age
  end

  def adult?
    @age >= 18
  end
end
```

```ruby
# spec/person_spec.rb
RSpec.describe Person do
  describe '#adult?' do
    it 'returns true for age 19' do
      expect(Person.new(age: 19).adult?).to be(true)
    end

    it 'returns false for age 17' do
      expect(Person.new(age: 17).adult?).to be(false)
    end
  end
end
```

Tests pass. But run mutant:

```bash
gem install mutant-rspec
mutant run --use rspec --usage opensource --require ./lib/person 'Person#adult?'
```

Mutant finds a surviving mutation indicating a shallow test:

```diff
 def adult?
-  @age >= 18
+  @age > 18
 end
```

Your tests don't cover `age == 18`. The mutation from `>=` to `>` doesn't break them.

This is just one of many mutation operators. Mutant also mutates arithmetic, logical,
bitwise operators, removes statements, modifies return values, and more.

A full working example is available in the [quick_start](quick_start/) directory.

## Session History

Mutant records every run to `.mutant/results/`, and keeps the 100 most recent.
You can recall past results without re-running mutation testing:

```bash
# List past sessions (most recent first)
mutant session list

#
阅读完整原文

商业机会分析 规则生成(AI 未配置)

综合评分 58.1 分。该项目在“个人可实施性”维度得 40 分,“付费可能性”维度得 20.0 分,差异化空间 100.0 分(评分依据见评分卡)。

面向细分需求的二次开发产品

产品构想基于 mutant 的核心能力,聚焦一个更窄的场景(如某平台、某行业)做差异化。
目标用户该细分场景用户
难度/周期中 · 2~6 周
收费模式买断制 / 订阅制 / 广告
竞争风险细分需求规模需验证
依据 AI 推测:基于项目主题标签的判断
以上为规则引擎基于仓库公开数据生成的参考结论,包含推测成分,不构成投资或创业承诺;配置 AI 后可获得更深入的分析。
报告会保存到 个人中心

竞品与相似项目 GitHub Search 真实检索

项目中文简介Stars语言
super-linter/super-linter 中文介绍暂未生成
Combination of multiple linters to run as a GitHub Action or
10,658 Shell
Tencent/CodeAnalysis 中文介绍暂未生成
Static Code Analysis - 静态代码分析
1,851 Python
SonarSource/sonar-java 中文介绍暂未生成
:coffee: SonarSource Static Analyzer for Java Code Quality a
1,220 Java
fastruby/skunk 中文介绍暂未生成
A SkunkScore Calculator for Ruby Code -- Find the most compl
548 Ruby
CodeNarc/CodeNarc 中文介绍暂未生成
CodeNarc is a static analysis tool for Groovy source code
343 Groovy
abaplint/abaplint 中文介绍暂未生成
Standalone static analysis for ABAP
322 TypeScript
以上为通过 GitHub 官方 Search API 检索的相似项目,功能差异与优劣势需进一步人工确认,配置 AI 后可生成对比分析。

项目优势与风险

技术成熟度创建于 2012-07-23,近 30 天仍在推送,发布过 5 个 Release
社区活跃Star 2,213 / Fork 163 / Issue 128(数据支持,可自行核实)
许可证NOASSERTION
主要风险上游项目方向可能变化;同赛道竞争者较多(见竞品表);热度与需求不完全等价

安装与使用

快速开始(以仓库 README 为准)
git clone https://github.com/mbj/mutant.git
cd mutant
# 请阅读仓库 README 获取确切安装步骤(依赖、配置、启动命令)
阅读原仓库文档
术语说明:Docker=应用容器(把程序和依赖打包运行);API Key=调用外部服务的密钥;Git Clone=把仓库代码下载到本地。常见错误:API Key 未配置 / 端口占用 / 数据库连接失败,多数项目在 README 的 Troubleshooting 章节有说明。