diff --git a/.coderabbit.yaml b/.coderabbit.yaml new file mode 100644 index 0000000..1c731ce --- /dev/null +++ b/.coderabbit.yaml @@ -0,0 +1,222 @@ +# CodeRabbit Configuration for Crossplane Function SDK for Go +# This configuration is optimized for the Crossplane Function SDK Go library + +# ============================================================================= +# GLOBAL SETTINGS +# ============================================================================= + +# Language for CodeRabbit reviews and comments (default: en-US, keeping explicit) +language: "en-US" + +# Instructions for CodeRabbit's tone and style in reviews (max 250 chars) +tone_instructions: | + Be collaborative and supportive. Ask clarifying questions rather than making + assumptions. Focus on the 'why' behind decisions. Frame concerns + constructively and thank contributors. + +# Disable early-access features for stability +early_access: false + +# ============================================================================= +# REVIEWS +# ============================================================================= + +reviews: + # We tested assertive and found it too verbose, e.g. approxing 200 comments on + # https://github.com/crossplane/crossplane/pull/6777. Some of the nitpicks do + # look valuable to me, but the signal to noise ratio isn't good enough. + profile: "chill" + + # Don't generate summary in PR description - let authors write their own + high_level_summary: false + + # Include the high-level summary in the walkthrough comment instead + high_level_summary_in_walkthrough: true + + # Collapse walkthrough comment to reduce visual clutter in PRs + collapse_walkthrough: true + + # Enable automatic label application + auto_apply_labels: true + + # Automatically assign suggested reviewers (disabled - let maintainers control) + auto_assign_reviewers: false + + # Disable poem generation in walkthrough comments + poem: false + + # Disable review status messages to reduce comment noise + review_status: false + + # Focus reviews on source code, exclude generated and vendor files + path_filters: + # Include source code + - "**/*.go" + - "**/*.yaml" + - "**/*.yml" + - "**/*.md" + - "**/*.proto" + - "**/Dockerfile*" + - "**/Earthfile" + - "**/*.sh" + + # Exclude generated and vendor files + - "!**/zz_generated*.go" + - "!**/vendor/**" + - "!**/node_modules/**" + - "!**/*.pb.go" + - "!**/*.pb.gw.go" + - "!**/mock_*.go" + - "!**/fake/**" + - "!**/testdata/**" + - "!**/dist/**" + - "!**/build/**" + - "!**/.tmp-earthly-out/**" + + # Path-specific instructions for different areas of the codebase + path_instructions: + - path: "**/*.go" + instructions: | + Enforce Crossplane-specific patterns: Use function-sdk-go/errors + for wrapping. Check variable naming (short for local scope, descriptive + for wider scope). Ensure 'return early' pattern. Verify error scoping + (declare in conditionals when possible). For nolint directives, require + specific linter names and explanations. CRITICAL: Ensure all error + messages are meaningful to end users, not just developers - avoid + technical jargon, include context about what the user was trying to do, + and suggest next steps when possible. + + - path: "**/*_test.go" + instructions: | + Enforce table-driven test structure: PascalCase test names (no + underscores), args/want pattern, use cmp.Diff with + cmpopts.EquateErrors() for error testing. Check for proper test case + naming and reason fields. Ensure no third-party test frameworks (no + Ginkgo, Gomega, Testify). + + - path: "**/*.md" + instructions: | + Ensure Markdown files are wrapped at 100 columns for consistency and + readability. Lines can be longer if it makes links more readable, but + otherwise should wrap at 100 characters. Check for proper heading + structure, clear language, and that documentation is helpful for users. + + - path: "**/test/**" + instructions: | + Focus on test coverage, test clarity, and proper use of testing + utilities. Ask about testing scenarios and edge cases. Ensure tests are + maintainable and cover the happy path and error conditions. Verify + error testing uses proper patterns (cmpopts.EquateErrors, sentinel + errors for complex cases). + + # Automatic review settings + auto_review: + # Skip reviewing draft PRs until they're ready for review (default: false, keeping explicit) + drafts: false + + # Skip reviews if PR title contains these keywords (case-insensitive) + ignore_title_keywords: + - "wip" + - "draft" + - "do not merge" + - "dnm" + + # Skip reviews from these automated bot accounts + ignore_usernames: + - "dependabot[bot]" + - "renovate[bot]" + - "github-actions[bot]" + + # Quality gates that run during CodeRabbit's review to check PR readiness + pre_merge_checks: + # Check PR title for length and descriptiveness + title: + requirements: "Keep under 72 characters and be descriptive about what the change does." + + # Disable docstring coverage check (too noisy for Go projects) + docstrings: + mode: "off" + + # Custom checks specific to Crossplane Function SDK development practices + custom_checks: + - name: "Breaking Changes" + mode: "error" + instructions: | + Fails if any public Go code (exported functions, types, methods, or + fields) in '**/*.go' (excluding *_test.go and generated files) is + removed, renamed, has signature changes, or has behavior changes that + could break existing users, without the 'breaking-change' label. This + is a library repo - all exported APIs are public. + + # Disable automatic code generation features + finishing_touches: + # Disable automatic docstring generation + docstrings: + enabled: false + + # Disable automatic unit test generation + unit_tests: + enabled: false + + # Tools - DISABLED: We prefer to run linting tools directly in CI + # Our comprehensive golangci-lint setup with "default: all" already covers + # most static analysis. Additional tools can be added to CI as needed. + tools: + # Go linting - disabled (we run golangci-lint with comprehensive config) + golangci-lint: + enabled: false + + # Security and vulnerability scanning - disabled (prefer direct CI integration) + gitleaks: + enabled: false + + semgrep: + enabled: false + + osvScanner: + enabled: false + + # File format linting - disabled (prefer direct CI integration) + yamllint: + enabled: false + + markdownlint: + enabled: false + + shellcheck: + enabled: false + + hadolint: + enabled: false + + actionlint: + enabled: false + + buf: + enabled: false + + # GitHub integration - disabled for now + github-checks: + enabled: false + +# ============================================================================= +# CHAT +# Interactive chat with CodeRabbit in PR comments. You can ask questions like: +# - @coderabbitai explain this error handling approach +# - @coderabbitai what are the edge cases for this function? +# - @coderabbitai how does this affect backward compatibility? +# - @coderabbitai generate unit tests for this function +# ============================================================================= + +chat: + # Disable ASCII/emoji art in responses + art: false + +# ============================================================================= +# KNOWLEDGE BASE +# ============================================================================= + +knowledge_base: + # Enable MCP integration to provide context about external libraries and APIs + mcp: + usage: "enabled"