From ef1f890df47084f31f84fc4ed280d08725e4affa Mon Sep 17 00:00:00 2001 From: Cookstyle Bot Date: Wed, 26 Jan 2022 13:51:57 -0800 Subject: [PATCH] Cookstyle Bot Auto Corrections with Cookstyle 7.31.1 This change is automatically generated by the Cookstyle Bot using the latest version of Cookstyle (7.31.1). Adopting changes suggested by Cookstyle improves cookbook readability, avoids common coding mistakes, and eases upgrades to newer versions of the Chef Infra Client. Signed-off-by: Cookstyle --- Berksfile | 1 - Gemfile | 2 -- Guardfile | 32 +++++++++++++++----------------- attributes/default.rb | 7 +++---- attributes/hardening.rb | 7 +++---- libraries/nginx_options.rb | 8 +++----- metadata.rb | 8 +------- recipes/default.rb | 11 +++++------ recipes/minimize_access.rb | 5 ++--- recipes/upgrades.rb | 7 +++---- spec/recipes/default_spec.rb | 3 +-- spec/spec_helper.rb | 6 ++---- 12 files changed, 38 insertions(+), 59 deletions(-) diff --git a/Berksfile b/Berksfile index f9d5d42..6c2968f 100644 --- a/Berksfile +++ b/Berksfile @@ -1,4 +1,3 @@ -# encoding: utf-8 source 'https://supermarket.chef.io' metadata diff --git a/Gemfile b/Gemfile index b8b0bf1..70a123b 100644 --- a/Gemfile +++ b/Gemfile @@ -1,5 +1,3 @@ -# encoding: utf-8 - source 'https://rubygems.org' gem 'berkshelf', '~> 6.3' diff --git a/Guardfile b/Guardfile index fe71ed4..87002a9 100644 --- a/Guardfile +++ b/Guardfile @@ -1,32 +1,30 @@ -# encoding: utf-8 - # Guardfile guard :rubocop do watch(/.+\.rb$/) - watch(/(?:.+\/)?\.rubocop\.yml$/) { |m| File.dirname(m[0]) } + watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) } end guard :foodcritic, cookbook_paths: '.', cli: '-f any --tags ~FC023' do - watch(/attributes\/.+\.rb$/) - watch(/providers\/.+\.rb$/) - watch(/recipes\/.+\.rb$/) - watch(/resources\/.+\.rb$/) + watch(%r{attributes/.+\.rb$}) + watch(%r{providers/.+\.rb$}) + watch(%r{recipes/.+\.rb$}) + watch(%r{resources/.+\.rb$}) watch(/metadata.rb/) end guard :rspec do - watch(/^spec\/.+_spec\.rb$/) - watch(/^(recipes)\/(.+)\.rb$/) { |m| "spec/#{m[1]}_spec.rb" } - watch('spec/spec_helper.rb') { 'spec' } + watch(%r{^spec/.+_spec\.rb$}) + watch(%r{^(recipes)/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" } + watch('spec/spec_helper.rb') { 'spec' } end guard :kitchen, all_on_start: false do - watch(/test\/.+/) - watch(/^recipes\/(.+)\.rb$/) - watch(/^attributes\/(.+)\.rb$/) - watch(/^files\/(.+)/) - watch(/^templates\/(.+)/) - watch(/^providers\/(.+)\.rb/) - watch(/^resources\/(.+)\.rb/) + watch(%r{test/.+}) + watch(%r{^recipes/(.+)\.rb$}) + watch(%r{^attributes/(.+)\.rb$}) + watch(%r{^files/(.+)}) + watch(%r{^templates/(.+)}) + watch(%r{^providers/(.+)\.rb}) + watch(%r{^resources/(.+)\.rb}) end diff --git a/attributes/default.rb b/attributes/default.rb index 28d51e3..6508c43 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -1,10 +1,9 @@ -# encoding: utf-8 # -# Cookbook Name:: nginx-hardening +# Cookbook:: nginx-hardening # Attributes:: default # -# Copyright 2014, Dominik Richter -# Copyright 2014, Deutsche Telekom AG +# Copyright:: 2014, Dominik Richter +# Copyright:: 2014, Deutsche Telekom AG # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/attributes/hardening.rb b/attributes/hardening.rb index c726542..3f17f2a 100644 --- a/attributes/hardening.rb +++ b/attributes/hardening.rb @@ -1,10 +1,9 @@ -# encoding: utf-8 # -# Cookbook Name:: nginx-hardening +# Cookbook:: nginx-hardening # Attributes:: default # -# Copyright 2014, Dominik Richter -# Copyright 2014, Deutsche Telekom AG +# Copyright:: 2014, Dominik Richter +# Copyright:: 2014, Deutsche Telekom AG # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/libraries/nginx_options.rb b/libraries/nginx_options.rb index 25802c2..82a3057 100644 --- a/libraries/nginx_options.rb +++ b/libraries/nginx_options.rb @@ -1,10 +1,8 @@ -# encoding: utf-8 - -# Cookbook Name:: nginx-hardening +# Cookbook:: nginx-hardening # Library:: nginx_options # -# Copyright 2014, Dominik Richter -# Copyright 2014, Deutsche Telekom AG +# Copyright:: 2014, Dominik Richter +# Copyright:: 2014, Deutsche Telekom AG # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/metadata.rb b/metadata.rb index f9d8a5f..708f43c 100644 --- a/metadata.rb +++ b/metadata.rb @@ -1,6 +1,5 @@ -# encoding: utf-8 # -# Copyright 2014, Deutsche Telekom AG +# Copyright:: 2014, Deutsche Telekom AG # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -20,7 +19,6 @@ maintainer_email 'dominik.richter@googlemail.com' license 'Apache-2.0' description 'Configures nginx hardening' -long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) version '3.0.0' @@ -32,10 +30,6 @@ supports 'centos', '>= 6.6' depends 'nginx', '>= 7.0' -depends 'openssl' - -recipe 'nginx-hardening::default', 'configures nginx for hardening' -recipe 'nginx-hardening::upgrades', 'upgrades dependencies of nginx for hardening' source_url 'https://github.com/dev-sec/chef-nginx-hardening' issues_url 'https://github.com/dev-sec/chef-nginx-hardening/issues' diff --git a/recipes/default.rb b/recipes/default.rb index cc6de7a..eca6628 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -1,10 +1,9 @@ -# encoding: utf-8 # -# Cookbook Name:: nginx-hardening +# Cookbook:: nginx-hardening # Recipe:: default.rb # -# Copyright 2014, Dominik Richter -# Copyright 2014, Deutsche Telekom AG +# Copyright:: 2014, Dominik Richter +# Copyright:: 2014, Deutsche Telekom AG # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -19,7 +18,7 @@ # limitations under the License. # -include_recipe('nginx-hardening::minimize_access') +include_recipe 'nginx-hardening::minimize_access' node.default['nginx-hardening']['options']['ssl_dhparam'] = ::File.join((node['nginx-hardening']['certificates_dir'] || node['nginx']['dir']), 'dh2048.pem') options = node['nginx-hardening']['options'].to_hash @@ -62,5 +61,5 @@ execute 'generate_dh_group' do command "openssl dhparam -out #{node['nginx-hardening']['options']['ssl_dhparam']} #{node['nginx-hardening']['dh-size']}" - not_if { File.exist?(node['nginx-hardening']['options']['ssl_dhparam']) } + not_if { ::File.exist?(node['nginx-hardening']['options']['ssl_dhparam']) } end diff --git a/recipes/minimize_access.rb b/recipes/minimize_access.rb index 803a6b0..529fb73 100644 --- a/recipes/minimize_access.rb +++ b/recipes/minimize_access.rb @@ -1,9 +1,8 @@ -# encoding: utf-8 # -# Cookbook Name: nginx-hardening +# Cookbook:: Name: nginx-hardening # Recipe: minimize_access # -# Copyright 2014, Deutsche Telekom AG +# Copyright:: 2014, Deutsche Telekom AG # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/recipes/upgrades.rb b/recipes/upgrades.rb index 08f5c11..c82d200 100644 --- a/recipes/upgrades.rb +++ b/recipes/upgrades.rb @@ -1,10 +1,9 @@ -# encoding: utf-8 # -# Cookbook Name:: nginx-hardening +# Cookbook:: nginx-hardening # Recipe:: default.rb # -# Copyright 2015, Edmund Haselwanter -# Copyright 2015, Deutsche Telekom AG +# Copyright:: 2015, Edmund Haselwanter +# Copyright:: 2015, Deutsche Telekom AG # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/spec/recipes/default_spec.rb b/spec/recipes/default_spec.rb index 2d47fd9..088cbf0 100644 --- a/spec/recipes/default_spec.rb +++ b/spec/recipes/default_spec.rb @@ -1,6 +1,5 @@ -# encoding: UTF-8 # -# Copyright 2014, Deutsche Telekom AG +# Copyright:: 2014, Deutsche Telekom AG # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 06c93c3..00f595b 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,7 +1,5 @@ -# encoding: utf-8 - -# Copyright 2014, Dominik Richter -# Copyright 2014, Deutsche Telekom AG +# Copyright:: 2014, Dominik Richter +# Copyright:: 2014, Deutsche Telekom AG # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License.