Skip to content

DevOps Workflow Cycle

The Logic: Commit → Scan → Decorate → Gate

Quality feedback flows through four stages:

  1. Commit: Developer pushes code to branch. Webhook triggers BrowserStack Code Quality.
  2. Scan: System analyzes changeset against configured rules and baselines.
  3. Decorate: Results display on pull/merge request as inline comments and status checks.
  4. 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

  1. Navigate to Settings > Webhooks in your repository.
  2. Click Add webhook.
  3. Set Payload URL to: https://your-bscq-instance.com/webhooks/github
  4. Set Content type to application/json
  5. Select Let me select individual events and enable:
    • push
    • pull_request
  6. Click Add webhook.

GitLab

  1. Navigate to Settings > Webhooks in your project.
  2. Enter URL as: https://your-bscq-instance.com/webhooks/gitlab
  3. Select events:
    • Push events
    • Merge request events
  4. Click Add webhook.

Bitbucket Cloud

  1. Navigate to Settings > Webhooks in your repository.
  2. Click Add webhook.
  3. Set URL to: https://your-bscq-instance.com/webhooks/bitbucket
  4. Select events:
    • Repository push
    • Pull request created
    • Pull request updated
  5. Click Save.

How It Works

Once webhooks are configured:

  1. Push/PR Event → BrowserStack Code Quality receives webhook notification
  2. Scan Start → Repository analyzed automatically
  3. Results Available → Status checks added to PR/MR
  4. Inline Comments → Issues shown at code locations
  5. Block/Allow → Gate enforces merge permissions based on thresholds

Quality Gates

Configure automatic enforcement of quality criteria:

Gate Thresholds

MetricTypeRecommendedNotes
Code Quality ScoreNumeric> 2.5Overall quality assessment (0-5 scale)
Critical IssuesCount= 0Security/stability violations
High IssuesCount< 5Major design/logic defects
Design RatingNumeric> 2.0Architecture quality indicator
Code DuplicationPercentage< 3Duplicated code in changeset
New Issues in PRCount< 3Issues introduced by changes
Issue DensityPer 1K LoC< 5Defect 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: 3

Gate 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.

See Also