summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith84@gmail.com>2020-07-07 15:28:50 -0700
committerTim Smith <tsmith84@gmail.com>2020-07-07 15:28:50 -0700
commitd7c4085d55a537d297f557c119fa6a9bd7e22690 (patch)
treefacde7c91df602a4b9584472a09c2043036501b0
parent3e9e6d41a31bd1ac932f7f4100102466b4fdfe05 (diff)
downloadchef-d7c4085d55a537d297f557c119fa6a9bd7e22690.tar.gz
Add spaces after attrs
This makes it easier to read the classes. Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r--chef-utils/spec/unit/dsl/introspection_spec.rb1
-rw-r--r--chef-utils/spec/unit/dsl/platform_spec.rb3
-rw-r--r--lib/chef/chef_fs/file_system/repository/base_file.rb1
-rw-r--r--lib/chef/exceptions.rb3
-rw-r--r--lib/chef/knife/bootstrap/train_connector.rb1
-rw-r--r--lib/chef/knife/core/hashed_command_loader.rb1
-rw-r--r--lib/chef/mixin/template.rb1
-rw-r--r--lib/chef/resource.rb2
-rw-r--r--lib/chef/resource/lwrp_base.rb1
-rw-r--r--lib/chef/shell/shell_session.rb2
-rw-r--r--spec/functional/run_lock_spec.rb1
-rw-r--r--spec/integration/recipes/resource_converge_if_changed_spec.rb2
-rw-r--r--spec/integration/recipes/resource_load_spec.rb2
-rw-r--r--spec/unit/dsl/platform_introspection_spec.rb1
-rw-r--r--spec/unit/event_dispatch/dispatcher_spec.rb3
-rw-r--r--spec/unit/provider_spec.rb1
16 files changed, 26 insertions, 0 deletions
diff --git a/chef-utils/spec/unit/dsl/introspection_spec.rb b/chef-utils/spec/unit/dsl/introspection_spec.rb
index 44a228061d..9275a9fc79 100644
--- a/chef-utils/spec/unit/dsl/introspection_spec.rb
+++ b/chef-utils/spec/unit/dsl/introspection_spec.rb
@@ -21,6 +21,7 @@ RSpec.describe ChefUtils::DSL::Introspection do
class IntrospectionTestClass
include ChefUtils::DSL::Introspection
attr_accessor :node
+
def initialize(node)
@node = node
end
diff --git a/chef-utils/spec/unit/dsl/platform_spec.rb b/chef-utils/spec/unit/dsl/platform_spec.rb
index 69efae877c..93b61f0532 100644
--- a/chef-utils/spec/unit/dsl/platform_spec.rb
+++ b/chef-utils/spec/unit/dsl/platform_spec.rb
@@ -58,6 +58,7 @@ RSpec.describe ChefUtils::DSL::Platform do
class ThingWithANode
include ChefUtils::DSL::Platform
attr_accessor :node
+
def initialize(node)
@node = node
end
@@ -69,6 +70,7 @@ RSpec.describe ChefUtils::DSL::Platform do
attr_accessor :node
end
attr_accessor :run_context
+
def initialize(node)
@run_context = RunContext.new
run_context.node = node
@@ -78,6 +80,7 @@ RSpec.describe ChefUtils::DSL::Platform do
class ThingWithTheDSL
include ChefUtils
attr_accessor :node
+
def initialize(node)
@node = node
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 582f4130a8..94b52b9201 100644
--- a/lib/chef/chef_fs/file_system/repository/base_file.rb
+++ b/lib/chef/chef_fs/file_system/repository/base_file.rb
@@ -92,6 +92,7 @@ class Chef
end
attr_writer :write_pretty_json
+
def write_pretty_json
@write_pretty_json.nil? ? root.write_pretty_json : @write_pretty_json
end
diff --git a/lib/chef/exceptions.rb b/lib/chef/exceptions.rb
index 645193389e..444fe82df1 100644
--- a/lib/chef/exceptions.rb
+++ b/lib/chef/exceptions.rb
@@ -198,6 +198,7 @@ class Chef
class MetadataNotFound < StandardError
attr_reader :install_path
attr_reader :cookbook_name
+
def initialize(install_path, cookbook_name)
@install_path = install_path
@cookbook_name = cookbook_name
@@ -448,6 +449,7 @@ class Chef
# to correctly populate the backtrace with the wrapped backtraces.
class RunFailedWrappingError < RuntimeError
attr_reader :wrapped_errors
+
def initialize(*errors)
errors = errors.select { |e| !e.nil? }
output = "Found #{errors.size} errors, they are stored in the backtrace"
@@ -488,6 +490,7 @@ class Chef
class MultipleDscResourcesFound < RuntimeError
attr_reader :resources_found
+
def initialize(resources_found)
@resources_found = resources_found
matches_info = @resources_found.each do |r|
diff --git a/lib/chef/knife/bootstrap/train_connector.rb b/lib/chef/knife/bootstrap/train_connector.rb
index 623720c0ad..8a1e5863bb 100644
--- a/lib/chef/knife/bootstrap/train_connector.rb
+++ b/lib/chef/knife/bootstrap/train_connector.rb
@@ -322,6 +322,7 @@ class Chef
class RemoteExecutionFailed < StandardError
attr_reader :exit_status, :command, :hostname, :stdout, :stderr
+
def initialize(hostname, command, result)
@hostname = hostname
@exit_status = result.exit_status
diff --git a/lib/chef/knife/core/hashed_command_loader.rb b/lib/chef/knife/core/hashed_command_loader.rb
index d31865affc..b88cededc0 100644
--- a/lib/chef/knife/core/hashed_command_loader.rb
+++ b/lib/chef/knife/core/hashed_command_loader.rb
@@ -27,6 +27,7 @@ class Chef
KEY = "_autogenerated_command_paths".freeze
attr_accessor :manifest
+
def initialize(chef_config_dir, plugin_manifest)
super(chef_config_dir)
@manifest = plugin_manifest
diff --git a/lib/chef/mixin/template.rb b/lib/chef/mixin/template.rb
index 06c191d63b..d72bfe9e3a 100644
--- a/lib/chef/mixin/template.rb
+++ b/lib/chef/mixin/template.rb
@@ -213,6 +213,7 @@ class Chef
class TemplateError < RuntimeError
attr_reader :original_exception, :context, :options
+
SOURCE_CONTEXT_WINDOW = 2
def initialize(original_exception, template, context, options)
diff --git a/lib/chef/resource.rb b/lib/chef/resource.rb
index bd6757c6f7..f2390b5801 100644
--- a/lib/chef/resource.rb
+++ b/lib/chef/resource.rb
@@ -638,6 +638,7 @@ class Chef
# Do NOT use this. It may be removed. It is for internal purposes only.
# @api private
attr_reader :resource_initializing
+
def resource_initializing=(value)
if value
@resource_initializing = true
@@ -888,6 +889,7 @@ class Chef
# have.
#
attr_writer :allowed_actions
+
def allowed_actions(value = NOT_PASSED)
if value != NOT_PASSED
self.allowed_actions = value
diff --git a/lib/chef/resource/lwrp_base.rb b/lib/chef/resource/lwrp_base.rb
index 935da6d29e..a1d2afd791 100644
--- a/lib/chef/resource/lwrp_base.rb
+++ b/lib/chef/resource/lwrp_base.rb
@@ -103,6 +103,7 @@ class Chef
protected
attr_writer :loaded_lwrps
+
def loaded_lwrps
@loaded_lwrps ||= {}
end
diff --git a/lib/chef/shell/shell_session.rb b/lib/chef/shell/shell_session.rb
index 49348d415d..a1957c6667 100644
--- a/lib/chef/shell/shell_session.rb
+++ b/lib/chef/shell/shell_session.rb
@@ -41,6 +41,7 @@ module Shell
attr_accessor :node, :compile, :recipe, :json_configuration
attr_reader :node_attributes, :client
+
def initialize
@node_built = false
formatter = Chef::Formatters.new(Chef::Config.formatter, STDOUT, STDERR)
@@ -75,6 +76,7 @@ module Shell
end
attr_writer :run_context
+
def run_context
@run_context ||= rebuild_context
end
diff --git a/spec/functional/run_lock_spec.rb b/spec/functional/run_lock_spec.rb
index 78d8b1e4ac..e922bdfd85 100644
--- a/spec/functional/run_lock_spec.rb
+++ b/spec/functional/run_lock_spec.rb
@@ -435,6 +435,7 @@ describe Chef::RunLock do
class TestRunLock < Chef::RunLock
attr_accessor :client_process
+
def create_lock
super
client_process.fire_event("created lock")
diff --git a/spec/integration/recipes/resource_converge_if_changed_spec.rb b/spec/integration/recipes/resource_converge_if_changed_spec.rb
index 24bd1f14ad..8177ef060a 100644
--- a/spec/integration/recipes/resource_converge_if_changed_spec.rb
+++ b/spec/integration/recipes/resource_converge_if_changed_spec.rb
@@ -6,6 +6,7 @@ describe "Resource::ActionClass#converge_if_changed" do
module Namer
extend self
attr_accessor :current_index
+
def incrementing_value
@incrementing_value += 1
@incrementing_value
@@ -30,6 +31,7 @@ describe "Resource::ActionClass#converge_if_changed" do
property :state2, default: "default_state2"
property :sensitive1, default: "default_dontprintme", sensitive: true
attr_accessor :converged
+
def initialize(*args)
super
@converged = 0
diff --git a/spec/integration/recipes/resource_load_spec.rb b/spec/integration/recipes/resource_load_spec.rb
index dec482f5c9..b3d1c7893a 100644
--- a/spec/integration/recipes/resource_load_spec.rb
+++ b/spec/integration/recipes/resource_load_spec.rb
@@ -6,6 +6,7 @@ describe "Resource.load_current_value" do
module Namer
extend self
attr_accessor :current_index
+
def incrementing_value
@incrementing_value += 1
@incrementing_value
@@ -194,6 +195,7 @@ describe "simple load_current_value tests" do
let(:resource_class) do
Class.new(Chef::Resource) do
attr_writer :index # this is our hacky global state
+
def index; @index ||= 1; end
property :myindex, Integer
diff --git a/spec/unit/dsl/platform_introspection_spec.rb b/spec/unit/dsl/platform_introspection_spec.rb
index 4ac6c420fa..875de03f8e 100644
--- a/spec/unit/dsl/platform_introspection_spec.rb
+++ b/spec/unit/dsl/platform_introspection_spec.rb
@@ -21,6 +21,7 @@ require "chef/dsl/platform_introspection"
class LanguageTester
attr_reader :node
+
def initialize(node)
@node = node
end
diff --git a/spec/unit/event_dispatch/dispatcher_spec.rb b/spec/unit/event_dispatch/dispatcher_spec.rb
index 8499ba13b9..7942e8eb6b 100644
--- a/spec/unit/event_dispatch/dispatcher_spec.rb
+++ b/spec/unit/event_dispatch/dispatcher_spec.rb
@@ -61,6 +61,7 @@ describe Chef::EventDispatch::Dispatcher do
let(:event_sink) do
Class.new(Chef::EventDispatch::Base) do
attr_reader :synchronized_cookbook_args
+
def synchronized_cookbook(cookbook_name)
@synchronized_cookbook_args = [cookbook_name]
end
@@ -79,6 +80,7 @@ describe Chef::EventDispatch::Dispatcher do
let(:event_sink_1) do
Class.new(Chef::EventDispatch::Base) do
attr_reader :synchronized_cookbook_args
+
def synchronized_cookbook(cookbook_name)
@synchronized_cookbook_args = [cookbook_name]
end
@@ -87,6 +89,7 @@ describe Chef::EventDispatch::Dispatcher do
let(:event_sink_2) do
Class.new(Chef::EventDispatch::Base) do
attr_reader :synchronized_cookbook_args
+
def synchronized_cookbook(cookbook_name, cookbook)
@synchronized_cookbook_args = [cookbook_name, cookbook]
end
diff --git a/spec/unit/provider_spec.rb b/spec/unit/provider_spec.rb
index ddee406e31..a8f0ede94e 100644
--- a/spec/unit/provider_spec.rb
+++ b/spec/unit/provider_spec.rb
@@ -20,6 +20,7 @@ require "spec_helper"
class NoWhyrunDemonstrator < Chef::Provider
attr_reader :system_state_altered
+
def whyrun_supported?
false
end