fbe 0.0.59 → 0.0.60

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dcb7a83f13eadb9bd57bd7a4741709a4b41622109f64e716ffabe98df60f2e7e
4
- data.tar.gz: b854b1108dc729e24cee35970cefc92387c4e44c0a171c3991a162a819e7e256
3
+ metadata.gz: 4933facacd974e44985f3931125665ab4456062b0f4a45faf3bdc6a970e42c21
4
+ data.tar.gz: 53f0dde5e526aa66a703f8ee088ecd08e7aedb49d847b46c3b6a0080930509d6
5
5
  SHA512:
6
- metadata.gz: 95584b9296deb9707f364d29b8351505f70e12273c3df3794704535febd965a18f0777318ec8d445a51bcc2309453820094039354e1d3dc3f82aa50635f81b1c
7
- data.tar.gz: a2893b12fef6a7f24ffda4ac0152c08500ac58a9ac27e6bc9e32ae3ba329b7b8f781dbfae7514bd6ade9b0c9fff38ac109706f1e2a6d8a67b7631b8a6a1be020
6
+ metadata.gz: 17c95861794f3865ecd9e5e5f1afe3863a7194393dce7fa7d1bd479455595ca563868819f2e7e445590ddc819f09907411923a4c21c65a26e7201165809270c4
7
+ data.tar.gz: 2404df0f1d5514a696f8e6604fada7792f5ce8e605dec85f48938b831dc5cd833221137e5c907e233723b67d080d78d77a1bdbf38db37f4cbe06a54cb84e72f2
@@ -1,7 +1,7 @@
1
1
  (award
2
2
  (explain "If a branch has a name that doesn\\\'t obey the convention, a penalty is given to the author")
3
3
  (aka
4
- (let fee -12)
4
+ (let fee {{ -6 | times: anger }})
5
5
  (give fee "as a basis")
6
6
  "deduct ${fee} points")
7
7
  )
@@ -11,7 +11,7 @@
11
11
 
12
12
  (aka
13
13
  (let hoc_k {{ 0.05 | times: love }})
14
- (let hoc_threshold 200)
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 800)
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 5)
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 20)
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 6)
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 15)
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")
@@ -1,7 +1,7 @@
1
1
  (award
2
2
  (explain "When someone pushes directly to the default branch, they get a penalty")
3
3
  (aka
4
- (let fee -16)
4
+ (let fee {{ -8 | times: anger }})
5
5
  (give fee "as a basis")
6
6
  "${fee} points")
7
7
  )
@@ -10,7 +10,7 @@
10
10
 
11
11
  (aka
12
12
  (let b1 {{ 4 | times: love }})
13
- (let hours_threshold 24)
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.rb CHANGED
@@ -27,5 +27,5 @@
27
27
  # License:: MIT
28
28
  module Fbe
29
29
  # Current version of the gem (changed by .rultor.yml on every release)
30
- VERSION = '0.0.59'
30
+ VERSION = '0.0.60'
31
31
  end
@@ -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 } => 31,
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}: {\n ",
107
+ " '#{title.gsub('-', '_')}' => {\n ",
108
108
  pairs.map do |args, _|
109
109
  [
110
110
  '{',
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fbe
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.59
4
+ version: 0.0.60
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko