Skip to content

Commit 22221e1

Browse files
Update rubocop requirement from ~> 1.75.0 to ~> 1.76.1 (#314)
* Update rubocop requirement from ~> 1.75.0 to ~> 1.76.1 Updates the requirements on [rubocop](https://github.com/rubocop/rubocop) to permit the latest version. - [Release notes](https://github.com/rubocop/rubocop/releases) - [Changelog](https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md) - [Commits](rubocop/rubocop@v1.75.0...v1.76.1) --- updated-dependencies: - dependency-name: rubocop dependency-version: 1.76.1 dependency-type: direct:development ... Signed-off-by: dependabot[bot] <[email protected]> * Fix lint --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: なつき <[email protected]>
1 parent e231a76 commit 22221e1

File tree

11 files changed

+42
-42
lines changed

11 files changed

+42
-42
lines changed

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ gemspec
77
group :development do
88
gem 'rake', '>= 13'
99
gem 'rspec', '~> 3.13.0'
10-
gem 'rubocop', '~> 1.75.0'
10+
gem 'rubocop', '~> 1.76.1'
1111
gem 'rubocop-performance', '~> 1.25.0'
1212
gem 'rubocop-rake', '~> 0.7.1'
1313
gem 'rubocop-rspec', '~> 3.6.0'

lib/sass/value.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def to_a
3838
end
3939

4040
# @return [::Boolean]
41-
def to_bool
41+
def to_bool # rubocop:disable Naming/PredicateMethod
4242
true
4343
end
4444

lib/sass/value/color.rb

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -318,21 +318,21 @@ def ==(other)
318318

319319
if legacy?
320320
return false unless other.legacy?
321-
return false unless FuzzyMath.equals_nilable(other.alpha_or_nil, alpha_or_nil)
321+
return false unless FuzzyMath.equals_nilable?(other.alpha_or_nil, alpha_or_nil)
322322

323323
if _space == other._space
324-
FuzzyMath.equals_nilable(other.channel0_or_nil, channel0_or_nil) &&
325-
FuzzyMath.equals_nilable(other.channel1_or_nil, channel1_or_nil) &&
326-
FuzzyMath.equals_nilable(other.channel2_or_nil, channel2_or_nil)
324+
FuzzyMath.equals_nilable?(other.channel0_or_nil, channel0_or_nil) &&
325+
FuzzyMath.equals_nilable?(other.channel1_or_nil, channel1_or_nil) &&
326+
FuzzyMath.equals_nilable?(other.channel2_or_nil, channel2_or_nil)
327327
else
328328
_to_space(Space::RGB) == other._to_space(Space::RGB)
329329
end
330330
else
331331
other._space == _space &&
332-
FuzzyMath.equals_nilable(other.channel0_or_nil, channel0_or_nil) &&
333-
FuzzyMath.equals_nilable(other.channel1_or_nil, channel1_or_nil) &&
334-
FuzzyMath.equals_nilable(other.channel2_or_nil, channel2_or_nil) &&
335-
FuzzyMath.equals_nilable(other.alpha_or_nil, alpha_or_nil)
332+
FuzzyMath.equals_nilable?(other.channel0_or_nil, channel0_or_nil) &&
333+
FuzzyMath.equals_nilable?(other.channel1_or_nil, channel1_or_nil) &&
334+
FuzzyMath.equals_nilable?(other.channel2_or_nil, channel2_or_nil) &&
335+
FuzzyMath.equals_nilable?(other.alpha_or_nil, alpha_or_nil)
336336
end
337337
end
338338

@@ -367,9 +367,9 @@ def channel0_missing?
367367
def channel0_powerless?
368368
case _space
369369
when Space::HSL
370-
FuzzyMath.equals(channel1, 0)
370+
FuzzyMath.equals?(channel1, 0)
371371
when Space::HWB
372-
FuzzyMath.greater_than_or_equals(channel1 + channel2, 100)
372+
FuzzyMath.greater_than_or_equals?(channel1 + channel2, 100)
373373
else
374374
false
375375
end
@@ -398,7 +398,7 @@ def channel2_missing?
398398
def channel2_powerless?
399399
case _space
400400
when Space::LCH, Space::OKLCH
401-
FuzzyMath.equals(channel1, 0)
401+
FuzzyMath.equals?(channel1, 0)
402402
else
403403
false
404404
end
@@ -449,7 +449,7 @@ def _initialize_for_space_internal(space, channel0, channel1, channel2, alpha =
449449
when Space::HSL
450450
_initialize_for_space(
451451
space,
452-
_normalize_hue(channel0, invert: !channel1.nil? && FuzzyMath.less_than(channel1, 0)),
452+
_normalize_hue(channel0, invert: !channel1.nil? && FuzzyMath.less_than?(channel1, 0)),
453453
channel1&.abs,
454454
channel2,
455455
alpha
@@ -461,7 +461,7 @@ def _initialize_for_space_internal(space, channel0, channel1, channel2, alpha =
461461
space,
462462
channel0,
463463
channel1&.abs,
464-
_normalize_hue(channel2, invert: !channel1.nil? && FuzzyMath.less_than(channel1, 0)),
464+
_normalize_hue(channel2, invert: !channel1.nil? && FuzzyMath.less_than?(channel1, 0)),
465465
alpha
466466
)
467467
else
@@ -488,7 +488,7 @@ def _normalize_hue(hue, invert:)
488488
def _is_channel_in_gamut(value, channel)
489489
case channel
490490
when LinearChannel
491-
FuzzyMath.less_than_or_equals(value, channel.max) && FuzzyMath.greater_than_or_equals(value, channel.min)
491+
FuzzyMath.less_than_or_equals?(value, channel.max) && FuzzyMath.greater_than_or_equals?(value, channel.min)
492492
else
493493
true
494494
end
@@ -500,8 +500,8 @@ def _interpolate(other, method, weight: nil)
500500
raise Sass::ScriptError.new("Expected #{wieght} to be within 0 and 1.", 'weight')
501501
end
502502

503-
return other if FuzzyMath.equals(weight, 0)
504-
return self if FuzzyMath.equals(weight, 1)
503+
return other if FuzzyMath.equals?(weight, 0)
504+
return self if FuzzyMath.equals?(weight, 1)
505505

506506
color1 = _to_space(method.space)
507507
color2 = other._to_space(method.space)

lib/sass/value/color/gamut_map_method/local_minde.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def map(color)
2828
hue = original_oklch.send(:channel2_or_nil)
2929
alpha = original_oklch.send(:alpha_or_nil)
3030

31-
if FuzzyMath.greater_than_or_equals(lightness.nil? ? 0 : lightness, 1)
31+
if FuzzyMath.greater_than_or_equals?(lightness.nil? ? 0 : lightness, 1)
3232
if color.legacy?
3333
return Color.send(:_for_space,
3434
Space::RGB, 255, 255, 255, color.send(:alpha_or_nil))
@@ -37,7 +37,7 @@ def map(color)
3737
return Color.send(:for_space_internal,
3838
color.send(:_space), 1, 1, 1, color.send(:alpha_or_nil))
3939
end
40-
elsif FuzzyMath.less_than_or_equals(lightness.nil? ? 0 : lightness, 0)
40+
elsif FuzzyMath.less_than_or_equals?(lightness.nil? ? 0 : lightness, 0)
4141
return Color.send(:_for_space,
4242
Space::RGB, 0, 0, 0, color.send(:alpha_or_nil))
4343
.send(:_to_space, color.send(:_space))

lib/sass/value/color/space/lab.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def convert(dest, lightness, a, b, alpha, # rubocop:disable Naming/MethodParamet
2424
missing_chroma: false, missing_hue: false)
2525
case dest
2626
when LAB
27-
powerless_ab = lightness.nil? || FuzzyMath.equals(lightness, 0)
27+
powerless_ab = lightness.nil? || FuzzyMath.equals?(lightness, 0)
2828
Color.send(
2929
:_for_space,
3030
dest,

lib/sass/value/color/space/srgb.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def convert(dest, red, green, blue, alpha,
5555
Color.send(
5656
:for_space_internal,
5757
dest,
58-
missing_hue || FuzzyMath.equals(saturation, 0) ? nil : hue % 360,
58+
missing_hue || FuzzyMath.equals?(saturation, 0) ? nil : hue % 360,
5959
missing_chroma ? nil : saturation,
6060
missing_lightness ? nil : lightness * 100,
6161
alpha
@@ -67,7 +67,7 @@ def convert(dest, red, green, blue, alpha,
6767
Color.send(
6868
:for_space_internal,
6969
dest,
70-
missing_hue || FuzzyMath.greater_than_or_equals(whiteness + blackness, 100) ? nil : hue % 360,
70+
missing_hue || FuzzyMath.greater_than_or_equals?(whiteness + blackness, 100) ? nil : hue % 360,
7171
whiteness,
7272
blackness,
7373
alpha

lib/sass/value/color/space/utils.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def srgb_and_display_p3_from_linear(channel)
6262
def lab_to_lch(dest, lightness, a, b, alpha, # rubocop:disable Naming/MethodParameterName
6363
missing_chroma: false, missing_hue: false)
6464
chroma = Math.sqrt(((a.nil? ? 0 : a)**2) + ((b.nil? ? 0 : b)**2))
65-
hue = if missing_hue || FuzzyMath.equals(chroma, 0)
65+
hue = if missing_hue || FuzzyMath.equals?(chroma, 0)
6666
nil
6767
else
6868
Math.atan2(b.nil? ? 0 : b, a.nil? ? 0 : a) * 180 / Math::PI

lib/sass/value/fuzzy_math.rb

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ module FuzzyMath
1212

1313
module_function
1414

15-
def equals(number1, number2)
15+
def equals?(number1, number2)
1616
return true if number1 == number2
1717

1818
(number1 - number2).abs <= EPSILON &&
1919
(number1 * INVERSE_EPSILON).round ==
2020
(number2 * INVERSE_EPSILON).round
2121
end
2222

23-
def equals_nilable(number1, number2)
23+
def equals_nilable?(number1, number2)
2424
return true if number1 == number2
2525
return false if number1.nil? || number2.nil?
2626

@@ -29,35 +29,35 @@ def equals_nilable(number1, number2)
2929
(number2 * INVERSE_EPSILON).round
3030
end
3131

32-
def less_than(number1, number2)
33-
number1 < number2 && !equals(number1, number2)
32+
def less_than?(number1, number2)
33+
number1 < number2 && !equals?(number1, number2)
3434
end
3535

36-
def less_than_or_equals(number1, number2)
37-
number1 < number2 || equals(number1, number2)
36+
def less_than_or_equals?(number1, number2)
37+
number1 < number2 || equals?(number1, number2)
3838
end
3939

40-
def greater_than(number1, number2)
41-
number1 > number2 && !equals(number1, number2)
40+
def greater_than?(number1, number2)
41+
number1 > number2 && !equals?(number1, number2)
4242
end
4343

44-
def greater_than_or_equals(number1, number2)
45-
number1 > number2 || equals(number1, number2)
44+
def greater_than_or_equals?(number1, number2)
45+
number1 > number2 || equals?(number1, number2)
4646
end
4747

4848
def integer?(number)
4949
return false unless number.finite?
5050

51-
equals(number, number.round)
51+
equals?(number, number.round)
5252
end
5353

5454
def to_i(number)
5555
integer?(number) ? number.round : nil
5656
end
5757

5858
def between(number, min, max)
59-
return min if equals(number, min)
60-
return max if equals(number, max)
59+
return min if equals?(number, min)
60+
return max if equals?(number, max)
6161
return number if number > min && number < max
6262

6363
nil

lib/sass/value/null.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def hash
3131
end
3232

3333
# @return [::Boolean]
34-
def to_bool
34+
def to_bool # rubocop:disable Naming/PredicateMethod
3535
false
3636
end
3737

lib/sass/value/number.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,14 @@ def ==(other)
8080
return false if numerator_units.length != other.numerator_units.length ||
8181
denominator_units.length != other.denominator_units.length
8282

83-
return FuzzyMath.equals(value, other.value) if unitless?
83+
return FuzzyMath.equals?(value, other.value) if unitless?
8484

8585
if Unit.canonicalize_units(numerator_units) != Unit.canonicalize_units(other.numerator_units) &&
8686
Unit.canonicalize_units(denominator_units) != Unit.canonicalize_units(other.denominator_units)
8787
return false
8888
end
8989

90-
FuzzyMath.equals(
90+
FuzzyMath.equals?(
9191
value *
9292
Unit.canonical_multiplier(numerator_units) /
9393
Unit.canonical_multiplier(denominator_units),
@@ -306,7 +306,7 @@ def coerce_or_convert_value(new_numerator_units, new_denominator_units,
306306

307307
unit_length = new_numerator_units.length + new_denominator_units.length
308308
units = unit_string(new_numerator_units, new_denominator_units)
309-
Sass::ScriptError.new("Expected #{self} to have unit#{unit_length > 1 ? 's' : ''} #{units}", name)
309+
Sass::ScriptError.new("Expected #{self} to have unit#{'s' if unit_length > 1} #{units}", name)
310310
}
311311

312312
result = value

0 commit comments

Comments
 (0)