From 2015112c8c531454563d053df901b6f9ba7e4ccc Mon Sep 17 00:00:00 2001 From: archanaserver Date: Thu, 4 Jan 2024 17:21:12 +0530 Subject: [PATCH] Fix rubocop Layout/FirstHashElementIndentation --- .rubocop.yml | 3 ++ app/helpers/layout_helper.rb | 4 +-- app/helpers/search_bar_helper.rb | 4 +-- app/services/power_manager/bmc.rb | 4 +-- app/services/power_manager/virt.rb | 4 +-- lib/tasks/seed.rake | 8 ++--- .../api/v2/bookmarks_controller_test.rb | 8 ++--- test/models/host_test.rb | 36 +++++++++---------- test/models/operatingsystems/solaris_test.rb | 4 +-- .../config_report_status_calculator_test.rb | 16 ++++----- 10 files changed, 47 insertions(+), 44 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 73bcf2ea259f..f6c2897f98a5 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -102,3 +102,6 @@ Layout/EmptyLinesAroundAttributeAccessor: Layout/EmptyLineBetweenDefs: Enabled: true + +Layout/FirstHashElementIndentation: + Enabled: false diff --git a/app/helpers/layout_helper.rb b/app/helpers/layout_helper.rb index 198756949f44..20d2e99b0c2b 100644 --- a/app/helpers/layout_helper.rb +++ b/app/helpers/layout_helper.rb @@ -1,10 +1,10 @@ module LayoutHelper def mount_react_app react_component('ReactApp', { - layout: layout_data, + layout: layout_data, metadata: app_metadata, toasts: toast_notifications_data, - }) + }) end def fetch_menus diff --git a/app/helpers/search_bar_helper.rb b/app/helpers/search_bar_helper.rb index 15500a128b1c..36301535d4be 100644 --- a/app/helpers/search_bar_helper.rb +++ b/app/helpers/search_bar_helper.rb @@ -7,7 +7,7 @@ def mount_search_bar } url = send("auto_complete_search_#{auto_complete_controller_name}_path") react_component("SearchBar", data: { - controller: auto_complete_controller_name, + controller: auto_complete_controller_name, autocomplete: { id: 'searchBar', searchQuery: params[:search], @@ -15,6 +15,6 @@ def mount_search_bar useKeyShortcuts: true, }, bookmarks: bookmarks, - }) + }) end end diff --git a/app/services/power_manager/bmc.rb b/app/services/power_manager/bmc.rb index e49e44a854ea..cea50bc12d77 100644 --- a/app/services/power_manager/bmc.rb +++ b/app/services/power_manager/bmc.rb @@ -16,14 +16,14 @@ def ready? # TODO: consider moving this to the proxy code, so we can just delegate like as with Virt. def action_map super.deep_merge({ - :start => 'on', + :start => 'on', :stop => 'off', :poweroff => 'off', :reboot => 'soft', :reset => 'cycle', :state => 'status', :ready? => 'ready?', - }) + }) end def default_action(action) diff --git a/app/services/power_manager/virt.rb b/app/services/power_manager/virt.rb index 2251f1d717ed..543e924ffb98 100644 --- a/app/services/power_manager/virt.rb +++ b/app/services/power_manager/virt.rb @@ -35,13 +35,13 @@ def default_action(action) def action_map super.deep_merge({ - :on => 'start', + :on => 'start', :off => 'stop', :soft => 'reboot', :cycle => 'reset', :status => {:action => :virt_state, :output => :state_output}, :state => {:action => :virt_state, :output => :state_output}, - }) + }) end private diff --git a/lib/tasks/seed.rake b/lib/tasks/seed.rake index a8be41674770..3c666459a30d 100644 --- a/lib/tasks/seed.rake +++ b/lib/tasks/seed.rake @@ -199,10 +199,10 @@ namespace :seed do "A message" end base["logs"].append({ - "log" => { "sources" => { "source" => src }, - "messages" => { "message" => msg }, - "level" => (i.even? ? "notice" : "err") }, - }) + "log" => { "sources" => { "source" => src }, + "messages" => { "message" => msg }, + "level" => (i.even? ? "notice" : "err") }, + }) end base["reporter"] = "ansible" if is_ansible base diff --git a/test/controllers/api/v2/bookmarks_controller_test.rb b/test/controllers/api/v2/bookmarks_controller_test.rb index 6c98b40dd98f..ce280c959c10 100644 --- a/test/controllers/api/v2/bookmarks_controller_test.rb +++ b/test/controllers/api/v2/bookmarks_controller_test.rb @@ -7,14 +7,14 @@ class Api::V2::BookmarksControllerTest < ActionController::TestCase } simple_bookmark = bookmark_base.merge({ - :name => "foo-bar", + :name => "foo-bar", :query => "bar", - }) + }) dot_bookmark = bookmark_base.merge({ - :name => "facts.architecture", + :name => "facts.architecture", :query => " facts.architecture = x86_64", - }) + }) context 'index test' do def setup diff --git a/test/models/host_test.rb b/test/models/host_test.rb index ea9a14bcd9d2..511bd1e8a895 100644 --- a/test/models/host_test.rb +++ b/test/models/host_test.rb @@ -1735,13 +1735,13 @@ class HostTest < ActiveSupport::TestCase test "can search hosts by numeric and string facts" do host = FactoryBot.create(:host, :hostname => 'num001.example.com') HostFactImporter.new(host).import_facts({ - :architecture => "x86_64", + :architecture => "x86_64", :interfaces => 'eth0', :operatingsystem => 'RedHat-test', :operatingsystemrelease => '6.2', :memory_mb => "64498", :custom_fact => "find_me", - }) + }) hosts = Host::Managed.search_for("facts.memory_mb > 112889") assert_equal hosts.count, 0 @@ -2590,14 +2590,14 @@ def to_managed! test '#initialize respects primary interface attributes and sets provision to the same if missing' do h = Host.new(:interfaces_attributes => { - '0' => {'_destroy' => '0', - :type => 'Nic::Managed', - :mac => 'ff:ff:ff:aa:aa:aa', - :managed => '1', - :primary => '1', - :provision => '0', - :virtual => '0'}, - }) + '0' => {'_destroy' => '0', + :type => 'Nic::Managed', + :mac => 'ff:ff:ff:aa:aa:aa', + :managed => '1', + :primary => '1', + :provision => '0', + :virtual => '0'}, + }) refute_nil h.primary_interface refute_nil h.provision_interface assert_equal 'ff:ff:ff:aa:aa:aa', h.primary_interface.mac @@ -2606,13 +2606,13 @@ def to_managed! test '#initialize respects primary and provision interface attributes' do h = Host.new(:interfaces_attributes => { - '0' => {'_destroy' => '0', - :type => 'Nic::Managed', - :mac => 'ff:ff:ff:aa:aa:aa', - :managed => '1', - :primary => '1', - :provision => '0', - :virtual => '0'}, + '0' => {'_destroy' => '0', + :type => 'Nic::Managed', + :mac => 'ff:ff:ff:aa:aa:aa', + :managed => '1', + :primary => '1', + :provision => '0', + :virtual => '0'}, '1' => {'_destroy' => '0', :type => 'Nic::Managed', :mac => 'aa:aa:aa:ff:ff:ff', @@ -2620,7 +2620,7 @@ def to_managed! :primary => '0', :provision => '1', :virtual => '0'}, - }) + }) refute_nil h.primary_interface refute_nil h.provision_interface assert_equal 'ff:ff:ff:aa:aa:aa', h.primary_interface.mac diff --git a/test/models/operatingsystems/solaris_test.rb b/test/models/operatingsystems/solaris_test.rb index 76cd9f4a4228..81e71448747d 100644 --- a/test/models/operatingsystems/solaris_test.rb +++ b/test/models/operatingsystems/solaris_test.rb @@ -19,7 +19,7 @@ class SolarisTest < ActiveSupport::TestCase Resolv::DNS.any_instance.stubs(:getaddress).with("brsla01.yourdomain.net").returns("2.3.4.5").once result = h.os.jumpstart_params h, h.model.vendor_class assert_equal({ - :vendor => "", + :vendor => "", :install_path => "/vol/solgi_5.10/sol10_hw0910_sparc", :install_server_ip => "2.3.4.5", :install_server_name => "brsla01", @@ -28,6 +28,6 @@ class SolarisTest < ActiveSupport::TestCase :root_server_hostname => "brsla01", :root_server_ip => "2.3.4.5", :sysid_server_path => "2.3.4.5:/vol/jumpstart/sysidcfg/sysidcfg_primary", - }, result) + }, result) end end diff --git a/test/unit/config_report_status_calculator_test.rb b/test/unit/config_report_status_calculator_test.rb index 8d17824ea654..92dcde8d94b2 100644 --- a/test/unit/config_report_status_calculator_test.rb +++ b/test/unit/config_report_status_calculator_test.rb @@ -13,13 +13,13 @@ class ConfigReportStatusCalculatorTest < ActiveSupport::TestCase test 'it should save metrics as bits in status integers' do r = ConfigReportStatusCalculator.new(:size => 6, :counters => { - 'applied': 1, + 'applied': 1, 'restarted': 2, 'failed': 3, 'failed_restarts': 4, 'skipped': 5, 'pending': 6, - }) + }) assert_equal 1, r.status_of('applied') assert_equal 2, r.status_of('restarted') assert_equal 3, r.status_of('failed') @@ -30,13 +30,13 @@ class ConfigReportStatusCalculatorTest < ActiveSupport::TestCase test 'it should save metrics as bits in status strings' do r = ConfigReportStatusCalculator.new(:size => 6, :counters => { - 'applied': 0, + 'applied': 0, 'restarted': 1, 'failed': 63, 'failed_restarts': 64, 'skipped': 100, 'pending': 200, - }) + }) assert_equal "0", r.status_as_text_of('applied') assert_equal "1", r.status_as_text_of('restarted') assert_equal "63+", r.status_as_text_of('failed') @@ -48,20 +48,20 @@ class ConfigReportStatusCalculatorTest < ActiveSupport::TestCase test 'it should make use of some bits for (the legacy) word size 6' do maximum_value = 63 r = ConfigReportStatusCalculator.new(:size => 6, :counters => { - 'applied': maximum_value, + 'applied': maximum_value, 'restarted': maximum_value, 'failed': maximum_value, 'failed_restarts': maximum_value, 'skipped': maximum_value, 'pending': maximum_value, - }) + }) assert_equal 0xFFFFFFFFF, r.calculate, "Expected in hex: %x, Actual in hex: %x" % [0xFFFFFFFFF, r.calculate] end test 'it should make use of all bits available' do maximum_value = 255 r = ConfigReportStatusCalculator.new(:metrics => %w[1 2 3 4 5 6 7 8], :counters => { - '1': maximum_value, + '1': maximum_value, '2': maximum_value, '3': maximum_value, '4': maximum_value, @@ -69,7 +69,7 @@ class ConfigReportStatusCalculatorTest < ActiveSupport::TestCase '6': maximum_value, '7': maximum_value, '8': maximum_value, - }) + }) assert_equal 0xFFFFFFFFFFFFFFFF, r.calculate, "Expected in hex: %x, Actual in hex: %x" % [0xFFFFFFFFFFFFFFFF, r.calculate] end