diff --git a/.coderabbit.yaml b/.coderabbit.yaml new file mode 100644 index 0000000..9587fcb --- /dev/null +++ b/.coderabbit.yaml @@ -0,0 +1,90 @@ +language: en-GB + +tone_instructions: | + Provide feedback in a professional, friendly, constructive and concise tone. + Offer clear, specific suggestions and best practices to help enhance the code + quality and promote learning. + Be concise and only comment on significant issues. + +early_access: false + +knowledge_base: + # Stop this repo's agent instructions becoming code guidelines for every repo + code_guidelines: + enabled: false + # `global` uses the organization's learnings, + learnings: + scope: global + issues: + scope: global + pull_requests: + scope: global + +reviews: + profile: chill + high_level_summary: true + # Add the high-level summary into the walkthrough instead of the PR body + high_level_summary_in_walkthrough: true + # Don't post review details on each review. + review_status: false + review_info: false + commit_status: false + # Ensure the walkthrough is visible now that the summary is disabled + collapse_walkthrough: false + changed_files_summary: false + sequence_diagrams: false + estimate_code_review_effort: false + related_issues: false + related_prs: false + suggested_labels: false + suggested_reviewers: false + in_progress_fortune: false + poem: false + # Define path filters and instructions in the local repository + path_filters: [] + path_instructions: [] + auto_review: + # Keywords are case-insensitive + ignore_title_keywords: + - wip + - draft + - "chore(release):" + - "ci(trunk):" + ignore_usernames: + # Reduce noise as chazypro is not currently licensed + - chazypro + # Ignore bots as they perform automated tasks that do not require review + - 3ware[bot] + - github-actions[bot] + - renovate[bot] + finishing_touches: + autofix: + enabled: false + docstrings: + enabled: false + unit_tests: + enabled: false + pre_merge_checks: + docstrings: + mode: "off" + title: + # PR Check does this to ensure conventional commit syntax + mode: "off" + tools: + # Disable tools where Trunk (https://trunk.io) overlaps. + actionlint: + enabled: false + checkov: + enabled: false + markdownlint: + enabled: false + shellcheck: + enabled: false + trufflehog: + enabled: false + yamllint: + enabled: false + zizmor: + enabled: false +chat: + art: false diff --git a/.github/README.md b/.github/README.md index 6f62842..22fa86a 100644 --- a/.github/README.md +++ b/.github/README.md @@ -1,23 +1,52 @@ -# README Template +# Coderabbit Central Configuration - +Defines standard Coderabbit configuration for 3ware repositories -[![GitHub release](https://img.shields.io/github/release/3ware/template-base?include_prereleases=&sort=semver&color=green)](https://github.com/3ware/template-base/releases/) [![issues - workflows](https://img.shields.io/github/issues/3ware/template-base)](https://github.com/3ware/template-base/issues) [![CI](https://img.shields.io/github/actions/workflow/status/3ware/template-base/pr-check.yaml?label=CI&logo=githubactions&logoColor=white)](https://github.com/3ware/template-base/actions/workflows/pr-check.yaml) +[![GitHub release](https://img.shields.io/github/release/3ware/coderabbit?include_prereleases=&sort=semver&color=green)](https://github.com/3ware/coderabbit/releases/) [![issues - workflows](https://img.shields.io/github/issues/3ware/coderabbit)](https://github.com/3ware/coderabbit/issues) [![CI](https://img.shields.io/github/actions/workflow/status/3ware/coderabbit/pr-check.yaml?label=CI&logo=githubactions&logoColor=white)](https://github.com/3ware/coderabbit/actions/workflows/pr-check.yaml) ## Configuration - +[.coderabbit.yaml](../.coderabbit.yaml) sets the org-wide defaults. Notable settings: + +| Setting | Value | Reason | +| --------------------------------------------------------- | ------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------- | +| `language` | `en-GB` | | +| `reviews.profile` | `chill` | Only comment on significant issues | +| `knowledge_base.code_guidelines.enabled` | `false` | Stop this repository's agent instructions applying to every repository | +| `knowledge_base.*.scope` | `global` | Share learnings, issues and PRs across the org | +| `reviews.high_level_summary_in_walkthrough` | `true` | Moves high level summary to the walkthrough to avoid editing the PR body, which skips workflows that ignore `edited` events. | +| Extras (poem, fortune, diagrams, labels, reviewers, etc.) | disabled | Reduce noise | +| `reviews.auto_review.ignore_title_keywords` | `wip`, `draft`, `chore(release):`, `ci(trunk):` | Skip non-reviewable PRs | +| `reviews.pre_merge_checks.title` | `off` | PR titles are validated by the PR Check workflow | +| `reviews.tools` | actionlint, checkov, markdownlint, shellcheck, trufflehog, yamllint, zizmor disabled | Overlap with [Trunk](https://trunk.io) | +| `reviews.path_filters` / `path_instructions` | empty | Set these in the local repository | ## Requirements - +- The CodeRabbit GitHub App is installed on the `3ware` organisation and has access to both this repository and the repository being reviewed. +- This repository must stay named `coderabbit`. CodeRabbit looks it up by name. +- Repositories that rely on the disabled tools above should run [Trunk](https://trunk.io) instead. ## Usage - - -## Maintenance - - +Add a `.coderabbit.yaml` file to the root of your repository. As a minimum set `inheritance` to true and add `path_filters` and `path_instructions` to focus the reviews. + +> [!IMPORTANT] +> Without a local `.coderabbit.yaml`, CodeRabbit doesn't read your repository's own `.github/copilot-instructions.md` or `.github/skills//SKILL.md`. A local config with `inheritance: true` keeps the central settings. Code guidelines are disabled centrally, so also set `knowledge_base.code_guidelines.enabled: true` to have CodeRabbit read your repository's own guideline files and skills. If you already use those agent instructions, consider omitting `path_instructions`. + +```yaml +inheritance: true +knowledge_base: + code_guidelines: + enabled: true +reviews: + path_filters: + - iac/** + path_instructions: + - path: "**/*.tf" + instructions: | + Say what to check and what to flag. Concrete rules work better than general advice + Consider omitting this if it overlaps with coding guidelines. +``` diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md new file mode 100644 index 0000000..3422dd7 --- /dev/null +++ b/.github/copilot-instructions.md @@ -0,0 +1,37 @@ +# CodeRabbit Central Configuration + +This repository holds the org-wide [CodeRabbit](https://coderabbit.ai) defaults for the `3ware` GitHub organisation. CodeRabbit reads `.coderabbit.yaml` from a repository named exactly `coderabbit` and applies it to every 3ware repository that has no `.coderabbit.yaml` of its own. Repositories that add their own file with `inheritance: true` merge their settings over these defaults. + +Changes here affect reviews across the whole organisation, so keep them deliberate and minimal. + +## Tech stack + +- CodeRabbit configuration in YAML - V2 schema only. CodeRabbit ignores a central file that declares `version: 3`. +- GitHub Actions, mostly calling reusable workflows from `3ware/workflows`. +- [Trunk](https://trunk.io) Code Quality (CLI 1.25.0) with plugins from `3ware/trunk-code-quality-plugins`. +- release-please (`simple` release type) for versioning and the changelog. +- Renovate, extending `local>3ware/renovate-config`. +- `gh actions-lock` for the actions lockfile. + +## Guidelines + +- Keep `reviews.path_filters` and `reviews.path_instructions` empty. Repositories set them in their own `.coderabbit.yaml`. +- Give every non-obvious setting a one-line comment saying why it is set. +- Don't enable CodeRabbit tools that overlap with Trunk (actionlint, checkov, markdownlint, shellcheck, trufflehog, yamllint, zizmor). +- Check every key against the [configuration reference](https://docs.coderabbit.ai/reference/configuration) before adding it. An invalid central file is ignored for every repository. +- Keep the Configuration table in `.github/README.md` in sync with `.coderabbit.yaml`. +- Follow `.editorconfig`: 2-space indentation, LF line endings and a final newline. +- Use British English spelling. + +## Project structure + +- `.coderabbit.yaml`: the central CodeRabbit configuration. +- `.github/README.md`: usage documentation for repositories consuming this configuration. +- `.github/renovate.json` and `.github/CODEOWNERS`: may need updating when the central configuration changes. +- Workflows, `.trunk/`, release-please files and `.vscode/` (except `mcp.json`) are standard across 3ware repositories. Leave them unchanged. + +## Resources + +- `trunk check` and `trunk fmt` lint and format changed files. +- Comment `@coderabbitai configuration` on a PR in another 3ware repository to see which configuration a review used. +- The `coderabbit-docs` MCP server (configured in `.vscode/mcp.json`) searches the CodeRabbit documentation. Use it to check configuration keys and behaviour. diff --git a/.vscode/cspell.json b/.vscode/cspell.json index 7f000f2..df051bf 100644 --- a/.vscode/cspell.json +++ b/.vscode/cspell.json @@ -6,6 +6,7 @@ "words": [ "chazypro", "coderabbit", + "coderabbitai", "docstrings", "pullrequest", "shellcheck", diff --git a/.vscode/mcp.json b/.vscode/mcp.json new file mode 100644 index 0000000..182b630 --- /dev/null +++ b/.vscode/mcp.json @@ -0,0 +1,8 @@ +{ + "servers": { + "coderabbit-docs": { + "type": "http", + "url": "https://docs.coderabbit.ai/mcp" + } + } +}