Compliance
Overview
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.

Example Usage
Manual Triggering
Invoke the tool manually by commenting /compliance
on any PR. The compliance results are presented in a comprehensive table:
To edit configurations related to the compliance
tool, use the following template:
/compliance --pr_compliance.some_config1=... --pr_compliance.some_config2=...
For example, you can enable ticket compliance labels by running:
/compliance --pr_compliance.enable_ticket_labels=true
Automatic Triggering
The tool can be triggered automatically every time a new PR is opened, or in a push event to an existing PR.
To run the compliance
tool automatically when a PR is opened, define the following in the configuration file:
[github_app] # for example
pr_commands = [
"/compliance",
...
]
Compliance Categories
The compliance tool evaluates three main categories:
1. Security Compliance
Scans for security vulnerabilities and potential exploits in the PR code changes:
Verified Security Concerns 🔴: Clear security vulnerabilities that require immediate attention
Possible Security Risks ⚪: Potential security issues that need human verification
No Security Concerns 🟢: No security vulnerabilities detected
Examples of security issues:
Exposure of sensitive information (API keys, passwords, secrets)
SQL injection vulnerabilities
Cross-site scripting (XSS) risks
Cross-site request forgery (CSRF) vulnerabilities
Insecure data handling patterns
2. Ticket Compliance
How to set up ticket compliance
Auto-create ticket
Follow this guide to learn how to enable triggering create tickets
based on PR content.
Validates that PR changes fulfill the requirements specified in linked tickets:
Fully Compliant 🟢: All ticket requirements are satisfied
Partially Compliant 🟡: Some requirements are met, others need attention
Not Compliant 🔴: Clear violations of ticket requirements
Requires Verification ⚪: Requirements that need human review
3. RAG Code Duplication Compliance
Analyzes code changes using RAG endpoint to detect potential code duplication from the codebase:
Fully Compliant 🟢: No code duplication found
Not Compliant 🔴: Full code duplication found
Requires Verification ⚪: Near code duplication
4. Custom Compliance
Validates against an organization-specific compliance checklist:
Fully Compliant 🟢: All custom compliance are satisfied
Not Compliant 🔴: Violations of custom compliance
Requires Verification ⚪: Compliance that need human assessment
Custom Compliance
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
└── compliance_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
│ └── ...
├── qodo-merge/ # For standalone repositories
│ └── pr_compliance_checklist.yaml
├── qodo-monorepo/ # For monorepo-specific compliance
│ ├── pr_compliance_checklist.yaml # Root-level monorepo compliance
│ ├── qodo-github/ # Subproject compliance
│ │ └── pr_compliance_checklist.yaml
│ └── qodo-gitlab/ # 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?