forked from nodejs/node-core-utils
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdata.js
145 lines (125 loc) · 5.33 KB
/
data.js
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
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
142
143
144
145
import { basename } from 'node:path';
import { readdirSync } from 'node:fs';
import { Collaborator } from '../../lib/collaborators.js';
import { Review } from '../../lib/reviews.js';
import { readJSON, patchPrototype, readFile, path } from './index.js';
export const approved = readJSON('reviewers_approved.json');
export const requestedChanges = readJSON('reviewers_requested_changes.json');
patchPrototype(approved, 'reviewer', Collaborator.prototype);
patchPrototype(approved, 'review', Review.prototype);
patchPrototype(requestedChanges, 'reviewer', Collaborator.prototype);
patchPrototype(requestedChanges, 'review', Review.prototype);
export const allGreenReviewers = {
approved,
requestedChanges: []
};
export const singleGreenReviewer = {
approved: [approved[0]],
requestedChanges: []
};
export const requestedChangesReviewers = {
requestedChanges,
approved: []
};
export const noReviewers = {
requestedChanges: [],
approved: []
};
export const approvingReviews = readJSON('reviews_approved.json');
export const requestingChangesReviews =
readJSON('reviews_requesting_changes.json');
export const commentsWithFastTrack = readJSON('comments_with_fast_track.json');
export const commentsWithTwoFastTrack =
readJSON('comments_with_two_fast_track.json');
export const commentsWithTwoFastTrackDifferentCase =
readJSON('comments_with_two_fast_track_different_case.json');
export const commentsWithFastTrackInsuffientApprovals =
readJSON('comments_with_fast_track_insufficient_approvals.json');
export const commentsWithCI = readJSON('comments_with_ci.json');
export const commentsWithFailedCI = readJSON('comments_with_failed_ci.json');
export const commentsWithLGTM = readJSON('comments_with_lgtm.json');
export const commentsWithPendingCI = readJSON('comments_with_pending_ci.json');
export const commentsWithSuccessCI = readJSON('comments_with_success_ci.json');
export const oddCommits = readJSON('odd_commits.json');
export const incorrectGitConfigCommits =
readJSON('incorrect_git_config_commits.json');
export const simpleCommits = readJSON('simple_commits.json');
export const singleCommitAfterReview = {
commits: readJSON('single_commit_after_review_commits.json'),
reviews: readJSON('single_commit_after_review_reviews.json')
};
export const multipleCommitsAfterReview = {
commits: readJSON('multiple_commits_after_review_commits.json'),
reviews: readJSON('multiple_commits_after_review_reviews.json')
};
export const moreThanThreeCommitsAfterReview = {
commits: readJSON('more_than_three_commits_after_review_commits.json'),
reviews: readJSON('more_than_three_commits_after_review_reviews.json')
};
export const commitsAfterCi = readJSON('commits_after_ci.json');
export const mulipleCommitsAfterCi = readJSON('multiple_commits_after_ci.json');
function makeCollaborators(arr) {
arr.forEach((c) => {
Object.setPrototypeOf(c, Collaborator.prototype);
});
return new Map(
arr.map((c) => [c.login.toLowerCase(), c])
);
}
export const collaborators = makeCollaborators(readJSON('collaborators.json'));
export const collaboratorsAlternative = makeCollaborators(
readJSON('collaborators_alternative.json')
);
export const firstTimerPR = readJSON('first_timer_pr.json');
export const firstTimerPrivatePR =
readJSON('first_timer_pr_with_private_email.json');
export const semverMajorPR = readJSON('semver_major_pr.json');
export const fixAndRefPR = readJSON('pr_with_fixes_and_refs.json');
export const fixCrossPR = readJSON('pr_with_fixes_cross.json');
export const duplicateRefPR = readJSON('pr_with_duplicate_refs.json');
export const selfRefPR = readJSON('pr_with_self_ref.json');
export const backportPR = readJSON('pr_with_backport.json');
export const conflictingPR = readJSON('conflicting_pr.json');
export const emptyProfilePR = readJSON('empty_profile_pr.json');
export const closedPR = readJSON('./closed_pr.json');
export const mergedPR = readJSON('./merged_pr.json');
export const readme = readFile('./README/README.md');
export const readmeAlternative = readFile('./README/README_alternative.md');
export const readmeNoTsc = readFile('./README/README_no_TSC.md');
export const readmeNoTscE = readFile('./README/README_no_TSCE.md');
export const readmeNoCollaborators =
readFile('./README/README_no_collaborators.md');
export const readmeNoCollaboratorE =
readFile('./README/README_no_collaboratorE.md');
export const readmeUnordered = readFile('./README/README_unordered.md');
export const githubCI = {};
for (const item of readdirSync(path('./github-ci'))) {
if (!item.endsWith('.json')) {
continue;
}
githubCI[basename(item, '.json')] = readJSON(`./github-ci/${item}`);
};
export const pullRequests = {};
for (const item of readdirSync(path('./pull_requests'))) {
if (!item.endsWith('.json')) {
continue;
}
pullRequests[basename(item, '.json')] = readJSON(`./pull_requests/${item}`);
};
export const jenkinsCI = {};
for (const subdir of readdirSync(path('./jenkins'))) {
for (const item of readdirSync(path(`./jenkins/${subdir}`))) {
if (!item.endsWith('.json')) {
continue;
}
jenkinsCI[`${subdir}/${basename(item, '.json')}`] =
readJSON(`./jenkins/${subdir}/${item}`);
}
};
export const labeledEvents = {};
for (const item of readdirSync(path('./labeled_events'))) {
if (!item.endsWith('.json')) {
continue;
}
labeledEvents[basename(item, '.json')] = readJSON(`./labeled_events/${item}`);
}