From c3478b13ad6ef9242419b1b24ce0d39cfe93a7f1 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 6 Aug 2020 07:42:15 +0000 Subject: [PATCH] Update rubocop requirement from ~> 0.88.0 to ~> 0.89.0 Updates the requirements on [rubocop](https://github.com/rubocop-hq/rubocop) to permit the latest version. - [Release notes](https://github.com/rubocop-hq/rubocop/releases) - [Changelog](https://github.com/rubocop-hq/rubocop/blob/master/CHANGELOG.md) - [Commits](https://github.com/rubocop-hq/rubocop/compare/v0.88.0...v0.89.0) Signed-off-by: dependabot-preview[bot] --- .rubocop.yml | 6 +++++- Rakefile | 2 +- client_side_validations.gemspec | 2 +- dist/client-side-validations.js | 2 +- lib/client_side_validations/action_view/form_builder.rb | 2 +- lib/client_side_validations/active_model/numericality.rb | 1 + lib/client_side_validations/files.rb | 4 ++-- test/action_view/cases/helper.rb | 4 ++-- test/base_helper.rb | 2 +- test/javascript/server.rb | 2 +- vendor/assets/javascripts/rails.validations.js | 2 +- 11 files changed, 17 insertions(+), 12 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 7e1b308cb..fb4c45258 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -19,7 +19,7 @@ Layout/LineLength: Enabled: false Metrics/AbcSize: - Max: 18.36 + Max: 21.91 Metrics/BlockLength: Exclude: @@ -73,3 +73,7 @@ Style/FormatStringToken: Style/IfUnlessModifier: Enabled: false + +Style/StringConcatenation: + Exclude: + - 'test/**/*' diff --git a/Rakefile b/Rakefile index 304dbff3a..4e2a660c6 100644 --- a/Rakefile +++ b/Rakefile @@ -16,7 +16,7 @@ namespace :test do desc %(Test Ruby code) Rake::TestTask.new(:ruby) do |test| test.libs << 'lib' << 'test' - test.test_files = Dir.glob("#{File.dirname(__FILE__)}/test/**/test_*.rb").sort + test.test_files = Dir.glob("#{__dir__}/test/**/test_*.rb").sort test.warning = false end diff --git a/client_side_validations.gemspec b/client_side_validations.gemspec index 855cec6dc..3b7d8e9b2 100644 --- a/client_side_validations.gemspec +++ b/client_side_validations.gemspec @@ -36,7 +36,7 @@ Gem::Specification.new do |spec| spec.add_development_dependency 'minitest', '~> 5.14' spec.add_development_dependency 'mocha', '~> 1.11' spec.add_development_dependency 'rake', '~> 13.0' - spec.add_development_dependency 'rubocop', '~> 0.88.0' + spec.add_development_dependency 'rubocop', '~> 0.89.0' spec.add_development_dependency 'rubocop-performance', '~> 1.7' spec.add_development_dependency 'rubocop-rails', '~> 2.7' spec.add_development_dependency 'simplecov', '~> 0.18.5' diff --git a/dist/client-side-validations.js b/dist/client-side-validations.js index 1f84880ba..10b10232c 100644 --- a/dist/client-side-validations.js +++ b/dist/client-side-validations.js @@ -7,7 +7,7 @@ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('jquery')) : typeof define === 'function' && define.amd ? define(['jquery'], factory) : - (global = global || self, global.ClientSideValidations = factory(global.$)); + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.ClientSideValidations = factory(global.$)); }(this, (function ($) { 'use strict'; $ = $ && Object.prototype.hasOwnProperty.call($, 'default') ? $['default'] : $; diff --git a/lib/client_side_validations/action_view/form_builder.rb b/lib/client_side_validations/action_view/form_builder.rb index 5baa9e700..37c362cd0 100644 --- a/lib/client_side_validations/action_view/form_builder.rb +++ b/lib/client_side_validations/action_view/form_builder.rb @@ -4,7 +4,7 @@ module ClientSideValidations module ActionView module Helpers module FormBuilder - def self.prepended(base) + def self.prepended(base) # rubocop:disable Lint/MissingSuper (base.field_helpers - %i[label check_box radio_button fields_for hidden_field file_field]).each do |selector| base.class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1 # Cannot call super here, rewrite all diff --git a/lib/client_side_validations/active_model/numericality.rb b/lib/client_side_validations/active_model/numericality.rb index bc668de75..a18e527c3 100644 --- a/lib/client_side_validations/active_model/numericality.rb +++ b/lib/client_side_validations/active_model/numericality.rb @@ -7,6 +7,7 @@ module Numericality def self.included(base) @@option_map.merge!(base::CHECKS.keys.inject({}) { |acc, elem| acc.merge!(elem => elem) }) + super end def client_side_hash(model, attribute, force = nil) diff --git a/lib/client_side_validations/files.rb b/lib/client_side_validations/files.rb index 133554968..35da94cbd 100644 --- a/lib/client_side_validations/files.rb +++ b/lib/client_side_validations/files.rb @@ -4,7 +4,7 @@ module ClientSideValidations module Files - Initializer = File.expand_path(File.dirname(__FILE__) + '/../generators/templates/client_side_validations/initializer.rb') - Javascript = File.expand_path(File.dirname(__FILE__) + '/../../vendor/assets/javascripts/rails.validations.js') + Initializer = File.expand_path('../generators/templates/client_side_validations/initializer.rb', __dir__) + Javascript = File.expand_path('../../vendor/assets/javascripts/rails.validations.js', __dir__) end end diff --git a/test/action_view/cases/helper.rb b/test/action_view/cases/helper.rb index 37894cad1..8a658bb41 100644 --- a/test/action_view/cases/helper.rb +++ b/test/action_view/cases/helper.rb @@ -150,7 +150,7 @@ def form_field(tag, id: nil, name: nil, type: nil, value: nil, multiple: false, txt end - def form_for_text(action = 'http://www.example.com', id = nil, html_class = nil, _remote = nil, validators = nil, file = nil, custom_id = false) + def form_for_text(action = 'http://www.example.com', id = nil, html_class = nil, _remote = nil, validators = nil, file = nil, custom_id: false) txt = +%(
' + form_for_text(action, id, html_class, remote, (validators || no_validate), file, custom_id: custom_id) + snowman(method) + (contents || '') + '
' end def form_with_text(action = 'http://www.example.com', id = nil, html_class = nil, local = nil, validators = nil, file = nil) diff --git a/test/base_helper.rb b/test/base_helper.rb index f2da7a817..12cc47a22 100644 --- a/test/base_helper.rb +++ b/test/base_helper.rb @@ -23,7 +23,7 @@ module TestApp class Application < Rails::Application - config.root = File.dirname(__FILE__) + config.root = __dir__ config.active_support.deprecation = :log config.active_support.test_order = :random config.eager_load = false diff --git a/test/javascript/server.rb b/test/javascript/server.rb index 161e441f4..c79b05e19 100644 --- a/test/javascript/server.rb +++ b/test/javascript/server.rb @@ -46,7 +46,7 @@ def script_tag(src) def test(*types) types.map do |type| - Dir.glob(File.expand_path("public/test/#{type}", settings.root) + '/*.js').map { |file| File.basename(file) }.map do |file| + Dir.glob(File.expand_path("public/test/#{type}/*.js", settings.root)).map { |file| File.basename(file) }.map do |file| script_tag "/test/#{type}/#{file}" end.join("\n") end.join("\n") diff --git a/vendor/assets/javascripts/rails.validations.js b/vendor/assets/javascripts/rails.validations.js index 1f84880ba..10b10232c 100644 --- a/vendor/assets/javascripts/rails.validations.js +++ b/vendor/assets/javascripts/rails.validations.js @@ -7,7 +7,7 @@ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('jquery')) : typeof define === 'function' && define.amd ? define(['jquery'], factory) : - (global = global || self, global.ClientSideValidations = factory(global.$)); + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.ClientSideValidations = factory(global.$)); }(this, (function ($) { 'use strict'; $ = $ && Object.prototype.hasOwnProperty.call($, 'default') ? $['default'] : $;