fbe 0.8.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +0 -1
- data/Gemfile.lock +8 -8
- data/assets/bylaws/code-contribution-was-rewarded.liquid +10 -3
- data/lib/fbe/award.rb +4 -2
- data/lib/fbe/octo.rb +7 -2
- data/lib/fbe.rb +1 -1
- data/test/fbe/test_octo.rb +22 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bdf5c399cce9ed9558af9ad5ae54c5acc4da5a0461bbe6e7b09d430cba4dd481
|
4
|
+
data.tar.gz: 99a06827b9b501288146d1ce2e2d65169ca57e8f292ca1e9c481d935e5475cec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da68e83a59fe793f173802db1df9e13f0c2a5a6845bec43023416769b3a8d41672a06b176508dc20ff2f0d841a9a0e2e55c551101cfd18ecf65edc1e6ca78af7
|
7
|
+
data.tar.gz: e8a9db23f68d6f368db568a66b3461e21402ee971a2d1620377a1605ab2b5883c70f8057a178ba57325447a47efd1027d0b34f8f54d6b6acbf59f9ac9e31d80f
|
data/.rubocop.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -58,7 +58,7 @@ GEM
|
|
58
58
|
bigdecimal (3.1.9)
|
59
59
|
builder (3.3.0)
|
60
60
|
concurrent-ruby (1.3.5)
|
61
|
-
connection_pool (2.5.
|
61
|
+
connection_pool (2.5.1)
|
62
62
|
crack (1.0.0)
|
63
63
|
bigdecimal
|
64
64
|
rexml
|
@@ -99,7 +99,7 @@ GEM
|
|
99
99
|
fiber-storage (1.0.1)
|
100
100
|
gli (2.22.2)
|
101
101
|
ostruct
|
102
|
-
graphql (2.5.
|
102
|
+
graphql (2.5.4)
|
103
103
|
base64
|
104
104
|
fiber-storage
|
105
105
|
logger
|
@@ -111,7 +111,7 @@ GEM
|
|
111
111
|
concurrent-ruby (~> 1.0)
|
112
112
|
iri (0.10.0)
|
113
113
|
json (2.10.2)
|
114
|
-
judges (0.
|
114
|
+
judges (0.41.0)
|
115
115
|
backtrace (~> 0)
|
116
116
|
baza.rb (~> 0)
|
117
117
|
concurrent-ruby (~> 1.2)
|
@@ -143,13 +143,13 @@ GEM
|
|
143
143
|
multipart-post (2.4.1)
|
144
144
|
net-http (0.6.0)
|
145
145
|
uri
|
146
|
-
nokogiri (1.18.
|
146
|
+
nokogiri (1.18.8-arm64-darwin)
|
147
147
|
racc (~> 1.4)
|
148
|
-
nokogiri (1.18.
|
148
|
+
nokogiri (1.18.8-x64-mingw-ucrt)
|
149
149
|
racc (~> 1.4)
|
150
|
-
nokogiri (1.18.
|
150
|
+
nokogiri (1.18.8-x86_64-darwin)
|
151
151
|
racc (~> 1.4)
|
152
|
-
nokogiri (1.18.
|
152
|
+
nokogiri (1.18.8-x86_64-linux-gnu)
|
153
153
|
racc (~> 1.4)
|
154
154
|
obk (0.3.2)
|
155
155
|
octokit (9.2.0)
|
@@ -175,7 +175,7 @@ GEM
|
|
175
175
|
regexp_parser (2.10.0)
|
176
176
|
retries (0.0.5)
|
177
177
|
rexml (3.4.1)
|
178
|
-
rubocop (1.75.
|
178
|
+
rubocop (1.75.3)
|
179
179
|
json (~> 2.3)
|
180
180
|
language_server-protocol (~> 3.17.0.2)
|
181
181
|
lint_roller (~> 1.1.0)
|
@@ -46,10 +46,17 @@
|
|
46
46
|
(let comments_k {{ 0.1 | times: anger }})
|
47
47
|
(let comments_max -16)
|
48
48
|
(let comments_min -4)
|
49
|
-
(
|
49
|
+
(let comments_threshold {{ 16 | divided_by: paranoia }})
|
50
|
+
(set bonus_for_comments
|
51
|
+
(if
|
52
|
+
(gt comments comments_threshold)
|
53
|
+
(times comments (times -1 comments_k))
|
54
|
+
0
|
55
|
+
)
|
56
|
+
)
|
50
57
|
(set bonus_for_comments (between bonus_for_comments comments_min comments_max))
|
51
|
-
(give bonus_for_comments "for too many (${comments}) comments that were made during review")
|
52
|
-
"deduct ${comments_k} points for every comment made during review, but not more than ${comments_max} points")
|
58
|
+
(give bonus_for_comments "for too many (${comments} > ${comments_threshold}) comments that were made during review")
|
59
|
+
"deduct ${comments_k} points for every comment above ${comments_threshold} made during review, but not more than ${comments_max} points")
|
53
60
|
|
54
61
|
(aka
|
55
62
|
(let few_hoc_fee {{ 4 | times: anger }})
|
data/lib/fbe/award.rb
CHANGED
@@ -91,7 +91,9 @@ class Fbe::Award
|
|
91
91
|
raise "Failure in #{o}: #{e.message}"
|
92
92
|
end
|
93
93
|
when :let, :set
|
94
|
-
|
94
|
+
v = to_val(@operands[1], bill)
|
95
|
+
raise "Can't #{@op.inspect} #{@operands[0].inspect} to nil" if v.nil?
|
96
|
+
bill.set(@operands[0], v)
|
95
97
|
when :give
|
96
98
|
text = @operands[1]
|
97
99
|
text = '' if text.nil?
|
@@ -108,7 +110,7 @@ class Fbe::Award
|
|
108
110
|
any.calc(bill)
|
109
111
|
elsif any.is_a?(Symbol)
|
110
112
|
v = bill.vars[any]
|
111
|
-
raise "Unknown name
|
113
|
+
raise "Unknown name #{any.inspect} among: #{bill.vars.keys.map(&:inspect).join(', ')}" if v.nil?
|
112
114
|
v
|
113
115
|
else
|
114
116
|
any
|
data/lib/fbe/octo.rb
CHANGED
@@ -96,13 +96,16 @@ def Fbe.octo(options: $options, global: $global, loog: $loog)
|
|
96
96
|
end
|
97
97
|
|
98
98
|
def user_name_by_id(id)
|
99
|
+
raise 'The ID of the user is nil' if id.nil?
|
100
|
+
raise 'The ID of the user must be an Integer' unless id.is_a?(Integer)
|
99
101
|
json = @origin.user(id)
|
100
|
-
name = json[:login]
|
102
|
+
name = json[:login].downcase
|
101
103
|
@loog.debug("GitHub user ##{id} has a name: @#{name}")
|
102
104
|
name
|
103
105
|
end
|
104
106
|
|
105
107
|
def repo_id_by_name(name)
|
108
|
+
raise 'The name of the repo is nil' if name.nil?
|
106
109
|
json = @origin.repository(name)
|
107
110
|
id = json[:id]
|
108
111
|
@loog.debug("GitHub repository #{name.inspect} has an ID: ##{id}")
|
@@ -110,8 +113,10 @@ def Fbe.octo(options: $options, global: $global, loog: $loog)
|
|
110
113
|
end
|
111
114
|
|
112
115
|
def repo_name_by_id(id)
|
116
|
+
raise 'The ID of the repo is nil' if id.nil?
|
117
|
+
raise 'The ID of the repo must be an Integer' unless id.is_a?(Integer)
|
113
118
|
json = @origin.repository(id)
|
114
|
-
name = json[:full_name]
|
119
|
+
name = json[:full_name].downcase
|
115
120
|
@loog.debug("GitHub repository ##{id} has a name: #{name}")
|
116
121
|
name
|
117
122
|
end
|
data/lib/fbe.rb
CHANGED
data/test/fbe/test_octo.rb
CHANGED
@@ -51,6 +51,28 @@ class TestOcto < Fbe::Test
|
|
51
51
|
assert_equal(100, o.rate_limit.remaining)
|
52
52
|
end
|
53
53
|
|
54
|
+
def test_reads_nickname_by_id
|
55
|
+
WebMock.disable_net_connect!
|
56
|
+
global = {}
|
57
|
+
o = Fbe.octo(loog: Loog::NULL, global:, options: Judges::Options.new)
|
58
|
+
stub_request(:get, 'https://api.github.com/user/42').to_return(
|
59
|
+
body: { login: 'Dude56' }.to_json, headers: { 'Content-Type': 'application/json' }
|
60
|
+
)
|
61
|
+
nick = o.user_name_by_id(42)
|
62
|
+
assert_equal('dude56', nick)
|
63
|
+
end
|
64
|
+
|
65
|
+
def test_reads_repo_name_by_id
|
66
|
+
WebMock.disable_net_connect!
|
67
|
+
global = {}
|
68
|
+
o = Fbe.octo(loog: Loog::NULL, global:, options: Judges::Options.new)
|
69
|
+
stub_request(:get, 'https://api.github.com/repositories/42').to_return(
|
70
|
+
body: { full_name: 'Foo/bar56-Ff' }.to_json, headers: { 'Content-Type': 'application/json' }
|
71
|
+
)
|
72
|
+
nick = o.repo_name_by_id(42)
|
73
|
+
assert_equal('foo/bar56-ff', nick)
|
74
|
+
end
|
75
|
+
|
54
76
|
def test_caching
|
55
77
|
WebMock.disable_net_connect!
|
56
78
|
global = {}
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fbe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yegor Bugayenko
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-04-
|
10
|
+
date: 2025-04-23 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: backtrace
|