From c71baf7ba287f7b4d24d8e320f41e1ebf69dc392 Mon Sep 17 00:00:00 2001 From: Robert Waffen Date: Fri, 6 Sep 2024 10:10:12 +0200 Subject: [PATCH 1/2] feat: update rubocop and implement suggestions Signed-off-by: Robert Waffen --- Gemfile | 4 ++-- Gemfile.lock | 17 ++++++++--------- app/models/hiera_data/layer.rb | 2 +- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/Gemfile b/Gemfile index c5bc7e2b..aa58da74 100644 --- a/Gemfile +++ b/Gemfile @@ -60,10 +60,10 @@ group :test do end group :linter do - gem 'rubocop', '~> 1.65.1' + gem 'rubocop', '~> 1.66.1' gem 'rubocop-capybara', '~> 2.21.0' gem 'rubocop-performance', '~> 1.21.1' - gem 'rubocop-rails', '~> 2.25.1' + gem 'rubocop-rails', '~> 2.26.0' gem 'rubocop-rake', '~> 0.6.0' end diff --git a/Gemfile.lock b/Gemfile.lock index f5c4010f..d0a7121c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -284,7 +284,7 @@ GEM faraday (>= 1, < 3) sawyer (~> 0.9) optimist (3.1.0) - parallel (1.25.1) + parallel (1.26.3) parser (3.3.4.0) ast (~> 2.4.1) racc @@ -390,28 +390,27 @@ GEM rails-dom-testing rspec-core rspec-support (3.13.1) - rubocop (1.65.1) + rubocop (1.66.1) json (~> 2.3) language_server-protocol (>= 3.17.0) parallel (~> 1.10) parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 2.4, < 3.0) - rexml (>= 3.2.5, < 4.0) - rubocop-ast (>= 1.31.1, < 2.0) + rubocop-ast (>= 1.32.2, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.31.3) + rubocop-ast (1.32.3) parser (>= 3.3.1.0) rubocop-capybara (2.21.0) rubocop (~> 1.41) rubocop-performance (1.21.1) rubocop (>= 1.48.1, < 2.0) rubocop-ast (>= 1.31.1, < 2.0) - rubocop-rails (2.25.1) + rubocop-rails (2.26.0) activesupport (>= 4.2.0) rack (>= 1.1) - rubocop (>= 1.33.0, < 2.0) + rubocop (>= 1.52.0, < 2.0) rubocop-ast (>= 1.31.1, < 2.0) rubocop-rake (0.6.0) rubocop (~> 1.0) @@ -527,10 +526,10 @@ DEPENDENCIES puppetdb-ruby rails (~> 7.1.3) rspec-openapi - rubocop (~> 1.65.1) + rubocop (~> 1.66.1) rubocop-capybara (~> 2.21.0) rubocop-performance (~> 1.21.1) - rubocop-rails (~> 2.25.1) + rubocop-rails (~> 2.26.0) rubocop-rake (~> 0.6.0) ruby-saml selenium-webdriver diff --git a/app/models/hiera_data/layer.rb b/app/models/hiera_data/layer.rb index 1e94ad87..8311cdb6 100644 --- a/app/models/hiera_data/layer.rb +++ b/app/models/hiera_data/layer.rb @@ -1,7 +1,7 @@ class HieraData module Layer def self.for(environment:, key: nil) - [Global.new, Environment.new(environment:), Module.new(environment:, key:)].select(&:present?) + [Global.new, Environment.new(environment:), Module.new(environment:, key:)].compact_blank end end end From 7ae27d498403813b616834ae66b7b2c4de9e7b1e Mon Sep 17 00:00:00 2001 From: Robert Waffen Date: Fri, 6 Sep 2024 10:50:01 +0200 Subject: [PATCH 2/2] fix: revert back and skip cop for this. prsent is here a custom method Signed-off-by: Robert Waffen --- app/models/hiera_data/layer.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/models/hiera_data/layer.rb b/app/models/hiera_data/layer.rb index 8311cdb6..4fd7abea 100644 --- a/app/models/hiera_data/layer.rb +++ b/app/models/hiera_data/layer.rb @@ -1,7 +1,9 @@ class HieraData module Layer def self.for(environment:, key: nil) - [Global.new, Environment.new(environment:), Module.new(environment:, key:)].compact_blank + # rubocop:disable Rails/CompactBlank + [Global.new, Environment.new(environment:), Module.new(environment:, key:)].select(&:present?) + # rubocop:enable Rails/CompactBlank end end end