-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathextract-easy-bugs.ts
More file actions
51 lines (41 loc) · 1.41 KB
/
extract-easy-bugs.ts
File metadata and controls
51 lines (41 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import fs from 'fs';
// Configuration
const INPUT_FILE = 'bugs.json';
const OUTPUT_FILE = 'easy-bugs.json';
const DIFFICULTY_LEVEL = 'easy';
interface Bug {
repo: string;
LLMReviewPassed: boolean;
difficultyLevel?: string;
[key: string]: any;
}
// Read and parse the bugs file
const bugs = JSON.parse(fs.readFileSync(INPUT_FILE, 'utf-8')) as Bug[];
// Filter for bugs that have "easy" difficulty
const easyBugs = bugs.filter(bug =>
bug.LLMReviewPassed === true &&
bug.difficultyLevel === DIFFICULTY_LEVEL
);
console.log(`Found ${easyBugs.length} easy bugs out of ${bugs.length} total bugs`);
// Group bugs by repository to show distribution
const bugsByRepo = easyBugs.reduce((acc: { [key: string]: any[] }, bug: any) => {
if (!acc[bug.repo]) {
acc[bug.repo] = [];
}
acc[bug.repo].push(bug);
return acc;
}, {});
// Get list of repos with their bug counts
const repoStats = Object.entries(bugsByRepo)
.map(([repo, bugs]) => ({
repo,
count: bugs.length
}))
.sort((a, b) => b.count - a.count); // Sort by count descending
console.log('\n=== Repositories with Easy Bugs ===');
repoStats.forEach(({repo, count}) => {
console.log(`${repo}: ${count} easy bugs`);
});
// Write all easy bugs to output file
fs.writeFileSync(OUTPUT_FILE, JSON.stringify(easyBugs, null, 2));
console.log(`\nAll ${easyBugs.length} easy bugs have been saved to ${OUTPUT_FILE}`);