judges 0.60.0 → 0.60.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5ac172cd19babb5a8fcbe6b7bc6311b70df9ff437dfb8bff633ffeeaf68218ce
4
- data.tar.gz: 34776e965033db141dfabd895e41f554fffb6977caeb7aa6a39718c61d67d228
3
+ metadata.gz: f52de1c7c4227a92ab20d9811fc5e9afa82529ae974cbf13f2f10182cde01266
4
+ data.tar.gz: 231b7e823dd35dcd6973a6d7abeccf3ee50a62c28654c0486a496082e3c3efd1
5
5
  SHA512:
6
- metadata.gz: 6965159d5e0cf14900bb8a7ac9b546e809ba199b52c6581edd3819a1a0d477b8e1536ece942971e16aadf951987badcae88e16a93291965037f9693d42c32358
7
- data.tar.gz: 07313a43d4badf58218d153ba18264090ef4ad57bf3d195fce77a48009f891453b817eccbbc504b5be29fefa55266ad8c5ebb1ec8ab17a8a88a4836e9d229571
6
+ metadata.gz: c8ceea017656a8dfef6cb0a57b55d68b18247b7f60bfa821c375dff87a9e32ed93260cb8f21bac8c8bec6d35775646b61b1ee8dc94e241e483d07bad95137630
7
+ data.tar.gz: 44b0ec1172b9c0c2dc434ea572818e6081e57e734bff043da0f9d6a14d079422c01788105bc37d246cafb19d2804457d1ab75934c50194a39dbaf640bef437aa
data/Gemfile.lock CHANGED
@@ -23,7 +23,7 @@ PATH
23
23
  GEM
24
24
  remote: https://rubygems.org/
25
25
  specs:
26
- addressable (2.8.8)
26
+ addressable (2.8.9)
27
27
  public_suffix (>= 2.0.2, < 8.0)
28
28
  ansi (1.5.0)
29
29
  ast (2.4.3)
@@ -66,25 +66,26 @@ GEM
66
66
  cucumber-tag-expressions (> 6, < 9)
67
67
  cucumber-cucumber-expressions (19.0.0)
68
68
  bigdecimal
69
- cucumber-gherkin (38.0.0)
69
+ cucumber-gherkin (39.0.0)
70
70
  cucumber-messages (>= 31, < 33)
71
71
  cucumber-html-formatter (22.3.0)
72
72
  cucumber-messages (> 23, < 33)
73
- cucumber-messages (32.0.1)
73
+ cucumber-messages (32.2.0)
74
74
  cucumber-tag-expressions (8.1.0)
75
75
  date (3.5.1)
76
76
  decoor (0.1.0)
77
77
  diff-lcs (1.6.2)
78
78
  docile (1.4.1)
79
+ drb (2.2.3)
79
80
  elapsed (0.3.1)
80
81
  loog (~> 0.6)
81
82
  tago (~> 0.1)
82
83
  ellipsized (0.3.0)
83
- erb (6.0.1)
84
+ erb (6.0.2)
84
85
  ethon (0.18.0)
85
86
  ffi (>= 1.15.0)
86
87
  logger
87
- factbase (0.19.6)
88
+ factbase (0.19.9)
88
89
  backtrace (~> 0.4)
89
90
  decoor (~> 0.1)
90
91
  ellipsized (~> 0.3)
@@ -121,15 +122,21 @@ GEM
121
122
  hashdiff (1.2.1)
122
123
  iri (0.11.8)
123
124
  json (2.18.1)
125
+ json-schema (6.1.0)
126
+ addressable (~> 2.8)
127
+ bigdecimal (>= 3.1, < 5)
124
128
  language_server-protocol (3.17.0.5)
125
129
  lint_roller (1.1.0)
126
130
  logger (1.7.0)
127
131
  loog (0.8.0)
128
132
  ellipsized
129
133
  logger (~> 1.0)
134
+ mcp (0.7.1)
135
+ json-schema (>= 4.1)
130
136
  memoist3 (1.0.0)
131
137
  mini_mime (1.1.5)
132
- minitest (6.0.1)
138
+ minitest (6.0.2)
139
+ drb (~> 2.0)
133
140
  prism (~> 1.5)
134
141
  minitest-mock (5.27.0)
135
142
  minitest-reporters (1.7.1)
@@ -144,33 +151,33 @@ GEM
144
151
  multipart-post (2.4.1)
145
152
  net-http (0.9.1)
146
153
  uri (>= 0.11.1)
147
- nokogiri (1.19.0-aarch64-linux-gnu)
154
+ nokogiri (1.19.1-aarch64-linux-gnu)
148
155
  racc (~> 1.4)
149
- nokogiri (1.19.0-aarch64-linux-musl)
156
+ nokogiri (1.19.1-aarch64-linux-musl)
150
157
  racc (~> 1.4)
151
- nokogiri (1.19.0-arm-linux-gnu)
158
+ nokogiri (1.19.1-arm-linux-gnu)
152
159
  racc (~> 1.4)
153
- nokogiri (1.19.0-arm-linux-musl)
160
+ nokogiri (1.19.1-arm-linux-musl)
154
161
  racc (~> 1.4)
155
- nokogiri (1.19.0-arm64-darwin)
162
+ nokogiri (1.19.1-arm64-darwin)
156
163
  racc (~> 1.4)
157
- nokogiri (1.19.0-x64-mingw-ucrt)
164
+ nokogiri (1.19.1-x64-mingw-ucrt)
158
165
  racc (~> 1.4)
159
- nokogiri (1.19.0-x86_64-darwin)
166
+ nokogiri (1.19.1-x86_64-darwin)
160
167
  racc (~> 1.4)
161
- nokogiri (1.19.0-x86_64-linux-gnu)
168
+ nokogiri (1.19.1-x86_64-linux-gnu)
162
169
  racc (~> 1.4)
163
- nokogiri (1.19.0-x86_64-linux-musl)
170
+ nokogiri (1.19.1-x86_64-linux-musl)
164
171
  racc (~> 1.4)
165
172
  online (0.3.0)
166
173
  openssl (>= 3)
167
174
  timeout (~> 0.4)
168
- openssl (4.0.0)
175
+ openssl (4.0.1)
169
176
  os (1.1.4)
170
177
  ostruct (0.6.3)
171
178
  others (0.1.1)
172
179
  parallel (1.27.0)
173
- parser (3.3.10.1)
180
+ parser (3.3.10.2)
174
181
  ast (~> 2.4.1)
175
182
  racc
176
183
  prism (1.9.0)
@@ -178,7 +185,7 @@ GEM
178
185
  date
179
186
  stringio
180
187
  public_suffix (7.0.2)
181
- qbash (0.7.2)
188
+ qbash (0.8.0)
182
189
  backtrace (> 0)
183
190
  elapsed (> 0)
184
191
  loog (> 0)
@@ -195,10 +202,11 @@ GEM
195
202
  regexp_parser (2.11.3)
196
203
  retries (0.0.5)
197
204
  rexml (3.4.4)
198
- rubocop (1.84.2)
205
+ rubocop (1.85.0)
199
206
  json (~> 2.3)
200
207
  language_server-protocol (~> 3.17.0.2)
201
208
  lint_roller (~> 1.1.0)
209
+ mcp (~> 0.6)
202
210
  parallel (~> 1.10)
203
211
  parser (>= 3.3.0.2)
204
212
  rainbow (>= 2.2.2, < 4.0)
@@ -209,7 +217,7 @@ GEM
209
217
  rubocop-ast (1.49.0)
210
218
  parser (>= 3.3.7.2)
211
219
  prism (~> 1.7)
212
- rubocop-minitest (0.38.2)
220
+ rubocop-minitest (0.39.1)
213
221
  lint_roller (~> 1.1)
214
222
  rubocop (>= 1.75.0, < 2.0)
215
223
  rubocop-ast (>= 1.38.0, < 2.0)
@@ -231,7 +239,7 @@ GEM
231
239
  simplecov-html (0.13.2)
232
240
  simplecov_json_formatter (0.1.4)
233
241
  stringio (3.2.0)
234
- sys-uname (1.4.1)
242
+ sys-uname (1.5.0)
235
243
  ffi (~> 1.1)
236
244
  memoist3 (~> 1.0.0)
237
245
  tago (0.7.0)
data/README.md CHANGED
@@ -90,8 +90,9 @@ Read
90
90
  [these guidelines](https://www.yegor256.com/2014/04/15/github-guidelines.html).
91
91
  Make sure your build is green before you contribute
92
92
  your pull request. You will need to have
93
- [Ruby](https://www.ruby-lang.org/en/) 3.0+ and
94
- [Bundler](https://bundler.io/) installed. Then:
93
+ [Ruby](https://www.ruby-lang.org/en/) 3.0+,
94
+ [Bundler](https://bundler.io/), and
95
+ [Tidy](https://www.html-tidy.org/) installed. Then:
95
96
 
96
97
  ```bash
97
98
  bundle update
@@ -16,9 +16,9 @@ Feature: Test
16
16
  And Exit code is zero
17
17
 
18
18
  Scenario: Factbase version can be set
19
- When I run bin/judges with "--factbase 0.19.6 --verbose test --judge guess ./fixtures"
19
+ When I run bin/judges with "--factbase 0.19.9 --verbose test --judge guess ./fixtures"
20
20
  Then Exit code is zero
21
- And Stdout contains "Factbase version to be used: '0.19.6'"
21
+ And Stdout contains "Factbase version to be used: '0.19.9'"
22
22
 
23
23
  Scenario: Simple test of no judges
24
24
  Given I run bin/judges with "test --judge absent_for_sure ./fixtures"
data/judges.gemspec CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
9
9
  s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
10
10
  s.required_ruby_version = '>=3.2'
11
11
  s.name = 'judges'
12
- s.version = '0.60.0'
12
+ s.version = '0.60.1'
13
13
  s.license = 'MIT'
14
14
  s.summary = 'Command-Line Tool for a Factbase'
15
15
  s.description =
@@ -70,10 +70,10 @@ class Judges::Update
70
70
  epoch: @epoch, shuffle: opts['shuffle'], boost: opts['boost'],
71
71
  demote: opts['demote'], seed: opts['seed']
72
72
  )
73
- churn = nil
73
+ churn = Factbase::Churn.new
74
74
  begin
75
75
  Timeout.timeout(opts['lifetime']) do
76
- churn = loop_them(judges, fb, opts, options)
76
+ loop_them(judges, fb, churn, opts, options)
77
77
  end
78
78
  rescue Timeout::Error, Timeout::ExitException => e
79
79
  @loog.error("Terminated due to --lifetime=#{opts['lifetime']}")
@@ -90,9 +90,9 @@ class Judges::Update
90
90
 
91
91
  private
92
92
 
93
- def loop_them(judges, fb, opts, options)
93
+ def loop_them(judges, fb, churn, opts, options)
94
94
  c = 0
95
- churn = Factbase::Churn.new
95
+ ch = Factbase::Churn.new
96
96
  errors = []
97
97
  statistics = opts['statistics'] ? Judges::Statistics.new : nil
98
98
  sum = fb.query('(eq what "judges-summary")').each.to_a
@@ -115,8 +115,8 @@ class Judges::Update
115
115
  end
116
116
  @loog.info("\nStarting cycle ##{c}#{" (out of #{opts['max-cycles']})" if opts['max-cycles']}...")
117
117
  end
118
- delta = cycle(opts, judges, fb, options, errors, statistics)
119
- churn += delta
118
+ delta = cycle(opts, judges, fb, churn, options, errors, statistics)
119
+ ch += delta
120
120
  if delta.zero?
121
121
  @loog.info("The update cycle ##{c} has made no changes to the factbase, let's stop")
122
122
  break
@@ -131,16 +131,15 @@ class Judges::Update
131
131
  end
132
132
  @loog.info("The cycle #{c} did #{delta}")
133
133
  end
134
- throw :"👍 Update completed in #{c} cycle(s), did #{churn}"
134
+ throw :"👍 Update completed in #{c} cycle(s), did #{ch}"
135
135
  end
136
136
  statistics&.report(@loog)
137
- summarize(fb, churn, errors, c) if %w[add append].include?(opts['summary'])
138
- churn
137
+ summarize(fb, ch, errors, c) if %w[add append].include?(opts['summary'])
139
138
  end
140
139
 
141
140
  # Update the summary.
142
141
  # @param [Factbase] fb The factbase
143
- # @param [Churn] churn The churn
142
+ # @param [Factbase::Churn] churn The churn
144
143
  # @param [Array<String>] errors List of errors
145
144
  # @param [Integer] cycles How many cycles
146
145
  def summarize(fb, churn, errors, cycles)
@@ -176,11 +175,12 @@ class Judges::Update
176
175
  # @param [Hash] opts The command line options
177
176
  # @param [Judges::Judges] judges The judges
178
177
  # @param [Factbase] fb The factbase
178
+ # @param [Factbase::Churn] churn All modifications
179
179
  # @param [Judges::Options] options The options
180
180
  # @param [Array<String>] errors List of errors
181
181
  # @param [Judges::Statistics] statistics Statistics tracking object (optional)
182
- # @return [Factbase::Churn] How many modifications have been made
183
- def cycle(opts, judges, fb, options, errors, statistics = nil)
182
+ # @return [Factbase::Churn] How many modifications have been made in current cycle
183
+ def cycle(opts, judges, fb, churn, options, errors, statistics = nil)
184
184
  delta = Factbase::Churn.new
185
185
  global = {}
186
186
  used = 0
@@ -209,6 +209,7 @@ class Judges::Update
209
209
  elapsed(@loog, level: Logger::INFO) do
210
210
  impact = one_judge(opts, fb, judge, global, options, errors)
211
211
  delta += impact
212
+ churn.append(impact.inserted, impact.deleted, impact.added)
212
213
  throw :"👍 The '#{judge.name}' judge made zero changes to #{fb.size} facts" if impact.zero?
213
214
  throw :"👍 The '#{judge.name}' judge #{impact} out of #{fb.size} facts"
214
215
  end
data/lib/judges/judges.rb CHANGED
@@ -84,10 +84,11 @@ class Judges::Judges
84
84
  list.sort_by!(&:name)
85
85
  all = list.each_with_index.to_a
86
86
  good = all.dup
87
- mapping = all
88
- .map { |a| [a[0].name, a[1], a[1]] }
89
- .reject { |a| !@shuffle.empty? && a[0].start_with?(@shuffle) }
90
- .to_h { |a| [a[1], a[2]] }
87
+ mapping =
88
+ all
89
+ .map { |a| [a[0].name, a[1], a[1]] }
90
+ .reject { |a| !@shuffle.empty? && a[0].start_with?(@shuffle) }
91
+ .to_h { |a| [a[1], a[2]] }
91
92
  positions = mapping.values.shuffle(random: Random.new(@seed))
92
93
  mapping.keys.zip(positions).to_h.each do |before, after|
93
94
  good[after] = all[before]
@@ -76,7 +76,7 @@ class Judges::Statistics
76
76
  # @return [String] Compact summary of results
77
77
  def summarize(results)
78
78
  return 'N/A' if results.empty?
79
- counts = results.each_with_object(Hash.new(0)) { |result, hash| hash[result] += 1 }
79
+ counts = results.tally
80
80
  return results.first if counts.size == 1
81
81
  counts.sort_by { |_, count| -count }.map { |result, count| "#{count}x#{result}" }.join(', ')
82
82
  end
data/lib/judges.rb CHANGED
@@ -8,5 +8,5 @@
8
8
  # Copyright:: Copyright (c) 2024-2026 Yegor Bugayenko
9
9
  # License:: MIT
10
10
  module Judges
11
- VERSION = '0.60.0' unless const_defined?(:VERSION)
11
+ VERSION = '0.60.1' unless const_defined?(:VERSION)
12
12
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: judges
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.60.0
4
+ version: 0.60.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko