From 5f6daf7b670b571447a5d907219ab7804e3c9007 Mon Sep 17 00:00:00 2001 From: Tim Smith Date: Sun, 26 Jul 2020 17:26:36 -0700 Subject: Combine attr_readers onto a single line The method takes more than 1 argument Signed-off-by: Tim Smith --- lib/chef/action_collection.rb | 6 +----- lib/chef/api_client/registration.rb | 3 +-- lib/chef/chef_fs/chef_fs_data_store.rb | 3 +-- lib/chef/chef_fs/config.rb | 4 +--- lib/chef/chef_fs/file_system.rb | 7 ++----- lib/chef/chef_fs/file_system/base_fs_object.rb | 4 +--- .../file_system/chef_server/chef_server_root_dir.rb | 8 +------- .../chef_fs/file_system/chef_server/cookbook_subdir.rb | 3 +-- .../chef_fs/file_system/chef_server/rest_list_dir.rb | 3 +-- lib/chef/chef_fs/file_system/exceptions.rb | 4 ++-- lib/chef/chef_fs/file_system/repository/base_file.rb | 6 +----- .../chef_repository_file_system_cookbook_entry.rb | 7 +------ .../repository/chef_repository_file_system_root_dir.rb | 4 +--- lib/chef/chef_fs/file_system/repository/directory.rb | 5 +---- lib/chef/chef_fs/parallelizer/flatten_enumerable.rb | 3 +-- lib/chef/chef_fs/parallelizer/parallel_enumerable.rb | 5 +---- lib/chef/client.rb | 3 +-- lib/chef/cookbook/cookbook_version_loader.rb | 8 +------- lib/chef/cookbook/file_system_file_vendor.rb | 3 +-- lib/chef/cookbook/metadata.rb | 5 +---- lib/chef/cookbook/remote_file_vendor.rb | 3 +-- lib/chef/cookbook/syntax_check.rb | 4 +--- lib/chef/cookbook_uploader.rb | 6 +----- lib/chef/cookbook_version.rb | 3 +-- lib/chef/daemon.rb | 3 +-- lib/chef/decorator/unchain.rb | 3 +-- lib/chef/encrypted_data_bag_item/decryptor.rb | 6 ++---- lib/chef/encrypted_data_bag_item/encryptor.rb | 3 +-- lib/chef/event_dispatch/events_output_stream.rb | 3 +-- lib/chef/exceptions.rb | 9 +++------ lib/chef/file_access_control.rb | 5 +---- lib/chef/file_content_management/content_base.rb | 5 +---- lib/chef/formatters/base.rb | 4 +--- .../error_inspectors/compile_error_inspector.rb | 3 +-- .../cookbook_resolve_error_inspector.rb | 3 +-- .../error_inspectors/cookbook_sync_error_inspector.rb | 3 +-- .../error_inspectors/node_load_error_inspector.rb | 4 +--- .../error_inspectors/registration_error_inspector.rb | 4 +--- .../error_inspectors/resource_failure_inspector.rb | 4 +--- .../run_list_expansion_error_inspector.rb | 3 +-- lib/chef/formatters/indentable_output_stream.rb | 9 +++------ lib/chef/formatters/minimal.rb | 3 +-- lib/chef/http.rb | 8 +------- lib/chef/http/authenticator.rb | 7 +------ lib/chef/http/basic_client.rb | 4 +--- lib/chef/http/json_output.rb | 3 +-- lib/chef/knife.rb | 3 +-- lib/chef/knife/configure.rb | 3 +-- lib/chef/knife/core/bootstrap_context.rb | 4 +--- lib/chef/knife/core/cookbook_scm_repo.rb | 5 +---- lib/chef/knife/core/generic_presenter.rb | 3 +-- lib/chef/knife/core/object_loader.rb | 3 +-- lib/chef/knife/core/text_formatter.rb | 3 +-- lib/chef/knife/core/ui.rb | 7 +------ lib/chef/knife/core/windows_bootstrap_context.rb | 3 +-- lib/chef/knife/supermarket_install.rb | 3 +-- lib/chef/node/mixin/state_tracking.rb | 5 +---- lib/chef/policy_builder/dynamic.rb | 7 +------ lib/chef/policy_builder/expand_node_object.rb | 9 +-------- lib/chef/policy_builder/policyfile.rb | 7 +------ lib/chef/powershell.rb | 3 +-- lib/chef/provider.rb | 8 ++------ lib/chef/provider/file.rb | 4 +--- lib/chef/provider/group.rb | 3 +-- lib/chef/provider/ifconfig.rb | 3 +-- lib/chef/provider/package/dnf/python_helper.rb | 7 +------ lib/chef/provider/package/dnf/version.rb | 4 +--- lib/chef/provider/package/rubygems.rb | 3 +-- lib/chef/provider/package/windows/exe.rb | 5 +---- lib/chef/provider/package/windows/msi.rb | 4 +--- .../package/windows/registry_uninstall_entry.rb | 8 +------- lib/chef/provider/package/yum/python_helper.rb | 7 +------ lib/chef/provider/package/yum/version.rb | 4 +--- lib/chef/provider/remote_file/ftp.rb | 4 +--- lib/chef/provider/remote_file/http.rb | 5 +---- lib/chef/provider/remote_file/local_file.rb | 3 +-- lib/chef/provider/remote_file/sftp.rb | 4 +--- lib/chef/provider/resource_update.rb | 14 +++++--------- lib/chef/provider/user/dscl.rb | 4 +--- lib/chef/provider_resolver.rb | 4 +--- lib/chef/resource/conditional.rb | 5 +---- lib/chef/resource/template.rb | 3 +-- lib/chef/resource_builder.rb | 10 +--------- lib/chef/resource_collection.rb | 3 +-- lib/chef/resource_collection/resource_list.rb | 3 +-- lib/chef/resource_reporter.rb | 6 +----- lib/chef/run_context.rb | 4 +--- lib/chef/run_context/cookbook_compiler.rb | 4 +--- lib/chef/run_list/run_list_expansion.rb | 13 +------------ lib/chef/run_lock.rb | 4 +--- lib/chef/run_status.rb | 18 +++--------------- lib/chef/scan_access_control.rb | 3 +-- lib/chef/shell.rb | 4 ++-- lib/chef/util/windows/logon_session.rb | 9 +-------- lib/chef/win32/mutex.rb | 3 +-- lib/chef/win32/security/securable_object.rb | 3 +-- spec/functional/run_lock_spec.rb | 9 ++------- spec/integration/recipes/recipe_dsl_spec.rb | 5 ++--- spec/integration/recipes/resource_action_spec.rb | 9 ++++----- spec/support/shared/integration/knife_support.rb | 4 +--- spec/tiny_server.rb | 4 +--- 101 files changed, 121 insertions(+), 380 deletions(-) diff --git a/lib/chef/action_collection.rb b/lib/chef/action_collection.rb index efe03fff5f..d8239c7f8e 100644 --- a/lib/chef/action_collection.rb +++ b/lib/chef/action_collection.rb @@ -81,11 +81,7 @@ class Chef end end - attr_reader :action_records - attr_reader :pending_updates - attr_reader :run_context - attr_reader :consumers - attr_reader :events + attr_reader :action_records, :pending_updates, :run_context, :consumers, :events def initialize(events, run_context = nil, action_records = []) @action_records = action_records diff --git a/lib/chef/api_client/registration.rb b/lib/chef/api_client/registration.rb index 02b7258fba..a38ae5eacf 100644 --- a/lib/chef/api_client/registration.rb +++ b/lib/chef/api_client/registration.rb @@ -31,8 +31,7 @@ class Chef # a new client/node identity by borrowing the validator client identity # when creating a new client. class Registration - attr_reader :destination - attr_reader :name + attr_reader :destination, :name def initialize(name, destination, http_api: nil) @name = name diff --git a/lib/chef/chef_fs/chef_fs_data_store.rb b/lib/chef/chef_fs/chef_fs_data_store.rb index 8237729e89..8fd537f2ee 100644 --- a/lib/chef/chef_fs/chef_fs_data_store.rb +++ b/lib/chef/chef_fs/chef_fs_data_store.rb @@ -164,8 +164,7 @@ class Chef "Reading and writing data to #{chef_fs.fs_description}" end - attr_reader :chef_fs - attr_reader :repo_mode + attr_reader :chef_fs, :repo_mode def create_dir(path, name, *options) if use_memory_store?(path) diff --git a/lib/chef/chef_fs/config.rb b/lib/chef/chef_fs/config.rb index 6f9183f40b..3890229ae7 100644 --- a/lib/chef/chef_fs/config.rb +++ b/lib/chef/chef_fs/config.rb @@ -159,9 +159,7 @@ class Chef end end - attr_reader :chef_config - attr_reader :cwd - attr_reader :cookbook_version + attr_reader :chef_config, :cwd, :cookbook_version def is_hosted? @chef_config[:chef_server_url] =~ %r{/+organizations/.+} diff --git a/lib/chef/chef_fs/file_system.rb b/lib/chef/chef_fs/file_system.rb index aadfc9807c..b1e5de4b73 100644 --- a/lib/chef/chef_fs/file_system.rb +++ b/lib/chef/chef_fs/file_system.rb @@ -43,8 +43,7 @@ class Chef @pattern = pattern end - attr_reader :root - attr_reader :pattern + attr_reader :root, :pattern def each(&block) list_from(root, &block) @@ -179,9 +178,7 @@ class Chef @b_root = b_root end - attr_reader :pattern - attr_reader :a_root - attr_reader :b_root + attr_reader :pattern, :a_root, :b_root def each # Make sure everything on the server is also on the filesystem, and diff diff --git a/lib/chef/chef_fs/file_system/base_fs_object.rb b/lib/chef/chef_fs/file_system/base_fs_object.rb index a0bcf3ff65..e24ae7e2e0 100644 --- a/lib/chef/chef_fs/file_system/base_fs_object.rb +++ b/lib/chef/chef_fs/file_system/base_fs_object.rb @@ -37,9 +37,7 @@ class Chef end end - attr_reader :name - attr_reader :parent - attr_reader :path + attr_reader :name, :parent, :path alias_method :display_path, :path alias_method :display_name, :name diff --git a/lib/chef/chef_fs/file_system/chef_server/chef_server_root_dir.rb b/lib/chef/chef_fs/file_system/chef_server/chef_server_root_dir.rb index 3477278c96..0900a033d0 100644 --- a/lib/chef/chef_fs/file_system/chef_server/chef_server_root_dir.rb +++ b/lib/chef/chef_fs/file_system/chef_server/chef_server_root_dir.rb @@ -86,13 +86,7 @@ class Chef @cookbook_version = options[:cookbook_version] # Used in knife diff and download for server cookbook version end - attr_reader :chef_server_url - attr_reader :chef_username - attr_reader :chef_private_key - attr_reader :environment - attr_reader :repo_mode - attr_reader :cookbook_version - attr_reader :versioned_cookbooks + attr_reader :chef_server_url, :chef_username, :chef_private_key, :environment, :repo_mode, :cookbook_version, :versioned_cookbooks def fs_description "Chef server at #{chef_server_url} (user #{chef_username}), repo_mode = #{repo_mode}" diff --git a/lib/chef/chef_fs/file_system/chef_server/cookbook_subdir.rb b/lib/chef/chef_fs/file_system/chef_server/cookbook_subdir.rb index 91b5e47d66..c037d8ce25 100644 --- a/lib/chef/chef_fs/file_system/chef_server/cookbook_subdir.rb +++ b/lib/chef/chef_fs/file_system/chef_server/cookbook_subdir.rb @@ -30,8 +30,7 @@ class Chef @recursive = recursive end - attr_reader :versions - attr_reader :children + attr_reader :versions, :children def add_child(child) @children << child diff --git a/lib/chef/chef_fs/file_system/chef_server/rest_list_dir.rb b/lib/chef/chef_fs/file_system/chef_server/rest_list_dir.rb index 0a1ee83c36..a96cdbbf9a 100644 --- a/lib/chef/chef_fs/file_system/chef_server/rest_list_dir.rb +++ b/lib/chef/chef_fs/file_system/chef_server/rest_list_dir.rb @@ -31,8 +31,7 @@ class Chef @data_handler = data_handler end - attr_reader :api_path - attr_reader :data_handler + attr_reader :api_path, :data_handler def can_have_child?(name, is_dir) !is_dir diff --git a/lib/chef/chef_fs/file_system/exceptions.rb b/lib/chef/chef_fs/file_system/exceptions.rb index 8f6ce64f02..9c1c4dbfe3 100644 --- a/lib/chef/chef_fs/file_system/exceptions.rb +++ b/lib/chef/chef_fs/file_system/exceptions.rb @@ -78,8 +78,8 @@ class Chef @operation = operation end - attr_reader :operation - attr_reader :entry + attr_reader :operation, :entry + end class AlreadyExistsError < OperationFailedError; end diff --git a/lib/chef/chef_fs/file_system/repository/base_file.rb b/lib/chef/chef_fs/file_system/repository/base_file.rb index 94b52b9201..1a7e5e7d1b 100644 --- a/lib/chef/chef_fs/file_system/repository/base_file.rb +++ b/lib/chef/chef_fs/file_system/repository/base_file.rb @@ -25,11 +25,7 @@ class Chef class BaseFile - attr_reader :name - attr_reader :parent - attr_reader :path - attr_reader :file_path - attr_reader :data_handler + attr_reader :name, :parent, :path, :file_path, :data_handler alias_method :display_path, :path alias_method :display_name, :name diff --git a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry.rb b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry.rb index 99deddae41..1a2e9289d2 100644 --- a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry.rb +++ b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry.rb @@ -30,12 +30,7 @@ class Chef # methods/if branches for each. class ChefRepositoryFileSystemCookbookEntry - attr_reader :name - attr_reader :parent - attr_reader :path - attr_reader :ruby_only - attr_reader :recursive - attr_reader :file_path + attr_reader :name, :parent, :path, :ruby_only, :recursive, :file_path alias_method :display_path, :path alias_method :display_name, :name diff --git a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir.rb b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir.rb index 431b9ecb22..8cb2273790 100644 --- a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir.rb +++ b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir.rb @@ -80,9 +80,7 @@ class Chef attr_accessor :write_pretty_json - attr_reader :root_paths - attr_reader :child_paths - attr_reader :versioned_cookbooks + attr_reader :root_paths, :child_paths, :versioned_cookbooks CHILDREN = %w{org.json invitations.json members.json}.freeze diff --git a/lib/chef/chef_fs/file_system/repository/directory.rb b/lib/chef/chef_fs/file_system/repository/directory.rb index 8d227fd9d2..29d9f5c7d7 100644 --- a/lib/chef/chef_fs/file_system/repository/directory.rb +++ b/lib/chef/chef_fs/file_system/repository/directory.rb @@ -25,10 +25,7 @@ class Chef class Directory - attr_reader :name - attr_reader :parent - attr_reader :path - attr_reader :file_path + attr_reader :name, :parent, :path, :file_path alias_method :display_path, :path alias_method :display_name, :name diff --git a/lib/chef/chef_fs/parallelizer/flatten_enumerable.rb b/lib/chef/chef_fs/parallelizer/flatten_enumerable.rb index 84db2c2053..5146b607de 100644 --- a/lib/chef/chef_fs/parallelizer/flatten_enumerable.rb +++ b/lib/chef/chef_fs/parallelizer/flatten_enumerable.rb @@ -9,8 +9,7 @@ class Chef @levels = levels end - attr_reader :enum - attr_reader :levels + attr_reader :enum, :levels def each(&block) enum.each do |value| diff --git a/lib/chef/chef_fs/parallelizer/parallel_enumerable.rb b/lib/chef/chef_fs/parallelizer/parallel_enumerable.rb index 5fafc5c88f..dee4fc3053 100644 --- a/lib/chef/chef_fs/parallelizer/parallel_enumerable.rb +++ b/lib/chef/chef_fs/parallelizer/parallel_enumerable.rb @@ -28,10 +28,7 @@ class Chef @unconsumed_output = Queue.new end - attr_reader :parent_task_queue - attr_reader :input_enumerable - attr_reader :options - attr_reader :block + attr_reader :parent_task_queue, :input_enumerable, :options, :block def each each_with_input do |output, index, input, type| diff --git a/lib/chef/client.rb b/lib/chef/client.rb index 1e069be185..0cc4b19e9f 100644 --- a/lib/chef/client.rb +++ b/lib/chef/client.rb @@ -880,8 +880,7 @@ class Chef private - attr_reader :override_runlist - attr_reader :specific_recipes + attr_reader :override_runlist, :specific_recipes def profiling_prereqs! require "ruby-prof" diff --git a/lib/chef/cookbook/cookbook_version_loader.rb b/lib/chef/cookbook/cookbook_version_loader.rb index 626a5d423b..eb0df849d1 100644 --- a/lib/chef/cookbook/cookbook_version_loader.rb +++ b/lib/chef/cookbook/cookbook_version_loader.rb @@ -35,17 +35,11 @@ class Chef UPLOADED_COOKBOOK_VERSION_FILE = ".uploaded-cookbook-version.json".freeze - attr_reader :cookbook_settings - attr_reader :frozen - attr_reader :uploaded_cookbook_version_file - - attr_reader :cookbook_path + attr_reader :cookbook_settings, :frozen, :uploaded_cookbook_version_file, :cookbook_path, :metadata_error # The cookbook's name as inferred from its directory. attr_reader :inferred_cookbook_name - attr_reader :metadata_error - def initialize(path, chefignore = nil) @cookbook_path = File.expand_path( path ) # cookbook_path from which this was loaded diff --git a/lib/chef/cookbook/file_system_file_vendor.rb b/lib/chef/cookbook/file_system_file_vendor.rb index a4a6711270..c96c53b15f 100644 --- a/lib/chef/cookbook/file_system_file_vendor.rb +++ b/lib/chef/cookbook/file_system_file_vendor.rb @@ -30,8 +30,7 @@ class Chef # nonsensical. class FileSystemFileVendor < FileVendor - attr_reader :cookbook_name - attr_reader :repo_paths + attr_reader :cookbook_name, :repo_paths def initialize(manifest, *repo_paths) @cookbook_name = manifest.name diff --git a/lib/chef/cookbook/metadata.rb b/lib/chef/cookbook/metadata.rb index 7f6d972771..260bc1ac6b 100644 --- a/lib/chef/cookbook/metadata.rb +++ b/lib/chef/cookbook/metadata.rb @@ -68,10 +68,7 @@ class Chef include Chef::Mixin::ParamsValidate include Chef::Mixin::FromFile - attr_reader :platforms - attr_reader :dependencies - attr_reader :providing - attr_reader :recipes + attr_reader :platforms, :dependencies, :providing, :recipes # @return [Array] Array of supported Chef versions attr_reader :chef_versions diff --git a/lib/chef/cookbook/remote_file_vendor.rb b/lib/chef/cookbook/remote_file_vendor.rb index a6a6e96e06..005839243e 100644 --- a/lib/chef/cookbook/remote_file_vendor.rb +++ b/lib/chef/cookbook/remote_file_vendor.rb @@ -24,8 +24,7 @@ class Chef # if not available, loading them from the remote server. class RemoteFileVendor < FileVendor - attr_reader :rest - attr_reader :cookbook_name + attr_reader :rest, :cookbook_name def initialize(manifest, rest) @manifest = manifest diff --git a/lib/chef/cookbook/syntax_check.rb b/lib/chef/cookbook/syntax_check.rb index 8b593eea81..ea6e59b894 100644 --- a/lib/chef/cookbook/syntax_check.rb +++ b/lib/chef/cookbook/syntax_check.rb @@ -72,14 +72,12 @@ class Chef include Chef::Mixin::ShellOut include Chef::Mixin::Checksum - attr_reader :cookbook_path + attr_reader :cookbook_path, :chefignore # A PersistentSet object that tracks which files have already been # validated. attr_reader :validated_files - attr_reader :chefignore - # Creates a new SyntaxCheck given the +cookbook_name+ and a +cookbook_path+. # If no +cookbook_path+ is given, +Chef::Config.cookbook_path+ is used. def self.for_cookbook(cookbook_name, cookbook_path = nil) diff --git a/lib/chef/cookbook_uploader.rb b/lib/chef/cookbook_uploader.rb index 816cbf95fe..6ab452c1a5 100644 --- a/lib/chef/cookbook_uploader.rb +++ b/lib/chef/cookbook_uploader.rb @@ -14,11 +14,7 @@ require_relative "server_api" class Chef class CookbookUploader - attr_reader :cookbooks - attr_reader :path - attr_reader :opts - attr_reader :rest - attr_reader :concurrency + attr_reader :cookbooks, :path, :opts, :rest, :concurrency # Creates a new CookbookUploader. # ===Arguments: diff --git a/lib/chef/cookbook_version.rb b/lib/chef/cookbook_version.rb index 62407aa314..25963292c4 100644 --- a/lib/chef/cookbook_version.rb +++ b/lib/chef/cookbook_version.rb @@ -46,8 +46,7 @@ class Chef attr_reader :all_files - attr_accessor :root_paths - attr_accessor :name + attr_accessor :root_paths, :name # A Chef::Cookbook::Metadata object. It has a setter that fixes up the # metadata to add descriptions of the recipes contained in this diff --git a/lib/chef/daemon.rb b/lib/chef/daemon.rb index 41d93e1fe6..c6f8b8b608 100644 --- a/lib/chef/daemon.rb +++ b/lib/chef/daemon.rb @@ -24,8 +24,7 @@ require "etc" unless defined?(Etc) class Chef class Daemon class << self - attr_accessor :name - attr_accessor :runlock + attr_accessor :name, :runlock # Daemonize the current process, managing pidfiles and process uid/gid # diff --git a/lib/chef/decorator/unchain.rb b/lib/chef/decorator/unchain.rb index 30179d4e63..5934a475e0 100644 --- a/lib/chef/decorator/unchain.rb +++ b/lib/chef/decorator/unchain.rb @@ -20,8 +20,7 @@ class Chef # node.set_unless['foo'].keys is not legal now or ever # class Unchain - attr_accessor :__path__ - attr_accessor :__method__ + attr_accessor :__path__, :__method__ def initialize(obj, method) @__path__ = [] diff --git a/lib/chef/encrypted_data_bag_item/decryptor.rb b/lib/chef/encrypted_data_bag_item/decryptor.rb index 19c3a82bb7..104e2bdfc0 100644 --- a/lib/chef/encrypted_data_bag_item/decryptor.rb +++ b/lib/chef/encrypted_data_bag_item/decryptor.rb @@ -70,8 +70,7 @@ class Chef::EncryptedDataBagItem class Version0Decryptor include Chef::EncryptedDataBagItem::Assertions - attr_reader :encrypted_data - attr_reader :key + attr_reader :encrypted_data, :key def initialize(encrypted_data, key) @encrypted_data = encrypted_data @@ -115,8 +114,7 @@ class Chef::EncryptedDataBagItem class Version1Decryptor < Version0Decryptor - attr_reader :encrypted_data - attr_reader :key + attr_reader :encrypted_data, :key def initialize(encrypted_data, key) @encrypted_data = encrypted_data diff --git a/lib/chef/encrypted_data_bag_item/encryptor.rb b/lib/chef/encrypted_data_bag_item/encryptor.rb index 2d38b9d44e..335bfbd1c4 100644 --- a/lib/chef/encrypted_data_bag_item/encryptor.rb +++ b/lib/chef/encrypted_data_bag_item/encryptor.rb @@ -51,8 +51,7 @@ class Chef::EncryptedDataBagItem end class Version1Encryptor - attr_reader :key - attr_reader :plaintext_data + attr_reader :key, :plaintext_data include Chef::EncryptedDataBagItem::Assertions diff --git a/lib/chef/event_dispatch/events_output_stream.rb b/lib/chef/event_dispatch/events_output_stream.rb index d9c21642b7..b21764dcad 100644 --- a/lib/chef/event_dispatch/events_output_stream.rb +++ b/lib/chef/event_dispatch/events_output_stream.rb @@ -14,8 +14,7 @@ class Chef events.stream_opened(self, options) end - attr_reader :options - attr_reader :events + attr_reader :options, :events def print(str) events.stream_output(self, str, options) diff --git a/lib/chef/exceptions.rb b/lib/chef/exceptions.rb index 444fe82df1..ab396b02fe 100644 --- a/lib/chef/exceptions.rb +++ b/lib/chef/exceptions.rb @@ -196,8 +196,7 @@ class Chef class MetadataNotValid < StandardError; end class MetadataNotFound < StandardError - attr_reader :install_path - attr_reader :cookbook_name + attr_reader :install_path, :cookbook_name def initialize(install_path, cookbook_name) @install_path = install_path @@ -333,8 +332,7 @@ class Chef # run_list items referred to cookbooks that don't exist and/or # have no versions available. class InvalidRunListItems < StandardError - attr_reader :non_existent_cookbooks - attr_reader :cookbooks_with_no_matching_versions + attr_reader :non_existent_cookbooks, :cookbooks_with_no_matching_versions def initialize(message, non_existent_cookbooks, cookbooks_with_no_matching_versions) super(message) @@ -360,8 +358,7 @@ class Chef # resolve the misconfiguration represented by this exception and # re-solve, you may get another exception class UnsatisfiableRunListItem < StandardError - attr_reader :run_list_item - attr_reader :non_existent_cookbooks, :most_constrained_cookbooks + attr_reader :run_list_item, :non_existent_cookbooks, :most_constrained_cookbooks # most_constrained_cookbooks: if I were to remove constraints # regarding these cookbooks, I would get a solution or move on diff --git a/lib/chef/file_access_control.rb b/lib/chef/file_access_control.rb index c192a24d4d..e13916e1ee 100644 --- a/lib/chef/file_access_control.rb +++ b/lib/chef/file_access_control.rb @@ -34,10 +34,7 @@ class Chef include FileAccessControl::Unix end - attr_reader :current_resource - attr_reader :resource - attr_reader :provider - attr_reader :file + attr_reader :current_resource, :resource, :provider, :file # FileAccessControl objects set the owner, group and mode of +file+ to # the values specified by +resource+. +file+ is completely independent diff --git a/lib/chef/file_content_management/content_base.rb b/lib/chef/file_content_management/content_base.rb index 8098ea14a2..db762b25cb 100644 --- a/lib/chef/file_content_management/content_base.rb +++ b/lib/chef/file_content_management/content_base.rb @@ -20,10 +20,7 @@ class Chef class FileContentManagement class ContentBase - attr_reader :run_context - attr_reader :new_resource - attr_reader :current_resource - attr_reader :logger + attr_reader :run_context, :new_resource, :current_resource, :logger def initialize(new_resource, current_resource, run_context, logger = Chef::Log.with_child) @new_resource = new_resource diff --git a/lib/chef/formatters/base.rb b/lib/chef/formatters/base.rb index 2471cfe844..8c87199998 100644 --- a/lib/chef/formatters/base.rb +++ b/lib/chef/formatters/base.rb @@ -67,9 +67,7 @@ class Chef Chef::Formatters.register(name, self) end - attr_reader :out - attr_reader :err - attr_reader :output + attr_reader :out, :err, :output def initialize(out, err) @output = IndentableOutputStream.new(out, err) diff --git a/lib/chef/formatters/error_inspectors/compile_error_inspector.rb b/lib/chef/formatters/error_inspectors/compile_error_inspector.rb index d765e66e7a..adf8783987 100644 --- a/lib/chef/formatters/error_inspectors/compile_error_inspector.rb +++ b/lib/chef/formatters/error_inspectors/compile_error_inspector.rb @@ -25,8 +25,7 @@ class Chef # tries to find the code responsible for the error. class CompileErrorInspector - attr_reader :path - attr_reader :exception + attr_reader :path, :exception def initialize(path, exception) @path, @exception = path, exception diff --git a/lib/chef/formatters/error_inspectors/cookbook_resolve_error_inspector.rb b/lib/chef/formatters/error_inspectors/cookbook_resolve_error_inspector.rb index b5029c082a..ee08b3654f 100644 --- a/lib/chef/formatters/error_inspectors/cookbook_resolve_error_inspector.rb +++ b/lib/chef/formatters/error_inspectors/cookbook_resolve_error_inspector.rb @@ -23,8 +23,7 @@ class Chef module ErrorInspectors class CookbookResolveErrorInspector - attr_reader :exception - attr_reader :expanded_run_list + attr_reader :exception, :expanded_run_list include APIErrorFormatting diff --git a/lib/chef/formatters/error_inspectors/cookbook_sync_error_inspector.rb b/lib/chef/formatters/error_inspectors/cookbook_sync_error_inspector.rb index 45b550e5ab..6639e5a26f 100644 --- a/lib/chef/formatters/error_inspectors/cookbook_sync_error_inspector.rb +++ b/lib/chef/formatters/error_inspectors/cookbook_sync_error_inspector.rb @@ -32,8 +32,7 @@ class Chef include APIErrorFormatting - attr_reader :exception - attr_reader :cookbooks + attr_reader :exception, :cookbooks def initialize(cookbooks, exception) @cookbooks, @exception = cookbooks, exception diff --git a/lib/chef/formatters/error_inspectors/node_load_error_inspector.rb b/lib/chef/formatters/error_inspectors/node_load_error_inspector.rb index 3a3f602203..c11ee7c718 100644 --- a/lib/chef/formatters/error_inspectors/node_load_error_inspector.rb +++ b/lib/chef/formatters/error_inspectors/node_load_error_inspector.rb @@ -29,9 +29,7 @@ class Chef include APIErrorFormatting - attr_reader :exception - attr_reader :node_name - attr_reader :config + attr_reader :exception, :node_name, :config def initialize(node_name, exception, config) @node_name = node_name diff --git a/lib/chef/formatters/error_inspectors/registration_error_inspector.rb b/lib/chef/formatters/error_inspectors/registration_error_inspector.rb index 565ea217b8..6335fe7cbe 100644 --- a/lib/chef/formatters/error_inspectors/registration_error_inspector.rb +++ b/lib/chef/formatters/error_inspectors/registration_error_inspector.rb @@ -12,9 +12,7 @@ class Chef class RegistrationErrorInspector include APIErrorFormatting - attr_reader :exception - attr_reader :node_name - attr_reader :config + attr_reader :exception, :node_name, :config def initialize(node_name, exception, config) @node_name = node_name diff --git a/lib/chef/formatters/error_inspectors/resource_failure_inspector.rb b/lib/chef/formatters/error_inspectors/resource_failure_inspector.rb index fa7580d2c3..46f70a540e 100644 --- a/lib/chef/formatters/error_inspectors/resource_failure_inspector.rb +++ b/lib/chef/formatters/error_inspectors/resource_failure_inspector.rb @@ -23,9 +23,7 @@ class Chef module ErrorInspectors class ResourceFailureInspector - attr_reader :resource - attr_reader :action - attr_reader :exception + attr_reader :resource, :action, :exception def initialize(resource, action, exception) @resource = resource diff --git a/lib/chef/formatters/error_inspectors/run_list_expansion_error_inspector.rb b/lib/chef/formatters/error_inspectors/run_list_expansion_error_inspector.rb index ca3dec138b..c4d58f73c2 100644 --- a/lib/chef/formatters/error_inspectors/run_list_expansion_error_inspector.rb +++ b/lib/chef/formatters/error_inspectors/run_list_expansion_error_inspector.rb @@ -27,8 +27,7 @@ class Chef include APIErrorFormatting - attr_reader :exception - attr_reader :node + attr_reader :exception, :node def initialize(node, exception) @node, @exception = node, exception diff --git a/lib/chef/formatters/indentable_output_stream.rb b/lib/chef/formatters/indentable_output_stream.rb index d508a32eb0..73fc7ecf9a 100644 --- a/lib/chef/formatters/indentable_output_stream.rb +++ b/lib/chef/formatters/indentable_output_stream.rb @@ -3,12 +3,9 @@ class Chef # Handles basic indentation and colorization tasks class IndentableOutputStream - attr_reader :out - attr_reader :err - attr_accessor :indent - attr_reader :line_started - attr_accessor :current_stream - attr_reader :semaphore + attr_reader :out, :err, :line_started, :semaphore + + attr_accessor :indent, :current_stream def initialize(out, err) @out, @err = out, err diff --git a/lib/chef/formatters/minimal.rb b/lib/chef/formatters/minimal.rb index a35a7e8057..4d4fd82546 100644 --- a/lib/chef/formatters/minimal.rb +++ b/lib/chef/formatters/minimal.rb @@ -17,8 +17,7 @@ class Chef cli_name(:minimal) cli_name(:min) - attr_reader :updated_resources - attr_reader :updates_by_resource + attr_reader :updated_resources, :updates_by_resource def initialize(out, err) super diff --git a/lib/chef/http.rb b/lib/chef/http.rb index 1777739a93..3780ab1ee3 100644 --- a/lib/chef/http.rb +++ b/lib/chef/http.rb @@ -69,13 +69,7 @@ class Chef middlewares << middleware_class end - attr_reader :url - attr_reader :sign_on_redirect - attr_reader :redirect_limit - - attr_reader :options - - attr_reader :middlewares + attr_reader :url, :sign_on_redirect, :redirect_limit, :options, :middlewares # [Boolean] if we're doing keepalives or not attr_reader :keepalives diff --git a/lib/chef/http/authenticator.rb b/lib/chef/http/authenticator.rb index e65e93d2ac..a2590167b1 100644 --- a/lib/chef/http/authenticator.rb +++ b/lib/chef/http/authenticator.rb @@ -26,12 +26,7 @@ class Chef DEFAULT_SERVER_API_VERSION = "2".freeze - attr_reader :signing_key_filename - attr_reader :raw_key - attr_reader :attr_names - attr_reader :auth_credentials - attr_reader :version_class - attr_reader :api_version + attr_reader :signing_key_filename, :raw_key, :attr_names, :auth_credentials, :version_class, :api_version attr_accessor :sign_request diff --git a/lib/chef/http/basic_client.rb b/lib/chef/http/basic_client.rb index fa77b67427..2029234579 100644 --- a/lib/chef/http/basic_client.rb +++ b/lib/chef/http/basic_client.rb @@ -31,9 +31,7 @@ class Chef HTTPS = "https".freeze - attr_reader :url - attr_reader :ssl_policy - attr_reader :keepalives + attr_reader :url, :ssl_policy, :keepalives # Instantiate a BasicClient. # === Arguments: diff --git a/lib/chef/http/json_output.rb b/lib/chef/http/json_output.rb index bad009bd14..f36b35fec2 100644 --- a/lib/chef/http/json_output.rb +++ b/lib/chef/http/json_output.rb @@ -26,8 +26,7 @@ class Chef # Middleware that takes an HTTP response, parses it as JSON if possible. class JSONOutput - attr_accessor :raw_output - attr_accessor :inflate_json_class + attr_accessor :raw_output, :inflate_json_class def initialize(opts = {}) @raw_output = opts[:raw_output] diff --git a/lib/chef/knife.rb b/lib/chef/knife.rb index e1f2d56aaf..f17554b835 100644 --- a/lib/chef/knife.rb +++ b/lib/chef/knife.rb @@ -62,8 +62,7 @@ class Chef def_delegator :@ui, :edit_object def_delegator :@ui, :confirm - attr_accessor :name_args - attr_accessor :ui + attr_accessor :name_args, :ui # knife acl subcommands are grouped in this category using this constant to verify. OPSCODE_HOSTED_CHEF_ACCESS_CONTROL = %w{acl group user}.freeze diff --git a/lib/chef/knife/configure.rb b/lib/chef/knife/configure.rb index e0bd835ddb..d7cec09a0d 100644 --- a/lib/chef/knife/configure.rb +++ b/lib/chef/knife/configure.rb @@ -22,8 +22,7 @@ require_relative "../dist" class Chef class Knife class Configure < Knife - attr_reader :chef_server, :new_client_name, :admin_client_name, :admin_client_key - attr_reader :chef_repo, :new_client_key, :validation_client_name, :validation_key + attr_reader :chef_server, :new_client_name, :admin_client_name, :admin_client_key, :chef_repo, :new_client_key, :validation_client_name, :validation_key deps do require_relative "../util/path_helper" diff --git a/lib/chef/knife/core/bootstrap_context.rb b/lib/chef/knife/core/bootstrap_context.rb index a70e463089..2a7d2dfd60 100644 --- a/lib/chef/knife/core/bootstrap_context.rb +++ b/lib/chef/knife/core/bootstrap_context.rb @@ -32,9 +32,7 @@ class Chef # class BootstrapContext - attr_accessor :client_pem - attr_accessor :config - attr_accessor :chef_config + attr_accessor :client_pem, :config, :chef_config def initialize(config, run_list, chef_config, secret = nil) @config = config diff --git a/lib/chef/knife/core/cookbook_scm_repo.rb b/lib/chef/knife/core/cookbook_scm_repo.rb index 31654d2954..e875eb5675 100644 --- a/lib/chef/knife/core/cookbook_scm_repo.rb +++ b/lib/chef/knife/core/cookbook_scm_repo.rb @@ -26,10 +26,7 @@ class Chef include Chef::Mixin::ShellOut - attr_reader :repo_path - attr_reader :default_branch - attr_reader :use_current_branch - attr_reader :ui + attr_reader :repo_path, :default_branch, :use_current_branch, :ui def initialize(repo_path, ui, opts = {}) @repo_path = repo_path diff --git a/lib/chef/knife/core/generic_presenter.rb b/lib/chef/knife/core/generic_presenter.rb index bca5b5bfaf..39d72a6d3c 100644 --- a/lib/chef/knife/core/generic_presenter.rb +++ b/lib/chef/knife/core/generic_presenter.rb @@ -51,8 +51,7 @@ class Chef # most kinds of objects that knife needs to display. class GenericPresenter - attr_reader :ui - attr_reader :config + attr_reader :ui, :config # Instantiates a new GenericPresenter. This is generally handled by the # Chef::Knife::UI object, though you need to match the signature of this diff --git a/lib/chef/knife/core/object_loader.rb b/lib/chef/knife/core/object_loader.rb index 9cabbf97db..4737867c85 100644 --- a/lib/chef/knife/core/object_loader.rb +++ b/lib/chef/knife/core/object_loader.rb @@ -25,8 +25,7 @@ class Chef module Core class ObjectLoader - attr_reader :ui - attr_reader :klass + attr_reader :ui, :klass class ObjectType FILE = 1 diff --git a/lib/chef/knife/core/text_formatter.rb b/lib/chef/knife/core/text_formatter.rb index ec97748afb..f26acb1403 100644 --- a/lib/chef/knife/core/text_formatter.rb +++ b/lib/chef/knife/core/text_formatter.rb @@ -21,8 +21,7 @@ class Chef module Core class TextFormatter - attr_reader :data - attr_reader :ui + attr_reader :data, :ui def initialize(data, ui) @ui = ui diff --git a/lib/chef/knife/core/ui.rb b/lib/chef/knife/core/ui.rb index 0d467b69c8..42d1abe4ef 100644 --- a/lib/chef/knife/core/ui.rb +++ b/lib/chef/knife/core/ui.rb @@ -31,12 +31,7 @@ class Chef extend Forwardable - attr_reader :stdout - attr_reader :stderr - attr_reader :stdin - attr_reader :config - - attr_reader :presenter + attr_reader :stdout, :stderr, :stdin, :config, :presenter def_delegator :@presenter, :format_list_for_display def_delegator :@presenter, :format_for_display diff --git a/lib/chef/knife/core/windows_bootstrap_context.rb b/lib/chef/knife/core/windows_bootstrap_context.rb index 8469879022..9225796163 100644 --- a/lib/chef/knife/core/windows_bootstrap_context.rb +++ b/lib/chef/knife/core/windows_bootstrap_context.rb @@ -30,8 +30,7 @@ class Chef # * @run_list - the run list for the node to bootstrap # class WindowsBootstrapContext < BootstrapContext - attr_accessor :config - attr_accessor :chef_config + attr_accessor :config, :chef_config def initialize(config, run_list, chef_config, secret = nil) @config = config diff --git a/lib/chef/knife/supermarket_install.rb b/lib/chef/knife/supermarket_install.rb index a3d3aa7a5d..719164ffe6 100644 --- a/lib/chef/knife/supermarket_install.rb +++ b/lib/chef/knife/supermarket_install.rb @@ -65,8 +65,7 @@ class Chef description: "The URL of the Supermarket site.", default: "https://supermarket.chef.io" - attr_reader :cookbook_name - attr_reader :vendor_path + attr_reader :cookbook_name, :vendor_path def run if config[:cookbook_path] diff --git a/lib/chef/node/mixin/state_tracking.rb b/lib/chef/node/mixin/state_tracking.rb index 4d197e7cbd..d690d813e7 100644 --- a/lib/chef/node/mixin/state_tracking.rb +++ b/lib/chef/node/mixin/state_tracking.rb @@ -19,10 +19,7 @@ class Chef class Node module Mixin module StateTracking - attr_reader :__path__ - attr_reader :__root__ - attr_reader :__node__ - attr_reader :__precedence__ + attr_reader :__path__, :__root__, :__node__, :__precedence__ def initialize(data = nil, root = self, node = nil, precedence = nil) # __path__ and __root__ must be nil when we call super so it knows diff --git a/lib/chef/policy_builder/dynamic.rb b/lib/chef/policy_builder/dynamic.rb index 7971379d2c..482a162b2e 100644 --- a/lib/chef/policy_builder/dynamic.rb +++ b/lib/chef/policy_builder/dynamic.rb @@ -33,12 +33,7 @@ class Chef extend Forwardable - attr_reader :node - attr_reader :node_name - attr_reader :ohai_data - attr_reader :json_attribs - attr_reader :override_runlist - attr_reader :events + attr_reader :node, :node_name, :ohai_data, :json_attribs, :override_runlist, :events def initialize(node_name, ohai_data, json_attribs, override_runlist, events) @implementation = nil diff --git a/lib/chef/policy_builder/expand_node_object.rb b/lib/chef/policy_builder/expand_node_object.rb index 965e4defe6..068a2037ab 100644 --- a/lib/chef/policy_builder/expand_node_object.rb +++ b/lib/chef/policy_builder/expand_node_object.rb @@ -38,14 +38,7 @@ class Chef # not instantiated directly. class ExpandNodeObject - attr_reader :events - attr_reader :node - attr_reader :node_name - attr_reader :ohai_data - attr_reader :json_attribs - attr_reader :override_runlist - attr_reader :run_context - attr_reader :run_list_expansion + attr_reader :events, :node, :node_name, :ohai_data, :json_attribs, :override_runlist, :run_context, :run_list_expansion def initialize(node_name, ohai_data, json_attribs, override_runlist, events) @node_name = node_name diff --git a/lib/chef/policy_builder/policyfile.rb b/lib/chef/policy_builder/policyfile.rb index 0055f9d4b6..2c20a3a84d 100644 --- a/lib/chef/policy_builder/policyfile.rb +++ b/lib/chef/policy_builder/policyfile.rb @@ -75,12 +75,7 @@ class Chef end end - attr_reader :events - attr_reader :node - attr_reader :node_name - attr_reader :ohai_data - attr_reader :json_attribs - attr_reader :run_context + attr_reader :events, :node, :node_name, :ohai_data, :json_attribs, :run_context def initialize(node_name, ohai_data, json_attribs, override_runlist, events) @node_name = node_name diff --git a/lib/chef/powershell.rb b/lib/chef/powershell.rb index 10765384ff..73543468dd 100644 --- a/lib/chef/powershell.rb +++ b/lib/chef/powershell.rb @@ -22,8 +22,7 @@ class Chef class PowerShell extend FFI::Library - attr_reader :result - attr_reader :errors + attr_reader :result, :errors # Run a command under PowerShell via FFI # This implementation requires the managed dll and native wrapper to be in the library search diff --git a/lib/chef/provider.rb b/lib/chef/provider.rb index 3607b24752..a26dee2fbe 100644 --- a/lib/chef/provider.rb +++ b/lib/chef/provider.rb @@ -33,13 +33,9 @@ class Chef require_relative "mixin/why_run" require_relative "mixin/provides" - attr_accessor :new_resource - attr_accessor :current_resource - attr_accessor :after_resource - attr_accessor :run_context + attr_accessor :new_resource, :current_resource, :after_resource, :run_context - attr_reader :recipe_name - attr_reader :logger + attr_reader :recipe_name, :logger include Chef::Mixin::WhyRun extend Chef::Mixin::Provides diff --git a/lib/chef/provider/file.rb b/lib/chef/provider/file.rb index 0de620bba1..d7b1279c9f 100644 --- a/lib/chef/provider/file.rb +++ b/lib/chef/provider/file.rb @@ -55,9 +55,7 @@ class Chef attr_reader :deployment_strategy - attr_accessor :needs_creating - attr_accessor :needs_unlinking - attr_accessor :managing_symlink + attr_accessor :needs_creating, :needs_unlinking, :managing_symlink def initialize(new_resource, run_context) @content_class ||= Chef::Provider::File::Content diff --git a/lib/chef/provider/group.rb b/lib/chef/provider/group.rb index bfbffe9139..b40c2f5fd6 100644 --- a/lib/chef/provider/group.rb +++ b/lib/chef/provider/group.rb @@ -24,8 +24,7 @@ class Chef class Provider class Group < Chef::Provider include Chef::Mixin::ShellOut - attr_accessor :group_exists - attr_accessor :change_desc + attr_accessor :group_exists, :change_desc def initialize(new_resource, run_context) super diff --git a/lib/chef/provider/ifconfig.rb b/lib/chef/provider/ifconfig.rb index cfabe292f9..ccf99b021c 100644 --- a/lib/chef/provider/ifconfig.rb +++ b/lib/chef/provider/ifconfig.rb @@ -36,8 +36,7 @@ class Chef include Chef::Mixin::ShellOut - attr_accessor :config_template - attr_accessor :config_path + attr_accessor :config_template, :config_path # @api private # @return [String] the major.minor of the net-tools version as a string diff --git a/lib/chef/provider/package/dnf/python_helper.rb b/lib/chef/provider/package/dnf/python_helper.rb index 9dfcc7808a..b397d99fc6 100644 --- a/lib/chef/provider/package/dnf/python_helper.rb +++ b/lib/chef/provider/package/dnf/python_helper.rb @@ -30,12 +30,7 @@ class Chef include Chef::Mixin::Which include Chef::Mixin::ShellOut - attr_accessor :stdin - attr_accessor :stdout - attr_accessor :stderr - attr_accessor :inpipe - attr_accessor :outpipe - attr_accessor :wait_thr + attr_accessor :stdin, :stdout, :stderr, :inpipe, :outpipe, :wait_thr DNF_HELPER = ::File.expand_path(::File.join(::File.dirname(__FILE__), "dnf_helper.py")).freeze diff --git a/lib/chef/provider/package/dnf/version.rb b/lib/chef/provider/package/dnf/version.rb index d6b72a84bd..4ab1a580c7 100644 --- a/lib/chef/provider/package/dnf/version.rb +++ b/lib/chef/provider/package/dnf/version.rb @@ -22,9 +22,7 @@ class Chef # helper class to assist in passing around name/version/arch triples class Version - attr_accessor :name - attr_accessor :version - attr_accessor :arch + attr_accessor :name, :version, :arch def initialize(name, version, arch) @name = name diff --git a/lib/chef/provider/package/rubygems.rb b/lib/chef/provider/package/rubygems.rb index be4f1a149c..8274287bc2 100644 --- a/lib/chef/provider/package/rubygems.rb +++ b/lib/chef/provider/package/rubygems.rb @@ -375,8 +375,7 @@ class Chef end - attr_reader :gem_env - attr_reader :cleanup_gem_env + attr_reader :gem_env, :cleanup_gem_env provides :chef_gem provides :gem_package diff --git a/lib/chef/provider/package/windows/exe.rb b/lib/chef/provider/package/windows/exe.rb index 191e8fb4ae..b9817137bb 100644 --- a/lib/chef/provider/package/windows/exe.rb +++ b/lib/chef/provider/package/windows/exe.rb @@ -33,10 +33,7 @@ class Chef @uninstall_entries = uninstall_entries end - attr_reader :new_resource - attr_reader :logger - attr_reader :installer_type - attr_reader :uninstall_entries + attr_reader :new_resource, :logger, :installer_type, :uninstall_entries # From Chef::Provider::Package def expand_options(options) diff --git a/lib/chef/provider/package/windows/msi.rb b/lib/chef/provider/package/windows/msi.rb index 1ce8add80d..9ec078d693 100644 --- a/lib/chef/provider/package/windows/msi.rb +++ b/lib/chef/provider/package/windows/msi.rb @@ -35,9 +35,7 @@ class Chef @uninstall_entries = uninstall_entries end - attr_reader :new_resource - attr_reader :logger - attr_reader :uninstall_entries + attr_reader :new_resource, :logger, :uninstall_entries # From Chef::Provider::Package def expand_options(options) diff --git a/lib/chef/provider/package/windows/registry_uninstall_entry.rb b/lib/chef/provider/package/windows/registry_uninstall_entry.rb index 548b911ecb..45db125cf7 100644 --- a/lib/chef/provider/package/windows/registry_uninstall_entry.rb +++ b/lib/chef/provider/package/windows/registry_uninstall_entry.rb @@ -84,13 +84,7 @@ class Chef @uninstall_string = RegistryUninstallEntry.read_registry_property(registry_data, uninstall_key) end - attr_reader :hive - attr_reader :key - attr_reader :display_name - attr_reader :display_version - attr_reader :uninstall_string - attr_reader :data - attr_reader :logger + attr_reader :hive, :key, :display_name, :display_version, :uninstall_string, :data, :logger UNINSTALL_SUBKEY = 'Software\Microsoft\Windows\CurrentVersion\Uninstall'.freeze end diff --git a/lib/chef/provider/package/yum/python_helper.rb b/lib/chef/provider/package/yum/python_helper.rb index 7758383b95..19e8ed686c 100644 --- a/lib/chef/provider/package/yum/python_helper.rb +++ b/lib/chef/provider/package/yum/python_helper.rb @@ -30,12 +30,7 @@ class Chef include Chef::Mixin::Which include Chef::Mixin::ShellOut - attr_accessor :stdin - attr_accessor :stdout - attr_accessor :stderr - attr_accessor :inpipe - attr_accessor :outpipe - attr_accessor :wait_thr + attr_accessor :stdin, :stdout, :stderr, :inpipe, :outpipe, :wait_thr YUM_HELPER = ::File.expand_path(::File.join(::File.dirname(__FILE__), "yum_helper.py")).freeze diff --git a/lib/chef/provider/package/yum/version.rb b/lib/chef/provider/package/yum/version.rb index 6107a54532..f06804010a 100644 --- a/lib/chef/provider/package/yum/version.rb +++ b/lib/chef/provider/package/yum/version.rb @@ -22,9 +22,7 @@ class Chef # helper class to assist in passing around name/version/arch triples class Version - attr_accessor :name - attr_accessor :version - attr_accessor :arch + attr_accessor :name, :version, :arch def initialize(name, version, arch) @name = name diff --git a/lib/chef/provider/remote_file/ftp.rb b/lib/chef/provider/remote_file/ftp.rb index e2b32ddaf6..57ee62f106 100644 --- a/lib/chef/provider/remote_file/ftp.rb +++ b/lib/chef/provider/remote_file/ftp.rb @@ -28,9 +28,7 @@ class Chef class RemoteFile class FTP - attr_reader :uri - attr_reader :new_resource - attr_reader :current_resource + attr_reader :uri, :new_resource, :current_resource def initialize(uri, new_resource, current_resource) @uri = uri diff --git a/lib/chef/provider/remote_file/http.rb b/lib/chef/provider/remote_file/http.rb index ef2461848d..fcde893329 100644 --- a/lib/chef/provider/remote_file/http.rb +++ b/lib/chef/provider/remote_file/http.rb @@ -28,10 +28,7 @@ class Chef class HTTP - attr_reader :uri - attr_reader :new_resource - attr_reader :current_resource - attr_reader :logger + attr_reader :uri, :new_resource, :current_resource, :logger # Parse the uri into instance variables def initialize(uri, new_resource, current_resource, logger = Chef::Log.with_child) diff --git a/lib/chef/provider/remote_file/local_file.rb b/lib/chef/provider/remote_file/local_file.rb index c68c4eecd5..3e61a6cf53 100644 --- a/lib/chef/provider/remote_file/local_file.rb +++ b/lib/chef/provider/remote_file/local_file.rb @@ -26,8 +26,7 @@ class Chef class RemoteFile class LocalFile - attr_reader :uri - attr_reader :new_resource + attr_reader :uri, :new_resource def initialize(uri, new_resource, current_resource) @new_resource = new_resource diff --git a/lib/chef/provider/remote_file/sftp.rb b/lib/chef/provider/remote_file/sftp.rb index 43654bd67c..78dc81cfa7 100644 --- a/lib/chef/provider/remote_file/sftp.rb +++ b/lib/chef/provider/remote_file/sftp.rb @@ -27,9 +27,7 @@ class Chef class Provider class RemoteFile class SFTP - attr_reader :uri - attr_reader :new_resource - attr_reader :current_resource + attr_reader :uri, :new_resource, :current_resource def initialize(uri, new_resource, current_resource) @uri = uri diff --git a/lib/chef/provider/resource_update.rb b/lib/chef/provider/resource_update.rb index d3c674dd22..8d4b8db5b6 100644 --- a/lib/chef/provider/resource_update.rb +++ b/lib/chef/provider/resource_update.rb @@ -29,15 +29,11 @@ class Chef class ResourceUpdate - attr_accessor :type - attr_accessor :name - attr_accessor :duration # ms - attr_accessor :status - attr_accessor :initial_state - attr_accessor :final_state - attr_accessor :initial_properties - attr_accessor :final_properties - attr_accessor :event_data # e.g., a diff. + attr_accessor :type, :name, :duration, :status, :initial_state, :final_state, :initial_properties, :final_properties, :event_data + + # ms + + # e.g., a diff. def initial_state_from_resource(resource) @initial_properties = resource.to_hash diff --git a/lib/chef/provider/user/dscl.rb b/lib/chef/provider/user/dscl.rb index 4c056b00fd..0e1d7c52af 100644 --- a/lib/chef/provider/user/dscl.rb +++ b/lib/chef/provider/user/dscl.rb @@ -45,9 +45,7 @@ class Chef # This provider only supports macOS versions 10.7 to 10.13 class Dscl < Chef::Provider::User - attr_accessor :user_info - attr_accessor :authentication_authority - attr_accessor :password_shadow_conversion_algorithm + attr_accessor :user_info, :authentication_authority, :password_shadow_conversion_algorithm provides :dscl_user provides :user, os: "darwin", platform_version: "<= 10.13" diff --git a/lib/chef/provider_resolver.rb b/lib/chef/provider_resolver.rb index b0dd0d9376..b1c433317d 100644 --- a/lib/chef/provider_resolver.rb +++ b/lib/chef/provider_resolver.rb @@ -46,9 +46,7 @@ class Chef # class ProviderResolver - attr_reader :node - attr_reader :resource - attr_reader :action + attr_reader :node, :resource, :action def initialize(node, resource, action) @node = node diff --git a/lib/chef/resource/conditional.rb b/lib/chef/resource/conditional.rb index 76f7637693..3dd2766e1a 100644 --- a/lib/chef/resource/conditional.rb +++ b/lib/chef/resource/conditional.rb @@ -38,10 +38,7 @@ class Chef new(:only_if, parent_resource, command, command_opts, &block) end - attr_reader :positivity - attr_reader :command - attr_reader :command_opts - attr_reader :block + attr_reader :positivity, :command, :command_opts, :block def initialize(positivity, parent_resource, command = nil, command_opts = {}, &block) @positivity = positivity diff --git a/lib/chef/resource/template.rb b/lib/chef/resource/template.rb index 0ffa2194d8..c181561a8b 100644 --- a/lib/chef/resource/template.rb +++ b/lib/chef/resource/template.rb @@ -40,8 +40,7 @@ class Chef include Chef::Mixin::Securable - attr_reader :inline_helper_blocks - attr_reader :inline_helper_modules + attr_reader :inline_helper_blocks, :inline_helper_modules def initialize(name, run_context = nil) super diff --git a/lib/chef/resource_builder.rb b/lib/chef/resource_builder.rb index 9f2cd657f9..e9c01a660f 100644 --- a/lib/chef/resource_builder.rb +++ b/lib/chef/resource_builder.rb @@ -20,15 +20,7 @@ class Chef class ResourceBuilder - attr_reader :type - attr_reader :name - attr_reader :created_at - attr_reader :params - attr_reader :run_context - attr_reader :cookbook_name - attr_reader :recipe_name - attr_reader :enclosing_provider - attr_reader :resource + attr_reader :type, :name, :created_at, :params, :run_context, :cookbook_name, :recipe_name, :enclosing_provider, :resource # FIXME (ruby-2.1 syntax): most of these are mandatory def initialize(type: nil, name: nil, created_at: nil, params: nil, run_context: nil, cookbook_name: nil, recipe_name: nil, enclosing_provider: nil) diff --git a/lib/chef/resource_collection.rb b/lib/chef/resource_collection.rb index 588fe12f0a..069964fd8b 100644 --- a/lib/chef/resource_collection.rb +++ b/lib/chef/resource_collection.rb @@ -32,10 +32,9 @@ class Chef include ResourceCollectionSerialization extend Forwardable - attr_accessor :unified_mode + attr_accessor :unified_mode, :run_context attr_reader :resource_set, :resource_list - attr_accessor :run_context protected :resource_set, :resource_list diff --git a/lib/chef/resource_collection/resource_list.rb b/lib/chef/resource_collection/resource_list.rb index a290ecad62..65a6b76595 100644 --- a/lib/chef/resource_collection/resource_list.rb +++ b/lib/chef/resource_collection/resource_list.rb @@ -30,9 +30,8 @@ class Chef include Enumerable extend Forwardable - attr_reader :iterator + attr_reader :iterator, :resources - attr_reader :resources private :resources # Delegate direct access methods to the @resources array # 4 extra methods here are not included in the Enumerable's instance methods diff --git a/lib/chef/resource_reporter.rb b/lib/chef/resource_reporter.rb index 379201768f..d9e5535710 100644 --- a/lib/chef/resource_reporter.rb +++ b/lib/chef/resource_reporter.rb @@ -49,11 +49,7 @@ class Chef as_hash end - attr_reader :status - attr_reader :exception - attr_reader :error_descriptions - attr_reader :action_collection - attr_reader :rest_client + attr_reader :status, :exception, :error_descriptions, :action_collection, :rest_client PROTOCOL_VERSION = "0.1.0".freeze diff --git a/lib/chef/run_context.rb b/lib/chef/run_context.rb index 7ba7d9f33e..f37e9fb482 100644 --- a/lib/chef/run_context.rb +++ b/lib/chef/run_context.rb @@ -650,9 +650,7 @@ class Chef protected - attr_reader :cookbook_compiler - attr_reader :loaded_attributes_hash - attr_reader :loaded_recipes_hash + attr_reader :cookbook_compiler, :loaded_attributes_hash, :loaded_recipes_hash # # A child run context. Delegates all root context calls to its parent. diff --git a/lib/chef/run_context/cookbook_compiler.rb b/lib/chef/run_context/cookbook_compiler.rb index 9d8ea87360..8f4bdb012e 100644 --- a/lib/chef/run_context/cookbook_compiler.rb +++ b/lib/chef/run_context/cookbook_compiler.rb @@ -29,9 +29,7 @@ class Chef # Implements the compile phase of the chef run by loading/eval-ing files # from cookbooks in the correct order and in the correct context. class CookbookCompiler - attr_reader :events - attr_reader :run_list_expansion - attr_reader :logger + attr_reader :events, :run_list_expansion, :logger def initialize(run_context, run_list_expansion, events) @run_context = run_context diff --git a/lib/chef/run_list/run_list_expansion.rb b/lib/chef/run_list/run_list_expansion.rb index 413d0a3db8..4cb0852a54 100644 --- a/lib/chef/run_list/run_list_expansion.rb +++ b/lib/chef/run_list/run_list_expansion.rb @@ -30,20 +30,12 @@ class Chef # fetching roles from a data source by defining +fetch_role+ class RunListExpansion - attr_reader :run_list_items + attr_reader :run_list_items, :default_attrs, :override_attrs, :environment, :missing_roles_with_including_role, :all_missing_roles, :role_errors # A VersionedRecipeList of recipes. Populated only after #expand # is called. attr_reader :recipes - attr_reader :default_attrs - - attr_reader :override_attrs - - attr_reader :environment - - attr_reader :missing_roles_with_including_role - # The data source passed to the constructor. Not used in this class. # In subclasses, this is a Chef::ServerAPI object pre-configured # to fetch roles from their correct location. @@ -59,9 +51,6 @@ class Chef # The to_json method uses this list to construct json. attr_reader :better_run_list_trace - attr_reader :all_missing_roles - attr_reader :role_errors - def initialize(environment, run_list_items, source = nil) @environment = environment @missing_roles_with_including_role = [] diff --git a/lib/chef/run_lock.rb b/lib/chef/run_lock.rb index a7c66837d5..c35947bb08 100644 --- a/lib/chef/run_lock.rb +++ b/lib/chef/run_lock.rb @@ -36,9 +36,7 @@ class Chef class RunLock include Chef::Mixin::CreatePath - attr_reader :runlock - attr_reader :mutex - attr_reader :runlock_file + attr_reader :runlock, :mutex, :runlock_file # Create a new instance of RunLock # === Arguments diff --git a/lib/chef/run_status.rb b/lib/chef/run_status.rb index f5bc1837d7..e9b25f6705 100644 --- a/lib/chef/run_status.rb +++ b/lib/chef/run_status.rb @@ -23,23 +23,11 @@ # Chef run. class Chef::RunStatus - attr_reader :events + attr_reader :events, :run_context, :start_time, :end_time, :exception - attr_reader :run_context + attr_writer :run_context, :exception - attr_writer :run_context - - attr_reader :start_time - - attr_reader :end_time - - attr_reader :exception - - attr_writer :exception - - attr_accessor :run_id - - attr_accessor :node + attr_accessor :run_id, :node def initialize(node, events) @node = node diff --git a/lib/chef/scan_access_control.rb b/lib/chef/scan_access_control.rb index d81166c28a..1575b90855 100644 --- a/lib/chef/scan_access_control.rb +++ b/lib/chef/scan_access_control.rb @@ -37,8 +37,7 @@ class Chef # TODO: windows class ScanAccessControl - attr_reader :new_resource - attr_reader :current_resource + attr_reader :new_resource, :current_resource def initialize(new_resource, current_resource) @new_resource, @current_resource = new_resource, current_resource diff --git a/lib/chef/shell.rb b/lib/chef/shell.rb index fbee4c093b..e7d591d695 100644 --- a/lib/chef/shell.rb +++ b/lib/chef/shell.rb @@ -42,8 +42,8 @@ module Shell LEADERS[Chef::Node] = ":attributes" class << self - attr_accessor :options - attr_accessor :env + attr_accessor :options, :env + attr_writer :editor end diff --git a/lib/chef/util/windows/logon_session.rb b/lib/chef/util/windows/logon_session.rb index b29f24565c..3fb9a0e0f3 100644 --- a/lib/chef/util/windows/logon_session.rb +++ b/lib/chef/util/windows/logon_session.rb @@ -109,14 +109,7 @@ class Chef protected - attr_reader :original_username - attr_reader :original_password - attr_reader :original_domain - attr_reader :authentication - - attr_reader :token - attr_reader :session_opened - attr_reader :impersonating + attr_reader :original_username, :original_password, :original_domain, :authentication, :token, :session_opened, :impersonating def validate_session_open! unless session_opened diff --git a/lib/chef/win32/mutex.rb b/lib/chef/win32/mutex.rb index 85f4036c87..3ef1bf12b5 100644 --- a/lib/chef/win32/mutex.rb +++ b/lib/chef/win32/mutex.rb @@ -29,8 +29,7 @@ class Chef create_system_mutex end - attr_reader :handle - attr_reader :name + attr_reader :handle, :name ##################################################### # Attempts to grab the mutex. diff --git a/lib/chef/win32/security/securable_object.rb b/lib/chef/win32/security/securable_object.rb index 3dd1470e9e..a248bdff7c 100644 --- a/lib/chef/win32/security/securable_object.rb +++ b/lib/chef/win32/security/securable_object.rb @@ -30,8 +30,7 @@ class Chef @type = type end - attr_reader :path - attr_reader :type + attr_reader :path, :type SecurityConst = Chef::ReservedNames::Win32::API::Security diff --git a/spec/functional/run_lock_spec.rb b/spec/functional/run_lock_spec.rb index fa450b9c8d..c8d6560be7 100644 --- a/spec/functional/run_lock_spec.rb +++ b/spec/functional/run_lock_spec.rb @@ -326,9 +326,7 @@ describe Chef::RunLock do @read_from_tests, @write_to_process = IO.pipe end - attr_reader :example - attr_reader :name - attr_reader :pid + attr_reader :example, :name, :pid def last_event loop do @@ -428,10 +426,7 @@ describe Chef::RunLock do private - attr_reader :read_from_process - attr_reader :write_to_tests - attr_reader :read_from_tests - attr_reader :write_to_process + attr_reader :read_from_process, :write_to_tests, :read_from_tests, :write_to_process class TestRunLock < Chef::RunLock attr_accessor :client_process diff --git a/spec/integration/recipes/recipe_dsl_spec.rb b/spec/integration/recipes/recipe_dsl_spec.rb index 797e9ecb70..eb2377e25e 100644 --- a/spec/integration/recipes/recipe_dsl_spec.rb +++ b/spec/integration/recipes/recipe_dsl_spec.rb @@ -20,9 +20,8 @@ describe "Recipe DSL methods" do default_action :create class<