diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 008d8649..3f97f27c 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -273,18 +273,6 @@ Rails/Pick: - "lib/foreman_inventory_upload/async/progress_output.rb" - "lib/foreman_inventory_upload/generators/fact_helpers.rb" -# Offense count: 7 -# Configuration parameters: ForbiddenMethods, AllowedMethods. -# ForbiddenMethods: decrement!, decrement_counter, increment!, increment_counter, insert, insert!, insert_all, insert_all!, toggle!, touch, touch_all, update_all, update_attribute, update_column, update_columns, update_counters, upsert, upsert_all -Rails/SkipsModelValidations: - Exclude: - - "lib/foreman_inventory_upload/async/progress_output.rb" - - "lib/insights_cloud/async/insights_client_status_aging.rb" - - "lib/insights_cloud/async/insights_full_sync.rb" - - "lib/insights_cloud/async/insights_rules_sync.rb" - - "lib/inventory_sync/async/inventory_hosts_sync.rb" - - "test/unit/foreman_rh_cloud_self_host_test.rb" - # Offense count: 10 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle. diff --git a/db/migrate/20210720000001_remove_old_insights_statuses.foreman_rh_cloud.rb b/db/migrate/20210720000001_remove_old_insights_statuses.foreman_rh_cloud.rb index 6bc2575d..e73142ba 100644 --- a/db/migrate/20210720000001_remove_old_insights_statuses.foreman_rh_cloud.rb +++ b/db/migrate/20210720000001_remove_old_insights_statuses.foreman_rh_cloud.rb @@ -1,6 +1,6 @@ class RemoveOldInsightsStatuses < ActiveRecord::Migration[5.2] def up - InsightsClientReportStatus.where(status: 2).update_all(status: InsightsClientReportStatus::NO_REPORT) - InsightsClientReportStatus.where(status: 3).update_all(status: InsightsClientReportStatus::REPORTING) + InsightsClientReportStatus.where(status: 2).update(status: InsightsClientReportStatus::NO_REPORT) + InsightsClientReportStatus.where(status: 3).update(status: InsightsClientReportStatus::REPORTING) end end diff --git a/db/migrate/20221102110254_fix_rh_cloud_settings_category_to_dsl.rb b/db/migrate/20221102110254_fix_rh_cloud_settings_category_to_dsl.rb index b6d54b17..637a2221 100644 --- a/db/migrate/20221102110254_fix_rh_cloud_settings_category_to_dsl.rb +++ b/db/migrate/20221102110254_fix_rh_cloud_settings_category_to_dsl.rb @@ -2,6 +2,6 @@ class FixRhCloudSettingsCategoryToDsl < ActiveRecord::Migration[6.0] def up - Setting.where(category: 'Setting::RhCloud').update_all(category: 'Setting') if column_exists?(:settings, :category) + Setting.where(category: 'Setting::RhCloud').update(category: 'Setting') if column_exists?(:settings, :category) end end diff --git a/lib/insights_cloud/async/insights_client_status_aging.rb b/lib/insights_cloud/async/insights_client_status_aging.rb index d5ab4f56..7cc5e6ff 100644 --- a/lib/insights_cloud/async/insights_client_status_aging.rb +++ b/lib/insights_cloud/async/insights_client_status_aging.rb @@ -7,7 +7,7 @@ def run host_ids = InsightsClientReportStatus.stale.reporting.pluck(:host_id) # update all stale records - InsightsClientReportStatus.where(host_id: host_ids).update_all(status: InsightsClientReportStatus::NO_REPORT) + InsightsClientReportStatus.where(host_id: host_ids).update(status: InsightsClientReportStatus::NO_REPORT) # refresh global status Host.where(id: host_ids).preload(:host_statuses).find_in_batches do |hosts| diff --git a/lib/insights_cloud/async/insights_full_sync.rb b/lib/insights_cloud/async/insights_full_sync.rb index 829ac873..80cd9ca2 100644 --- a/lib/insights_cloud/async/insights_full_sync.rb +++ b/lib/insights_cloud/async/insights_full_sync.rb @@ -100,7 +100,7 @@ def host_id(uuid) def replace_hits_data(hits, organization) InsightsHit.transaction do # Reset hit counters to 0, they will be recreated later - InsightsFacet.for_organizations(organization.id).update_all(hits_count: 0) + InsightsFacet.for_organizations(organization.id).update(hits_count: 0) InsightsHit.for_organizations(organization.id).delete_all InsightsHit.create(hits.map { |hits_hash| to_model_hash(hits_hash) }.compact) end diff --git a/test/unit/foreman_rh_cloud_self_host_test.rb b/test/unit/foreman_rh_cloud_self_host_test.rb index 328936f0..aac63f94 100644 --- a/test/unit/foreman_rh_cloud_self_host_test.rb +++ b/test/unit/foreman_rh_cloud_self_host_test.rb @@ -18,7 +18,7 @@ class ForemanRhCloudSelfHostTest < ActiveSupport::TestCase test 'finds host by shortname' do @host = FactoryBot.create(:host, :managed) - Host.where(name: @host.name).update_all(name: @host.shortname) + Host.where(name: @host.name).update(name: @host.shortname) ForemanRhCloud.expects(:foreman_host_name).returns(@host.name) actual = ForemanRhCloud.foreman_host