Skip to content

Commit

Permalink
Merge pull request #120 from gocardless/revert-105-upgrade-gc-ruboconfig
Browse files Browse the repository at this point in the history
Revert "Upgrade gc_ruboconfig & test on Ruby 2.5"
  • Loading branch information
Sannim1 authored Dec 5, 2018
2 parents 5c44a83 + 5fd5c70 commit 0d4bbb4
Show file tree
Hide file tree
Showing 15 changed files with 43 additions and 507 deletions.
5 changes: 4 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
inherit_from: .rubocop_todo.yml
inherit_gem:
gc_ruboconfig: rubocop.yml
ruboconfig: rubocop.yml

AllCops:
TargetRubyVersion: 2.1

# Limit lines to 80 characters.
LineLength:
Expand Down
73 changes: 13 additions & 60 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,74 +1,27 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2018-10-18 09:23:39 +0100 using RuboCop version 0.58.2.
# This configuration was generated by `rubocop --auto-gen-config`
# on 2014-12-08 13:56:37 +0000 using RuboCop version 0.27.1.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 10
# Offense count: 4
Metrics/AbcSize:
Max: 26

# Offense count: 3
Metrics/CyclomaticComplexity:
Max: 8
Max: 28

# Offense count: 1
RSpec/DescribeClass:
Exclude:
- 'spec/ibandit/structure_spec.rb'
# Configuration parameters: CountComments.
Metrics/ClassLength:
Max: 110

# Offense count: 1
# Configuration parameters: Max.
RSpec/ExampleLength:
Exclude:
- 'spec/ibandit/iban_spec.rb'

# Offense count: 8
# Configuration parameters: AggregateFailuresByDefault.
RSpec/MultipleExpectations:
Max: 2

# Offense count: 13
RSpec/NamedSubject:
Exclude:
- 'spec/ibandit/german_details_converter_spec.rb'
- 'spec/ibandit/iban_spec.rb'

# Offense count: 344
RSpec/NestedGroups:
Max: 6

# Offense count: 3
RSpec/ScatteredLet:
Exclude:
- 'spec/ibandit/iban_spec.rb'

# Offense count: 18
RSpec/ScatteredSetup:
Exclude:
- 'spec/ibandit/iban_assembler_spec.rb'
- 'spec/ibandit/iban_spec.rb'

# Offense count: 13
RSpec/SubjectStub:
Exclude:
- 'spec/ibandit/iban_spec.rb'
Metrics/CyclomaticComplexity:
Max: 10

# Offense count: 4
# Configuration parameters: IgnoreSymbolicNames.
RSpec/VerifiedDoubles:
Exclude:
- 'spec/ibandit/iban_spec.rb'
Style/Documentation:
Enabled: false

# Offense count: 5
# Cop supports --auto-correct.
# Configuration parameters: AutoCorrect, EnforcedStyle.
# SupportedStyles: predicate, comparison
# Offense count: 4
Style/NumericPredicate:
Exclude:
- 'spec/**/*'
- 'lib/ibandit/iban.rb'
- 'lib/ibandit/pseudo_iban_assembler.rb'
- 'lib/ibandit/pseudo_iban_splitter.rb'
Enabled: false
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ rvm:
- 2.2.7
- 2.3.4
- 2.4.1
- 2.5.1

sudo: false

Expand Down
6 changes: 6 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,9 @@
source 'https://rubygems.org'

gemspec

group :development do
gem "ruboconfig",
git: "https://github.com/gocardless/ruboconfig.git",
tag: "v1.2.0"
end
4 changes: 2 additions & 2 deletions ibandit.gemspec
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# frozen_string_literal: true

require File.expand_path("lib/ibandit/version", __dir__)
require File.expand_path("../lib/ibandit/version", __FILE__)

Gem::Specification.new do |gem|
gem.add_development_dependency "gc_ruboconfig", "~> 2.3.11"
gem.add_development_dependency "nokogiri", "~> 1.6"
gem.add_development_dependency "pry", "~> 0.10"
gem.add_development_dependency "pry-nav", "~> 0.2"
gem.add_development_dependency "rspec", "~> 3.3"
gem.add_development_dependency "rspec-its", "~> 1.2"
gem.add_development_dependency "rubocop", "~> 0.52.0"
gem.add_development_dependency "sax-machine", "~> 1.3"

gem.add_runtime_dependency "i18n"
Expand Down
6 changes: 3 additions & 3 deletions lib/ibandit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
require "ibandit/local_details_cleaner"
require "ibandit/check_digit"

I18n.load_path += Dir[File.expand_path("../config/locales/*.{rb,yml}",
__dir__)]
I18n.load_path += Dir[File.expand_path("../../config/locales/*.{rb,yml}",
__FILE__)]

module Ibandit
class << self
Expand All @@ -28,7 +28,7 @@ def find_bic(country_code, national_id)

def structures
@structures ||= YAML.load_file(
File.expand_path("../data/structures.yml", __dir__),
File.expand_path("../../data/structures.yml", __FILE__),
)
end

Expand Down
6 changes: 3 additions & 3 deletions lib/ibandit/german_details_converter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module Ibandit
module GermanDetailsConverter
def self.rules
@rules ||= YAML.load_file(
File.expand_path("../../data/german_iban_rules.yml", __dir__),
File.expand_path("../../../data/german_iban_rules.yml", __FILE__),
)
end

Expand Down Expand Up @@ -41,8 +41,8 @@ def converted_details
end

module PseudoAccountNumberBehaviour
def self.included(object)
object.extend(ClassMethods)
def self.included(o)
o.extend(ClassMethods)
end

module ClassMethods
Expand Down
2 changes: 1 addition & 1 deletion lib/ibandit/sweden/bank_lookup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def self.for_bank_code(bank_code)
end

def self.bank_info_table
@bank_info_table ||=
@swedish_bank_lookup ||=
begin
relative_path = "../../../../data/raw/swedish_bank_lookup.yml"
raw_info = YAML.load_file(File.expand_path(relative_path, __FILE__))
Expand Down
14 changes: 5 additions & 9 deletions spec/ibandit/german_details_converter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
shared_examples "json based fixture" do |json_fixture_file|
json_fixture(json_fixture_file).each do |convertor|
context "Rule #{convertor['convertor']}" do
subject { test_subject }

let(:klass) do
described_class.const_get("Rule#{convertor['convertor']}")
end

subject { test_subject }

before do
allow_any_instance_of(klass).
to receive(:converted_details).and_call_original
expect_any_instance_of(klass).to receive(:converted_details).
and_call_original
end

convertor.fetch("valid", []).each do |tuple|
Expand All @@ -30,9 +30,8 @@
let(:converted_account_number) do
tuple["converted_account_number"] || account_number
end

it do
expect(subject).to eq(
is_expected.to eq(
bank_code: converted_bank_code,
account_number: converted_account_number,
)
Expand All @@ -45,7 +44,6 @@
"#{tuple['account_number']}" do
let(:bank_code) { tuple["bank_code"] || "00000000" }
let(:account_number) { tuple["account_number"] }

it "raises UnsupportedAccountDetails" do
expect { subject }.
to raise_error(Ibandit::UnsupportedAccountDetails)
Expand Down Expand Up @@ -90,15 +88,13 @@
valid_account_numbers.each do |number|
context number.to_s do
let(:account_number) { number }

it { is_expected.to be_valid }
end
end

invalid_account_numbers.each do |number|
context number.to_s do
let(:account_number) { number }

it { is_expected.to_not be_valid }
end
end
Expand Down
Loading

0 comments on commit 0d4bbb4

Please sign in to comment.