Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some RuboCop rules #73

Merged
merged 5 commits into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ inherit_gem:
theforeman-rubocop:
- strict.yml

AllCops:
TargetRubyVersion: 2.7

Layout/LineLength:
Enabled: 111 # TODO: discuss and set this

Expand Down
6 changes: 3 additions & 3 deletions app/lib/foreman_google/google_compute_adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion foreman_google.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down
2 changes: 1 addition & 1 deletion test/test_google_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down