Skip to content

Commit ae2f3c5

Browse files
authored
Lint: Fix indentation (#1184)
1 parent 02fe18d commit ae2f3c5

File tree

8 files changed

+118
-156
lines changed

8 files changed

+118
-156
lines changed

.rubocop_todo.yml

Lines changed: 0 additions & 43 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/money/bank/variable_exchange.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,8 +264,8 @@ def import_rates(format, s, opts = {})
264264

265265
if format == :ruby
266266
warn '[WARNING] Using :ruby format when importing rates is potentially unsafe and ' \
267-
'might lead to remote code execution via Marshal.load deserializer. Consider using ' \
268-
'safe alternatives such as :json and :yaml.'
267+
'might lead to remote code execution via Marshal.load deserializer. Consider using ' \
268+
'safe alternatives such as :json and :yaml.'
269269
end
270270

271271
store.transaction do

lib/money/money.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def to_nearest_cash_value
9191
smallest_denomination = as_d(self.currency.smallest_denomination)
9292
rounded_value =
9393
(fractional / smallest_denomination)
94-
.round(0, self.class.rounding_mode) * smallest_denomination
94+
.round(0, self.class.rounding_mode) * smallest_denomination
9595

9696
dup_with(fractional: return_value(rounded_value))
9797
end

lib/money/money/arithmetic.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ def eql?(other_money)
4141
if other_money.is_a?(Money)
4242
if !Money.strict_eql_compare && fractional == 0 && other_money.fractional == 0
4343
warn "[DEPRECATION] Comparing 0 #{currency} with 0 " \
44-
"#{other_money.currency} using `#eql?` will return false in " \
45-
"future versions of Money. Opt-in to the new behavior by " \
46-
"setting `Money.strict_eql_compare = true`."
44+
"#{other_money.currency} using `#eql?` will return false in " \
45+
"future versions of Money. Opt-in to the new behavior by " \
46+
"setting `Money.strict_eql_compare = true`."
4747
return true
4848
end
4949

spec/currency_spec.rb

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,14 @@ def to_s
7777
expect(described_class.find_by_iso_numeric(250)).to be_nil
7878

7979
described_class.register(
80-
priority: 1,
81-
iso_code: "FRF",
82-
iso_numeric: "250",
83-
name: "French Francs",
84-
symbol: "FR",
85-
subunit: "Centimes",
86-
subunit_to_unit: 100,
87-
decimal_mark: ",",
80+
priority: 1,
81+
iso_code: "FRF",
82+
iso_numeric: "250",
83+
name: "French Francs",
84+
symbol: "FR",
85+
subunit: "Centimes",
86+
subunit_to_unit: 100,
87+
decimal_mark: ",",
8888
thousands_separator: " ",
8989
)
9090

@@ -94,12 +94,12 @@ def to_s
9494

9595
it "returns nil for unregistered currencies after cache invalidation" do
9696
described_class.register(
97-
priority: 1,
98-
iso_code: "FRF",
99-
iso_numeric: "250",
100-
name: "French Francs",
101-
symbol: "FR",
102-
subunit: "Centimes",
97+
priority: 1,
98+
iso_code: "FRF",
99+
iso_numeric: "250",
100+
name: "French Francs",
101+
symbol: "FR",
102+
subunit: "Centimes",
103103
subunit_to_unit: 100,
104104
)
105105

@@ -472,13 +472,13 @@ def to_s
472472
cad = described_class.find(:cad)
473473

474474
described_class.register(
475-
:priority => 100,
476-
:iso_code => cad.iso_code,
477-
:name => cad.name,
478-
:subunit => cad.subunit,
479-
:subunit_to_unit => cad.subunit_to_unit,
475+
:priority => 100,
476+
:iso_code => cad.iso_code,
477+
:name => cad.name,
478+
:subunit => cad.subunit,
479+
:subunit_to_unit => cad.subunit_to_unit,
480480
:thousands_separator => cad.thousands_separator,
481-
:decimal_mark => modified_mark,
481+
:decimal_mark => modified_mark,
482482
)
483483
end
484484

spec/money/allocation_spec.rb

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,13 @@
4949
# Rounding due to inconsistent BigDecimal size in ruby compared to jruby. In reality the
5050
# first 2 elements will look like the last one with a '5' at the end, compensating for a
5151
# missing fraction
52-
expect(parts.map { |x| x.round(10) }).to eq([
53-
BigDecimal('33.3333333333'),
54-
BigDecimal('33.3333333333'),
55-
BigDecimal('33.3333333333'),
56-
])
52+
expect(parts.map { |x| x.round(10) }).to eq(
53+
[
54+
BigDecimal('33.3333333333'),
55+
BigDecimal('33.3333333333'),
56+
BigDecimal('33.3333333333'),
57+
],
58+
)
5759
expect(parts.inject(0, :+)).to eq(amount)
5860
end
5961
end
@@ -123,11 +125,13 @@
123125
# Rounding due to inconsistent BigDecimal size in ruby compared to jruby. In reality the
124126
# first 2 elements will look like the last one with a '5' at the end, compensating for a
125127
# missing fraction
126-
expect(parts.map { |x| x.round(10) }).to eq([
127-
BigDecimal('33.3333333333'),
128-
BigDecimal('33.3333333333'),
129-
BigDecimal('33.3333333333'),
130-
])
128+
expect(parts.map { |x| x.round(10) }).to eq(
129+
[
130+
BigDecimal('33.3333333333'),
131+
BigDecimal('33.3333333333'),
132+
BigDecimal('33.3333333333'),
133+
],
134+
)
131135
expect(parts.inject(0, :+)).to eq(amount)
132136
end
133137
end

spec/money/arithmetic_spec.rb

Lines changed: 56 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -469,10 +469,10 @@
469469
describe "#div" do
470470
it "divides Money by Integer and returns Money" do
471471
ts = [
472-
{ a: Money.new(13, :USD), b: 4, c: Money.new(3, :USD) },
473-
{ a: Money.new(13, :USD), b: -4, c: Money.new(-3, :USD) },
474-
{ a: Money.new(-13, :USD), b: 4, c: Money.new(-3, :USD) },
475-
{ a: Money.new(-13, :USD), b: -4, c: Money.new(3, :USD) },
472+
{ a: Money.new(13, :USD), b: 4, c: Money.new(3, :USD) },
473+
{ a: Money.new(13, :USD), b: -4, c: Money.new(-3, :USD) },
474+
{ a: Money.new(-13, :USD), b: 4, c: Money.new(-3, :USD) },
475+
{ a: Money.new(-13, :USD), b: -4, c: Money.new(3, :USD) },
476476
]
477477
ts.each do |t|
478478
expect(t[:a].div(t[:b])).to eq t[:c]
@@ -481,10 +481,10 @@
481481

482482
it "divides Money by Money (same currency) and returns Float" do
483483
ts = [
484-
{ a: Money.new(13, :USD), b: Money.new(4, :USD), c: 3.25 },
485-
{ a: Money.new(13, :USD), b: Money.new(-4, :USD), c: -3.25 },
486-
{ a: Money.new(-13, :USD), b: Money.new(4, :USD), c: -3.25 },
487-
{ a: Money.new(-13, :USD), b: Money.new(-4, :USD), c: 3.25 },
484+
{ a: Money.new(13, :USD), b: Money.new(4, :USD), c: 3.25 },
485+
{ a: Money.new(13, :USD), b: Money.new(-4, :USD), c: -3.25 },
486+
{ a: Money.new(-13, :USD), b: Money.new(4, :USD), c: -3.25 },
487+
{ a: Money.new(-13, :USD), b: Money.new(-4, :USD), c: 3.25 },
488488
]
489489
ts.each do |t|
490490
expect(t[:a].div(t[:b])).to eq t[:c]
@@ -493,10 +493,10 @@
493493

494494
it "divides Money by Money (different currency) and returns Float" do
495495
ts = [
496-
{ a: Money.new(13, :USD), b: Money.new(4, :EUR), c: 1.625 },
497-
{ a: Money.new(13, :USD), b: Money.new(-4, :EUR), c: -1.625 },
498-
{ a: Money.new(-13, :USD), b: Money.new(4, :EUR), c: -1.625 },
499-
{ a: Money.new(-13, :USD), b: Money.new(-4, :EUR), c: 1.625 },
496+
{ a: Money.new(13, :USD), b: Money.new(4, :EUR), c: 1.625 },
497+
{ a: Money.new(13, :USD), b: Money.new(-4, :EUR), c: -1.625 },
498+
{ a: Money.new(-13, :USD), b: Money.new(4, :EUR), c: -1.625 },
499+
{ a: Money.new(-13, :USD), b: Money.new(-4, :EUR), c: 1.625 },
500500
]
501501
ts.each do |t|
502502
expect(t[:b]).to receive(:exchange_to).once.with(t[:a].currency).and_return(Money.new(t[:b].cents * 2, :USD))
@@ -522,10 +522,10 @@
522522
describe "#divmod" do
523523
it "calculates division and modulo with Integer" do
524524
ts = [
525-
{ a: Money.new(13, :USD), b: 4, c: [Money.new(3, :USD), Money.new(1, :USD)] },
526-
{ a: Money.new(13, :USD), b: -4, c: [Money.new(-4, :USD), Money.new(-3, :USD)] },
527-
{ a: Money.new(-13, :USD), b: 4, c: [Money.new(-4, :USD), Money.new(3, :USD)] },
528-
{ a: Money.new(-13, :USD), b: -4, c: [Money.new(3, :USD), Money.new(-1, :USD)] },
525+
{ a: Money.new(13, :USD), b: 4, c: [Money.new(3, :USD), Money.new(1, :USD)] },
526+
{ a: Money.new(13, :USD), b: -4, c: [Money.new(-4, :USD), Money.new(-3, :USD)] },
527+
{ a: Money.new(-13, :USD), b: 4, c: [Money.new(-4, :USD), Money.new(3, :USD)] },
528+
{ a: Money.new(-13, :USD), b: -4, c: [Money.new(3, :USD), Money.new(-1, :USD)] },
529529
]
530530
ts.each do |t|
531531
expect(t[:a].divmod(t[:b])).to eq t[:c]
@@ -534,10 +534,10 @@
534534

535535
it "calculates division and modulo with Money (same currency)" do
536536
ts = [
537-
{ a: Money.new(13, :USD), b: Money.new(4, :USD), c: [3, Money.new(1, :USD)] },
538-
{ a: Money.new(13, :USD), b: Money.new(-4, :USD), c: [-4, Money.new(-3, :USD)] },
539-
{ a: Money.new(-13, :USD), b: Money.new(4, :USD), c: [-4, Money.new(3, :USD)] },
540-
{ a: Money.new(-13, :USD), b: Money.new(-4, :USD), c: [3, Money.new(-1, :USD)] },
537+
{ a: Money.new(13, :USD), b: Money.new(4, :USD), c: [3, Money.new(1, :USD)] },
538+
{ a: Money.new(13, :USD), b: Money.new(-4, :USD), c: [-4, Money.new(-3, :USD)] },
539+
{ a: Money.new(-13, :USD), b: Money.new(4, :USD), c: [-4, Money.new(3, :USD)] },
540+
{ a: Money.new(-13, :USD), b: Money.new(-4, :USD), c: [3, Money.new(-1, :USD)] },
541541
]
542542
ts.each do |t|
543543
expect(t[:a].divmod(t[:b])).to eq t[:c]
@@ -546,10 +546,10 @@
546546

547547
it "calculates division and modulo with Money (different currency)" do
548548
ts = [
549-
{ a: Money.new(13, :USD), b: Money.new(4, :EUR), c: [1, Money.new(5, :USD)] },
550-
{ a: Money.new(13, :USD), b: Money.new(-4, :EUR), c: [-2, Money.new(-3, :USD)] },
551-
{ a: Money.new(-13, :USD), b: Money.new(4, :EUR), c: [-2, Money.new(3, :USD)] },
552-
{ a: Money.new(-13, :USD), b: Money.new(-4, :EUR), c: [1, Money.new(-5, :USD)] },
549+
{ a: Money.new(13, :USD), b: Money.new(4, :EUR), c: [1, Money.new(5, :USD)] },
550+
{ a: Money.new(13, :USD), b: Money.new(-4, :EUR), c: [-2, Money.new(-3, :USD)] },
551+
{ a: Money.new(-13, :USD), b: Money.new(4, :EUR), c: [-2, Money.new(3, :USD)] },
552+
{ a: Money.new(-13, :USD), b: Money.new(-4, :EUR), c: [1, Money.new(-5, :USD)] },
553553
]
554554
ts.each do |t|
555555
expect(t[:b]).to receive(:exchange_to).once.with(t[:a].currency).and_return(Money.new(t[:b].cents * 2, :USD))
@@ -560,10 +560,10 @@
560560
context "with infinite_precision", :default_infinite_precision_true do
561561
it "uses BigDecimal division" do
562562
ts = [
563-
{ a: Money.new(13, :USD), b: 4, c: [Money.new(3, :USD), Money.new(1, :USD)] },
564-
{ a: Money.new(13, :USD), b: -4, c: [Money.new(-4, :USD), Money.new(-3, :USD)] },
565-
{ a: Money.new(-13, :USD), b: 4, c: [Money.new(-4, :USD), Money.new(3, :USD)] },
566-
{ a: Money.new(-13, :USD), b: -4, c: [Money.new(3, :USD), Money.new(-1, :USD)] },
563+
{ a: Money.new(13, :USD), b: 4, c: [Money.new(3, :USD), Money.new(1, :USD)] },
564+
{ a: Money.new(13, :USD), b: -4, c: [Money.new(-4, :USD), Money.new(-3, :USD)] },
565+
{ a: Money.new(-13, :USD), b: 4, c: [Money.new(-4, :USD), Money.new(3, :USD)] },
566+
{ a: Money.new(-13, :USD), b: -4, c: [Money.new(3, :USD), Money.new(-1, :USD)] },
567567
]
568568
ts.each do |t|
569569
expect(t[:a].divmod(t[:b])).to eq t[:c]
@@ -610,10 +610,10 @@
610610
describe "#modulo" do
611611
it "calculates modulo with Integer" do
612612
ts = [
613-
{ a: Money.new(13, :USD), b: 4, c: Money.new(1, :USD) },
614-
{ a: Money.new(13, :USD), b: -4, c: Money.new(-3, :USD) },
615-
{ a: Money.new(-13, :USD), b: 4, c: Money.new(3, :USD) },
616-
{ a: Money.new(-13, :USD), b: -4, c: Money.new(-1, :USD) },
613+
{ a: Money.new(13, :USD), b: 4, c: Money.new(1, :USD) },
614+
{ a: Money.new(13, :USD), b: -4, c: Money.new(-3, :USD) },
615+
{ a: Money.new(-13, :USD), b: 4, c: Money.new(3, :USD) },
616+
{ a: Money.new(-13, :USD), b: -4, c: Money.new(-1, :USD) },
617617
]
618618
ts.each do |t|
619619
expect(t[:a].modulo(t[:b])).to eq t[:c]
@@ -622,10 +622,10 @@
622622

623623
it "calculates modulo with Money (same currency)" do
624624
ts = [
625-
{ a: Money.new(13, :USD), b: Money.new(4, :USD), c: Money.new(1, :USD) },
626-
{ a: Money.new(13, :USD), b: Money.new(-4, :USD), c: Money.new(-3, :USD) },
627-
{ a: Money.new(-13, :USD), b: Money.new(4, :USD), c: Money.new(3, :USD) },
628-
{ a: Money.new(-13, :USD), b: Money.new(-4, :USD), c: Money.new(-1, :USD) },
625+
{ a: Money.new(13, :USD), b: Money.new(4, :USD), c: Money.new(1, :USD) },
626+
{ a: Money.new(13, :USD), b: Money.new(-4, :USD), c: Money.new(-3, :USD) },
627+
{ a: Money.new(-13, :USD), b: Money.new(4, :USD), c: Money.new(3, :USD) },
628+
{ a: Money.new(-13, :USD), b: Money.new(-4, :USD), c: Money.new(-1, :USD) },
629629
]
630630
ts.each do |t|
631631
expect(t[:a].modulo(t[:b])).to eq t[:c]
@@ -634,10 +634,10 @@
634634

635635
it "calculates modulo with Money (different currency)" do
636636
ts = [
637-
{ a: Money.new(13, :USD), b: Money.new(4, :EUR), c: Money.new(5, :USD) },
638-
{ a: Money.new(13, :USD), b: Money.new(-4, :EUR), c: Money.new(-3, :USD) },
639-
{ a: Money.new(-13, :USD), b: Money.new(4, :EUR), c: Money.new(3, :USD) },
640-
{ a: Money.new(-13, :USD), b: Money.new(-4, :EUR), c: Money.new(-5, :USD) },
637+
{ a: Money.new(13, :USD), b: Money.new(4, :EUR), c: Money.new(5, :USD) },
638+
{ a: Money.new(13, :USD), b: Money.new(-4, :EUR), c: Money.new(-3, :USD) },
639+
{ a: Money.new(-13, :USD), b: Money.new(4, :EUR), c: Money.new(3, :USD) },
640+
{ a: Money.new(-13, :USD), b: Money.new(-4, :EUR), c: Money.new(-5, :USD) },
641641
]
642642
ts.each do |t|
643643
expect(t[:b]).to receive(:exchange_to).once.with(t[:a].currency).and_return(Money.new(t[:b].cents * 2, :USD))
@@ -649,10 +649,10 @@
649649
describe "#%" do
650650
it "calculates modulo with Integer" do
651651
ts = [
652-
{ a: Money.new(13, :USD), b: 4, c: Money.new(1, :USD) },
653-
{ a: Money.new(13, :USD), b: -4, c: Money.new(-3, :USD) },
654-
{ a: Money.new(-13, :USD), b: 4, c: Money.new(3, :USD) },
655-
{ a: Money.new(-13, :USD), b: -4, c: Money.new(-1, :USD) },
652+
{ a: Money.new(13, :USD), b: 4, c: Money.new(1, :USD) },
653+
{ a: Money.new(13, :USD), b: -4, c: Money.new(-3, :USD) },
654+
{ a: Money.new(-13, :USD), b: 4, c: Money.new(3, :USD) },
655+
{ a: Money.new(-13, :USD), b: -4, c: Money.new(-1, :USD) },
656656
]
657657
ts.each do |t|
658658
expect(t[:a] % t[:b]).to eq t[:c]
@@ -661,10 +661,10 @@
661661

662662
it "calculates modulo with Money (same currency)" do
663663
ts = [
664-
{ a: Money.new(13, :USD), b: Money.new(4, :USD), c: Money.new(1, :USD) },
665-
{ a: Money.new(13, :USD), b: Money.new(-4, :USD), c: Money.new(-3, :USD) },
666-
{ a: Money.new(-13, :USD), b: Money.new(4, :USD), c: Money.new(3, :USD) },
667-
{ a: Money.new(-13, :USD), b: Money.new(-4, :USD), c: Money.new(-1, :USD) },
664+
{ a: Money.new(13, :USD), b: Money.new(4, :USD), c: Money.new(1, :USD) },
665+
{ a: Money.new(13, :USD), b: Money.new(-4, :USD), c: Money.new(-3, :USD) },
666+
{ a: Money.new(-13, :USD), b: Money.new(4, :USD), c: Money.new(3, :USD) },
667+
{ a: Money.new(-13, :USD), b: Money.new(-4, :USD), c: Money.new(-1, :USD) },
668668
]
669669
ts.each do |t|
670670
expect(t[:a] % t[:b]).to eq t[:c]
@@ -673,10 +673,10 @@
673673

674674
it "calculates modulo with Money (different currency)" do
675675
ts = [
676-
{ a: Money.new(13, :USD), b: Money.new(4, :EUR), c: Money.new(5, :USD) },
677-
{ a: Money.new(13, :USD), b: Money.new(-4, :EUR), c: Money.new(-3, :USD) },
678-
{ a: Money.new(-13, :USD), b: Money.new(4, :EUR), c: Money.new(3, :USD) },
679-
{ a: Money.new(-13, :USD), b: Money.new(-4, :EUR), c: Money.new(-5, :USD) },
676+
{ a: Money.new(13, :USD), b: Money.new(4, :EUR), c: Money.new(5, :USD) },
677+
{ a: Money.new(13, :USD), b: Money.new(-4, :EUR), c: Money.new(-3, :USD) },
678+
{ a: Money.new(-13, :USD), b: Money.new(4, :EUR), c: Money.new(3, :USD) },
679+
{ a: Money.new(-13, :USD), b: Money.new(-4, :EUR), c: Money.new(-5, :USD) },
680680
]
681681
ts.each do |t|
682682
expect(t[:b]).to receive(:exchange_to).once.with(t[:a].currency).and_return(Money.new(t[:b].cents * 2, :USD))
@@ -688,10 +688,10 @@
688688
describe "#remainder" do
689689
it "calculates remainder with Integer" do
690690
ts = [
691-
{ a: Money.new(13, :USD), b: 4, c: Money.new(1, :USD) },
692-
{ a: Money.new(13, :USD), b: -4, c: Money.new(1, :USD) },
693-
{ a: Money.new(-13, :USD), b: 4, c: Money.new(-1, :USD) },
694-
{ a: Money.new(-13, :USD), b: -4, c: Money.new(-1, :USD) },
691+
{ a: Money.new(13, :USD), b: 4, c: Money.new(1, :USD) },
692+
{ a: Money.new(13, :USD), b: -4, c: Money.new(1, :USD) },
693+
{ a: Money.new(-13, :USD), b: 4, c: Money.new(-1, :USD) },
694+
{ a: Money.new(-13, :USD), b: -4, c: Money.new(-1, :USD) },
695695
]
696696
ts.each do |t|
697697
expect(t[:a].remainder(t[:b])).to eq t[:c]

0 commit comments

Comments
 (0)