Skip to content

Commit 26f4195

Browse files
committed
Code Rabbit config
1 parent bd96550 commit 26f4195

1 file changed

Lines changed: 156 additions & 0 deletions

File tree

.coderabbit.yaml

Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
2+
#
3+
# CodeRabbit configuration for stackrox-mcp
4+
#
5+
# This MCP server bridges AI assistants to StackRox/RHACS Central via gRPC.
6+
# The project is Go-only (~120 files), with Dockerfiles, Helm charts, shell
7+
# scripts, GitHub Actions, and Tekton/Konflux pipelines.
8+
9+
inheritance: true
10+
11+
reviews:
12+
# Assertive catches more issues; acceptable for a small, security-focused project.
13+
profile: assertive
14+
high_level_summary: true
15+
# Sequence diagrams help reviewers follow MCP tool→gRPC call→response flows.
16+
sequence_diagrams: true
17+
auto_review:
18+
# Enabled so every PR gets automatic review — the primary goal of this config.
19+
enabled: true
20+
# Review drafts too — catches issues before PRs are marked ready.
21+
drafts: true
22+
base_branches:
23+
- "main"
24+
- "release-.*"
25+
26+
# ── Path-based review guidance ──────────────────────────────────────
27+
#
28+
# Tailored for a Go MCP server that talks to StackRox Central via gRPC.
29+
# No frontend, protobuf, Python, or database migrations in this project.
30+
31+
path_instructions:
32+
# Go is the only application language in this project.
33+
- path: "**/*.go"
34+
instructions: >
35+
Go MCP server codebase. Review for:
36+
- Proper error wrapping with client.NewError for user-facing errors
37+
- Context propagation (context.Context as first param)
38+
- MCP tool handlers must follow (ctx, req, input) → (*CallToolResult, *output, error) signature
39+
- Tools must implement the toolsets.Tool interface (IsReadOnly, GetTool, GetName, RegisterWith)
40+
- Auth context injection via auth.WithMCPRequestContext(ctx, req)
41+
- gRPC connections via client.ReadyConn(ctx), not direct dials
42+
- No direct fmt.Print or os.Stdout (use structured logging with `slog`)
43+
- Testify assert/require in tests, table-driven subtests preferred
44+
- For table-driven subtest cases use `map` with `testName` as key
45+
- When looping over test cases, use variables `testName` and `testCase`.
46+
- Deferred mutex unlocks instead of manual Unlock calls
47+
- Cursor-based pagination must use the cursor package
48+
49+
# Dockerfiles: standard and Konflux-specific.
50+
- path: "**/{Dockerfile,Dockerfile.*,*.Dockerfile,konflux.Dockerfile}"
51+
instructions: >
52+
Container images for the MCP server. Review for:
53+
- Minimal base images (UBI9 preferred for RHACS ecosystem)
54+
- Multi-stage builds to minimize final image size
55+
- No secrets or credentials in build args or layers
56+
- Correct layer ordering for cache efficiency
57+
- CGO_ENABLED=0 for static Go binaries
58+
- Non-root user in the final stage
59+
60+
# Shell scripts for build automation and CI.
61+
- path: "**/*.sh"
62+
instructions: >
63+
Shell scripts for build and CI. Review for:
64+
- set -euo pipefail at the top
65+
- Proper variable quoting ("${VAR}" not $VAR)
66+
- No hardcoded credentials, tokens, or internal URLs
67+
- Correct exit code propagation
68+
- Consistent use of the sandbox env vars (GOPATH, GOCACHE, etc.)
69+
70+
# GitHub Actions workflows.
71+
- path: ".github/workflows/**"
72+
instructions: >
73+
GitHub Actions CI/CD workflows. Review for:
74+
- Pin action versions to full SHA, not tags (supply chain safety)
75+
- Minimize GITHUB_TOKEN permissions (principle of least privilege)
76+
- No script injection from untrusted PR inputs (title, body, labels)
77+
- Secrets must use GitHub secrets, never hardcoded values
78+
- Cache keys should include go.sum hash for correctness
79+
80+
# Tekton/Konflux pipelines for RHACS CI.
81+
- path: ".tekton/**"
82+
instructions: >
83+
Tekton/Konflux pipeline definitions for Red Hat CI. Review for:
84+
- Task parameter validation and correct workspace bindings
85+
- No hardcoded image references (use params or bundles)
86+
- Resource limits set on task containers
87+
- Pipeline results propagated correctly for Konflux integration
88+
89+
# Helm charts for deployment.
90+
- path: "**/helm/**"
91+
instructions: >
92+
Helm chart templates and values. Review for:
93+
- Template correctness (proper quoting, indentation with nindent)
94+
- Sensible defaults in values.yaml
95+
- Security context set (non-root, read-only root filesystem)
96+
- Resource requests and limits defined
97+
- No secrets in default values
98+
99+
# YAML configs (catch-all for non-workflow, non-Tekton YAML).
100+
- path: "**/*.{yml,yaml}"
101+
instructions: >
102+
YAML configuration files. Review for well-formed structure,
103+
no trailing whitespace, and correct indentation. For CI configs,
104+
verify environment variables and secrets are handled securely.
105+
106+
# E2E and integration test configs.
107+
- path: "e2e-tests/**"
108+
instructions: >
109+
E2E test infrastructure using mcpchecker and WireMock. Review for:
110+
- Correct tool patterns matching actual tool names
111+
- WireMock stubs matching expected gRPC responses
112+
- Test isolation (no shared mutable state between test cases)
113+
114+
# ── Static analysis tools ─────────────────────────────────────────────
115+
#
116+
# These complement the project's own Makefile lint targets (golangci-lint,
117+
# hadolint, shellcheck, helm-lint, actionlint). Running them in PR review
118+
# catches issues before CI even starts.
119+
120+
tools:
121+
# Primary Go linter — matches the project's `make lint` target.
122+
golangci-lint:
123+
enabled: true
124+
# Shell script analysis — matches `make shell-lint`.
125+
shellcheck:
126+
enabled: true
127+
# YAML validation for configs and CI definitions.
128+
yamllint:
129+
enabled: true
130+
# Dockerfile best practices — matches `make dockerfile-lint`.
131+
hadolint:
132+
enabled: true
133+
# SAST scanner for security patterns (SQL injection, command injection, etc.).
134+
semgrep:
135+
enabled: true
136+
# Secret detection — critical for a security product's own codebase.
137+
gitleaks:
138+
enabled: true
139+
140+
chat:
141+
# Auto-reply to reviewer comments for faster feedback loops.
142+
auto_reply: true
143+
144+
knowledge_base:
145+
# Learn from the project's own conventions over time.
146+
code_guidelines:
147+
enabled: true
148+
learnings:
149+
scope: auto
150+
issues:
151+
scope: auto
152+
pull_requests:
153+
scope: auto
154+
# Disabled — this project's domain knowledge is internal to StackRox/RHACS.
155+
web_search:
156+
enabled: false

0 commit comments

Comments
 (0)