Skip to Content
FeaturesPolicies

Configure organization policies

Open Settings → Policies to manage the canonical organization policy. The same policy is consumed by manual scans, provider-triggered pull-request reviews, quality-gate decisions, and provider status delivery.

Use the dedicated Settings → Quality Gates page for new-code thresholds, quality-gate waivers, and the quality policy-as-code workflow.

Policy inheritance

CodeStax starts with the organization policy, then applies fields explicitly set in a repository override. Deleting an override restores full organization inheritance.

Organization policy └── Repository override └── Effective policy

Repository overrides can narrow or relax supported controls, but cannot change the organization-only default scan type, scan timeout, or notification preferences.

Available controls

Quality gate

FieldDefaultPurpose
risk_threshold75Maximum review risk score before the gate fails
block_merge_on_failfalsePublish a provider failure signal when the gate fails
gate_reliabilityA,BAccepted reliability grades
gate_securityAAccepted security grades
gate_maintainabilityA,B,CAccepted maintainability grades
gate_max_complexity60Maximum allowed complexity signal
max_critical_issues0Maximum critical findings
max_high_issues-1Maximum high findings; -1 disables the limit
fail_on_dead_codefalseFail when dead-code findings are present
fail_on_duplicates_pct-1Maximum duplication percentage; -1 disables the limit

Scans and reviews

FieldDefaultPurpose
auto_scan_on_pushtrueAllow supported push webhooks to trigger scans
auto_review_enabledtrueMaster switch for provider-triggered reviews
auto_review_on_pr_opentrueReview newly opened pull or merge requests
auto_review_on_pr_updatefalseReview new commits on an existing request
auto_review_on_pr_reopentrueReview reopened requests
default_scan_typesmartOrganization default for manual and scheduled scans
scan_timeout_minutes30Maximum scan time, from 1 to 1,440 minutes
review_target_branchesmain,developComma-separated target-branch patterns
excluded_pathsemptyComma-separated repository-relative path patterns

Code quality analyzers

The policy can enable or disable the Python complexity, Python dead-code, and duplication analyzers; set complexity and confidence thresholds; set duplication minimum lines and tokens; and add repository-relative exclusion patterns. The Quality Profiles and Rule Catalog pages provide the customer-facing configuration workflow.

Notifications

Organization policy includes notify_critical, notify_gate_fail, and notify_weekly_digest. User delivery preferences live under Settings → Notifications.

API

# Read the organization policy $ curl -H "X-API-Key: $CODESTAX_API_KEY" \ https://codestax.co/api/policies/org # Update selected organization fields $ curl -X PUT \ -H "X-API-Key: $CODESTAX_API_KEY" \ -H "Content-Type: application/json" \ -d '{"risk_threshold":70,"auto_review_on_pr_update":true}' \ https://codestax.co/api/policies/org # Read a repository override and effective policy $ curl -H "X-API-Key: $CODESTAX_API_KEY" \ https://codestax.co/api/policies/repo/<repo_id> # Update a repository override $ curl -X PUT \ -H "X-API-Key: $CODESTAX_API_KEY" \ -H "Content-Type: application/json" \ -d '{"risk_threshold":60}' \ https://codestax.co/api/policies/repo/<repo_id>

Use DELETE /api/policies/repo/{repo_id} to remove the override. GET /api/policies/gate-conditions returns the current supported gate-condition catalog.

Policy updates reject unknown fields and explicit null values. Read the current policy before updating it, and send only fields you intend to change.

Permissions and enforcement

Viewers can read policy through tenant-scoped product views. Organization admins and owners can change organization and repository policy. API keys must carry the scopes required by the endpoint.

block_merge_on_fail publishes a failure result; the SCM provider blocks merging only when you also require the CodeStax signal in branch protection, merge checks, or branch restrictions. See Set up quality gates.