This repository has been archived by the owner on Jul 26, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 347
/
.issues-guidelines.js
55 lines (40 loc) · 1.62 KB
/
.issues-guidelines.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
var assert = require('assert');
module.exports = {
'pull-requests': {
'should always be made from feature branches': function (pull) {
assert.notEqual(pull.head.ref, 'master')
},
'should always include a unit test if changing js files': function (pull) {
var hasJS = false
var hasTests = false
pull.files.forEach(function (file) {
if (/^lib\/[^./]+.js/.test(file.filename)) hasJS = true
if (/^spec\/suites\/[^.]+.js/.test(file.filename)) hasTests = true
})
assert.ok(!hasJS || hasJS && hasTests)
},
'after': function (pull) {
if (pull.reporter.stats.failures) {
pull.reportFailures(pull.close.bind(pull))
}
}
},
'issues': {
'before': function (issue) {
var plus = {}
issue.comments.forEach(function (comment) {
if (/\+1/.test(comment.body)) plus[comment.user.login] = true
})
if (Object.keys(plus) > 10) issue.tag('popular')
},
'should include a jsfiddle/jsbin illustrating the problem if tagged with js but not a feature': function (issue) {
var labels = issue.labels.map(function (label) { return label.name });
if (~labels.indexOf('js') && !~labels.indexOf('feature')) assert.ok(/(jsfiddle|jsbin)/.test(issue.body))
},
'after': function (issue) {
if (issue.reporter.stats.failures) {
issue.reportFailures(issue.close.bind(issue))
}
}
}
}