Skip to content

Commit

Permalink
Fixed rubocop issues and fixed rubocop version to 0.54.
Browse files Browse the repository at this point in the history
  • Loading branch information
leio10 committed Apr 6, 2018
1 parent 3a72f78 commit 81fcc1e
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 17 deletions.
15 changes: 8 additions & 7 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -523,9 +523,6 @@ Style/HashSyntax:
# Do not suggest { a?: 1 } over { :a? => 1 } in ruby19 style
PreferHashRocketsForNonAlnumEndingSymbols: false

Style/IfUnlessModifier:
MaxLineLength: 80

Layout/IndentationConsistency:
# The difference between `rails` and `normal` is that the `rails` style
# prescribes that in classes and modules the `protected` and `private`
Expand Down Expand Up @@ -964,7 +961,14 @@ Style/TrailingCommaInArguments:
# for all parenthesized method calls with arguments.
EnforcedStyleForMultiline: no_comma

Style/TrailingCommaInLiteral:
Style/TrailingCommaInArrayLiteral:
# If `comma`, the cop requires a comma after the last item in an array or
# hash, but only when each item is on its own line.
# If `consistent_comma`, the cop requires a comma after the last item of all
# non-empty array and hash literals.
EnforcedStyleForMultiline: no_comma

Style/TrailingCommaInHashLiteral:
# If `comma`, the cop requires a comma after the last item in an array or
# hash, but only when each item is on its own line.
# If `consistent_comma`, the cop requires a comma after the last item of all
Expand Down Expand Up @@ -1026,9 +1030,6 @@ Naming/VariableNumber:
- normalcase
- non_integer

Style/WhileUntilModifier:
MaxLineLength: 80

# WordArray enforces how array literals of word-like strings should be expressed.
Style/WordArray:
EnforcedStyle: percent
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ DEPENDENCIES
generator_spec (~> 0.9.3)
iban_bic!
rspec-rails (~> 3.6)
rubocop (~> 0.50)
rubocop (~> 0.54.0)
sqlite3 (~> 1.3)
virtus (~> 1.0)

Expand Down
2 changes: 1 addition & 1 deletion bin/test
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

test = File.expand_path("../../test", __FILE__)
test = File.expand_path("../test", __dir__)
$LOAD_PATH.unshift(test) unless $LOAD_PATH.include?(test)

require "bundler/setup"
Expand Down
4 changes: 2 additions & 2 deletions iban_bic.gemspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

lib = File.expand_path("../lib", __FILE__)
lib = File.expand_path("lib", __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)

# Maintain your gem's version:
Expand All @@ -25,7 +25,7 @@ Gem::Specification.new do |s|
s.add_development_dependency "codecov", "~> 0.1"
s.add_development_dependency "generator_spec", "~> 0.9.3"
s.add_development_dependency "rspec-rails", "~> 3.6"
s.add_development_dependency "rubocop", "~> 0.50"
s.add_development_dependency "rubocop", "~> 0.54.0"
s.add_development_dependency "sqlite3", "~> 1.3"
s.add_development_dependency "virtus", "~> 1.0"
end
4 changes: 1 addition & 3 deletions lib/active_model/validations/bic_validator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ module Validations
class BicValidator < ActiveModel::EachValidator
def validate_each(record, attribute, value)
country_field = options[:country] ? record[options[:country]] : "[A-Z]{2}"
unless /^[A-Z]{4}#{country_field}[0-9A-Z]{2}([0-9A-Z]{3})?$/.match? value.upcase
record.errors.add(attribute, :invalid_format)
end
record.errors.add(attribute, :invalid_format) unless /^[A-Z]{4}#{country_field}[0-9A-Z]{2}([0-9A-Z]{3})?$/.match? value.upcase
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/generators/iban_bic/install_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module IbanBic
class InstallGenerator < ::Rails::Generators::Base
include ::Rails::Generators::Migration

source_root File.expand_path("../templates", __FILE__)
source_root File.expand_path("templates", __dir__)

class_option(
:with_static_bics,
Expand Down
4 changes: 2 additions & 2 deletions spec/generators/install_generator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

require "rails_helper"
require "generator_spec/test_case"
require File.expand_path("../../../lib/generators/iban_bic/install_generator", __FILE__)
require File.expand_path("../../lib/generators/iban_bic/install_generator", __dir__)

RSpec.describe IbanBic::InstallGenerator, type: :generator do
include GeneratorSpec::TestCase
destination File.expand_path("../tmp", __FILE__)
destination File.expand_path("tmp", __dir__)

after(:all) { prepare_destination } # cleanup the tmp directory

Expand Down

0 comments on commit 81fcc1e

Please sign in to comment.