Skip to content

Commit

Permalink
Fix rubocop Layout/FirstHashElementIndentation
Browse files Browse the repository at this point in the history
  • Loading branch information
archanaserver committed Jan 4, 2024
1 parent 0e40c12 commit 2f8031c
Show file tree
Hide file tree
Showing 10 changed files with 47 additions and 44 deletions.
3 changes: 3 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,6 @@ Layout/EmptyLinesAroundAttributeAccessor:

Layout/EmptyLineBetweenDefs:
Enabled: true

Layout/FirstHashElementIndentation:
Enabled: true
4 changes: 2 additions & 2 deletions app/helpers/layout_helper.rb
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions app/helpers/search_bar_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ 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],
url: url,
useKeyShortcuts: true,
},
bookmarks: bookmarks,
})
})
end
end
4 changes: 2 additions & 2 deletions app/services/power_manager/bmc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions app/services/power_manager/virt.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions lib/tasks/seed.rake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions test/controllers/api/v2/bookmarks_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
36 changes: 18 additions & 18 deletions test/models/host_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -2606,21 +2606,21 @@ 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',
:managed => '1',
: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
Expand Down
4 changes: 2 additions & 2 deletions test/models/operatingsystems/solaris_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 => "<Sun-Fire-V210>",
:vendor => "<Sun-Fire-V210>",
:install_path => "/vol/solgi_5.10/sol10_hw0910_sparc",
:install_server_ip => "2.3.4.5",
:install_server_name => "brsla01",
Expand All @@ -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
16 changes: 8 additions & 8 deletions test/unit/config_report_status_calculator_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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')
Expand All @@ -48,28 +48,28 @@ 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,
'5': maximum_value,
'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

Expand Down

0 comments on commit 2f8031c

Please sign in to comment.