Custom Compliance
The compliance
tool performs comprehensive compliance checks on PR code changes, validating them against security standards, ticket requirements, and custom organizational compliance checklists, thereby helping teams, enterprises, and agents maintain consistent code quality and security practices while ensuring that development work aligns with business requirements.
Setting Up Custom Compliance
Each compliance is defined in a YAML file as follows:
title
(required): A clear, descriptive title that identifies what is being checkedcompliance_label
(required): Determines whether this compliance generates labels for non-compliance issues (set totrue
orfalse
)objective
(required): A detailed description of the goal or purpose this compliance aims to achievesuccess_criteria
andfailure_criteria
(at least one required; both recommended): Define the conditions for compliance
Local Compliance Checklists
For basic usage, create a pr_compliance_checklist.yaml
file in your repository's root directory containing the compliance requirements specific to your repository.
The AI model will use this pr_compliance_checklist.yaml
file as a reference, and if the PR code violates any of the compliance requirements, it will be shown in the compliance tool's comment.
Global Hierarchical Compliance
Qodo Merge supports hierarchical compliance checklists using a dedicated global configuration repository.
Setting up global hierarchical compliance
1. Create a new repository named pr-agent-settings
in your organization or workspace.
2. Build the folder hierarchy in your pr-agent-settings
repository:
pr-agent-settings/
├── metadata.yaml # Maps repos/folders to compliance paths
└── codebase_standards/ # Root for all compliance definitions
├── global/ # Global compliance, inherited widely
│ └── pr_compliance_checklist.yaml
├── groups/ # For groups of repositories
│ ├── frontend_repos/
│ │ └── pr_compliance_checklist.yaml
│ ├── backend_repos/
│ │ └── pr_compliance_checklist.yaml
│ ├── python_repos/
│ │ └── pr_compliance_checklist.yaml
│ ├── cpp_repos/
│ │ └── pr_compliance_checklist.yaml
│ └── ...
├── repo_a/ # For standalone repositories
│ └── pr_compliance_checklist.yaml
├── monorepo-name/ # For monorepo-specific compliance
│ ├── pr_compliance_checklist.yaml # Root-level monorepo compliance
│ ├── service-a/ # Subproject compliance
│ │ └── pr_compliance_checklist.yaml
│ └── service-b/ # Another subproject
│ └── pr_compliance_checklist.yaml
└── ... # More repositories
3. Define the metadata file metadata.yaml
in the root of pr-agent-settings
:
# Standalone repos
qodo-merge:
pr_compliance_checklist_paths:
- "qodo-merge"
# Group-associated repos
repo_b:
pr_compliance_checklist_paths:
- "groups/backend_repos"
# Multi-group repos
repo_c:
pr_compliance_checklist_paths:
- "groups/frontend_repos"
- "groups/backend_repos"
# Monorepo with subprojects
qodo-monorepo:
pr_compliance_checklist_paths:
- "qodo-monorepo"
monorepo_subprojects:
frontend:
pr_compliance_checklist_paths:
- "qodo-monorepo/qodo-github"
backend:
pr_compliance_checklist_paths:
- "qodo-monorepo/qodo-gitlab"
4. Set the following configuration:
[pr_compliance]
enable_global_pr_compliance = true
Configuration Options
Usage Tips
Blocking PRs Based on Compliance
You can configure CI/CD Actions to prevent merging PRs with specific compliance labels:
Possible security concern
- Block PRs with potential security issuesFailed compliance check
- Block PRs that violate custom compliance checklists
Implement a dedicated GitHub Action to enforce these checklists.
Last updated
Was this helpful?