Datasets:
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,159 +1,140 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: mit
|
| 3 |
-
task_categories:
|
| 4 |
-
- text-generation
|
| 5 |
-
language:
|
| 6 |
-
- en
|
| 7 |
-
- code
|
| 8 |
-
tags:
|
| 9 |
-
- code-review
|
| 10 |
-
- code-generation
|
| 11 |
-
- software-engineering
|
| 12 |
-
- pull-requests
|
| 13 |
-
- github
|
| 14 |
-
size_categories:
|
| 15 |
-
- 100K<n<1M
|
| 16 |
-
---
|
| 17 |
-
|
| 18 |
-
# Code Review
|
| 19 |
-
|
| 20 |
-
A large-scale dataset of
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
This provides a natural signal for training models to:
|
| 27 |
-
|
| 28 |
-
- **Generate code review comments** given a code diff
|
| 29 |
-
- **Apply review feedback** by modifying code based on reviewer suggestions
|
| 30 |
-
- **Understand code quality patterns** across languages and projects
|
| 31 |
-
- **Know when not to comment** — recognizing clean code that needs no changes
|
| 32 |
-
|
| 33 |
-
### Key Features
|
| 34 |
-
|
| 35 |
-
- **167K+ positive triplets** from 725 top GitHub repositories
|
| 36 |
-
- **51K+ negative examples** (~23% of dataset) of clean code labeled "No issues found."
|
| 37 |
-
- **37 programming languages** (Python, TypeScript, Go, Rust, C++, JavaScript, C#, Java, Kotlin, Swift, and more)
|
| 38 |
-
- **Human-only reviews**: AI/bot reviewers (Copilot, linter bots, etc.) are excluded
|
| 39 |
-
- **Quality-filtered**: noise
|
| 40 |
-
- **Chunk-focused**: ~50 lines of context around the reviewed code, not entire files
|
| 41 |
-
- **Permissive licenses only**: all source repos use MIT, Apache-2.0, BSD, or similar licenses
|
| 42 |
-
- **Verified changes**: only includes triplets where the code chunk actually changed after the review
|
| 43 |
-
|
| 44 |
-
##
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
|
| 56 |
-
|
|
| 57 |
-
|
|
| 58 |
-
|
|
| 59 |
-
|
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
|
| 66 |
-
|
|
| 67 |
-
| `
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
``
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
``
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
``
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
- Review comments may address style/formatting rather than substantive logic changes
|
| 142 |
-
- The "after" code may include changes unrelated to the specific review comment
|
| 143 |
-
- Line number alignment may be imprecise when multiple commits occur between review and merge
|
| 144 |
-
- Some `original_commit_id` SHAs may be unavailable due to force-pushes; in these cases, the PR merge base is used as the "before" state
|
| 145 |
-
- Negative examples assume that uncommented code was acceptable, though reviewers may have simply not reviewed certain files
|
| 146 |
-
|
| 147 |
-
## Citation
|
| 148 |
-
|
| 149 |
-
If you use this dataset, please cite:
|
| 150 |
-
|
| 151 |
-
```bibtex
|
| 152 |
-
@dataset{takizawa2026codereviewdiffs,
|
| 153 |
-
title={Code Review Diffs: A Large-Scale Dataset of Review-Driven Code Changes},
|
| 154 |
-
author={Takizawa, Ronan},
|
| 155 |
-
year={2026},
|
| 156 |
-
publisher={Hugging Face},
|
| 157 |
-
url={https://huggingface.co/datasets/ronantakizawa/github-codereview}
|
| 158 |
-
}
|
| 159 |
-
```
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
task_categories:
|
| 4 |
+
- text-generation
|
| 5 |
+
language:
|
| 6 |
+
- en
|
| 7 |
+
- code
|
| 8 |
+
tags:
|
| 9 |
+
- code-review
|
| 10 |
+
- code-generation
|
| 11 |
+
- software-engineering
|
| 12 |
+
- pull-requests
|
| 13 |
+
- github
|
| 14 |
+
size_categories:
|
| 15 |
+
- 100K<n<1M
|
| 16 |
+
---
|
| 17 |
+
|
| 18 |
+
# Code Review Dataset
|
| 19 |
+
|
| 20 |
+
A large-scale dataset of the best code reviews from top GitHub repositories.
|
| 21 |
+
|
| 22 |
+
Each row captures a moment where a human code reviewer left an inline comment on a pull request, and the author subsequently modified the code in response.
|
| 23 |
+
|
| 24 |
+
The dataset also includes **negative examples** — code from the same PRs that passed review without comments — to help models learn when code is acceptable.
|
| 25 |
+
|
| 26 |
+
This provides a natural signal for training models to:
|
| 27 |
+
|
| 28 |
+
- **Generate code review comments** given a code diff
|
| 29 |
+
- **Apply review feedback** by modifying code based on reviewer suggestions
|
| 30 |
+
- **Understand code quality patterns** across languages and projects
|
| 31 |
+
- **Know when not to comment** — recognizing clean code that needs no changes
|
| 32 |
+
|
| 33 |
+
### Key Features
|
| 34 |
+
|
| 35 |
+
- **167K+ positive triplets** from 725 top GitHub repositories
|
| 36 |
+
- **51K+ negative examples** (~23% of dataset) of clean code labeled "No issues found."
|
| 37 |
+
- **37 programming languages** (Python, TypeScript, Go, Rust, C++, JavaScript, C#, Java, Kotlin, Swift, and more)
|
| 38 |
+
- **Human-only reviews**: AI/bot reviewers (Copilot, linter bots, etc.) are excluded
|
| 39 |
+
- **Quality-filtered**: noise and auto-generated content removed
|
| 40 |
+
- **Chunk-focused**: ~50 lines of context around the reviewed code, not entire files
|
| 41 |
+
- **Permissive licenses only**: all source repos use MIT, Apache-2.0, BSD, or similar licenses
|
| 42 |
+
- **Verified changes**: only includes triplets where the code chunk actually changed after the review
|
| 43 |
+
|
| 44 |
+
## Collection Methodology
|
| 45 |
+
|
| 46 |
+
1. **Repo selection**: Top GitHub repos by stars with permissive licenses, sourced from [ronantakizawa/github-top-projects](https://huggingface.co/datasets/ronantakizawa/github-top-projects) and curated additions
|
| 47 |
+
2. **PR discovery**: Paginate merged PRs, filter bot authors, fetch inline review comments
|
| 48 |
+
3. **Comment filtering**: Remove bots, noise patterns, auto-generated comments, non-English text, non-code files, reply comments
|
| 49 |
+
4. **Triplet extraction**: Fetch file contents at the review commit (before) and PR head (after), extract focused chunks around the comment line
|
| 50 |
+
5. **Change verification**: Only keep triplets where the code chunk around the comment actually changed
|
| 51 |
+
6. **Negative extraction**: For each reviewed PR, identify source code files that were changed but received no review comments; extract a ~50-line chunk as a negative example labeled "No issues found."
|
| 52 |
+
|
| 53 |
+
## Splits
|
| 54 |
+
|
| 55 |
+
| Split | Percentage | Description |
|
| 56 |
+
|-------|-----------|-------------|
|
| 57 |
+
| train | 90% | Training data |
|
| 58 |
+
| test | 5% | Test data |
|
| 59 |
+
| validation | 5% | Validation data |
|
| 60 |
+
|
| 61 |
+
Splits are deterministic by repository — all examples from the same repo appear in the same split.
|
| 62 |
+
|
| 63 |
+
## Schema
|
| 64 |
+
|
| 65 |
+
| Column | Type | Description |
|
| 66 |
+
|--------|------|-------------|
|
| 67 |
+
| `pr_title` | string | Pull request title |
|
| 68 |
+
| `pr_number` | int | PR number |
|
| 69 |
+
| `repo_name` | string | Full repo name (owner/repo) |
|
| 70 |
+
| `repo_stars` | int | GitHub stars |
|
| 71 |
+
| `repo_language` | string | Primary repo language |
|
| 72 |
+
| `author_username` | string | PR author's GitHub username |
|
| 73 |
+
| `reviewer_username` | string | Reviewer's GitHub username |
|
| 74 |
+
| `before_code` | string | ~50 lines of code around the comment, before the fix |
|
| 75 |
+
| `reviewer_comment` | string | The inline review comment text (or "No issues found." for negatives) |
|
| 76 |
+
| `after_code` | string | ~50 lines of code around the comment, after the fix |
|
| 77 |
+
| `diff_context` | string | The PR diff hunk where the comment was placed |
|
| 78 |
+
| `file_path` | string | File path within the repo |
|
| 79 |
+
| `comment_line` | int | Line number within the code chunk (0 for negatives) |
|
| 80 |
+
| `language` | string | Programming language |
|
| 81 |
+
| `quality_score` | float | Comment quality score (0.0-1.0; 1.0 for negatives) |
|
| 82 |
+
| `comment_type` | string | Category: suggestion, question, nitpick, bug, refactor, style, security, performance, none |
|
| 83 |
+
| `comment_length` | int | Character count of reviewer comment |
|
| 84 |
+
| `before_lines` | int | Line count of before code |
|
| 85 |
+
| `after_lines` | int | Line count of after code |
|
| 86 |
+
| `is_negative` | bool | True if this is a negative example (no reviewer comment) |
|
| 87 |
+
|
| 88 |
+
## Usage
|
| 89 |
+
|
| 90 |
+
```python
|
| 91 |
+
from datasets import load_dataset
|
| 92 |
+
|
| 93 |
+
ds = load_dataset("ronantakizawa/github-codereview")
|
| 94 |
+
|
| 95 |
+
# Get a training example
|
| 96 |
+
example = ds["train"][0]
|
| 97 |
+
print(f"Review comment: {example['reviewer_comment']}")
|
| 98 |
+
print(f"Language: {example['language']}")
|
| 99 |
+
print(f"Before:\n{example['before_code'][:200]}")
|
| 100 |
+
print(f"After:\n{example['after_code'][:200]}")
|
| 101 |
+
```
|
| 102 |
+
|
| 103 |
+
### Filter by language
|
| 104 |
+
|
| 105 |
+
```python
|
| 106 |
+
python_reviews = ds["train"].filter(lambda x: x["language"] == "Python")
|
| 107 |
+
```
|
| 108 |
+
|
| 109 |
+
### Filter by quality
|
| 110 |
+
|
| 111 |
+
```python
|
| 112 |
+
high_quality = ds["train"].filter(lambda x: x["quality_score"] >= 0.5)
|
| 113 |
+
```
|
| 114 |
+
|
| 115 |
+
### Positive examples only
|
| 116 |
+
|
| 117 |
+
```python
|
| 118 |
+
positives = ds["train"].filter(lambda x: not x["is_negative"])
|
| 119 |
+
```
|
| 120 |
+
|
| 121 |
+
### Negative examples only
|
| 122 |
+
|
| 123 |
+
```python
|
| 124 |
+
negatives = ds["train"].filter(lambda x: x["is_negative"])
|
| 125 |
+
```
|
| 126 |
+
|
| 127 |
+
|
| 128 |
+
## Citation
|
| 129 |
+
|
| 130 |
+
If you use this dataset, please cite:
|
| 131 |
+
|
| 132 |
+
```bibtex
|
| 133 |
+
@dataset{takizawa2026codereviewdiffs,
|
| 134 |
+
title={Code Review Diffs: A Large-Scale Dataset of Review-Driven Code Changes},
|
| 135 |
+
author={Takizawa, Ronan},
|
| 136 |
+
year={2026},
|
| 137 |
+
publisher={Hugging Face},
|
| 138 |
+
url={https://huggingface.co/datasets/ronantakizawa/github-codereview}
|
| 139 |
+
}
|
| 140 |
+
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|