Skip to content

Commit e49bad8

Browse files
adding docs on score card reports
1 parent e3c67f5 commit e49bad8

File tree

3 files changed

+95
-0
lines changed

3 files changed

+95
-0
lines changed

docs/guides/custom-reports.md

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,101 @@ Issues and tickets brings in conversations, descriptions, and comments from Jira
295295
- `<issue_description>`: markdown - The description of the issue.
296296
- `<issue_comments>`: array of comment objects - Contains all the comments made on the issue.
297297

298+
#### Remove PRs without a "Score Card/Chart" bot comment
299+
300+
This option gives you the ability to create a report limited only to reports containing a "Score Card" or "Score Chart" bot comment from CodeRabbit or other bots. To enable issues and tickets you must include the tag `<pr_score_card>` in your prompt.
301+
302+
For example you can ask coderabbit to check serveral conditions on a pull request and produce a "Score Chart":
303+
304+
<details>
305+
<summary>Click to view example User Score Card/Chart Comment:</summary>
306+
307+
![Score Card/Chart Trigger Comment Example](/img/guides/score-card-trigger-comment.png)
308+
309+
```markdown
310+
@coderabbitai
311+
Use the <overall_instructions> to guide the content of the summary. Use the format shown in <\_example> but do not include or refer to the example's content in the final summary/report.
312+
313+
<overall_instructions>
314+
315+
**Instructions:**
316+
Generate a weekly code review report for the author of this pull request only following scoring parameters. Calculate the scores and compile the results into a table so that the team-wise average score can be easily determined.
317+
**Scoring Parameters:**
318+
319+
1. **Basic Code Standards (Score out of 2)**
320+
321+
- Avoidance of hard-coded values
322+
- No repetition of code (DRY principle)
323+
324+
2. **Code Readability (Score out of 2)**
325+
326+
- Presence of meaningful comments
327+
- Proper variable declaration using `const` and `let`
328+
329+
3. **Error Handling (Score out of 4)**
330+
331+
- Handling failure scenarios (e.g., try-catch, fallbacks)
332+
- Proper loading state implementation (e.g., button click loading states)
333+
- Handling edge cases (e.g., checking for undefined or missing values)
334+
- Input validation (ensuring correct user inputs)
335+
336+
4. **Circle CI Check Validation (Score: 0 or 1)**
337+
- `0` → Not Passed
338+
- `1` → Passed
339+
340+
**Final Score Calculation:**
341+
Combine the scores from the parameters above to derive the final code quality score (out of 5).
342+
**Output Format:**
343+
Provide the final report in a table format with the following columns (use shorthand notations), be sure to include this list at the top above the chart in the "Column Notation" section so users understand what the columns mean:
344+
345+
- **User Name (User)**
346+
- **Basic Code Standards (BCS) (out of 2)**
347+
- **Code Readability (CR) (out of 2)**
348+
- **Error Handling (EH) (out of 4)**
349+
- **Shopify Theme Check (CI) (out of 1)**
350+
- **Final Code Quality Score (FCQS) (out of 9)**
351+
352+
</overall_instructions>
353+
354+
<\_example>
355+
356+
## Column Notation
357+
358+
- **User Name (User)**
359+
- **Basic Code Standards (BCS) (out of 2)**
360+
- **Code Readability (CR) (out of 2)**
361+
- **Error Handling (EH) (out of 4)**
362+
- **Shopify Theme Check (CI) (out of 1)**
363+
- **Final Code Quality Score (FCQS) (out of 9)**
364+
365+
## Score Chart
366+
367+
| User | BCS (2) | CR (3) | EH (2) | CI (1) | FCQS (9) |
368+
| -------- | ------- | ------ | ------ | ------ | -------- |
369+
| John Doe | 2 | 3 | 2 | 1 | 9 |
370+
371+
</\_example>
372+
```
373+
374+
</details>
375+
376+
Then CodeRabbit will reply with a score for you pull request:
377+
378+
<details>
379+
<summary>Click to view resulting Score Card/Chart bot comment:</summary>
380+
381+
![CodeRabbit Score Card/Chart Result Comment Example](/img/guides/score-card-result-comment.png)
382+
383+
</details>
384+
385+
**Best Practices for Score Cards/Charts:**
386+
387+
- The reporting bot only has access to your comments and summary (like a project manager) if you want to make a report looking for these score card/chart comments make sure the reviewer does this ahead of time.
388+
- Only include checks for very specific scenarios, such as a specific check failing or using tabs vs spaces.
389+
- Do not use general rules without explaining specifically what they mean. If you add "Insure the pull request follows development best practices" you must define what "development best practices" actually mean or the AI will guess.
390+
- Make one point for each specific check and make sure its a True/False condition.
391+
- Instead of manually commenting on pull requests you can use the [Github Actions Bot](https://github.com/marketplace/actions/github-project-bot) to automatically comment on pull requests and trigger coderabbit score card/chart comments by including `@coderabbit` in the comment.
392+
298393
## Best Practices
299394

300395
1. **Be Specific**
95.3 KB
Loading
86.2 KB
Loading

0 commit comments

Comments
 (0)