Skip to content

Commit 9568a7a

Browse files
committedJan 28, 2025··
#194 minitest check
1 parent 3962d12 commit 9568a7a

File tree

6 files changed

+25
-6
lines changed

6 files changed

+25
-6
lines changed
 

‎.rubocop.yml

+5
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,12 @@ AllCops:
2727
TargetRubyVersion: 3.2
2828
SuggestExtensions: false
2929
NewCops: enable
30+
require:
31+
- rubocop-minitest
32+
- rubocop-performance
3033

34+
Minitest/EmptyLineBeforeAssertionMethods:
35+
Enabled: false
3136
Naming/FileName:
3237
Regex: '^[a-z\-._]*$'
3338
Style/GlobalVars:

‎Gemfile

+3
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ gem 'qbash', '0.3.0', require: false
3232
gem 'rake', '13.2.1', require: false
3333
gem 'redcarpet', '~>3.5'
3434
gem 'rubocop', '1.69.2', require: false
35+
gem 'rubocop-minitest', '0.36.0', require: false
36+
gem 'rubocop-performance', '1.23.1', require: false
37+
gem 'rubocop-rspec', '3.4.0', require: false
3538
gem 'simplecov', '0.22.0', require: false
3639
gem 'simplecov-cobertura', '2.1.0', require: false
3740
gem 'w3c_validators', '1.3.7', require: false

‎Gemfile.lock

+11
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,14 @@ GEM
195195
unicode-display_width (>= 2.4.0, < 4.0)
196196
rubocop-ast (1.38.0)
197197
parser (>= 3.3.1.0)
198+
rubocop-minitest (0.36.0)
199+
rubocop (>= 1.61, < 2.0)
200+
rubocop-ast (>= 1.31.1, < 2.0)
201+
rubocop-performance (1.23.1)
202+
rubocop (>= 1.48.1, < 2.0)
203+
rubocop-ast (>= 1.31.1, < 2.0)
204+
rubocop-rspec (3.4.0)
205+
rubocop (~> 1.61)
198206
ruby-progressbar (1.13.0)
199207
sawyer (0.9.2)
200208
addressable (>= 2.3.5)
@@ -257,6 +265,9 @@ DEPENDENCIES
257265
rake (= 13.2.1)
258266
redcarpet (~> 3.5)
259267
rubocop (= 1.69.2)
268+
rubocop-minitest (= 0.36.0)
269+
rubocop-performance (= 1.23.1)
270+
rubocop-rspec (= 3.4.0)
260271
simplecov (= 0.22.0)
261272
simplecov-cobertura (= 2.1.0)
262273
w3c_validators (= 1.3.7)

‎judges/normalize-metrics/normalize-metrics.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def fits(name)
3434
%w[quantity-of-deliverables quality-of-service].each do |qo|
3535
facts = Fbe.fb.query("(eq what '#{qo}')").each.to_a
3636

37-
facts.sort! { |a, b| a.when <=> b.when }
37+
facts.sort_by!(&:when)
3838
next if facts.empty?
3939

4040
start = {}
@@ -59,7 +59,7 @@ def fits(name)
5959
s = start[prop]
6060
diff = v - s
6161
diff /= start[prop] unless start[prop].zero?
62-
f.send("n_#{prop}=", diff)
62+
f.send(:"n_#{prop}=", diff)
6363
end
6464
end
6565
end

‎test/pages/test_eva_summary.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def test_template_long
4444
</fb>
4545
'
4646
)
47-
assert(!xml.xpath('/p/text()').to_s.start_with?('Not enough data'), xml)
47+
refute(xml.xpath('/p/text()').to_s.start_with?('Not enough data'))
4848
end
4949

5050
def test_template_short
@@ -58,6 +58,6 @@ def test_template_short
5858
</fb>
5959
'
6060
)
61-
assert(xml.xpath('/p/text()').to_s.start_with?('Not enough data'), xml)
61+
assert(xml.xpath('/p/text()').to_s.start_with?('Not enough data'))
6262
end
6363
end

‎test/pages/test_vitals.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ def test_validate_html
4747
rescue StandardError => e
4848
raise "#{doc}\n\n#{e}"
4949
end
50-
assert(xml.errors.empty?, xml)
51-
assert(!xml.xpath('/html').empty?, xml)
50+
assert_empty(xml.errors, xml)
51+
refute_empty(xml.xpath('/html'), xml)
5252
# WebMock.enable_net_connect!
5353
# v = W3CValidators::NuValidator.new.validate_file(html)
5454
# assert(v.errors.empty?, "#{doc}\n\n#{v.errors.join('; ')}")

0 commit comments

Comments
 (0)
Please sign in to comment.