From 3a72f7871f42e5e8592d9e3abb8c0b546457c2a1 Mon Sep 17 00:00:00 2001 From: Leonardo Diez Date: Fri, 6 Apr 2018 18:31:39 +0200 Subject: [PATCH 1/2] Dependencies security update. --- Gemfile.lock | 129 ++++++++++++++++++++-------------------- README.md | 4 ++ lib/iban_bic/version.rb | 2 +- 3 files changed, 69 insertions(+), 66 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 131f7fe..f44f341 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,58 +1,58 @@ PATH remote: . specs: - iban_bic (1.4.1) + iban_bic (1.4.2) rails (~> 5.1) regexp-examples (~> 1.3) GEM remote: https://rubygems.org/ specs: - actioncable (5.1.4) - actionpack (= 5.1.4) + actioncable (5.1.6) + actionpack (= 5.1.6) nio4r (~> 2.0) websocket-driver (~> 0.6.1) - actionmailer (5.1.4) - actionpack (= 5.1.4) - actionview (= 5.1.4) - activejob (= 5.1.4) + actionmailer (5.1.6) + actionpack (= 5.1.6) + actionview (= 5.1.6) + activejob (= 5.1.6) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (5.1.4) - actionview (= 5.1.4) - activesupport (= 5.1.4) + actionpack (5.1.6) + actionview (= 5.1.6) + activesupport (= 5.1.6) rack (~> 2.0) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (5.1.4) - activesupport (= 5.1.4) + actionview (5.1.6) + activesupport (= 5.1.6) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.3) - activejob (5.1.4) - activesupport (= 5.1.4) + activejob (5.1.6) + activesupport (= 5.1.6) globalid (>= 0.3.6) - activemodel (5.1.4) - activesupport (= 5.1.4) - activerecord (5.1.4) - activemodel (= 5.1.4) - activesupport (= 5.1.4) + activemodel (5.1.6) + activesupport (= 5.1.6) + activerecord (5.1.6) + activemodel (= 5.1.6) + activesupport (= 5.1.6) arel (~> 8.0) - activesupport (5.1.4) + activesupport (5.1.6) concurrent-ruby (~> 1.0, >= 1.0.2) - i18n (~> 0.7) + i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) arel (8.0.0) - ast (2.3.0) + ast (2.4.0) axiom-types (0.1.1) descendants_tracker (~> 0.0.4) ice_nine (~> 0.11.0) thread_safe (~> 0.3, >= 0.3.1) builder (3.2.3) - byebug (9.1.0) + byebug (10.0.2) codecov (0.1.10) json simplecov @@ -60,23 +60,23 @@ GEM coercible (1.0.0) descendants_tracker (~> 0.0.1) concurrent-ruby (1.0.5) - crass (1.0.2) + crass (1.0.3) descendants_tracker (0.0.4) thread_safe (~> 0.3, >= 0.3.1) diff-lcs (1.3) - docile (1.1.5) + docile (1.3.0) equalizer (0.0.11) - erubi (1.7.0) + erubi (1.7.1) generator_spec (0.9.4) activesupport (>= 3.0.0) railties (>= 3.0.0) globalid (0.4.1) activesupport (>= 4.2.0) - i18n (0.9.1) + i18n (1.0.0) concurrent-ruby (~> 1.0) ice_nine (0.11.2) json (2.1.0) - loofah (2.1.1) + loofah (2.2.2) crass (~> 1.0.2) nokogiri (>= 1.5.9) mail (2.7.0) @@ -84,45 +84,44 @@ GEM method_source (0.9.0) mini_mime (1.0.0) mini_portile2 (2.3.0) - minitest (5.10.3) - nio4r (2.1.0) - nokogiri (1.8.1) + minitest (5.11.3) + nio4r (2.3.0) + nokogiri (1.8.2) mini_portile2 (~> 2.3.0) - parallel (1.12.0) - parser (2.4.0.0) - ast (~> 2.2) + parallel (1.12.1) + parser (2.5.0.5) + ast (~> 2.4.0) powerpack (0.1.1) - rack (2.0.3) - rack-test (0.7.0) + rack (2.0.4) + rack-test (1.0.0) rack (>= 1.0, < 3) - rails (5.1.4) - actioncable (= 5.1.4) - actionmailer (= 5.1.4) - actionpack (= 5.1.4) - actionview (= 5.1.4) - activejob (= 5.1.4) - activemodel (= 5.1.4) - activerecord (= 5.1.4) - activesupport (= 5.1.4) + rails (5.1.6) + actioncable (= 5.1.6) + actionmailer (= 5.1.6) + actionpack (= 5.1.6) + actionview (= 5.1.6) + activejob (= 5.1.6) + activemodel (= 5.1.6) + activerecord (= 5.1.6) + activesupport (= 5.1.6) bundler (>= 1.3.0) - railties (= 5.1.4) + railties (= 5.1.6) sprockets-rails (>= 2.0.0) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) - rails-html-sanitizer (1.0.3) - loofah (~> 2.0) - railties (5.1.4) - actionpack (= 5.1.4) - activesupport (= 5.1.4) + rails-html-sanitizer (1.0.4) + loofah (~> 2.2, >= 2.2.2) + railties (5.1.6) + actionpack (= 5.1.6) + activesupport (= 5.1.6) method_source rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) - rainbow (2.2.2) - rake - rake (12.2.1) - regexp-examples (1.4.1) - rspec-core (3.7.0) + rainbow (3.0.0) + rake (12.3.1) + regexp-examples (1.4.2) + rspec-core (3.7.1) rspec-support (~> 3.7.0) rspec-expectations (3.7.0) diff-lcs (>= 1.2.0, < 2.0) @@ -130,7 +129,7 @@ GEM rspec-mocks (3.7.0) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.7.0) - rspec-rails (3.7.1) + rspec-rails (3.7.2) actionpack (>= 3.0) activesupport (>= 3.0) railties (>= 3.0) @@ -138,17 +137,17 @@ GEM rspec-expectations (~> 3.7.0) rspec-mocks (~> 3.7.0) rspec-support (~> 3.7.0) - rspec-support (3.7.0) - rubocop (0.51.0) + rspec-support (3.7.1) + rubocop (0.54.0) parallel (~> 1.10) - parser (>= 2.3.3.1, < 3.0) + parser (>= 2.5) powerpack (~> 0.1) - rainbow (>= 2.2.2, < 3.0) + rainbow (>= 2.2.2, < 4.0) ruby-progressbar (~> 1.7) unicode-display_width (~> 1.0, >= 1.0.1) ruby-progressbar (1.9.0) - simplecov (0.15.1) - docile (~> 1.1.0) + simplecov (0.16.1) + docile (~> 1.1) json (>= 1.8, < 3) simplecov-html (~> 0.10.0) simplecov-html (0.10.2) @@ -162,7 +161,7 @@ GEM sqlite3 (1.3.13) thor (0.20.0) thread_safe (0.3.6) - tzinfo (1.2.4) + tzinfo (1.2.5) thread_safe (~> 0.1) unicode-display_width (1.3.0) url (0.3.2) @@ -189,4 +188,4 @@ DEPENDENCIES virtus (~> 1.0) BUNDLED WITH - 1.16.0 + 1.16.1 diff --git a/README.md b/README.md index 8838c55..d523f6f 100644 --- a/README.md +++ b/README.md @@ -140,6 +140,10 @@ $ bundle exec rails generate iban_bic:install --with-static-data 4. Customize initializer if needed, adding validations for new countries, or overriding YAML files. ## Changelog +#### 1.4.2 + +* Dependencies security update. + #### 1.4.1 * Fixed BIC validation, don't allow less 1 or 2 characters for the office code and don't allow to add extra characters at the begining or at the end of the string. diff --git a/lib/iban_bic/version.rb b/lib/iban_bic/version.rb index 778aea6..b50d014 100644 --- a/lib/iban_bic/version.rb +++ b/lib/iban_bic/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module IbanBic - VERSION = "1.4.1" + VERSION = "1.4.2" end From 81fcc1e059a4783df2c4d57893a0525c830b866e Mon Sep 17 00:00:00 2001 From: Leonardo Diez Date: Fri, 6 Apr 2018 18:52:03 +0200 Subject: [PATCH 2/2] Fixed rubocop issues and fixed rubocop version to 0.54. --- .rubocop.yml | 15 ++++++++------- Gemfile.lock | 2 +- bin/test | 2 +- iban_bic.gemspec | 4 ++-- lib/active_model/validations/bic_validator.rb | 4 +--- lib/generators/iban_bic/install_generator.rb | 2 +- spec/generators/install_generator_spec.rb | 4 ++-- 7 files changed, 16 insertions(+), 17 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 1d61bc7..47c4765 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -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` @@ -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 @@ -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 diff --git a/Gemfile.lock b/Gemfile.lock index f44f341..30900da 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -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) diff --git a/bin/test b/bin/test index 1691196..0901d06 100755 --- a/bin/test +++ b/bin/test @@ -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" diff --git a/iban_bic.gemspec b/iban_bic.gemspec index 17ba368..9b1254d 100644 --- a/iban_bic.gemspec +++ b/iban_bic.gemspec @@ -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: @@ -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 diff --git a/lib/active_model/validations/bic_validator.rb b/lib/active_model/validations/bic_validator.rb index 35cc2c9..630dad2 100644 --- a/lib/active_model/validations/bic_validator.rb +++ b/lib/active_model/validations/bic_validator.rb @@ -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 diff --git a/lib/generators/iban_bic/install_generator.rb b/lib/generators/iban_bic/install_generator.rb index 7c0edb6..2c151ac 100644 --- a/lib/generators/iban_bic/install_generator.rb +++ b/lib/generators/iban_bic/install_generator.rb @@ -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, diff --git a/spec/generators/install_generator_spec.rb b/spec/generators/install_generator_spec.rb index ceeb50b..4f7e9b7 100644 --- a/spec/generators/install_generator_spec.rb +++ b/spec/generators/install_generator_spec.rb @@ -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