ronantakizawa commited on
Commit
e900522
·
verified ·
1 Parent(s): 2d94599

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +27 -8
README.md CHANGED
@@ -17,19 +17,23 @@ size_categories:
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.
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. This provides a natural signal for training models to:
 
 
25
 
26
  - **Generate code review comments** given a code diff
27
  - **Apply review feedback** by modifying code based on reviewer suggestions
28
  - **Understand code quality patterns** across languages and projects
 
29
 
30
  ### Key Features
31
 
32
- - **118K+ triplets** from 562 top GitHub repositories
 
33
  - **20+ programming languages** (Python, TypeScript, Go, C++, Rust, JavaScript, C#, Java, Kotlin, Swift, and more)
34
  - **Quality-filtered**: bot comments, noise ("LGTM", "+1"), and auto-generated content removed
35
  - **Chunk-focused**: ~50 lines of context around the reviewed code, not entire files
@@ -41,17 +45,18 @@ Each row captures a moment where a human code reviewer left an inline comment on
41
  | Column | Type | Description |
42
  |--------|------|-------------|
43
  | `before_code` | string | ~50 lines of code around the comment, before the fix |
44
- | `reviewer_comment` | string | The inline review comment text |
45
  | `after_code` | string | ~50 lines of code around the comment, after the fix |
46
  | `diff_context` | string | The PR diff hunk where the comment was placed |
47
  | `file_path` | string | File path within the repo |
48
- | `comment_line` | int | Line number where the comment was placed |
49
  | `language` | string | Programming language |
50
- | `quality_score` | float | Comment quality score (0.0-1.0) |
51
- | `comment_type` | string | Category: suggestion, question, nitpick, bug, refactor, style, security, performance |
52
  | `comment_length` | int | Character count of reviewer comment |
53
  | `before_lines` | int | Line count of before code |
54
  | `after_lines` | int | Line count of after code |
 
55
  | `pr_title` | string | Pull request title |
56
  | `pr_number` | int | PR number |
57
  | `repo_name` | string | Full repo name (owner/repo) |
@@ -87,6 +92,18 @@ python_reviews = ds["train"].filter(lambda x: x["language"] == "Python")
87
  high_quality = ds["train"].filter(lambda x: x["quality_score"] >= 0.5)
88
  ```
89
 
 
 
 
 
 
 
 
 
 
 
 
 
90
  ## Collection Methodology
91
 
92
  1. **Repo selection**: Top 10,000 GitHub repos by stars with permissive licenses from [ronantakizawa/github-top-projects](https://huggingface.co/datasets/ronantakizawa/github-top-projects)
@@ -94,6 +111,7 @@ high_quality = ds["train"].filter(lambda x: x["quality_score"] >= 0.5)
94
  3. **Comment filtering**: Remove bots, noise patterns, auto-generated comments, non-English text, non-code files, reply comments
95
  4. **Triplet extraction**: Fetch file contents at the review commit (before) and PR head (after), extract focused chunks around the comment line
96
  5. **Change verification**: Only keep triplets where the code chunk around the comment actually changed
 
97
 
98
  ### Quality Filters Applied
99
 
@@ -115,7 +133,7 @@ high_quality = ds["train"].filter(lambda x: x["quality_score"] >= 0.5)
115
  | test | 5% | Test data |
116
  | validation | 5% | Validation data |
117
 
118
- Splits are deterministic by repository — all triplets from the same repo appear in the same split.
119
 
120
  ## Limitations
121
 
@@ -123,6 +141,7 @@ Splits are deterministic by repository — all triplets from the same repo appea
123
  - The "after" code may include changes unrelated to the specific review comment
124
  - Line number alignment may be imprecise when multiple commits occur between review and merge
125
  - 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
 
126
 
127
  ## Citation
128
 
 
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
+ - **118K+ positive triplets** from 562 top GitHub repositories
36
+ - **Negative examples** (~30% ratio) of clean code labeled "No issues found."
37
  - **20+ programming languages** (Python, TypeScript, Go, C++, Rust, JavaScript, C#, Java, Kotlin, Swift, and more)
38
  - **Quality-filtered**: bot comments, noise ("LGTM", "+1"), and auto-generated content removed
39
  - **Chunk-focused**: ~50 lines of context around the reviewed code, not entire files
 
45
  | Column | Type | Description |
46
  |--------|------|-------------|
47
  | `before_code` | string | ~50 lines of code around the comment, before the fix |
48
+ | `reviewer_comment` | string | The inline review comment text (or "No issues found." for negatives) |
49
  | `after_code` | string | ~50 lines of code around the comment, after the fix |
50
  | `diff_context` | string | The PR diff hunk where the comment was placed |
51
  | `file_path` | string | File path within the repo |
52
+ | `comment_line` | int | Line number where the comment was placed (0 for negatives) |
53
  | `language` | string | Programming language |
54
+ | `quality_score` | float | Comment quality score (0.0-1.0; 1.0 for negatives) |
55
+ | `comment_type` | string | Category: suggestion, question, nitpick, bug, refactor, style, security, performance, none |
56
  | `comment_length` | int | Character count of reviewer comment |
57
  | `before_lines` | int | Line count of before code |
58
  | `after_lines` | int | Line count of after code |
59
+ | `is_negative` | bool | True if this is a negative example (no reviewer comment) |
60
  | `pr_title` | string | Pull request title |
61
  | `pr_number` | int | PR number |
62
  | `repo_name` | string | Full repo name (owner/repo) |
 
92
  high_quality = ds["train"].filter(lambda x: x["quality_score"] >= 0.5)
93
  ```
94
 
95
+ ### Positive examples only
96
+
97
+ ```python
98
+ positives = ds["train"].filter(lambda x: not x["is_negative"])
99
+ ```
100
+
101
+ ### Negative examples only
102
+
103
+ ```python
104
+ negatives = ds["train"].filter(lambda x: x["is_negative"])
105
+ ```
106
+
107
  ## Collection Methodology
108
 
109
  1. **Repo selection**: Top 10,000 GitHub repos by stars with permissive licenses from [ronantakizawa/github-top-projects](https://huggingface.co/datasets/ronantakizawa/github-top-projects)
 
111
  3. **Comment filtering**: Remove bots, noise patterns, auto-generated comments, non-English text, non-code files, reply comments
112
  4. **Triplet extraction**: Fetch file contents at the review commit (before) and PR head (after), extract focused chunks around the comment line
113
  5. **Change verification**: Only keep triplets where the code chunk around the comment actually changed
114
+ 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."
115
 
116
  ### Quality Filters Applied
117
 
 
133
  | test | 5% | Test data |
134
  | validation | 5% | Validation data |
135
 
136
+ Splits are deterministic by repository — all examples from the same repo appear in the same split.
137
 
138
  ## Limitations
139
 
 
141
  - The "after" code may include changes unrelated to the specific review comment
142
  - Line number alignment may be imprecise when multiple commits occur between review and merge
143
  - 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
144
+ - Negative examples assume that uncommented code was acceptable, though reviewers may have simply not reviewed certain files
145
 
146
  ## Citation
147