Skip to main content

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

FieldTypeRequiredDescription
ruleslistYesList of rule objects

Rule fields (all types)

FieldTypeRequiredDefaultDescription
namestringYesUnique rule identifier; used in output and depends_on references
descriptionstringYesHuman-readable description shown in CLI output
typestringYesRule evaluator: llm, regex, or ast
on_failstringNowarnWhat happens when the rule fails: warn prints a warning, fail exits with code 1
depends_onstringNoName of a rule that must pass for this rule to run

LLM rule fields

FieldTypeRequiredDefaultDescription
promptstringYesInstruction sent to the model; the diff is appended automatically
modelstringNoqwen/qwen-2.5-72b-instructAny OpenRouter model identifier

Regex rule fields

FieldTypeRequiredDefaultDescription
patternstringYesPython re-compatible regular expression
matchbooleanNotruetrue: pattern must match for PASS; false: pattern must not match for PASS

AST rule fields

FieldTypeRequiredDefaultDescription
checkstringYesOne 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.