Skip to content

Commit

Permalink
Merge pull request #2613 from hexdevs/bump-rubocop-to-1.38.0
Browse files Browse the repository at this point in the history
Bump rubocop to 1.38.0
  • Loading branch information
vbrazo authored Nov 3, 2022
2 parents 32fcc14 + 945d79a commit c4f3eaf
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ GEM
rake (13.0.6)
regexp_parser (2.6.0)
rexml (3.2.5)
rubocop (1.37.1)
rubocop (1.38.0)
json (~> 2.3)
parallel (~> 1.10)
parser (>= 3.1.2.1)
Expand Down Expand Up @@ -66,7 +66,7 @@ DEPENDENCIES
minitest (= 5.16.3)
pry (= 0.14.1)
rake (= 13.0.6)
rubocop (= 1.37.1)
rubocop (= 1.38.0)
rubocop-minitest (= 0.23.0)
rubocop-rake (= 0.6.0)
simplecov (= 0.21)
Expand Down
2 changes: 1 addition & 1 deletion faker.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Gem::Specification.new do |spec|
spec.add_development_dependency('minitest', '5.16.3')
spec.add_development_dependency('pry', '0.14.1')
spec.add_development_dependency('rake', '13.0.6')
spec.add_development_dependency('rubocop', '1.37.1')
spec.add_development_dependency('rubocop', '1.38.0')
spec.add_development_dependency('rubocop-minitest', '0.23.0')
spec.add_development_dependency('rubocop-rake', '0.6.0')
spec.add_development_dependency('simplecov', '0.21')
Expand Down
18 changes: 9 additions & 9 deletions test/faker/default/test_faker_company.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def test_profession
def test_polish_taxpayer_identification_number
number = @tester.polish_taxpayer_identification_number
control_sum = 0
[6, 5, 7, 2, 3, 4, 5, 6, 7].each_with_index do |control, index|
[6, 5, 7, 2, 3, 4, 5, 6, 7].each.with_index do |control, index|
control_sum += control * number[index].to_i
end

Expand All @@ -102,7 +102,7 @@ def test_polish_register_of_national_economy
# 9 length
number = @tester.polish_register_of_national_economy
control_sum = 0
[8, 9, 2, 3, 4, 5, 6, 7].each_with_index do |control, index|
[8, 9, 2, 3, 4, 5, 6, 7].each.with_index do |control, index|
control_sum += control * number[index].to_i
end
control_number = control_sum.modulo(11) == 10 ? 0 : control_sum.modulo(11)
Expand All @@ -111,7 +111,7 @@ def test_polish_register_of_national_economy
# 14 length
number = @tester.polish_register_of_national_economy(length: 14)
control_sum = 0
[2, 4, 8, 5, 0, 9, 7, 3, 6, 1, 2, 4, 8].each_with_index do |control, index|
[2, 4, 8, 5, 0, 9, 7, 3, 6, 1, 2, 4, 8].each.with_index do |control, index|
control_sum += control * number[index].to_i
end
control_number = control_sum.modulo(11) == 10 ? 0 : control_sum.modulo(11)
Expand Down Expand Up @@ -172,7 +172,7 @@ def test_brazilian_company_number

assert_match(/^\d{14}$/, sample)

digit_sum = sample[0..11].chars.each_with_index.inject(0) do |acc, (digit, i)|
digit_sum = sample[0..11].chars.each.with_index.inject(0) do |acc, (digit, i)|
factor = 2 + (3 - i) % 8
acc + digit.to_i * factor
end
Expand All @@ -181,7 +181,7 @@ def test_brazilian_company_number

assert_equal sample[12], first_digit

digit_sum = sample[0..12].chars.each_with_index.inject(0) do |acc, (digit, i)|
digit_sum = sample[0..12].chars.each.with_index.inject(0) do |acc, (digit, i)|
factor = 2 + (4 - i) % 8
acc + digit.to_i * factor
end
Expand Down Expand Up @@ -252,7 +252,7 @@ def czech_o_n_checksum(org_no)
weights = [8, 7, 6, 5, 4, 3, 2]
sum = 0
digits = org_no.chars.map(&:to_i)
weights.each_with_index.map do |w, i|
weights.each.with_index.map do |w, i|
sum += (w * digits[i])
end
(11 - (sum % 11)) % 10
Expand All @@ -261,13 +261,13 @@ def czech_o_n_checksum(org_no)
def abn_checksum(abn)
abn_weights = [10, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19]

abn.chars.map(&:to_i).each_with_index.map do |n, i|
abn.chars.map(&:to_i).each.with_index.map do |n, i|
(i.zero? ? n - 1 : n) * abn_weights[i]
end.inject(:+)
end

def luhn_checksum(luhn)
luhn_split = luhn.each_char.map(&:to_i).reverse.each_with_index.map do |n, i|
luhn_split = luhn.each_char.map(&:to_i).reverse.each.with_index.map do |n, i|
x = i.odd? ? n * 2 : n
x > 9 ? x - 9 : x
end
Expand All @@ -293,7 +293,7 @@ def cif_valid?(cif)
province_code = number[0..1]
actual_control = Regexp.last_match(3)

total = number.chars.each_with_index.inject(0) do |acc, (element, index)|
total = number.chars.each.with_index.inject(0) do |acc, (element, index)|
acc + if index.even?
(element.to_i * 2).digits.inject(:+)
else
Expand Down

0 comments on commit c4f3eaf

Please sign in to comment.