From aeb56f0fafdfdbb0d568737eaf2e37a9184e10b3 Mon Sep 17 00:00:00 2001 From: Geremia Taglialatela Date: Sun, 24 Dec 2023 16:55:50 +0100 Subject: [PATCH] Fix safe performance offences Also ignore Minitest/NonExecutableTestMethod for the moment because of #927 --- .github/workflows/ruby.yml | 1 - .rubocop.yml | 4 ++++ lib/client_side_validations/extender.rb | 2 +- test/action_view/models/category.rb | 2 +- test/action_view/models/comment.rb | 2 +- test/action_view/models/format_thing.rb | 2 +- test/action_view/models/post.rb | 2 +- test/action_view/models/tag.rb | 2 +- 8 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index 513a97352..784556ab6 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -60,7 +60,6 @@ jobs: uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby-version }} - rubygems: latest bundler-cache: true - name: Run tests run: bundle exec rake test:ruby diff --git a/.rubocop.yml b/.rubocop.yml index e842f0b7d..b61c60d86 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -62,6 +62,10 @@ Metrics/PerceivedComplexity: Minitest/MultipleAssertions: Enabled: false +# FIXME: DavyJonesLocker/client_side_validations#927 +Minitest/NonExecutableTestMethod: + Enabled: false + Rails/ApplicationRecord: Exclude: - 'test/**/*' diff --git a/lib/client_side_validations/extender.rb b/lib/client_side_validations/extender.rb index e826e0c24..91f0c91d8 100644 --- a/lib/client_side_validations/extender.rb +++ b/lib/client_side_validations/extender.rb @@ -7,7 +7,7 @@ module Extender def extend(klass, validators) validators.each do |validator| require "client_side_validations/#{klass.underscore}/#{validator.downcase}" - const_get(klass)::Validations.const_get("#{validator}Validator").send :include, ClientSideValidations.const_get(klass).const_get(validator) + const_get(klass)::Validations.const_get(:"#{validator}Validator").send :include, ClientSideValidations.const_get(klass).const_get(validator) end end end diff --git a/test/action_view/models/category.rb b/test/action_view/models/category.rb index ada142b59..a4cb434bf 100644 --- a/test/action_view/models/category.rb +++ b/test/action_view/models/category.rb @@ -12,7 +12,7 @@ class Category def initialize(params = {}) params.each do |attr, value| - public_send("#{attr}=", value) + public_send(:"#{attr}=", value) end end diff --git a/test/action_view/models/comment.rb b/test/action_view/models/comment.rb index 3db34d068..aeca8d630 100644 --- a/test/action_view/models/comment.rb +++ b/test/action_view/models/comment.rb @@ -12,7 +12,7 @@ class Comment def initialize(params = {}) params.each do |attr, value| - public_send("#{attr}=", value) + public_send(:"#{attr}=", value) end end diff --git a/test/action_view/models/format_thing.rb b/test/action_view/models/format_thing.rb index aa543c93b..b1f487182 100644 --- a/test/action_view/models/format_thing.rb +++ b/test/action_view/models/format_thing.rb @@ -35,7 +35,7 @@ class FormatThing def initialize(params = {}) params.each do |attr, value| - public_send("#{attr}=", value) + public_send(:"#{attr}=", value) end end diff --git a/test/action_view/models/post.rb b/test/action_view/models/post.rb index 705b1764a..7c2c18483 100644 --- a/test/action_view/models/post.rb +++ b/test/action_view/models/post.rb @@ -17,7 +17,7 @@ class Post def initialize(params = {}) params.each do |attr, value| - public_send("#{attr}=", value) + public_send(:"#{attr}=", value) end end diff --git a/test/action_view/models/tag.rb b/test/action_view/models/tag.rb index ed20aa88e..c16b950b1 100644 --- a/test/action_view/models/tag.rb +++ b/test/action_view/models/tag.rb @@ -10,7 +10,7 @@ class Tag def initialize(params = {}) params.each do |attr, value| - public_send("#{attr}=", value) + public_send(:"#{attr}=", value) end end