judges 0.31.0 → 0.32.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.
Files changed (79) hide show
  1. checksums.yaml +4 -4
  2. data/.0pdd.yml +2 -19
  3. data/.github/workflows/actionlint.yml +4 -20
  4. data/.github/workflows/codecov.yml +9 -21
  5. data/.github/workflows/copyrights.yml +4 -19
  6. data/.github/workflows/markdown-lint.yml +4 -19
  7. data/.github/workflows/pdd.yml +5 -20
  8. data/.github/workflows/rake.yml +6 -22
  9. data/.github/workflows/reuse.yml +19 -0
  10. data/.github/workflows/xcop.yml +4 -19
  11. data/.github/workflows/yamllint.yml +4 -19
  12. data/.gitignore +2 -1
  13. data/.rubocop.yml +9 -20
  14. data/.rultor.yml +3 -19
  15. data/.simplecov +2 -19
  16. data/Gemfile +10 -25
  17. data/Gemfile.lock +84 -61
  18. data/LICENSES/MIT.txt +21 -0
  19. data/REUSE.toml +25 -0
  20. data/Rakefile +3 -29
  21. data/assets/index.xsl +2 -21
  22. data/bin/judges +2 -19
  23. data/features/gem_package.feature +3 -0
  24. data/features/import.feature +3 -0
  25. data/features/inspect.feature +3 -1
  26. data/features/join.feature +3 -0
  27. data/features/misc.feature +3 -0
  28. data/features/print.feature +3 -0
  29. data/features/pull.feature +3 -1
  30. data/features/push.feature +3 -0
  31. data/features/step_definitions/steps.rb +2 -19
  32. data/features/support/env.rb +2 -19
  33. data/features/test.feature +3 -0
  34. data/features/trim.feature +3 -0
  35. data/features/update.feature +5 -2
  36. data/fixtures/guess/guess.rb +2 -19
  37. data/fixtures/guess/guess_made.yml +2 -19
  38. data/fixtures/guess/skipped.yml +2 -19
  39. data/fixtures/try/tried.yml +2 -19
  40. data/fixtures/try/try.rb +2 -19
  41. data/judges.gemspec +4 -21
  42. data/lib/judges/categories.rb +4 -21
  43. data/lib/judges/commands/eval.rb +2 -19
  44. data/lib/judges/commands/import.rb +3 -20
  45. data/lib/judges/commands/inspect.rb +2 -19
  46. data/lib/judges/commands/join.rb +2 -19
  47. data/lib/judges/commands/print.rb +2 -19
  48. data/lib/judges/commands/pull.rb +2 -19
  49. data/lib/judges/commands/push.rb +2 -19
  50. data/lib/judges/commands/test.rb +4 -21
  51. data/lib/judges/commands/trim.rb +2 -19
  52. data/lib/judges/commands/update.rb +25 -49
  53. data/lib/judges/impex.rb +2 -19
  54. data/lib/judges/judge.rb +6 -20
  55. data/lib/judges/judges.rb +2 -19
  56. data/lib/judges/options.rb +2 -19
  57. data/lib/judges/to_rel.rb +2 -19
  58. data/lib/judges.rb +3 -20
  59. data/test/commands/test_eval.rb +3 -20
  60. data/test/commands/test_import.rb +3 -20
  61. data/test/commands/test_inspect.rb +3 -20
  62. data/test/commands/test_join.rb +5 -22
  63. data/test/commands/test_print.rb +8 -25
  64. data/test/commands/test_pull.rb +4 -21
  65. data/test/commands/test_push.rb +3 -20
  66. data/test/commands/test_test.rb +10 -21
  67. data/test/commands/test_trim.rb +2 -19
  68. data/test/commands/test_update.rb +11 -28
  69. data/test/test__helper.rb +2 -19
  70. data/test/test_bin.rb +3 -20
  71. data/test/test_categories.rb +7 -24
  72. data/test/test_impex.rb +2 -19
  73. data/test/test_judge.rb +7 -24
  74. data/test/test_judges.rb +3 -20
  75. data/test/test_options.rb +11 -28
  76. data/test/test_to_rel.rb +2 -19
  77. metadata +9 -8
  78. data/lib/judges/churn.rb +0 -66
  79. data/test/test_churn.rb +0 -46
data/test/test_bin.rb CHANGED
@@ -1,24 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2024-2025 Yegor Bugayenko
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the 'Software'), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in all
13
- # copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- # SOFTWARE.
3
+ # SPDX-FileCopyrightText: Copyright (c) 2024-2025 Yegor Bugayenko
4
+ # SPDX-License-Identifier: MIT
22
5
 
23
6
  require 'minitest/autorun'
24
7
 
@@ -38,6 +21,6 @@ class TestBin < Minitest::Test
38
21
  ensure
39
22
  $stdout = before
40
23
  end
41
- assert(s.include?(Judges::VERSION), s)
24
+ assert_includes(s, Judges::VERSION, s)
42
25
  end
43
26
  end
@@ -1,24 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2024-2025 Yegor Bugayenko
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the 'Software'), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in all
13
- # copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- # SOFTWARE.
3
+ # SPDX-FileCopyrightText: Copyright (c) 2024-2025 Yegor Bugayenko
4
+ # SPDX-License-Identifier: MIT
22
5
 
23
6
  require 'minitest/autorun'
24
7
  require_relative '../lib/judges'
@@ -33,10 +16,10 @@ class TestCategories < Minitest::Test
33
16
  cats = Judges::Categories.new(%w[foo bar], ['bad'])
34
17
  assert(cats.ok?(%w[foo other]))
35
18
  assert(cats.ok?(%w[other more bar]))
36
- assert(!cats.ok?(%w[bad other]))
37
- assert(!cats.ok?(['other']))
38
- assert(!cats.ok?('hey'))
39
- assert(!cats.ok?(nil))
19
+ refute(cats.ok?(%w[bad other]))
20
+ refute(cats.ok?(['other']))
21
+ refute(cats.ok?('hey'))
22
+ refute(cats.ok?(nil))
40
23
  end
41
24
 
42
25
  def test_all_enabled
@@ -45,6 +28,6 @@ class TestCategories < Minitest::Test
45
28
  assert(cats.ok?('hey'))
46
29
  assert(cats.ok?(%w[foo other]))
47
30
  assert(cats.ok?(%w[other more bar]))
48
- assert(!cats.ok?(%w[bad other]))
31
+ refute(cats.ok?(%w[bad other]))
49
32
  end
50
33
  end
data/test/test_impex.rb CHANGED
@@ -1,24 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2024-2025 Yegor Bugayenko
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the 'Software'), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in all
13
- # copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- # SOFTWARE.
3
+ # SPDX-FileCopyrightText: Copyright (c) 2024-2025 Yegor Bugayenko
4
+ # SPDX-License-Identifier: MIT
22
5
 
23
6
  require 'minitest/autorun'
24
7
  require 'tmpdir'
data/test/test_judge.rb CHANGED
@@ -1,24 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2024-2025 Yegor Bugayenko
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the 'Software'), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in all
13
- # copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- # SOFTWARE.
3
+ # SPDX-FileCopyrightText: Copyright (c) 2024-2025 Yegor Bugayenko
4
+ # SPDX-License-Identifier: MIT
22
5
 
23
6
  require 'minitest/autorun'
24
7
  require 'tmpdir'
@@ -81,7 +64,7 @@ class TestJudge < Minitest::Test
81
64
  save_it(File.join(dir, "#{j}.rb"), '$loog.info("judge=" + $judge)')
82
65
  log = Loog::Buffer.new
83
66
  Judges::Judge.new(dir, nil, log).run(Factbase.new, {}, {}, {})
84
- assert(log.to_s.include?("judge=#{j}"))
67
+ assert_includes(log.to_s, "judge=#{j}")
85
68
  end
86
69
  end
87
70
 
@@ -93,12 +76,12 @@ class TestJudge < Minitest::Test
93
76
  log = Loog::Buffer.new
94
77
  time = Time.now
95
78
  Judges::Judge.new(dir, nil, log, start: time).run(Factbase.new, {}, {}, {})
96
- assert(log.to_s.include?("start=#{time}"))
79
+ assert_includes(log.to_s, "start=#{time}")
97
80
  end
98
81
  end
99
82
 
100
83
  def test_with_broken_ruby_syntax
101
- assert_raises do
84
+ assert_raises(StandardError) do
102
85
  Dir.mktmpdir do |d|
103
86
  dir = File.join(d, 'judges')
104
87
  save_it(File.join(dir, "#{File.basename(d)}.rb"), 'this$is$broken$syntax')
@@ -109,7 +92,7 @@ class TestJudge < Minitest::Test
109
92
  end
110
93
 
111
94
  def test_with_runtime_ruby_error
112
- assert_raises do
95
+ assert_raises(StandardError) do
113
96
  Dir.mktmpdir do |d|
114
97
  dir = File.join(d, 'judges')
115
98
  save_it(File.join(dir, "#{File.basename(d)}.rb"), 'a < 1')
@@ -120,7 +103,7 @@ class TestJudge < Minitest::Test
120
103
  end
121
104
 
122
105
  def test_with_standard_error
123
- assert_raises do
106
+ assert_raises(StandardError) do
124
107
  Dir.mktmpdir do |d|
125
108
  dir = File.join(d, 'judges')
126
109
  save_it(File.join(dir, "#{File.basename(d)}.rb"), 'raise "intentional"')
data/test/test_judges.rb CHANGED
@@ -1,24 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2024-2025 Yegor Bugayenko
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the 'Software'), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in all
13
- # copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- # SOFTWARE.
3
+ # SPDX-FileCopyrightText: Copyright (c) 2024-2025 Yegor Bugayenko
4
+ # SPDX-License-Identifier: MIT
22
5
 
23
6
  require 'minitest/autorun'
24
7
  require 'tmpdir'
@@ -73,7 +56,7 @@ class TestJudges < Minitest::Test
73
56
  save_it(File.join(d, 'another/wrong/wrong.rb'), '')
74
57
  save_it(File.join(d, 'bad/hello.rb'), '')
75
58
  list = Judges::Judges.new(d, nil, Loog::NULL).each.to_a
76
- assert(list.empty?)
59
+ assert_empty(list)
77
60
  end
78
61
  end
79
62
  end
data/test/test_options.rb CHANGED
@@ -1,24 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2024-2025 Yegor Bugayenko
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the 'Software'), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in all
13
- # copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- # SOFTWARE.
3
+ # SPDX-FileCopyrightText: Copyright (c) 2024-2025 Yegor Bugayenko
4
+ # SPDX-License-Identifier: MIT
22
5
 
23
6
  require 'minitest/autorun'
24
7
  require_relative '../lib/judges'
@@ -48,20 +31,20 @@ class TestOptions < Minitest::Test
48
31
 
49
32
  def test_with_nil
50
33
  opts = Judges::Options.new(nil)
51
- assert(opts.foo.nil?)
52
- assert(opts.empty?)
34
+ assert_nil(opts.foo)
35
+ assert_empty(opts)
53
36
  end
54
37
 
55
38
  def test_with_empty_string
56
39
  opts = Judges::Options.new(' ')
57
- assert(opts.foo.nil?)
58
- assert(opts.empty?, opts)
40
+ assert_nil(opts.foo)
41
+ assert_empty(opts, opts)
59
42
  end
60
43
 
61
44
  def test_with_empty_strings
62
45
  opts = Judges::Options.new(['', nil])
63
- assert(opts.foo.nil?)
64
- assert(opts.empty?)
46
+ assert_nil(opts.foo)
47
+ assert_empty(opts)
65
48
  end
66
49
 
67
50
  def test_with_string
@@ -74,14 +57,14 @@ class TestOptions < Minitest::Test
74
57
  opts = Judges::Options.new('foo' => 42, 'bar' => 'hello')
75
58
  assert_equal(42, opts.foo)
76
59
  assert_equal('hello', opts.Bar)
77
- assert(opts.xxx.nil?)
60
+ assert_nil(opts.xxx)
78
61
  end
79
62
 
80
63
  def test_converts_to_string
81
64
  opts = Judges::Options.new('foo' => 44, 'bar' => 'long-string-maybe-secret')
82
65
  s = opts.to_s
83
- assert(s.include?('FOO → "44"'), s)
84
- assert(s.include?('"long****************cret"'), s)
66
+ assert_includes(s, 'FOO → "44"', s)
67
+ assert_includes(s, '"long****************cret"', s)
85
68
  end
86
69
 
87
70
  def test_merge
data/test/test_to_rel.rb CHANGED
@@ -1,24 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2024-2025 Yegor Bugayenko
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the 'Software'), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in all
13
- # copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- # SOFTWARE.
3
+ # SPDX-FileCopyrightText: Copyright (c) 2024-2025 Yegor Bugayenko
4
+ # SPDX-License-Identifier: MIT
22
5
 
23
6
  require 'minitest/autorun'
24
7
  require_relative '../lib/judges'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: judges
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.31.0
4
+ version: 0.32.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-01-03 00:00:00.000000000 Z
11
+ date: 2025-02-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: backtrace
@@ -70,16 +70,16 @@ dependencies:
70
70
  name: factbase
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: '0'
75
+ version: 0.7.0
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: '0'
82
+ version: 0.7.0
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: gli
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -239,6 +239,7 @@ files:
239
239
  - ".github/workflows/markdown-lint.yml"
240
240
  - ".github/workflows/pdd.yml"
241
241
  - ".github/workflows/rake.yml"
242
+ - ".github/workflows/reuse.yml"
242
243
  - ".github/workflows/xcop.yml"
243
244
  - ".github/workflows/yamllint.yml"
244
245
  - ".gitignore"
@@ -249,7 +250,9 @@ files:
249
250
  - Gemfile
250
251
  - Gemfile.lock
251
252
  - LICENSE.txt
253
+ - LICENSES/MIT.txt
252
254
  - README.md
255
+ - REUSE.toml
253
256
  - Rakefile
254
257
  - assets/index.xsl
255
258
  - bin/judges
@@ -274,7 +277,6 @@ files:
274
277
  - judges.gemspec
275
278
  - lib/judges.rb
276
279
  - lib/judges/categories.rb
277
- - lib/judges/churn.rb
278
280
  - lib/judges/commands/eval.rb
279
281
  - lib/judges/commands/import.rb
280
282
  - lib/judges/commands/inspect.rb
@@ -304,7 +306,6 @@ files:
304
306
  - test/test__helper.rb
305
307
  - test/test_bin.rb
306
308
  - test/test_categories.rb
307
- - test/test_churn.rb
308
309
  - test/test_impex.rb
309
310
  - test/test_judge.rb
310
311
  - test/test_judges.rb
data/lib/judges/churn.rb DELETED
@@ -1,66 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Copyright (c) 2024-2025 Yegor Bugayenko
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the 'Software'), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in all
13
- # copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- # SOFTWARE.
22
-
23
- require_relative '../judges'
24
-
25
- # How many facts were modified.
26
- # Author:: Yegor Bugayenko (yegor256@gmail.com)
27
- # Copyright:: Copyright (c) 2024-2025 Yegor Bugayenko
28
- # License:: MIT
29
- class Judges::Churn
30
- attr_reader :added, :removed, :errors
31
-
32
- def initialize(added, removed, errors = [])
33
- @added = added
34
- @removed = removed
35
- @errors = errors
36
- end
37
-
38
- def to_s
39
- "#{@added}/#{@removed}#{@errors.empty? ? '' : "/#{@errors.size}"}"
40
- end
41
-
42
- def zero?
43
- @added.zero? && @removed.zero? && @errors.empty?
44
- end
45
-
46
- def <<(error)
47
- @errors << error
48
- nil
49
- end
50
-
51
- def +(other)
52
- if other.is_a?(Judges::Churn)
53
- Judges::Churn.new(@added + other.added, @removed + other.removed, @errors + other.errors)
54
- else
55
- Judges::Churn.new(@added + other, @removed, @errors)
56
- end
57
- end
58
-
59
- def -(other)
60
- if other.is_a?(Judges::Churn)
61
- Judges::Churn.new(@added - other.added, @removed - other.removed, @errors + other.errors)
62
- else
63
- Judges::Churn.new(@added, @removed + other, @errors)
64
- end
65
- end
66
- end
data/test/test_churn.rb DELETED
@@ -1,46 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Copyright (c) 2024-2025 Yegor Bugayenko
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the 'Software'), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in all
13
- # copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- # SOFTWARE.
22
-
23
- require 'minitest/autorun'
24
- require_relative '../lib/judges'
25
- require_relative '../lib/judges/churn'
26
-
27
- # Test.
28
- # Author:: Yegor Bugayenko (yegor256@gmail.com)
29
- # Copyright:: Copyright (c) 2024-2025 Yegor Bugayenko
30
- # License:: MIT
31
- class TestChurn < Minitest::Test
32
- def test_basic
33
- churn = Judges::Churn.new(0, 0)
34
- assert_equal('0/0', churn.to_s)
35
- assert_equal('42/0', (churn + 42).to_s)
36
- assert_equal('0/17', (churn - 17).to_s)
37
- end
38
-
39
- def test_with_errors
40
- churn = Judges::Churn.new(0, 0)
41
- churn << 'oops'
42
- assert_equal('0/0/1', churn.to_s)
43
- assert_equal('42/0/1', (churn + 42).to_s)
44
- assert_equal('0/0/1', (Judges::Churn.new(0, 0) + churn).to_s)
45
- end
46
- end