Skip to content

Commit 36119d0

Browse files
authored
Add cargo-mutants config schema (SchemaStore#4762)
1 parent db6b2b2 commit 36119d0

File tree

3 files changed

+178
-0
lines changed

3 files changed

+178
-0
lines changed

src/api/json/catalog.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,12 @@
546546
"fileMatch": ["buf.work.yaml"],
547547
"url": "https://json.schemastore.org/buf.work.json"
548548
},
549+
{
550+
"name": "cargo-mutants-config.yaml",
551+
"description": "cargo-mutants configuration file",
552+
"fileMatch": ["**/.cargo/mutants.toml"],
553+
"url": "https://json.schemastore.org/cargo-mutants-config.json"
554+
},
549555
{
550556
"name": "Cinnamon Spice info.json",
551557
"description": "The 'info.json' metadata file used in Cinnamon Spice components",
Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"$id": "https://json.schemastore.org/cargo-mutants-config.json",
4+
"additionalProperties": true,
5+
"title": "cargo-mutants config",
6+
"description": "cargo-mutants configuration, read by default from `.cargo/mutants.toml`.\n\nSee <https://mutants.rs/>.",
7+
"type": "object",
8+
"properties": {
9+
"additional_cargo_args": {
10+
"description": "Pass extra args to every cargo invocation.",
11+
"default": [],
12+
"type": "array",
13+
"items": {
14+
"type": "string"
15+
}
16+
},
17+
"additional_cargo_test_args": {
18+
"description": "Pass extra args to cargo test.",
19+
"default": [],
20+
"type": "array",
21+
"items": {
22+
"type": "string"
23+
}
24+
},
25+
"build_timeout_multiplier": {
26+
"description": "Build timeout multiplier, relative to the baseline 'cargo build'.",
27+
"default": null,
28+
"type": ["number", "null"],
29+
"format": "double"
30+
},
31+
"cap_lints": {
32+
"description": "Pass `--cap-lints` to rustc.",
33+
"default": false,
34+
"type": "boolean"
35+
},
36+
"copy_vcs": {
37+
"description": "Copy `.git` and other VCS directories to the build directory.",
38+
"default": null,
39+
"type": ["boolean", "null"]
40+
},
41+
"error_values": {
42+
"description": "Generate these error values from functions returning Result.",
43+
"default": [],
44+
"type": "array",
45+
"items": {
46+
"type": "string"
47+
}
48+
},
49+
"examine_globs": {
50+
"description": "Generate mutants from source files matching these globs.",
51+
"default": [],
52+
"type": "array",
53+
"items": {
54+
"type": "string"
55+
}
56+
},
57+
"examine_re": {
58+
"description": "Examine only mutants matching these regexps.",
59+
"default": [],
60+
"type": "array",
61+
"items": {
62+
"type": "string"
63+
}
64+
},
65+
"exclude_globs": {
66+
"description": "Exclude mutants from source files matching these globs.",
67+
"default": [],
68+
"type": "array",
69+
"items": {
70+
"type": "string"
71+
}
72+
},
73+
"exclude_re": {
74+
"description": "Exclude mutants from source files matches these regexps.",
75+
"default": [],
76+
"type": "array",
77+
"items": {
78+
"type": "string"
79+
}
80+
},
81+
"minimum_test_timeout": {
82+
"description": "Minimum test timeout, in seconds, as a floor on the autoset value.",
83+
"default": null,
84+
"type": ["number", "null"],
85+
"format": "double"
86+
},
87+
"output": {
88+
"description": "Output directory.",
89+
"default": null,
90+
"type": ["string", "null"]
91+
},
92+
"profile": {
93+
"description": "Cargo profile.",
94+
"default": null,
95+
"type": ["string", "null"]
96+
},
97+
"skip_calls": {
98+
"description": "Skip calls to functions or methods with these names.\n\nThis is combined with values from the --skip-calls argument.",
99+
"default": [],
100+
"type": "array",
101+
"items": {
102+
"type": "string"
103+
}
104+
},
105+
"skip_calls_defaults": {
106+
"description": "Use built-in defaults for `skip_calls` in addition to any explicit values.",
107+
"default": null,
108+
"type": ["boolean", "null"]
109+
},
110+
"test_package": {
111+
"description": "Run tests from these packages for all mutants.",
112+
"default": [],
113+
"type": "array",
114+
"items": {
115+
"type": "string"
116+
}
117+
},
118+
"test_tool": {
119+
"description": "Choice of test tool: cargo or nextest.",
120+
"anyOf": [
121+
{
122+
"$ref": "#/definitions/TestTool"
123+
},
124+
{
125+
"type": "null"
126+
}
127+
]
128+
},
129+
"test_workspace": {
130+
"description": "Run tests from all packages in the workspace, not just the mutated package.\n\nOverrides `test_package`.",
131+
"default": null,
132+
"type": ["boolean", "null"]
133+
},
134+
"timeout_multiplier": {
135+
"description": "Timeout multiplier, relative to the baseline 'cargo test'.",
136+
"default": null,
137+
"type": ["number", "null"],
138+
"format": "double"
139+
}
140+
},
141+
"definitions": {
142+
"TestTool": {
143+
"description": "Choice of tool to use to run tests.",
144+
"oneOf": [
145+
{
146+
"description": "Use `cargo test`, the default.",
147+
"type": "string",
148+
"enum": ["cargo"]
149+
},
150+
{
151+
"description": "Use `cargo nextest`.",
152+
"type": "string",
153+
"enum": ["nextest"]
154+
}
155+
]
156+
}
157+
}
158+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#:schema ../../schemas/json/cargo-mutants-config.json
2+
# cargo-mutants configuration
3+
4+
copy_vcs = true
5+
error_values = ["::anyhow::anyhow!(\"mutated!\")"]
6+
exclude_globs = ["src/console.rs"]
7+
profile = "mutants" # Build without debug symbols
8+
output = "custom-mutants-out"
9+
skip_calls = ["boring", "uninteresting"]
10+
skip_calls_defaults = true
11+
test_tool = "nextest"
12+
timeout_multiplier = 4.23
13+
build_timeout_multiplier = 2.1
14+
test_workspace = true

0 commit comments

Comments
 (0)