ronantakizawa commited on
Commit
db75421
·
verified ·
1 Parent(s): f7420a8

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +140 -159
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 Diffs
19
-
20
- A large-scale dataset of **(before_code, reviewer_comment, after_code)** triplets extracted from merged pull requests on top GitHub repositories, including negative examples of clean code that received no reviewer comments.
21
-
22
- ## Dataset Description
23
-
24
- 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. 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 ("LGTM", "+1"), 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
- ## Schema
45
-
46
- | Column | Type | Description |
47
- |--------|------|-------------|
48
- | `pr_title` | string | Pull request title |
49
- | `pr_number` | int | PR number |
50
- | `repo_name` | string | Full repo name (owner/repo) |
51
- | `repo_stars` | int | GitHub stars |
52
- | `repo_language` | string | Primary repo language |
53
- | `author_username` | string | PR author's GitHub username |
54
- | `reviewer_username` | string | Reviewer's GitHub username |
55
- | `before_code` | string | ~50 lines of code around the comment, before the fix |
56
- | `reviewer_comment` | string | The inline review comment text (or "No issues found." for negatives) |
57
- | `after_code` | string | ~50 lines of code around the comment, after the fix |
58
- | `diff_context` | string | The PR diff hunk where the comment was placed |
59
- | `file_path` | string | File path within the repo |
60
- | `comment_line` | int | Line number within the code chunk (0 for negatives) |
61
- | `language` | string | Programming language |
62
- | `quality_score` | float | Comment quality score (0.0-1.0; 1.0 for negatives) |
63
- | `comment_type` | string | Category: suggestion, question, nitpick, bug, refactor, style, security, performance, none |
64
- | `comment_length` | int | Character count of reviewer comment |
65
- | `before_lines` | int | Line count of before code |
66
- | `after_lines` | int | Line count of after code |
67
- | `is_negative` | bool | True if this is a negative example (no reviewer comment) |
68
-
69
- ## Usage
70
-
71
- ```python
72
- from datasets import load_dataset
73
-
74
- ds = load_dataset("ronantakizawa/github-codereview")
75
-
76
- # Get a training example
77
- example = ds["train"][0]
78
- print(f"Review comment: {example['reviewer_comment']}")
79
- print(f"Language: {example['language']}")
80
- print(f"Before:\n{example['before_code'][:200]}")
81
- print(f"After:\n{example['after_code'][:200]}")
82
- ```
83
-
84
- ### Filter by language
85
-
86
- ```python
87
- python_reviews = ds["train"].filter(lambda x: x["language"] == "Python")
88
- ```
89
-
90
- ### Filter by quality
91
-
92
- ```python
93
- high_quality = ds["train"].filter(lambda x: x["quality_score"] >= 0.5)
94
- ```
95
-
96
- ### Positive examples only
97
-
98
- ```python
99
- positives = ds["train"].filter(lambda x: not x["is_negative"])
100
- ```
101
-
102
- ### Negative examples only
103
-
104
- ```python
105
- negatives = ds["train"].filter(lambda x: x["is_negative"])
106
- ```
107
-
108
- ## Collection Methodology
109
-
110
- 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
111
- 2. **PR discovery**: Paginate merged PRs, filter bot authors, fetch inline review comments
112
- 3. **Comment filtering**: Remove bots, noise patterns, auto-generated comments, non-English text, non-code files, reply comments
113
- 4. **Triplet extraction**: Fetch file contents at the review commit (before) and PR head (after), extract focused chunks around the comment line
114
- 5. **Change verification**: Only keep triplets where the code chunk around the comment actually changed
115
- 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."
116
-
117
- ### Quality Filters Applied
118
-
119
- - Bot and AI reviewers excluded (dependabot, Copilot, golangcibot, houndci-bot, etc.)
120
- - Comments < 30 characters excluded
121
- - Noise patterns excluded (LGTM, +1, emoji-only, etc.)
122
- - Auto-generated comments excluded (coverage reports, CI output)
123
- - Non-English comments excluded (ASCII ratio < 70%)
124
- - Non-source-code files excluded
125
- - Reply comments excluded (only top-level review comments)
126
- - Files > 512 KB excluded
127
- - PRs with < 10 or > 500 changed lines excluded
128
-
129
- ## Splits
130
-
131
- | Split | Percentage | Description |
132
- |-------|-----------|-------------|
133
- | train | 90% | Training data |
134
- | test | 5% | Test data |
135
- | validation | 5% | Validation data |
136
-
137
- Splits are deterministic by repository — all examples from the same repo appear in the same split.
138
-
139
- ## Limitations
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
+ ```