Appearance
DevOps Workflow Cycle
The Logic: Commit → Scan → Decorate → Gate
Quality feedback flows through four stages:
- Commit: Developer pushes code to branch. Webhook triggers BrowserStack Code Quality.
- Scan: System analyzes changeset against configured rules and baselines.
- Decorate: Results display on pull/merge request as inline comments and status checks.
- Gate: Quality gate enforces configured thresholds; blocks merge if criteria unmet.
This cycle ensures code quality is evaluated before integration, reducing rework and maintaining standards.
PR Decoration
Prerequisites
- BrowserStack Code Quality instance running and accessible at public URL
- Repository already added to BrowserStack Code Quality
- API Token generated from User Settings (see Creating API Tokens)
- Webhook Access enabled on SCM platform (GitHub, GitLab, Bitbucket)
Webhook Setup
GitHub
- Navigate to Settings > Webhooks in your repository.
- Click Add webhook.
- Set Payload URL to:
https://your-bscq-instance.com/webhooks/github - Set Content type to
application/json - Select Let me select individual events and enable:
pushpull_request
- Click Add webhook.
GitLab
- Navigate to Settings > Webhooks in your project.
- Enter URL as:
https://your-bscq-instance.com/webhooks/gitlab - Select events:
Push eventsMerge request events
- Click Add webhook.
Bitbucket Cloud
- Navigate to Settings > Webhooks in your repository.
- Click Add webhook.
- Set URL to:
https://your-bscq-instance.com/webhooks/bitbucket - Select events:
Repository pushPull request createdPull request updated
- Click Save.
How It Works
Once webhooks are configured:
- Push/PR Event → BrowserStack Code Quality receives webhook notification
- Scan Start → Repository analyzed automatically
- Results Available → Status checks added to PR/MR
- Inline Comments → Issues shown at code locations
- Block/Allow → Gate enforces merge permissions based on thresholds
Quality Gates
Configure automatic enforcement of quality criteria:
Gate Thresholds
| Metric | Type | Recommended | Notes |
|---|---|---|---|
| Code Quality Score | Numeric | > 2.5 | Overall quality assessment (0-5 scale) |
| Critical Issues | Count | = 0 | Security/stability violations |
| High Issues | Count | < 5 | Major design/logic defects |
| Design Rating | Numeric | > 2.0 | Architecture quality indicator |
| Code Duplication | Percentage | < 3 | Duplicated code in changeset |
| New Issues in PR | Count | < 3 | Issues introduced by changes |
| Issue Density | Per 1K LoC | < 5 | Defect concentration in changeset |
Gate Configuration
Gates are set in Project Settings > Quality Gates:
yaml
gates:
- name: "Quality Score"
metric: "score"
operator: ">"
threshold: 2.5
- name: "Critical Issues"
metric: "critical_count"
operator: "=="
threshold: 0
- name: "Code Duplication"
metric: "duplication_percent"
operator: "<"
threshold: 3Gate Behavior
- Pass: All thresholds met → PR is mergeable
- Fail: Any threshold breached → PR blocked with details
- Bypass: Optional admin bypass with audit trail (see Admin Settings)
Common Policies
Strict Policy (Enterprise)
- Score > 3.0
- Critical Issues = 0
- New Issues = 0
Standard Policy (Teams)
- Score > 2.5
- Critical Issues < 2
- New Issues < 3
Permissive Policy (Open Source)
- Score > 2.0
- Critical Issues < 5
- Duplication < 5%
Configure gates per repository or apply organization-wide defaults in Admin > Quality Gate Defaults.
