fbe 0.0.58 → 0.0.60
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/assets/bylaws/bad-branch-name-was-punished.liquid +1 -1
- data/assets/bylaws/code-contribution-was-rewarded.liquid +4 -4
- data/assets/bylaws/code-review-was-rewarded.liquid +2 -2
- data/assets/bylaws/push-to-master-was-punished.liquid +1 -1
- data/assets/bylaws/resolved-bug-was-rewarded.liquid +1 -1
- data/lib/fbe/bylaws.rb +5 -2
- data/lib/fbe/github_graph.rb +3 -1
- data/lib/fbe.rb +1 -1
- data/test/fbe/test_bylaws.rb +2 -2
- data/test/fbe/test_github_graph.rb +8 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4933facacd974e44985f3931125665ab4456062b0f4a45faf3bdc6a970e42c21
|
4
|
+
data.tar.gz: 53f0dde5e526aa66a703f8ee088ecd08e7aedb49d847b46c3b6a0080930509d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 17c95861794f3865ecd9e5e5f1afe3863a7194393dce7fa7d1bd479455595ca563868819f2e7e445590ddc819f09907411923a4c21c65a26e7201165809270c4
|
7
|
+
data.tar.gz: 2404df0f1d5514a696f8e6604fada7792f5ce8e605dec85f48938b831dc5cd833221137e5c907e233723b67d080d78d77a1bdbf38db37f4cbe06a54cb84e72f2
|
@@ -11,7 +11,7 @@
|
|
11
11
|
|
12
12
|
(aka
|
13
13
|
(let hoc_k {{ 0.05 | times: love }})
|
14
|
-
(let hoc_threshold
|
14
|
+
(let hoc_threshold {{ 400 | divided_by: paranoia }})
|
15
15
|
(let hoc_max 16)
|
16
16
|
(let hoc_min 5)
|
17
17
|
(set bonus_for_hoc (if (lt hoc hoc_threshold) (times hoc hoc_k) 0))
|
@@ -30,7 +30,7 @@
|
|
30
30
|
|
31
31
|
(aka
|
32
32
|
(let many_hoc_fee2 {{ 8 | times: anger }})
|
33
|
-
(let hoc_threshold2
|
33
|
+
(let hoc_threshold2 {{ 1600 | divided_by: paranoia }})
|
34
34
|
(set penalty_for_hoc2 (if (gte hoc hoc_threshold2) (times -1 many_hoc_fee2) 0))
|
35
35
|
(give penalty_for_hoc2 "for way too many hits-of-code (${hoc} >= ${hoc_threshold2})")
|
36
36
|
"deduct ${many_hoc_fee2} points if more than ${hoc_threshold2}
|
@@ -53,7 +53,7 @@
|
|
53
53
|
|
54
54
|
(aka
|
55
55
|
(let few_comments_fee {{ 2 | times: anger }})
|
56
|
-
(let comments_needed
|
56
|
+
(let comments_needed {{ 3 | times: paranoia }})
|
57
57
|
(set penalty_for_few_comments (if (and (lt comments comments_needed) (not (eq comments 0))) (times -1 few_comments_fee) 0))
|
58
58
|
(give penalty_for_few_comments "for very few (${comments}) comments")
|
59
59
|
"deduct ${few_comments_fee} points if there were less than ${comments_needed} comments made during review")
|
@@ -66,7 +66,7 @@
|
|
66
66
|
|
67
67
|
(aka
|
68
68
|
(let few_hoc_fee {{ 4 | times: anger }})
|
69
|
-
(let hoc_needed
|
69
|
+
(let hoc_needed {{ 10 | times: paranoia }})
|
70
70
|
(set penalty_for_few_hoc (if (lt hoc hoc_needed) (times -1 few_hoc_fee) 0))
|
71
71
|
(give penalty_for_few_hoc "for too few (${hoc}) hits-of-code")
|
72
72
|
"deduct ${few_hoc_fee} points if you contribute less than ${hoc_needed} hits-of-code")
|
@@ -29,7 +29,7 @@
|
|
29
29
|
|
30
30
|
(aka
|
31
31
|
(let few_comments_fee {{ 5 | times: anger }})
|
32
|
-
(let comments_needed
|
32
|
+
(let comments_needed {{ 3 | times: paranoia }})
|
33
33
|
(set penalty_for_few_comments (if (and (lt comments comments_needed) (not (eq comments 0))) (times -1 few_comments_fee) 0))
|
34
34
|
(give penalty_for_few_comments "for very few (${comments}) comments")
|
35
35
|
"deduct ${few_comments_fee} points if there were less than ${comments_needed} comments made during review")
|
@@ -52,7 +52,7 @@
|
|
52
52
|
|
53
53
|
(aka
|
54
54
|
(let hoc_fee {{ 4 | times: anger }})
|
55
|
-
(let hoc_needed
|
55
|
+
(let hoc_needed {{ 8 | times: paranoia }})
|
56
56
|
(set penalty_for_hoc (if (lt hoc hoc_needed) (times -1 hoc_fee) 0))
|
57
57
|
(give penalty_for_hoc "for too few (${hoc}) hits-of-code")
|
58
58
|
"deduct ${hoc_fee} points if there were less than ${hoc_needed} hits-of-code")
|
@@ -10,7 +10,7 @@
|
|
10
10
|
|
11
11
|
(aka
|
12
12
|
(let b1 {{ 4 | times: love }})
|
13
|
-
(let hours_threshold
|
13
|
+
(let hours_threshold {{ 48 | divided_by: paranoia }})
|
14
14
|
(set b1 (if (lt hours hours_threshold) b1 0))
|
15
15
|
(give b1 "for resolving it in less than ${hours_threshold} hours")
|
16
16
|
"add ${b1} points if it was resolved in less than ${hours_threshold} hours")
|
data/lib/fbe/bylaws.rb
CHANGED
@@ -30,12 +30,15 @@ require_relative '../fbe'
|
|
30
30
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
31
31
|
# Copyright:: Copyright (c) 2024 Yegor Bugayenko
|
32
32
|
# License:: MIT
|
33
|
-
def Fbe.bylaws(anger: 2, love: 2)
|
33
|
+
def Fbe.bylaws(anger: 2, love: 2, paranoia: 2)
|
34
|
+
raise 'The "anger" must be in the [0..4] interval' unless !anger.negative? && anger < 5
|
35
|
+
raise 'The "lover" must be in the [0..4] interval' unless !love.negative? && love < 5
|
36
|
+
raise 'The "paranoia" must be in the [1..4] interval' unless paranoia.positive? && paranoia < 5
|
34
37
|
home = File.join(__dir__, '../../assets/bylaws')
|
35
38
|
raise "The directory with templates is absent '#{home}'" unless File.exist?(home)
|
36
39
|
Dir[File.join(home, '*.liquid')].to_h do |f|
|
37
40
|
formula = Liquid::Template.parse(File.read(f)).render(
|
38
|
-
'anger' => anger, 'love' => love
|
41
|
+
'anger' => anger, 'love' => love, 'paranoia' => paranoia
|
39
42
|
)
|
40
43
|
[File.basename(f).gsub(/\.liquid$/, ''), formula]
|
41
44
|
end
|
data/lib/fbe/github_graph.rb
CHANGED
@@ -82,7 +82,9 @@ class Fbe::Graph
|
|
82
82
|
}
|
83
83
|
GRAPHQL
|
84
84
|
)
|
85
|
-
result&.to_h&.dig('repository', 'pullRequest', 'reviewThreads', 'nodes')
|
85
|
+
result&.to_h&.dig('repository', 'pullRequest', 'reviewThreads', 'nodes')&.select do |thread|
|
86
|
+
thread['isResolved']
|
87
|
+
end || []
|
86
88
|
end
|
87
89
|
|
88
90
|
def total_commits(owner, name, branch)
|
data/lib/fbe.rb
CHANGED
data/test/fbe/test_bylaws.rb
CHANGED
@@ -80,7 +80,7 @@ class TestBylaws < Minitest::Test
|
|
80
80
|
{ hoc: 50, comments: 15, reviews: 0 } => 5,
|
81
81
|
{ hoc: 50, comments: 25, reviews: 0 } => 4,
|
82
82
|
{ hoc: 180, comments: 7, reviews: 2 } => 32,
|
83
|
-
{ hoc: 150, comments: 5, reviews: 1 } =>
|
83
|
+
{ hoc: 150, comments: 5, reviews: 1 } => 27,
|
84
84
|
{ hoc: 500, comments: 25, reviews: 2 } => 4,
|
85
85
|
{ hoc: 99, comments: 6, reviews: 1 } => 26,
|
86
86
|
{ hoc: 1_500, comments: 3, reviews: 0 } => 4,
|
@@ -104,7 +104,7 @@ class TestBylaws < Minitest::Test
|
|
104
104
|
assert(!formula.nil?, title)
|
105
105
|
a = Fbe::Award.new(formula)
|
106
106
|
help = [
|
107
|
-
" #{title}
|
107
|
+
" '#{title.gsub('-', '_')}' => {\n ",
|
108
108
|
pairs.map do |args, _|
|
109
109
|
[
|
110
110
|
'{',
|
@@ -91,6 +91,14 @@ class TestGitHubGraph < Minitest::Test
|
|
91
91
|
assert(0, result.count)
|
92
92
|
end
|
93
93
|
|
94
|
+
def test_does_not_count_unresolved_conversations
|
95
|
+
skip # it's a "live" test, run it manually if you need it
|
96
|
+
WebMock.allow_net_connect!
|
97
|
+
g = Fbe.github_graph(options: Judges::Options.new, loog: Loog::NULL, global: {})
|
98
|
+
result = g.resolved_conversations('zerocracy', 'judges-action', 296)
|
99
|
+
assert_equal(0, result.count)
|
100
|
+
end
|
101
|
+
|
94
102
|
def test_gets_total_commits_of_repo
|
95
103
|
skip # it's a "live" test, run it manually if you need it
|
96
104
|
WebMock.allow_net_connect!
|