--rules and --exclude flags.
Default Behavior
When you run pgvet without any rule selection flags, it runs all default rules:select-starlimit-without-ordernot-in-subqueryfor-update-no-skipdistinct-on-ordernull-comparisonupdate-without-wheredelete-without-whereinsert-without-columnsban-char-typetimestamp-without-timezoneorder-by-ordinalgroup-by-ordinallike-starts-with-wildcardoffset-without-limit
Selecting Specific Rules
Use the--rules flag to run only specific rules:
select-star and delete-without-where rules.
Rule Name Format
Rule names are:- Case-sensitive
- Comma-separated (no spaces)
- Matched exactly
Excluding Rules
Use the--exclude flag to run all default rules except the ones you specify:
select-star.
Exclude Multiple Rules
You can exclude multiple rules using a comma-separated list:Combining —rules and —exclude
When you use both flags together, pgvet:- First selects only the rules from
--rules - Then removes any rules listed in
--exclude
delete-without-where and update-without-where.
Opt-in Rules
Some rules are opt-in and not included in the default set. To use them, you must explicitly enable them with--rules.
multi-statement
Themulti-statement rule is opt-in:
Enabling Opt-in Rules with Defaults
To run all default rules plus opt-in rules, list them explicitly:Currently,
multi-statement is the only opt-in rule. Future versions may add more opt-in rules for specialized analysis.Common Configuration Patterns
Focus on Dangerous Operations
Run only rules that detect potentially destructive operations:Exclude Stylistic Warnings
Run all default rules except stylistic ones:CI/CD: Fail Only on Errors
If you want to run a strict check in CI, enable only error-level rules:multi-statement has error severity, this ensures your CI only fails on critical issues.
Development: Run All Rules
During development, you might want to run all rules including opt-ins. Since there’s currently only one opt-in rule, you can enable it alongside defaults by excluding nothing:Viewing Available Rules
To see all available rules and their descriptions:- All default rules
- Opt-in rules
- Each rule’s description