From 3d6685e7998c028f7081b7624afeeca42dcdd192 Mon Sep 17 00:00:00 2001 From: akumari Date: Fri, 28 Jun 2024 15:51:11 +0530 Subject: [PATCH 1/5] Fix Layout/ArgumentAlignment cop --- app/lib/foreman_google/google_compute_adapter.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/lib/foreman_google/google_compute_adapter.rb b/app/lib/foreman_google/google_compute_adapter.rb index dbf1526..41a1562 100644 --- a/app/lib/foreman_google/google_compute_adapter.rb +++ b/app/lib/foreman_google/google_compute_adapter.rb @@ -91,9 +91,9 @@ def set_disk_auto_delete(zone, instance_identity) instance = instance(zone, instance_identity) instance.disks.each do |disk| manage_instance :set_disk_auto_delete, zone: zone, - device_name: disk.device_name, - instance: instance_identity, - auto_delete: true + device_name: disk.device_name, + instance: instance_identity, + auto_delete: true end end From 53ff0a6add2db05a037f366dc5c1164ae142fb33 Mon Sep 17 00:00:00 2001 From: akumari Date: Fri, 28 Jun 2024 15:52:43 +0530 Subject: [PATCH 2/5] Fix Gemspec/RequiredRubyVersion cop --- foreman_google.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/foreman_google.gemspec b/foreman_google.gemspec index d2fbc1d..9b56926 100644 --- a/foreman_google.gemspec +++ b/foreman_google.gemspec @@ -11,7 +11,7 @@ Gem::Specification.new do |s| s.homepage = 'https://github.com/theforeman/foreman_google' s.summary = 'Google Compute Engine plugin for the Foreman' s.description = 'Google Compute Engine plugin for the Foreman' - s.required_ruby_version = '>= 2.5' + s.required_ruby_version = '>= 2.7', '< 4' s.files = Dir['{app,config,db,lib,locale,webpack}/**/*'] + ['LICENSE', 'Rakefile', 'README.md', 'package.json'] s.test_files = Dir['test/**/*'] + Dir['webpack/**/__tests__/*.js'] From 000a60e20a82ca8b6fd4fe5ef87bb9ecc6b4ec51 Mon Sep 17 00:00:00 2001 From: akumari Date: Fri, 28 Jun 2024 15:53:20 +0530 Subject: [PATCH 3/5] Fix Rails/FindEach cop --- db/migrate/20220331113745_foreman_gce_to_foreman_google_gce.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/migrate/20220331113745_foreman_gce_to_foreman_google_gce.rb b/db/migrate/20220331113745_foreman_gce_to_foreman_google_gce.rb index e281bf9..f74435e 100644 --- a/db/migrate/20220331113745_foreman_gce_to_foreman_google_gce.rb +++ b/db/migrate/20220331113745_foreman_gce_to_foreman_google_gce.rb @@ -10,7 +10,7 @@ def up # mechanism failed to locate the subclass: 'Foreman::Model::GCE' ComputeResource.unscoped.where(type: original_type).update_all(type: new_type) - ComputeResource.unscoped.where(type: new_type).each do |cr| + ComputeResource.unscoped.where(type: new_type).find_each do |cr| unless cr.attrs[:key_path] say("Compute resource [#{cr.name}] is missing path to JSON key file, can't load the data. Please update the resource manually.") next From 4bb38a2c61771c87c39b88f121cf5587c0a770bf Mon Sep 17 00:00:00 2001 From: akumari Date: Fri, 28 Jun 2024 15:53:59 +0530 Subject: [PATCH 4/5] Fix Style/TernaryParentheses cop --- test/test_google_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_google_helper.rb b/test/test_google_helper.rb index 30b59e3..2081b69 100644 --- a/test/test_google_helper.rb +++ b/test/test_google_helper.rb @@ -16,7 +16,7 @@ class GoogleTestCase < ActiveSupport::TestCase let(:google_access_token) { 'ya29.c.stubbed_token' } let(:gce_cr) { FactoryBot.create(:compute_resource, :google_gce) } let(:google_project_id) { gce_cr.google_project_id } - let(:gauth_json) { (ENV['VCR'] == '1' ? ENV['GCE_AUTH'] : nil) || gce_cr.password } + let(:gauth_json) { ((ENV['VCR'] == '1') ? ENV['GCE_AUTH'] : nil) || gce_cr.password } setup do ::Signet::OAuth2::Client.any_instance.stubs(fetch_access_token!: google_access_token) unless ENV['VCR'] == '1' From 57f7e5189bcf8e7cd728bfac4f105f6e1e90b678 Mon Sep 17 00:00:00 2001 From: akumari Date: Fri, 28 Jun 2024 17:34:31 +0530 Subject: [PATCH 5/5] Fix Gemspec/RequiredRubyVersion cop --- .rubocop.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.rubocop.yml b/.rubocop.yml index fb7f978..4cdd7b8 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -2,6 +2,9 @@ inherit_gem: theforeman-rubocop: - strict.yml +AllCops: + TargetRubyVersion: 2.7 + Layout/LineLength: Enabled: 111 # TODO: discuss and set this