From ccf931f2c16e30d8e391debd15c58f1b371b6206 Mon Sep 17 00:00:00 2001 From: JDutil Date: Tue, 18 Jun 2024 13:20:28 -0600 Subject: [PATCH] Enable new cops and autocorrect --- .rubocop.yml | 1 + contentful_lite.gemspec | 1 - lib/contentful_lite/assets_array.rb | 2 +- lib/contentful_lite/entries_array.rb | 2 +- lib/contentful_lite/entry.rb | 2 +- lib/contentful_lite/validations/included_child_validator.rb | 2 +- 6 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 3bf40a9..d6574ab 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,6 +1,7 @@ # Relaxed.Ruby.Style ## Version 2.1 AllCops: + NewCops: enable TargetRubyVersion: 3.0.0 Gemspec/OrderedDependencies: diff --git a/contentful_lite.gemspec b/contentful_lite.gemspec index b8303b6..299ac65 100644 --- a/contentful_lite.gemspec +++ b/contentful_lite.gemspec @@ -13,7 +13,6 @@ Gem::Specification.new do |spec| spec.required_ruby_version = '>= 3.0.0' spec.files = Dir["lib/**/*", "LICENSE", "README.md"] - spec.test_files = Dir["spec/**/*"] spec.require_paths = ["lib"] spec.add_dependency "http", '~> 5.0' diff --git a/lib/contentful_lite/assets_array.rb b/lib/contentful_lite/assets_array.rb index aca67b2..bd89936 100644 --- a/lib/contentful_lite/assets_array.rb +++ b/lib/contentful_lite/assets_array.rb @@ -3,7 +3,7 @@ class AssetsArray < BaseArray # @param raw [Hash] raw response from Contentful API # @api private def initialize(raw) - super(raw) + super # Create the array of asset objects @items.collect! { |item| ContentfulLite::Asset.new(item) } diff --git a/lib/contentful_lite/entries_array.rb b/lib/contentful_lite/entries_array.rb index 919184b..da72bb1 100644 --- a/lib/contentful_lite/entries_array.rb +++ b/lib/contentful_lite/entries_array.rb @@ -3,7 +3,7 @@ class EntriesArray < BaseArray # @param raw [Hash] raw response from Contentful API # @api private def initialize(raw) - super(raw) + super # Collect arrays of missing (unresolvable) links @errors = raw.fetch('errors', []).collect! { |error| error.fetch('details', {}) }.each_with_object({}) do |error_detail, hash| diff --git a/lib/contentful_lite/entry.rb b/lib/contentful_lite/entry.rb index d66f4aa..9ae2685 100644 --- a/lib/contentful_lite/entry.rb +++ b/lib/contentful_lite/entry.rb @@ -10,7 +10,7 @@ class Entry # @param raw [Hash] raw response from Contentful API # @api private def initialize(raw) - super(raw) + super @content_type_id = raw['sys']['contentType']['sys']['id'] @localized_fields.each_value do |fields| fields.transform_values! { |value| build_link(value) } diff --git a/lib/contentful_lite/validations/included_child_validator.rb b/lib/contentful_lite/validations/included_child_validator.rb index 64edaa3..5b7deab 100644 --- a/lib/contentful_lite/validations/included_child_validator.rb +++ b/lib/contentful_lite/validations/included_child_validator.rb @@ -18,7 +18,7 @@ def validate_each(record, attr_name, value) private def record_error(record, attr_name, message) - record.errors.add(attr_name, :invalid, **{ message: message }.merge(options.except(self.class.options_keys))) + record.errors.add(attr_name, :invalid, message: message, **options.except(self.class.options_keys)) end def validate_array(record, attr_name, value)