Skip to content

Commit

Permalink
Apply the linter to remove all the foodcritic exemption for the ones …
Browse files Browse the repository at this point in the history
…migrated to cookstyle: prod

Differential Revision: D53077178

fbshipit-source-id: e3759650d0df0a9a64cc278ac065de41a1ae1db2
  • Loading branch information
Olivier Raginel authored and facebook-github-bot committed Jan 26, 2024
1 parent 6567b9a commit 2db57f7
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 17 deletions.
8 changes: 4 additions & 4 deletions cookbooks/fb_consul/recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
mode '0644'
end

cookbook_file '/etc/consul/consul-agent-ca.pem' do # ~FB032
cookbook_file '/etc/consul/consul-agent-ca.pem' do # rubocop:disable Chef/Meta/AvoidCookbookProperty
only_if { node['fb_consul']['certificate_cookbook'] }
cookbook lazy { node['fb_consul']['certificate_cookbook'] }
owner 'root'
Expand All @@ -84,7 +84,7 @@
notifies :restart, 'service[consul]'
end

cookbook_file '/etc/consul/consul-agent-ca-key.pem' do # ~FB032
cookbook_file '/etc/consul/consul-agent-ca-key.pem' do # rubocop:disable Chef/Meta/AvoidCookbookProperty
only_if do
node['fb_consul']['config']['server'] &&
node['fb_consul']['certificate_cookbook']
Expand All @@ -96,7 +96,7 @@
notifies :restart, 'service[consul]'
end

cookbook_file '/etc/consul/consul-server.pem' do # ~FB032
cookbook_file '/etc/consul/consul-server.pem' do # rubocop:disable Chef/Meta/AvoidCookbookProperty
only_if do
node['fb_consul']['config']['server'] &&
node['fb_consul']['certificate_cookbook']
Expand All @@ -109,7 +109,7 @@
notifies :restart, 'service[consul]'
end

cookbook_file '/etc/consul/consul-server-key.pem' do # ~FB032
cookbook_file '/etc/consul/consul-server-key.pem' do # rubocop:disable Chef/Meta/AvoidCookbookProperty
only_if do
node['fb_consul']['config']['server'] &&
node['fb_consul']['certificate_cookbook']
Expand Down
2 changes: 1 addition & 1 deletion cookbooks/fb_fstab/libraries/provider.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def mount(mount_data, in_maint_disks, in_maint_mounts)
'immutable mountpoint. If you can see this, ' +
"the mount is missing!\n"
# rubocop:disable Chef/Meta/NoFileWrites
File.open(readme, 'w') do |f| # ~FB030
File.open(readme, 'w') do |f| # rubocop:disable Chef/Meta/NoFileWrites
f.write(readme_body)
end
# rubocop:enable Chef/Meta/NoFileWrites
Expand Down
2 changes: 1 addition & 1 deletion cookbooks/fb_grub/recipes/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
grub_base_dir = node['fb_grub']['_grub_base_dir']
grub2_base_dir = node['fb_grub']['_grub2_base_dir']

directory 'efi_vendor_dir' do # rubocop:disable Chef/Meta/RequireOwnerGroupMode # ~FB024 mode is controlled by mount options
directory 'efi_vendor_dir' do # rubocop:disable Chef/Meta/RequireOwnerGroupMode mode is controlled by mount options
only_if { node.efi? }
path lazy { node['fb_grub']['_efi_vendor_dir'] }
owner 'root'
Expand Down
6 changes: 3 additions & 3 deletions cookbooks/fb_helpers/resources/reboot.rb
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def reboot_allowed(node)
set_reboot_override('immediate')
do_managed_reboot
else
command = execute 'reboot' do # ~FB026
command = execute 'reboot' do # rubocop:disable Chef/Meta/FBUtilReboot
command 'reboot'
action :nothing
end
Expand Down Expand Up @@ -196,7 +196,7 @@ def reboot_allowed(node)
node,
load_reboot_reason,
)
reboot 'reboot' do # ~FB026
reboot 'reboot' do # rubocop:disable Chef/Meta/FBUtilReboot
action :request_reboot
end
else
Expand Down Expand Up @@ -224,7 +224,7 @@ def reboot_allowed(node)
command "rtcwake -m no -s #{new_resource.wakeup_time_secs}"
action :nothing
end
poweroff = execute 'poweroff' do # ~FB026
poweroff = execute 'poweroff' do # rubocop:disable Chef/Meta/FBUtilReboot
command 'shutdown -P now'
action :nothing
end
Expand Down
2 changes: 1 addition & 1 deletion cookbooks/fb_sysfs/resources/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
end
# We are using file to write content, not to manage the file itself,
# so we exempt the internal foodcritic rule that requires owner/group/mode.
file new_resource.path do # rubocop:disable Chef/Meta/RequireOwnerGroupMode # ~FB023
file new_resource.path do # rubocop:disable Chef/Meta/RequireOwnerGroupMode
if new_resource.type == :list
# Some :list sysfs require a newline at the end of the value to take
# effect. For others, the newline is ignored, so always write one (and
Expand Down
4 changes: 2 additions & 2 deletions cookbooks/fb_tmpclean/recipes/windows.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,12 @@
}
end

windows_task 'create-cleanup-task' do # ~FB047
windows_task 'create-cleanup-task' do # rubocop:disable Chef/Meta/WindowsTaskAbsolutePaths
# This is an absolute path - the linter is wrong
command lazy {
'C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe -File ' +
(node['fb_tmpclean']['windows_script_location']).to_s
} # ~FB047
} # rubocop:disable Chef/Meta/WindowsTaskAbsolutePaths
frequency :weekly
start_time '02:20'
start_when_available true
Expand Down
10 changes: 5 additions & 5 deletions cookbooks/fb_users/resources/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def bootstrap_pgroups
# We may not have this group if it's a remote one, so check we do and
# that it's set to create
if info && info['action'] && info['action'] != :delete
group "bootstrap #{grp}" do # rubocop:disable Chef/Meta/ResourceReplacer # ~FB015
group "bootstrap #{grp}" do # rubocop:disable Chef/Meta/ResourceReplacer
group_name grp
gid ::FB::Users::GID_MAP[grp]['gid']
action :create
Expand Down Expand Up @@ -123,7 +123,7 @@ def bootstrap_pgroups
# delete any users and optionally clean up home dirs if `manage_home true`
if info['action'] == :delete
# keep property list in sync with FB::Users._validate
user username do # rubocop:disable Chef/Meta/ResourceReplacer # ~FB014
user username do # rubocop:disable Chef/Meta/ResourceReplacer
manage_home manage_homedir
action :remove
info['notifies']&.each_value do |notif|
Expand All @@ -142,7 +142,7 @@ def bootstrap_pgroups

# disabling fc009 because it triggers on 'secure_token' below which
# is already guarded by a version 'if'
user username do # rubocop:disable Chef/Meta/ResourceReplacer # ~FB014 ~FC009
user username do # rubocop:disable Chef/Meta/ResourceReplacer
uid mapinfo['uid'].to_i
# the .to_i here is important - if the usermap accidentally
# quotes the gid, then it will try to look up a group named "142"
Expand Down Expand Up @@ -189,7 +189,7 @@ def bootstrap_pgroups
next unless info['only_if'].call
end
if info['action'] == :delete
group groupname do # rubocop:disable Chef/Meta/ResourceReplacer # ~FB015
group groupname do # rubocop:disable Chef/Meta/ResourceReplacer
action :remove
info['notifies']&.each_value do |notif|
timing = notif['timing'] || 'delayed'
Expand All @@ -202,7 +202,7 @@ def bootstrap_pgroups
mapinfo = ::FB::Users::GID_MAP[groupname]
# disabling fc009 becasue it triggers on 'comment' below which
# is already guarded by a version 'if'
group groupname do # rubocop:disable Chef/Meta/ResourceReplacer # ~FB015
group groupname do # rubocop:disable Chef/Meta/ResourceReplacer
gid mapinfo['gid'].to_i
system mapinfo['system'] unless mapinfo['system'].nil?
if info['members']
Expand Down

0 comments on commit 2db57f7

Please sign in to comment.