Skip to content

Commit 7dd57da

Browse files
add reporting guide (#187)
* add reporting guide * 🎨 pnpm run lint:fix [dependabot skip] * adding images and updates * add page on advanced custom reporting * correct details * last few edits * pnpm run lint:fix * adding group details * adding notes and fix position * add docstrings command to commands * add notes on different languages * add note on languages * fix lint * fix fenced off code --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 232d206 commit 7dd57da

File tree

6 files changed

+611
-1
lines changed

6 files changed

+611
-1
lines changed

docs/guides/commands.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@ The following commands are available (invoked as PR comments):
2121
- `@coderabbitai configuration` to show the current CodeRabbit configuration for
2222
the repository.
2323
- `@coderabbitai help` to get help.
24+
- `@coderabbitai generate docstrings` to generate docstrings for functions in the PR. Learn more about [docstrings generation](/finishing-touches/docstrings).

docs/guides/custom-reports.md

Lines changed: 362 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,362 @@
1+
---
2+
title: Custom Reports
3+
sidebar_label: Custom Reports
4+
description: Learn how to create custom reports with CodeRabbit Pro's flexible reporting system
5+
sidebar_position: 7
6+
---
7+
8+
```mdx-code-block
9+
import ProPlanNotice from '@site/src/components/ProPlanNotice.mdx';
10+
11+
<ProPlanNotice />
12+
```
13+
14+
CodeRabbit Pro allows you to create custom reports tailored to your specific needs using a flexible prompt-based system. This guide will help you understand how to create effective custom reports.
15+
16+
## Understanding Custom Reports
17+
18+
Custom reports allow you to:
19+
20+
- Define exactly what information you want to see
21+
- Specify the format and structure of the report
22+
- Set custom filtering and grouping rules
23+
- Generate reports in different languages
24+
25+
## Creating Custom Report Templates
26+
27+
### Basic Structure
28+
29+
A custom report template consists of instructions that tell CodeRabbit what information to include and how to present it. Here's a basic example:
30+
31+
```text
32+
Please provide a summary of:
33+
- All merged pull requests
34+
- Critical bug fixes
35+
- Code review discussions
36+
37+
Group by:
38+
- Repository
39+
- Team
40+
41+
Format using:
42+
- Bullet points for changes
43+
- Tables for statistics
44+
```
45+
46+
### Example for different languages
47+
48+
Japanese:
49+
50+
```text
51+
レポートを英語ではなく日本語で送信してください。
52+
53+
以下の要約を提供してください:
54+
- すべてのプルリクエスト活動
55+
- コードレビューの議論
56+
```
57+
58+
French:
59+
60+
```text
61+
Veuillez envoyer le rapport en français et non en anglais.
62+
63+
Veuillez fournir un résumé de :
64+
- Toutes les activités de demandes de fusion
65+
- Discussions sur la révision de code
66+
```
67+
68+
### Available Data Points
69+
70+
Your custom reports can access the following PR information that you can reference in your prompts:
71+
72+
#### Pull Request Status
73+
74+
- `Merged`: boolean (true/false) - Whether the PR has been merged
75+
- `Draft`: boolean (true/false) - Whether the PR is in draft state
76+
- `State`: string ("open"/"closed") - Current state of the PR
77+
- `Mergeable`: boolean (true/false) - Whether the PR can be merged
78+
- `Is stale`: boolean - Whether PR has been inactive for over 168 hours
79+
80+
#### Basic Information
81+
82+
- `Pull request number`: number - The PR's identifier
83+
- `Title`: string - PR title
84+
- `URL`: string - Link to the PR
85+
- `Author name`: string - PR creator's username
86+
- `Created at`: datetime - When the PR was created
87+
- `Last activity`: datetime - Most recent activity timestamp
88+
- `Closed at`: datetime (if applicable) - When the PR was closed
89+
90+
#### Additional Context
91+
92+
- `Labels`: array of strings - All labels applied to the PR
93+
- `Reviewers`: array of strings - Assigned reviewers' usernames
94+
- `Description`: markdown - Full PR description
95+
- `Summary`: string - AI-generated summary of changes
96+
- `Comments`: array of objects
97+
- `username`: string - Comment author
98+
- `body`: markdown - Comment content
99+
100+
Here's an example prompt that uses these data points:
101+
102+
```text
103+
Generate a summary with the following format for each PR:
104+
105+
## [PR Title](URL)
106+
**Status**: {Use these symbols based on state}
107+
- 🔀 if Merged is true
108+
- 📝 if Draft is true
109+
- 💬 if State is "open"
110+
- 🔒 if State is "closed" and not merged
111+
Add ⚠️ if Is stale is true
112+
113+
**Author**: {Author name}
114+
**Created**: {Created at}
115+
**Labels**: {Labels joined by commas}
116+
**Reviewers**: {Reviewers joined by commas}
117+
118+
### Summary
119+
{Summary limited to 50 words}
120+
121+
### Recent Activity
122+
{List last 3 comments with username and content}
123+
```
124+
125+
### Formatting Options
126+
127+
CodeRabbit supports markdown formatting in custom reports. You can use:
128+
129+
- Headers (`#`, `##`, `###`)
130+
- Lists (bullet points and numbered)
131+
- Tables
132+
- Code blocks
133+
- Bold and italic text
134+
- Links
135+
136+
### Language Support
137+
138+
You can generate reports in multiple languages by specifying the ISO language code in your template. For example:
139+
140+
```text
141+
Language: fr
142+
Please provide a summary of:
143+
- All pull request activities
144+
- Code review discussions
145+
```
146+
147+
## Advanced Features
148+
149+
### Filtering
150+
151+
Include specific filtering instructions in your template:
152+
153+
```text
154+
Include only:
155+
- PRs with "critical" or "bug" labels
156+
- Changes to production code
157+
- Reviews from senior developers
158+
159+
Exclude:
160+
- Automated commits
161+
- Documentation changes
162+
- Dependencies updates
163+
```
164+
165+
### Custom Grouping
166+
167+
Organize information using custom grouping rules:
168+
169+
```text
170+
Group by:
171+
1. Priority (High/Medium/Low)
172+
2. Component (Frontend/Backend/Infrastructure)
173+
3. Team (Team A/Team B)
174+
175+
Within each group, sort by:
176+
- Activity date (newest first)
177+
- Impact level
178+
```
179+
180+
### Time-Based Analysis
181+
182+
Add temporal analysis to your reports:
183+
184+
```text
185+
Provide:
186+
- Week-over-week comparison
187+
- Trend analysis for the past month
188+
- Velocity metrics
189+
- Time to merge statistics
190+
```
191+
192+
## Best Practices
193+
194+
1. **Be Specific**
195+
196+
- Clearly define what should be included/excluded
197+
- Use precise language to avoid ambiguity
198+
- Specify exact metrics you want to track
199+
200+
2. **Structure Matters**
201+
202+
- Start with high-level summaries
203+
- Use consistent grouping patterns
204+
- Include clear section breaks
205+
206+
3. **Keep it Relevant**
207+
208+
- Focus on actionable information
209+
- Avoid redundant data points
210+
- Consider your audience's needs
211+
212+
4. **Optimize Readability**
213+
- Use appropriate formatting
214+
- Include visual breaks
215+
- Maintain consistent styling
216+
217+
## Example Templates
218+
219+
### Executive Summary Template
220+
221+
```text
222+
Provide a high-level overview:
223+
1. Key metrics:
224+
- Total PRs merged
225+
- Average review time
226+
- Code quality scores
227+
2. Notable achievements
228+
3. Blocking issues
229+
4. Resource allocation
230+
231+
Format:
232+
- Use tables for metrics
233+
- Bullet points for achievements
234+
- Clear headers for sections
235+
```
236+
237+
### Technical Deep Dive Template
238+
239+
```text
240+
Generate a detailed technical report:
241+
1. Code changes:
242+
- Architecture updates
243+
- API modifications
244+
- Database changes
245+
2. Testing coverage
246+
3. Performance impacts
247+
4. Security considerations
248+
249+
Include:
250+
- Links to significant PRs
251+
- Code snippets for major changes
252+
- Technical debt analysis
253+
```
254+
255+
### Advanced Formatting
256+
257+
Heres a more advanced example of a custom report template:
258+
259+
```text
260+
Generate a report of all pull requests in the following format:
261+
262+
- As the first paragraph, start with "🟣" if merged, "⚫" if draft, "🟢" if open, "🔴" if closed
263+
- On the same line, add the PR title in bold (and only the title; don't put anything else in bold after that)
264+
- On the same line, add the PR browser link (do not use an api link)
265+
- On the same line, add the last activity date in the format "Day Month Year, Hour:Minute AM/PM (Timezone)" in italic (don't put anything else in italic after that and make sure it's not bold)
266+
- Make a new bullet-point list of high-level changes in the PR
267+
- Start each change with a gitmoji followed by a very terse one-liner to mention at a high level what the change does and to what part of the application it applies to
268+
- Do not start with verbose non-speak such as "The pull request enhances" or "This PR introduces". Keep it terse and straight to the point. Start change descriptions with a verb
269+
- Do not end with justifications or reasons for the changes such as "... enhancing type safety". Stick to the facts, do not make up the outcome of a change
270+
- Limit to the 4 most relevant changes
271+
- Examples: "✨ Add a rotating tagline on the home page", "🔧 Add func-style to ESLint", "📝 Add download badge to `README.md`", "✅ Add unit tests for comment trees", "👷 Create a pipeline to publish to npmjs.org", "🐛 Fix comment submission in posts", "📄 License under AGPL-3.0-or-later", "📱 Change post view for mobile", "💄 Make sidebar links blue", "🩹 Fix unfollow button", "🔒️ Limit login cookies to a specific subdomain", "🥅 Handle errors when commenting in a post", "🙈 Stop ignoring `.env` and start ignoring `.env.local` and `.env.*.local`", "⬆️ Update lemmy-js-client to v0.19.4", "🏷️ Define interfaces for pull request events", "🔐 Add environment variables for Bitbucket Server", "🚚 Rename exported client instances in test files", "🏷️ Add type alias `EventKey` and its type guard `isEventKey`", "🏗️ Aggregate exports for pull request events in an index file"
272+
- Start the next paragraph with "Blockers:" in bold
273+
- Summarize any issues preventing the PR from progressing
274+
- Some examples: "Waiting for merge", "Waiting for review", "Failing CI/CD", "Needs more tests", "Needs rebase", "@username is waiting for a response", etc.
275+
- If the PR is stale, note it here
276+
- Do not add a "Report" heading
277+
- Make sure there is one empty line between each paragraph
278+
279+
These are the available emojis and the type of change they represent. Do not using any other emoji. Make sure the change corresponds to the gitmoji.
280+
281+
<gitmojis>
282+
🎨: Improve structure / format of the code.
283+
⚡️: Improve performance.
284+
🔥: Remove code or files.
285+
🐛: Fix a bug.
286+
🚑️: Critical hotfix.
287+
✨: Introduce new features.
288+
📝: Add or update documentation.
289+
🚀: Deploy stuff.
290+
💄: Add or update the UI and style files.
291+
🎉: Begin a project.
292+
✅: Add, update, or pass tests.
293+
🔒️: Fix security or privacy issues.
294+
🔐: Add or update secrets.
295+
🔖: Release / Version tags.
296+
🚨: Fix compiler / linter warnings.
297+
🚧: Work in progress.
298+
💚: Fix CI Build.
299+
⬇️: Downgrade dependencies.
300+
⬆️: Upgrade dependencies.
301+
📌: Pin dependencies to specific versions.
302+
👷: Add or update CI build system.
303+
📈: Add or update analytics or track code.
304+
♻️: Refactor code.
305+
➕: Add a dependency.
306+
➖: Remove a dependency.
307+
🔧: Add or update configuration files.
308+
🔨: Add or update development scripts.
309+
🌐: Internationalization and localization.
310+
✏️: Fix typos.
311+
💩: Write bad code that needs to be improved.
312+
⏪️: Revert changes.
313+
🔀: Merge branches.
314+
📦️: Add or update compiled files or packages.
315+
👽️: Update code due to external API changes.
316+
🚚: Move or rename resources (e.g.: files, paths, routes).
317+
📄: Add or update license.
318+
💥: Introduce breaking changes.
319+
🍱: Add or update assets.
320+
♿️: Improve accessibility.
321+
💡: Add or update comments in source code.
322+
🍻: Write code drunkenly.
323+
💬: Add or update text and literals.
324+
🗃️: Perform database related changes.
325+
🔊: Add or update logs.
326+
🔇: Remove logs.
327+
👥: Add or update contributor(s).
328+
🚸: Improve user experience / usability.
329+
🏗️: Make architectural changes.
330+
📱: Work on responsive design.
331+
🤡: Mock things.
332+
🥚: Add or update an easter egg.
333+
🙈: Add or update a .gitignore file.
334+
📸: Add or update snapshots.
335+
⚗️: Perform experiments.
336+
🔍️: Improve SEO.
337+
🏷️: Add or update types.
338+
🌱: Add or update seed files.
339+
🚩: Add, update, or remove feature flags.
340+
🥅: Catch errors.
341+
💫: Add or update animations and transitions.
342+
🗑️: Deprecate code that needs to be cleaned up.
343+
🛂: Work on code related to authorization, roles and permissions.
344+
🩹: Simple fix for a non-critical issue.
345+
🧐: Data exploration/inspection.
346+
⚰️: Remove dead code.
347+
🧪: Add a failing test.
348+
👔: Add or update business logic.
349+
🩺: Add or update healthcheck.
350+
🧱: Infrastructure related changes.
351+
🧑‍💻: Improve developer experience.
352+
💸: Add sponsorships or money related infrastructure.
353+
🧵: Add or update code related to multithreading or concurrency.
354+
🦺: Add or update code related to validation.
355+
</gitmojis>
356+
```
357+
358+
## Related Resources
359+
360+
- [Scheduled Reports](./scheduled-reports.md)
361+
- [On-demand Reports](./ondemand-reports.md)
362+
- [API Documentation](https://api.coderabbit.ai/api/swagger/)

docs/guides/ondemand-reports.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: On-demand Reports
33
sidebar_label: On-demand Reports
44
description: CodeRabbit offers a way to generate on-demand reports using a simple API request
5-
sidebar_position: 6
5+
sidebar_position: 8
66
---
77

88
```mdx-code-block
@@ -12,6 +12,18 @@ import ProPlanNotice from '@site/src/components/ProPlanNotice.mdx';
1212
<ProPlanNotice />
1313
```
1414

15+
## Overview
16+
17+
CodeRabbit's reporting feature helps you track and analyze pull request activity across your repositories. There are two ways to generate reports:
18+
19+
1. **[Scheduled Reports](./scheduled-reports.md)** - Set up automated recurring reports that are delivered on a schedule to your preferred channels (email, Slack, MS Teams). This is the recommended way to keep your team informed about development progress.
20+
21+
2. **On-demand Reports** (this guide) - Generate reports programmatically through our API when you need them. This is useful for integration with your own tools and workflows.
22+
23+
If you're new to CodeRabbit's reporting features, we recommend starting with [Scheduled Reports](./scheduled-reports.md) to understand the available options and capabilities.
24+
25+
## API Access
26+
1527
CodeRabbit offers a way to generate on-demand reports using the [CodeRabbit API](https://api.coderabbit.ai/api/swagger/).
1628
You will need an API Key to access the CodeRabbit API and generate an on-demand report.
1729

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy