Config Schema Reference
Full reference for all fields in .comply.yml.
Top-level structure
rules:
- name: string # required
description: string # required
type: string # required: llm | regex | ast
on_fail: string # optional: warn | fail (default: warn)
depends_on: string # optional: name of another rule
# type-specific fields below
Top-level fields
| Field | Type | Required | Description |
|---|---|---|---|
rules | list | Yes | List of rule objects |
Rule fields (all types)
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
name | string | Yes | — | Unique rule identifier; used in output and depends_on references |
description | string | Yes | — | Human-readable description shown in CLI output |
type | string | Yes | — | Rule evaluator: llm, regex, or ast |
on_fail | string | No | warn | What happens when the rule fails: warn prints a warning, fail exits with code 1 |
depends_on | string | No | — | Name of a rule that must pass for this rule to run |
LLM rule fields
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
prompt | string | Yes | — | Instruction sent to the model; the diff is appended automatically |
model | string | No | qwen/qwen-2.5-72b-instruct | Any OpenRouter model identifier |
Regex rule fields
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
pattern | string | Yes | — | Python re-compatible regular expression |
match | boolean | No | true | true: pattern must match for PASS; false: pattern must not match for PASS |
AST rule fields
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
check | string | Yes | — | One of: bare_except, eval_usage, missing_docstring, complexity |
Full example
rules:
# LLM rule
- name: has-test-coverage
description: New features should include tests
type: llm
prompt: |
Does this diff include tests for any new functions or classes?
Answer YES or NO.
model: qwen/qwen-2.5-72b-instruct
on_fail: warn
# Regex rule
- name: no-print-statements
description: No print() calls in committed code
type: regex
pattern: '^\+.*\bprint\s*\('
match: false
on_fail: fail
# AST rule
- name: no-bare-except
description: Bare except clauses hide errors
type: ast
check: bare_except
on_fail: warn
# Chained rule
- name: migration-has-rollback
description: Database migrations should include rollback logic
type: llm
prompt: |
Does this migration include a rollback or down migration?
Answer YES or NO.
depends_on: has-migration-file
on_fail: warn
Validation
Run comply validate to check your config without executing checks:
comply validate
Next steps
Starter rules reference — the nine rules created by comply init.