From 87c995af26e3903d9e66133c8714e6218d955ce3 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 5 Aug 2026 23:10:46 +0200 Subject: [PATCH] rubocop: cleanup formatting and whitespace This fixes a few cops that are safe for autocorrect. Signed-off-by: Tim Meusel --- .rubocop_todo.yml | 60 +++---------------- ext/windows/service/daemon.rb | 3 +- lib/hiera/scope.rb | 2 - lib/puppet/application.rb | 3 +- lib/puppet/confine.rb | 3 +- lib/puppet/environments.rb | 15 +---- lib/puppet/face/epp.rb | 2 - lib/puppet/file_bucket/dipper.rb | 2 - lib/puppet/file_serving/content.rb | 3 +- lib/puppet/file_serving/mount.rb | 3 +- lib/puppet/gettext/config.rb | 2 - lib/puppet/graph/simple_graph.rb | 2 - .../indirector/file_bucket_file/file.rb | 2 - lib/puppet/module.rb | 7 +-- lib/puppet/parser/ast.rb | 3 +- .../parser/compiler/catalog_validator.rb | 3 +- lib/puppet/parser/files.rb | 2 - lib/puppet/parser/resource.rb | 4 -- lib/puppet/parser/scope.rb | 6 +- lib/puppet/pops/adaptable.rb | 2 - lib/puppet/pops/loader/base_loader.rb | 2 - lib/puppet/pops/loader/loader.rb | 2 - .../pops/loader/runtime3_type_loader.rb | 2 - lib/puppet/pops/loaders.rb | 2 - lib/puppet/pops/lookup/hiera_config.rb | 2 - lib/puppet/pops/lookup/interpolation.rb | 2 - lib/puppet/pops/lookup/key_recorder.rb | 6 +- lib/puppet/pops/lookup/lookup_key.rb | 2 - .../pops/migration/migration_checker.rb | 3 +- lib/puppet/pops/parser/lexer_support.rb | 2 - lib/puppet/pops/parser/locatable.rb | 6 +- lib/puppet/pops/parser/locator.rb | 27 +++------ lib/puppet/pops/puppet_stack.rb | 2 +- lib/puppet/pops/time/timespan.rb | 2 - lib/puppet/pops/types/class_loader.rb | 4 +- lib/puppet/pops/types/iterable.rb | 2 - lib/puppet/pops/types/p_runtime_type.rb | 2 - lib/puppet/pops/types/p_timespan_type.rb | 2 - lib/puppet/pops/types/puppet_object.rb | 6 +- lib/puppet/pops/types/type_acceptor.rb | 3 +- lib/puppet/pops/types/types.rb | 9 +-- lib/puppet/pops/utils.rb | 6 -- lib/puppet/pops/validation/checker4_0.rb | 8 +-- lib/puppet/pops/visitor.rb | 2 +- lib/puppet/property/ensure.rb | 4 -- lib/puppet/provider/nameservice.rb | 2 - lib/puppet/provider/network_device.rb | 3 +- lib/puppet/provider/package/pkgdmg.rb | 2 - lib/puppet/provider/package/portage.rb | 2 +- lib/puppet/provider/package/portupgrade.rb | 4 +- lib/puppet/provider/parsedfile.rb | 2 - lib/puppet/provider/service/base.rb | 6 +- lib/puppet/provider/service/launchd.rb | 2 +- lib/puppet/provider/service/openwrt.rb | 3 +- lib/puppet/provider/service/service.rb | 3 +- lib/puppet/provider/user/directoryservice.rb | 8 +-- lib/puppet/settings.rb | 2 - lib/puppet/test/test_helper.rb | 3 +- lib/puppet/transaction/event.rb | 1 - lib/puppet/transaction/persistence.rb | 2 - lib/puppet/type.rb | 17 +----- lib/puppet/type/component.rb | 3 +- lib/puppet/type/file.rb | 4 +- lib/puppet/type/resources.rb | 2 - lib/puppet/type/user.rb | 2 - lib/puppet/util/at_fork/noop.rb | 9 +-- lib/puppet/util/fileparsing.rb | 6 -- lib/puppet/util/filetype.rb | 2 - lib/puppet/util/ldap/generator.rb | 2 - .../util/network_device/transport/base.rb | 6 +- lib/puppet/util/symbolic_file_mode.rb | 4 +- lib/puppet/util/windows/file.rb | 1 - 72 files changed, 69 insertions(+), 273 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index c228413167..0696e85738 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `rubocop --auto-gen-config --no-offense-counts --no-auto-gen-timestamp` -# using RuboCop version 1.86.1. +# using RuboCop version 1.88.2. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new @@ -22,26 +22,6 @@ I18n/GetText/DecorateStringFormattingUsingPercent: I18n/RailsI18n/DecorateString: Enabled: false -# This cop supports safe autocorrection (--autocorrect). -Layout/EmptyLinesAroundMethodBody: - Exclude: - - 'lib/puppet/transaction/event.rb' - - 'lib/puppet/util/windows/file.rb' - -# This cop supports safe autocorrection (--autocorrect). -Layout/SpaceAroundKeyword: - Exclude: - - 'lib/puppet/provider/package/portage.rb' - - 'lib/puppet/type/file.rb' - -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: AllowForAlignment, EnforcedStyleForExponentOperator, EnforcedStyleForRationalLiterals. -# SupportedStylesForExponentOperator: space, no_space -# SupportedStylesForRationalLiterals: space, no_space -Layout/SpaceAroundOperators: - Exclude: - - 'lib/puppet/util/symbolic_file_mode.rb' - # Configuration parameters: AllowedMethods. # AllowedMethods: enums Lint/ConstantDefinitionInBlock: @@ -259,7 +239,6 @@ Style/CaseEquality: - 'lib/puppet/module_tool/shared_behaviors.rb' - 'lib/puppet/util/log/destination.rb' - 'lib/puppet/util/multi_match.rb' - - 'lib/puppet/util/rdoc/generators/puppet_generator.rb' # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: EnforcedStyle, EnforcedStyleForClasses, EnforcedStyleForModules. @@ -292,8 +271,6 @@ Style/CommentAnnotation: Style/CommentedKeyword: Exclude: - 'lib/puppet/util/command_line/trollop.rb' - - 'lib/puppet/util/rdoc/generators/puppet_generator.rb' - - 'lib/puppet/util/rdoc/generators/template/puppet/puppet.rb' - 'lib/puppet/util/rpm_compare.rb' - 'lib/puppet/util/windows/service.rb' @@ -325,24 +302,14 @@ Style/DoubleNegation: # Configuration parameters: EnforcedStyle, AllowComments. # SupportedStyles: empty, nil, both Style/EmptyElse: - Enabled: false - -# This cop supports safe autocorrection (--autocorrect). -Style/EmptyLiteral: Exclude: - - 'lib/puppet/parser/scope.rb' - - 'lib/puppet/pops/puppet_stack.rb' - - 'lib/puppet/pops/visitor.rb' - - 'lib/puppet/provider/package/portupgrade.rb' - - 'lib/puppet/provider/service/launchd.rb' - - 'lib/puppet/provider/user/directoryservice.rb' - - 'lib/puppet/type.rb' - -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle. -# SupportedStyles: compact, expanded -Style/EmptyMethod: - Enabled: false + - 'lib/puppet/pal/plan_signature.rb' + - 'lib/puppet/pops/loader/dependency_loader.rb' + - 'lib/puppet/pops/types/iterable.rb' + - 'lib/puppet/pops/types/p_sem_ver_range_type.rb' + - 'lib/puppet/pops/types/type_calculator.rb' + - 'lib/puppet/pops/types/types.rb' + - 'lib/puppet/ssl/state_machine.rb' # This cop supports safe autocorrection (--autocorrect). Style/Encoding: @@ -456,13 +423,6 @@ Style/MissingRespondToMissing: - 'lib/puppet/util/command_line/trollop.rb' - 'lib/puppet/util/feature.rb' -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle. -# SupportedStyles: separated, grouped -Style/MixinGrouping: - Exclude: - - 'lib/puppet/util/rdoc/generators/puppet_generator.rb' - Style/MultilineBlockChain: Enabled: false @@ -478,7 +438,6 @@ Style/MultilineIfModifier: - 'lib/puppet/provider/package/windows.rb' - 'lib/puppet/provider/service/upstart.rb' - 'lib/puppet/resource/catalog.rb' - - 'lib/puppet/type/file/content.rb' - 'lib/puppet/type/user.rb' - 'lib/puppet/util/execution.rb' - 'lib/puppet/util/windows/com.rb' @@ -525,7 +484,7 @@ Style/MultipleComparison: Enabled: false # This cop supports unsafe autocorrection (--autocorrect-all). -# Configuration parameters: EnforcedStyle. +# Configuration parameters: EnforcedStyle, Recursive. # SupportedStyles: literals, strict Style/MutableConstant: Enabled: false @@ -638,7 +597,6 @@ Style/StderrPuts: - 'lib/puppet/reference/type.rb' - 'lib/puppet/util.rb' - 'lib/puppet/util/command_line/trollop.rb' - - 'lib/puppet/util/rdoc/generators/puppet_generator.rb' # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: Mode. diff --git a/ext/windows/service/daemon.rb b/ext/windows/service/daemon.rb index 0423ad5592..be5862f2b1 100755 --- a/ext/windows/service/daemon.rb +++ b/ext/windows/service/daemon.rb @@ -26,8 +26,7 @@ class WindowsDaemon < Puppet::Util::Windows::Daemon end end - def service_init - end + def service_init; end def service_main(*argsv) argsv = (argsv << ARGV).flatten.compact diff --git a/lib/hiera/scope.rb b/lib/hiera/scope.rb index 726b0405c3..2e74ff9aab 100644 --- a/lib/hiera/scope.rb +++ b/lib/hiera/scope.rb @@ -80,8 +80,6 @@ def find_hostclass(scope) scope.source.name.downcase elsif scope.parent find_hostclass(scope.parent) - else - nil end end private :find_hostclass diff --git a/lib/puppet/application.rb b/lib/puppet/application.rb index 92ca1f4640..45429c67e4 100644 --- a/lib/puppet/application.rb +++ b/lib/puppet/application.rb @@ -381,8 +381,7 @@ def initialize_app_defaults # usually not necessary to override this method. # @return [void] # @api public - def preinit - end + def preinit; end # Call in setup of subclass to deprecate an application. # @return [void] diff --git a/lib/puppet/confine.rb b/lib/puppet/confine.rb index 003a54169d..07f7027df3 100644 --- a/lib/puppet/confine.rb +++ b/lib/puppet/confine.rb @@ -81,6 +81,5 @@ def valid? end # Provide a hook for subclasses. - def reset - end + def reset; end end diff --git a/lib/puppet/environments.rb b/lib/puppet/environments.rb index e0a158c7c9..073f34c2b2 100644 --- a/lib/puppet/environments.rb +++ b/lib/puppet/environments.rb @@ -122,8 +122,6 @@ def get_conf(name) env = get(name) if env Puppet::Settings::EnvironmentConf.static_for(env, Puppet[:environment_timeout], Puppet[:static_catalogs], Puppet[:rich_data]) - else - nil end end end @@ -221,8 +219,6 @@ def get_conf(name) envdir = validated_directory(File.join(@environment_dir, name.to_s)) if envdir Puppet::Settings::EnvironmentConf.load_from(envdir, @global_module_path) - else - nil end end @@ -257,8 +253,6 @@ def validated_directory(envdir) envdir = Puppet::Environments::Directories.real_path(envdir).to_s if Puppet::FileSystem.directory?(envdir) && Puppet::Node::Environment.valid_name?(env_name) envdir - else - nil end end @@ -325,8 +319,7 @@ class DefaultCacheExpirationService # Called when the environment is created. # # @param [Puppet::Node::Environment] env - def created(env) - end + def created(env); end # Is the environment with this name expired? # @@ -339,8 +332,7 @@ def expired?(env_name) # The environment with this name was evicted. # # @param [Symbol] env_name The symbolic environment name - def evicted(env_name) - end + def evicted(env_name); end end def self.cache_expiration_service=(service) @@ -536,8 +528,7 @@ def initialize(value) @guards = 0 end - def touch - end + def touch; end def expired?(now) false diff --git a/lib/puppet/face/epp.rb b/lib/puppet/face/epp.rb index 8f7fe4ba4e..370ce7516f 100644 --- a/lib/puppet/face/epp.rb +++ b/lib/puppet/face/epp.rb @@ -558,8 +558,6 @@ def effective_template(file, env) template_file elsif Puppet::FileSystem.exist?(file) file - else - nil end end end diff --git a/lib/puppet/file_bucket/dipper.rb b/lib/puppet/file_bucket/dipper.rb index 31312e8ccc..e4a49d5c8e 100644 --- a/lib/puppet/file_bucket/dipper.rb +++ b/lib/puppet/file_bucket/dipper.rb @@ -153,8 +153,6 @@ def restore(file, sum) return nil end newsum - else - nil end end diff --git a/lib/puppet/file_serving/content.rb b/lib/puppet/file_serving/content.rb index c938768aa7..54e4d36b0c 100644 --- a/lib/puppet/file_serving/content.rb +++ b/lib/puppet/file_serving/content.rb @@ -25,8 +25,7 @@ def self.from_binary(content) # This is no longer used, but is still called by the file server implementations when interacting # with their model abstraction. - def collect(source_permissions = nil) - end + def collect(source_permissions = nil); end # Read the content of our file in. def content diff --git a/lib/puppet/file_serving/mount.rb b/lib/puppet/file_serving/mount.rb index 954cf5b388..36e6d52348 100644 --- a/lib/puppet/file_serving/mount.rb +++ b/lib/puppet/file_serving/mount.rb @@ -36,6 +36,5 @@ def to_s end # A noop. - def validate - end + def validate; end end diff --git a/lib/puppet/gettext/config.rb b/lib/puppet/gettext/config.rb index 7a2d06dc81..4b1f05211d 100644 --- a/lib/puppet/gettext/config.rb +++ b/lib/puppet/gettext/config.rb @@ -196,8 +196,6 @@ def self.puppet_locale_path WINDOWS_PATH elsif !Puppet::Util::Platform.windows? && Puppet::FileSystem.exist?(POSIX_PATH) POSIX_PATH - else - nil end end diff --git a/lib/puppet/graph/simple_graph.rb b/lib/puppet/graph/simple_graph.rb index dc95c43e25..90987233e7 100644 --- a/lib/puppet/graph/simple_graph.rb +++ b/lib/puppet/graph/simple_graph.rb @@ -433,8 +433,6 @@ def path_between(f, t) elsif dependents(f).include?(t) m = (dependents(f) & direct_dependencies_of(t)).first path_between(f, m) + path_between(m, t) - else - nil end end diff --git a/lib/puppet/indirector/file_bucket_file/file.rb b/lib/puppet/indirector/file_bucket_file/file.rb index 86aefca248..b1d596b7e4 100644 --- a/lib/puppet/indirector/file_bucket_file/file.rb +++ b/lib/puppet/indirector/file_bucket_file/file.rb @@ -37,8 +37,6 @@ def find(request) Puppet.info _("FileBucket read %{checksum}") % { checksum: checksum } model.new(Puppet::FileSystem.binread(contents_file)) end - else - nil end end diff --git a/lib/puppet/module.rb b/lib/puppet/module.rb index 0f6e600caa..3c86849ea6 100644 --- a/lib/puppet/module.rb +++ b/lib/puppet/module.rb @@ -91,8 +91,7 @@ def puppetversion end # @deprecated The puppetversion module metadata field is no longer used. - def puppetversion=(something) - end + def puppetversion=(something); end # @deprecated The puppetversion module metadata field is no longer used. def validate_puppet_version @@ -172,8 +171,6 @@ def task_file(name) if Puppet::FileSystem.exist?(full_path) full_path - else - nil end end @@ -205,8 +202,6 @@ def plan_file(name) if Puppet::FileSystem.exist?(full_path) full_path - else - nil end end diff --git a/lib/puppet/parser/ast.rb b/lib/puppet/parser/ast.rb index be82a5339c..48e98b4805 100644 --- a/lib/puppet/parser/ast.rb +++ b/lib/puppet/parser/ast.rb @@ -18,8 +18,7 @@ def inspect # Evaluate the current object. Just a stub method, since the subclass # should override this method. - def evaluate(scope) - end + def evaluate(scope); end # The version of the evaluate method that should be called, because it # correctly handles errors. It is critical to use this method because diff --git a/lib/puppet/parser/compiler/catalog_validator.rb b/lib/puppet/parser/compiler/catalog_validator.rb index 3af65432f2..51dca170e6 100644 --- a/lib/puppet/parser/compiler/catalog_validator.rb +++ b/lib/puppet/parser/compiler/catalog_validator.rb @@ -25,8 +25,7 @@ def initialize(catalog) end # Validate some aspect of the catalog and raise a `CatalogValidationError` on failure - def validate - end + def validate; end end class CatalogValidationError < Puppet::Error diff --git a/lib/puppet/parser/files.rb b/lib/puppet/parser/files.rb index f9ff7e0e93..cd1d0d7db6 100644 --- a/lib/puppet/parser/files.rb +++ b/lib/puppet/parser/files.rb @@ -76,8 +76,6 @@ def find_in_module(reference, environment) if file && mod yield(mod, file) - else - nil end end end diff --git a/lib/puppet/parser/resource.rb b/lib/puppet/parser/resource.rb index b0a9dc34c2..f9e4724e90 100644 --- a/lib/puppet/parser/resource.rb +++ b/lib/puppet/parser/resource.rb @@ -38,8 +38,6 @@ def [](param) if @parameters.has_key?(param) @parameters[param].value - else - nil end end @@ -90,7 +88,6 @@ def evaluate def exported=(value) if value @virtual = true - else end @exported = value end @@ -226,7 +223,6 @@ def to_hash if value.is_a?(Array) value = value.flatten.reject { |v| v.nil? || :undef == v } end - else end result[param.name] = value end) diff --git a/lib/puppet/parser/scope.rb b/lib/puppet/parser/scope.rb index 63f85be85c..1314a9fec3 100644 --- a/lib/puppet/parser/scope.rb +++ b/lib/puppet/parser/scope.rb @@ -336,8 +336,6 @@ def self.number?(value) value.to_i(8) when /^-?\d+$/ value.to_i - else - nil end end @@ -566,8 +564,6 @@ def [](varname, options = EMPTY_HASH) def inherited_scope if resource && resource.type == TYPENAME_CLASS && !resource.resource_type.parent.nil? qualified_scope(resource.resource_type.parent) - else - nil end end @@ -680,7 +676,7 @@ def to_hash(recursive = true, include_undef = false) target.merge!(inherited.to_hash(recursive)) end else - target = Hash.new + target = {} end # add all local scopes diff --git a/lib/puppet/pops/adaptable.rb b/lib/puppet/pops/adaptable.rb index dabb91ee79..64b56b953e 100644 --- a/lib/puppet/pops/adaptable.rb +++ b/lib/puppet/pops/adaptable.rb @@ -142,8 +142,6 @@ def self.clear(o) attr_name = self_attr_name if o.instance_variable_defined?(attr_name) o.send(:remove_instance_variable, attr_name) - else - nil end end diff --git a/lib/puppet/pops/loader/base_loader.rb b/lib/puppet/pops/loader/base_loader.rb index cbde3d6e70..d3bfacb92b 100644 --- a/lib/puppet/pops/loader/base_loader.rb +++ b/lib/puppet/pops/loader/base_loader.rb @@ -56,8 +56,6 @@ def loaded_entry(typed_name, check_dependencies = false) @named_values[typed_name] elsif parent parent.loaded_entry(typed_name, check_dependencies) - else - nil end end end diff --git a/lib/puppet/pops/loader/loader.rb b/lib/puppet/pops/loader/loader.rb index e28b61f4e8..3efd54be03 100644 --- a/lib/puppet/pops/loader/loader.rb +++ b/lib/puppet/pops/loader/loader.rb @@ -116,8 +116,6 @@ def [](typed_name) found = get_entry(typed_name) if found found.value - else - nil end end diff --git a/lib/puppet/pops/loader/runtime3_type_loader.rb b/lib/puppet/pops/loader/runtime3_type_loader.rb index c47fbf945f..a4802ff0d7 100644 --- a/lib/puppet/pops/loader/runtime3_type_loader.rb +++ b/lib/puppet/pops/loader/runtime3_type_loader.rb @@ -62,8 +62,6 @@ def find(typed_name) te when :resource_type_pp @resource_3x_loader.nil? ? nil : find_impl(typed_name) - else - nil end end diff --git a/lib/puppet/pops/loaders.rb b/lib/puppet/pops/loaders.rb index d403787129..c764aa464b 100644 --- a/lib/puppet/pops/loaders.rb +++ b/lib/puppet/pops/loaders.rb @@ -401,8 +401,6 @@ def create_environment_loader(environment, parent_loader, load_from_pcore = true # Create pcore resource type loader, if applicable pcore_resource_type_loader = if load_from_pcore && env_path Loader::ModuleLoaders.pcore_resource_type_loader_from(parent_loader, self, env_path) - else - nil end @runtime3_type_loader = add_loader_by_name(Loader::Runtime3TypeLoader.new(parent_loader, self, environment, pcore_resource_type_loader)) diff --git a/lib/puppet/pops/lookup/hiera_config.rb b/lib/puppet/pops/lookup/hiera_config.rb index 254b6fde4f..cd7093c9f2 100644 --- a/lib/puppet/pops/lookup/hiera_config.rb +++ b/lib/puppet/pops/lookup/hiera_config.rb @@ -681,8 +681,6 @@ def create_configured_data_providers(lookup_invocation, parent_data_provider, us expand_uris([he[location_key]], lookup_invocation) when KEY_MAPPED_PATHS expand_mapped_paths(entry_datadir, he[location_key], lookup_invocation) - else - nil end end next if @config_path.nil? && !locations.nil? && locations.empty? # Default config and no existing paths found diff --git a/lib/puppet/pops/lookup/interpolation.rb b/lib/puppet/pops/lookup/interpolation.rb index c48e24fbff..b08144d9c2 100644 --- a/lib/puppet/pops/lookup/interpolation.rb +++ b/lib/puppet/pops/lookup/interpolation.rb @@ -103,8 +103,6 @@ def interpolate_method(method_key) if default_key_exists lookup_invocation.report_found_in_defaults(root_key, lookup_invocation.default_values[root_key]) - else - nil end else lookup_invocation.report_found(root_key, val) diff --git a/lib/puppet/pops/lookup/key_recorder.rb b/lib/puppet/pops/lookup/key_recorder.rb index 4149aa85d8..194309e600 100644 --- a/lib/puppet/pops/lookup/key_recorder.rb +++ b/lib/puppet/pops/lookup/key_recorder.rb @@ -4,8 +4,7 @@ # @api private # class Puppet::Pops::Lookup::KeyRecorder - def initialize - end + def initialize; end # rubocop:disable Naming/MemoizedInstanceVariableName def self.singleton @@ -16,6 +15,5 @@ def self.singleton # Records a key # (This implementation does nothing) # - def record(key) - end + def record(key); end end diff --git a/lib/puppet/pops/lookup/lookup_key.rb b/lib/puppet/pops/lookup/lookup_key.rb index 7089812117..e5707bcc61 100644 --- a/lib/puppet/pops/lookup/lookup_key.rb +++ b/lib/puppet/pops/lookup/lookup_key.rb @@ -47,8 +47,6 @@ def prune(value) EMPTY_HASH when Array EMPTY_ARRAY - else - nil end else undig(pruned) diff --git a/lib/puppet/pops/migration/migration_checker.rb b/lib/puppet/pops/migration/migration_checker.rb index 469a8788a1..b1a09b5266 100644 --- a/lib/puppet/pops/migration/migration_checker.rb +++ b/lib/puppet/pops/migration/migration_checker.rb @@ -4,8 +4,7 @@ # @api private # class Puppet::Pops::Migration::MigrationChecker - def initialize - end + def initialize; end # rubocop:disable Naming/MemoizedInstanceVariableName def self.singleton diff --git a/lib/puppet/pops/parser/lexer_support.rb b/lib/puppet/pops/parser/lexer_support.rb index 80cdef65bb..ecdc870584 100644 --- a/lib/puppet/pops/parser/lexer_support.rb +++ b/lib/puppet/pops/parser/lexer_support.rb @@ -132,8 +132,6 @@ def [](key) @locator when :offset @offset - else - nil end end diff --git a/lib/puppet/pops/parser/locatable.rb b/lib/puppet/pops/parser/locatable.rb index 93f65d87f2..c2cfd668dd 100644 --- a/lib/puppet/pops/parser/locatable.rb +++ b/lib/puppet/pops/parser/locatable.rb @@ -3,12 +3,10 @@ # Interface for something that is "locatable" (holds offset and length). class Puppet::Pops::Parser::Locatable # The offset in the locator's content - def offset - end + def offset; end # The length in the locator from the given offset - def length - end + def length; end # This class is useful for testing class Fixed < Puppet::Pops::Parser::Locatable diff --git a/lib/puppet/pops/parser/locator.rb b/lib/puppet/pops/parser/locator.rb index 61d363ce6c..b62bce0fdf 100644 --- a/lib/puppet/pops/parser/locator.rb +++ b/lib/puppet/pops/parser/locator.rb @@ -17,42 +17,34 @@ def self.locator(string, file, index = nil, char_offsets = false) end # Returns the file name associated with the string content - def file - end + def file; end # Returns the string content - def string - end + def string; end def to_s "Locator for file #{file}" end # Returns the position on line (first position on a line is 1) - def pos_on_line(offset) - end + def pos_on_line(offset); end # Returns the line number (first line is 1) for the given offset - def line_for_offset(offset) - end + def line_for_offset(offset); end # Returns the offset on line (first offset on a line is 0). # - def offset_on_line(offset) - end + def offset_on_line(offset); end # Returns the character offset for a given reported offset - def char_offset(byte_offset) - end + def char_offset(byte_offset); end # Returns the length measured in number of characters from the given start and end byte offset - def char_length(offset, end_offset) - end + def char_length(offset, end_offset); end # Extracts the text from offset with given length (measured in what the locator uses for offset) # @returns String - the extracted text - def extract_text(offset, length) - end + def extract_text(offset, length); end def extract_tree_text(ast) first = ast.offset @@ -71,8 +63,7 @@ def extract_tree_text(ast) # Returns the line index - an array of line offsets for the start position of each line, starting at 0 for # the first line. # - def line_index - end + def line_index; end # Common byte based impl that works for all rubies (stringscanner is byte based def self.compute_line_index(string) diff --git a/lib/puppet/pops/puppet_stack.rb b/lib/puppet/pops/puppet_stack.rb index 9b3a0befd1..96bb0e5ca8 100644 --- a/lib/puppet/pops/puppet_stack.rb +++ b/lib/puppet/pops/puppet_stack.rb @@ -29,7 +29,7 @@ module Pops # as well as a nil line number are supported. Such stack frames # will be represented with the text `unknown` and `0ยด respectively. module PuppetStack - @stack = Puppet::ThreadLocal.new { Array.new } + @stack = Puppet::ThreadLocal.new { [] } def self.stack(file, line, obj, message, args, &block) file = 'unknown' if file.nil? || file == '' diff --git a/lib/puppet/pops/time/timespan.rb b/lib/puppet/pops/time/timespan.rb index 9a790d6b55..f4a5b1555b 100644 --- a/lib/puppet/pops/time/timespan.rb +++ b/lib/puppet/pops/time/timespan.rb @@ -42,8 +42,6 @@ def <=>(o) to_int <=> o when Float to_f <=> o - else - nil end end diff --git a/lib/puppet/pops/types/class_loader.rb b/lib/puppet/pops/types/class_loader.rb index bddf002bd9..c6dde89e92 100644 --- a/lib/puppet/pops/types/class_loader.rb +++ b/lib/puppet/pops/types/class_loader.rb @@ -69,9 +69,7 @@ def self.provide_from_type(type) when PFloatType ; Float when PUndefType ; NilClass when PCallableType ; Proc - # rubocop:enable Layout/SpaceBeforeSemicolon - else - nil + # rubocop:enable Layout/SpaceBeforeSemicolon end end private_class_method :provide_from_type diff --git a/lib/puppet/pops/types/iterable.rb b/lib/puppet/pops/types/iterable.rb index f3fea8fe4f..a2693a9b87 100644 --- a/lib/puppet/pops/types/iterable.rb +++ b/lib/puppet/pops/types/iterable.rb @@ -100,8 +100,6 @@ def self.on(o, element_type = nil, infer_elements = true) Iterator.new(PUnitType::DEFAULT, o.times) elsif o > 0 IntegerRangeIterator.new(PIntegerType.new(0, o - 1)) - else - nil end when PIntegerType # a finite range will always produce at least one element since it's inclusive diff --git a/lib/puppet/pops/types/p_runtime_type.rb b/lib/puppet/pops/types/p_runtime_type.rb index c2ac127f92..903a80ce8c 100644 --- a/lib/puppet/pops/types/p_runtime_type.rb +++ b/lib/puppet/pops/types/p_runtime_type.rb @@ -81,8 +81,6 @@ def from_puppet_name(puppet_name) if @name_or_pattern.is_a?(Array) substituted = puppet_name.sub(*@name_or_pattern) substituted == puppet_name ? nil : PRuntimeType.new(@runtime, substituted) - else - nil end end diff --git a/lib/puppet/pops/types/p_timespan_type.rb b/lib/puppet/pops/types/p_timespan_type.rb index 43d2c15ae7..bfb4d7633a 100644 --- a/lib/puppet/pops/types/p_timespan_type.rb +++ b/lib/puppet/pops/types/p_timespan_type.rb @@ -88,8 +88,6 @@ def merge(o) new_min = numeric_from <= o.numeric_from ? numeric_from : o.numeric_from new_max = numeric_to >= o.numeric_to ? numeric_to : o.numeric_to self.class.new(new_min, new_max) - else - nil end end diff --git a/lib/puppet/pops/types/puppet_object.rb b/lib/puppet/pops/types/puppet_object.rb index c246d66bbe..f3b110fcf5 100644 --- a/lib/puppet/pops/types/puppet_object.rb +++ b/lib/puppet/pops/types/puppet_object.rb @@ -23,11 +23,9 @@ def _pcore_type t end - def _pcore_all_contents(path, &block) - end + def _pcore_all_contents(path, &block); end - def _pcore_contents - end + def _pcore_contents; end def _pcore_init_hash {} diff --git a/lib/puppet/pops/types/type_acceptor.rb b/lib/puppet/pops/types/type_acceptor.rb index 80b591fc63..c17f14b7c0 100644 --- a/lib/puppet/pops/types/type_acceptor.rb +++ b/lib/puppet/pops/types/type_acceptor.rb @@ -13,8 +13,7 @@ module Types module TypeAcceptor # @param type [PAnyType] the type that we accept a visit from # @param guard [RecursionGuard] the guard against self recursion - def visit(type, guard) - end + def visit(type, guard); end end # An acceptor that does nothing diff --git a/lib/puppet/pops/types/types.rb b/lib/puppet/pops/types/types.rb index c055bb8d00..4c2f27b395 100644 --- a/lib/puppet/pops/types/types.rb +++ b/lib/puppet/pops/types/types.rb @@ -182,8 +182,7 @@ def callable_args?(callable, guard) # @param originator [PTypeAliasType] the starting point for the check # @raise Puppet::Error if an illegal self recursion is detected # @api private - def check_self_recursion(originator) - end + def check_self_recursion(originator); end # Generalizes value specific types. Types that are not value specific will return `self` otherwise # the generalized type is returned. @@ -521,8 +520,6 @@ def iterable_type(guard = nil) # @type describes the element type perfectly since the iteration is made over the # specified range. @type.finite_range? ? PIterableType.new(@type) : nil - else - nil end end @@ -1050,8 +1047,6 @@ def merge(o) min = @from <= o.numeric_from ? @from : o.numeric_from max = @to >= o.numeric_to ? @to : o.numeric_to PIntegerType.new(min, max) - else - nil end end @@ -1224,8 +1219,6 @@ def merge(o) min = @from <= o.from ? @from : o.from max = @to >= o.to ? @to : o.to PFloatType.new(min, max) - else - nil end end diff --git a/lib/puppet/pops/utils.rb b/lib/puppet/pops/utils.rb index e09552aa98..6c8a71e067 100644 --- a/lib/puppet/pops/utils.rb +++ b/lib/puppet/pops/utils.rb @@ -30,8 +30,6 @@ def self.match_to_fp(match) fp_value = Float(match[2]) if fp_value != Float::INFINITY match[1] == '-' ? -fp_value : fp_value - else - nil end end end @@ -69,8 +67,6 @@ def self.to_n_with_radix o when Numeric # Impossible to calculate radix, assume decimal [o, 10] - else - nil end rescue ArgumentError nil @@ -94,8 +90,6 @@ def self.to_n o end when Numeric o - else - nil end rescue ArgumentError nil diff --git a/lib/puppet/pops/validation/checker4_0.rb b/lib/puppet/pops/validation/checker4_0.rb index 995281e242..97d3c388e5 100644 --- a/lib/puppet/pops/validation/checker4_0.rb +++ b/lib/puppet/pops/validation/checker4_0.rb @@ -185,8 +185,7 @@ def assign_Object(o, via_index) #---CHECKS - def check_Object(o) - end + def check_Object(o); end def check_Factory(o) check(o.model) @@ -753,8 +752,7 @@ def check_NodeDefinition(o) # other names). This means that (if the lexer/parser so chooses) a QualifiedName # can be anything when it represents a Bare Word and evaluates to a String. # - def check_QualifiedName(o) - end + def check_QualifiedName(o); end # Checks that the value is a valid UpperCaseWord (a CLASSREF), and optionally if it contains a hypen. # DOH: QualifiedReferences are created with LOWER CASE NAMES at parse time @@ -1146,8 +1144,6 @@ def varname_to_s(o) o.value when Model::QualifiedReference o.value - else - nil end end end diff --git a/lib/puppet/pops/visitor.rb b/lib/puppet/pops/visitor.rb index c9cbe424fa..b251a9be14 100644 --- a/lib/puppet/pops/visitor.rb +++ b/lib/puppet/pops/visitor.rb @@ -23,7 +23,7 @@ def initialize(receiver, message, min_args = 0, max_args = nil) @message = message @min_args = min_args @max_args = max_args - @cache = Hash.new + @cache = {} end # Visit the configured receiver diff --git a/lib/puppet/property/ensure.rb b/lib/puppet/property/ensure.rb index a227145916..f52ea25aaf 100644 --- a/lib/puppet/property/ensure.rb +++ b/lib/puppet/property/ensure.rb @@ -34,8 +34,6 @@ def self.defaultvalues defaultto do if @resource.managed? :present - else - nil end end @@ -100,8 +98,6 @@ def retrieve defaultto do if @resource.managed? :present - else - nil end end end diff --git a/lib/puppet/provider/nameservice.rb b/lib/puppet/provider/nameservice.rb index 382494b9e8..b6a621a06d 100644 --- a/lib/puppet/provider/nameservice.rb +++ b/lib/puppet/provider/nameservice.rb @@ -115,8 +115,6 @@ def autogen(field) value elsif respond_to?("autogen_#{field}") send("autogen_#{field}") - else - nil end end end diff --git a/lib/puppet/provider/network_device.rb b/lib/puppet/provider/network_device.rb index 40b10b1cd7..362c54cd15 100644 --- a/lib/puppet/provider/network_device.rb +++ b/lib/puppet/provider/network_device.rb @@ -61,8 +61,7 @@ def flush @property_hash.clear end - def self.instances - end + def self.instances; end def former_properties @properties.dup diff --git a/lib/puppet/provider/package/pkgdmg.rb b/lib/puppet/provider/package/pkgdmg.rb index 09866ed3af..e14db0d45f 100644 --- a/lib/puppet/provider/package/pkgdmg.rb +++ b/lib/puppet/provider/package/pkgdmg.rb @@ -138,8 +138,6 @@ def query if Puppet::FileSystem.exist?("/var/db/.puppet_pkgdmg_installed_#{@resource[:name]}") Puppet.debug "/var/db/.puppet_pkgdmg_installed_#{@resource[:name]} found" { :name => @resource[:name], :ensure => :present } - else - nil end end diff --git a/lib/puppet/provider/package/portage.rb b/lib/puppet/provider/package/portage.rb index b7b273b618..36ed652e24 100644 --- a/lib/puppet/provider/package/portage.rb +++ b/lib/puppet/provider/package/portage.rb @@ -179,7 +179,7 @@ def query if @resource[:name] =~ /^@/ if package_sets.include?(@resource[:name][1..].to_s) - return({ :name => (@resource[:name]).to_s, :ensure => '9999', :version_available => nil, :installed_versions => nil, :installable_versions => "9999," }) + return ({ :name => (@resource[:name]).to_s, :ensure => '9999', :version_available => nil, :installed_versions => nil, :installable_versions => "9999," }) end end diff --git a/lib/puppet/provider/package/portupgrade.rb b/lib/puppet/provider/package/portupgrade.rb index b80ae27556..653d1f0eac 100644 --- a/lib/puppet/provider/package/portupgrade.rb +++ b/lib/puppet/provider/package/portupgrade.rb @@ -39,7 +39,7 @@ def self.instances # Corresponding field names fields = [:portname, :ensure, :portorigin] # define Temporary hash used, packages array of hashes - hash = Hash.new + hash = {} packages = [] # exec command @@ -173,7 +173,7 @@ def query # Check: if output isn't in the right format, return nil if output =~ /^(\S+)-([^-\s]+)/ # Fill in the details - hash = Hash.new + hash = {} hash[:portorigin] = name hash[:portname] = Regexp.last_match(1) hash[:ensure] = Regexp.last_match(2) diff --git a/lib/puppet/provider/parsedfile.rb b/lib/puppet/provider/parsedfile.rb index 09e9dfa609..e93e96ab93 100644 --- a/lib/puppet/provider/parsedfile.rb +++ b/lib/puppet/provider/parsedfile.rb @@ -189,8 +189,6 @@ def self.mk_resource_methods @property_hash[attr] || :absent elsif defined?(@resource) @resource.should(attr) - else - nil end end diff --git a/lib/puppet/provider/service/base.rb b/lib/puppet/provider/service/base.rb index 943ba28f89..44f7471922 100644 --- a/lib/puppet/provider/service/base.rb +++ b/lib/puppet/provider/service/base.rb @@ -90,8 +90,7 @@ def status end # There is no default command, which causes other methods to be used - def statuscmd - end + def statuscmd; end # Run the 'start' parameter command, or the specified 'startcmd'. def start @@ -130,6 +129,5 @@ def stop end # There is no default command, which causes other methods to be used - def stopcmd - end + def stopcmd; end end diff --git a/lib/puppet/provider/service/launchd.rb b/lib/puppet/provider/service/launchd.rb index a97b664825..c7ef39fa87 100644 --- a/lib/puppet/provider/service/launchd.rb +++ b/lib/puppet/provider/service/launchd.rb @@ -184,7 +184,7 @@ def self.jobsearch(label = nil) # This status method lists out all currently running services. # This hash is returned at the end of the method. def self.job_list - @job_list = Hash.new + @job_list = {} begin output = launchctl :list raise Puppet::Error, "launchctl list failed to return any data." if output.nil? diff --git a/lib/puppet/provider/service/openwrt.rb b/lib/puppet/provider/service/openwrt.rb index ce73a13747..4f79cd497a 100644 --- a/lib/puppet/provider/service/openwrt.rb +++ b/lib/puppet/provider/service/openwrt.rb @@ -32,6 +32,5 @@ def enabled? # Purposely leave blank so we fail back to ps based status detection # As OpenWrt init script do not have status commands - def statuscmd - end + def statuscmd; end end diff --git a/lib/puppet/provider/service/service.rb b/lib/puppet/provider/service/service.rb index 45ae40025c..4af2abe18b 100644 --- a/lib/puppet/provider/service/service.rb +++ b/lib/puppet/provider/service/service.rb @@ -19,8 +19,7 @@ def restart end # There is no default command, which causes other methods to be used - def restartcmd - end + def restartcmd; end # @deprecated because the exit status is not returned, use service_execute instead def texecute(type, command, fof = true, squelch = false, combine = true) diff --git a/lib/puppet/provider/user/directoryservice.rb b/lib/puppet/provider/user/directoryservice.rb index c02c563864..13064747c1 100644 --- a/lib/puppet/provider/user/directoryservice.rb +++ b/lib/puppet/provider/user/directoryservice.rb @@ -288,8 +288,6 @@ def create '/bin/bash' when :home "/Users/#{@resource.name}" - else - nil end end @@ -642,7 +640,7 @@ def base64_decode_string(value) # set_shadow_hash_data method to serialize and write the plist to disk. def set_salted_sha512(users_plist, shadow_hash_data, value) unless shadow_hash_data - shadow_hash_data = Hash.new + shadow_hash_data = {} shadow_hash_data['SALTED-SHA512'] = ''.dup end shadow_hash_data['SALTED-SHA512'] = base64_decode_string(value) @@ -659,8 +657,8 @@ def set_salted_sha512(users_plist, shadow_hash_data, value) # the user's plist itself, and the shadow_hash_data hash containing the # existing PBKDF2 values. def set_salted_pbkdf2(users_plist, shadow_hash_data, field, value) - shadow_hash_data ||= Hash.new - shadow_hash_data['SALTED-SHA512-PBKDF2'] = Hash.new unless shadow_hash_data['SALTED-SHA512-PBKDF2'] + shadow_hash_data ||= {} + shadow_hash_data['SALTED-SHA512-PBKDF2'] = {} unless shadow_hash_data['SALTED-SHA512-PBKDF2'] case field when 'salt', 'entropy' shadow_hash_data['SALTED-SHA512-PBKDF2'][field] = Puppet::Util::Plist.string_to_blob(base64_decode_string(value)) diff --git a/lib/puppet/settings.rb b/lib/puppet/settings.rb index d8fef9b26b..61ed4b47de 100644 --- a/lib/puppet/settings.rb +++ b/lib/puppet/settings.rb @@ -443,8 +443,6 @@ def description(name) obj = @config[name.to_sym] if obj obj.desc - else - nil end end diff --git a/lib/puppet/test/test_helper.rb b/lib/puppet/test/test_helper.rb index d8cc3bd4f4..6057635391 100644 --- a/lib/puppet/test/test_helper.rb +++ b/lib/puppet/test/test_helper.rb @@ -77,8 +77,7 @@ def self.before_all_tests # Call this method once, at the end of a test run, when no more tests # will be run. # @return nil - def self.after_all_tests - end + def self.after_all_tests; end # The name of the rollback mark used in the Puppet.context. This is what # the test infrastructure returns to for each test. diff --git a/lib/puppet/transaction/event.rb b/lib/puppet/transaction/event.rb index 7893db862b..b86c12eab8 100644 --- a/lib/puppet/transaction/event.rb +++ b/lib/puppet/transaction/event.rb @@ -40,7 +40,6 @@ def initialize(audited: false, source_description: nil, status: nil, tags: nil) - @audited = audited @corrective_change = corrective_change @desired_value = desired_value diff --git a/lib/puppet/transaction/persistence.rb b/lib/puppet/transaction/persistence.rb index 88e188e69d..5b0b296e77 100644 --- a/lib/puppet/transaction/persistence.rb +++ b/lib/puppet/transaction/persistence.rb @@ -48,8 +48,6 @@ def get_system_value(resource_name, param_name) !@old_data["resources"][resource_name]["parameters"].nil? && !@old_data["resources"][resource_name]["parameters"][param_name].nil? @old_data["resources"][resource_name]["parameters"][param_name]["system_value"] - else - nil end end diff --git a/lib/puppet/type.rb b/lib/puppet/type.rb index f440bbc99c..7d6b1110ec 100644 --- a/lib/puppet/type.rb +++ b/lib/puppet/type.rb @@ -659,8 +659,6 @@ def [](name) # Note that if this is a property, then the value is the "should" value, # not the current value. obj.value - else - nil end end @@ -754,8 +752,6 @@ def should(name) prop = @parameters[name.intern] if prop && prop.is_a?(Puppet::Property) prop.should - else - nil end end @@ -833,8 +829,6 @@ def property(name) obj = @parameters[name.intern] if obj && obj.is_a?(Puppet::Property) obj - else - nil end end @@ -902,8 +896,6 @@ def value(name) obj = @parameters[name] if obj && obj.respond_to?(:value) obj.value - else - nil end end @@ -1023,8 +1015,7 @@ def ancestors # @return [void] # @abstract a resource type may implement this method to perform # validation checks that can query the complete catalog - def pre_run_check - end + def pre_run_check; end # Flushes the provider if supported by the provider, else no action. # This is called by the transaction. @@ -2197,8 +2188,8 @@ class << self # @return [void] def self.initvars # all of the instances of this class - @objects = Hash.new - @aliases = Hash.new + @objects = {} + @aliases = {} @defaults = {} @@ -2511,8 +2502,6 @@ def parent parents = catalog.adjacent(self, :direction => :in) @parent = if parents parents.shift - else - nil end end diff --git a/lib/puppet/type/component.rb b/lib/puppet/type/component.rb index 94e60a2050..aa2fd070d3 100644 --- a/lib/puppet/type/component.rb +++ b/lib/puppet/type/component.rb @@ -87,8 +87,7 @@ def to_s # is no risk of this information leaking into reports, since no # Component instances survive the graph transmutation. # - def set_sensitive_parameters(sensitive_parameters) - end + def set_sensitive_parameters(sensitive_parameters); end private diff --git a/lib/puppet/type/file.rb b/lib/puppet/type/file.rb index 24d0661b7b..e64a40bc18 100644 --- a/lib/puppet/type/file.rb +++ b/lib/puppet/type/file.rb @@ -881,7 +881,7 @@ def should_be_file? if self[:ensure] == :present return true unless stat - return(stat.ftype == "file") + return stat.ftype == "file" end # If we've gotten here, then :ensure isn't set @@ -1019,8 +1019,6 @@ def read_current_type stat_info = stat if stat_info stat_info.ftype.to_s - else - nil end end diff --git a/lib/puppet/type/resources.rb b/lib/puppet/type/resources.rb index 56f832972a..fa406844e2 100644 --- a/lib/puppet/type/resources.rb +++ b/lib/puppet/type/resources.rb @@ -64,8 +64,6 @@ defaultto { if @resource[:name] == "user" @resource.class.system_users_max_uid - else - nil end } end diff --git a/lib/puppet/type/user.rb b/lib/puppet/type/user.rb index fcc4f6396b..91ae07161e 100644 --- a/lib/puppet/type/user.rb +++ b/lib/puppet/type/user.rb @@ -85,8 +85,6 @@ module Puppet defaultto do if @resource.managed? :present - else - nil end end diff --git a/lib/puppet/util/at_fork/noop.rb b/lib/puppet/util/at_fork/noop.rb index c26df7db9f..7d00b887c4 100644 --- a/lib/puppet/util/at_fork/noop.rb +++ b/lib/puppet/util/at_fork/noop.rb @@ -8,13 +8,10 @@ def new self end - def prepare - end + def prepare; end - def parent - end + def parent; end - def child - end + def child; end end end diff --git a/lib/puppet/util/fileparsing.rb b/lib/puppet/util/fileparsing.rb index f927dc2df6..ed600a7308 100644 --- a/lib/puppet/util/fileparsing.rb +++ b/lib/puppet/util/fileparsing.rb @@ -154,8 +154,6 @@ def fields(type) record = record_type(type) if record record.fields.dup - else - nil end end @@ -196,8 +194,6 @@ def handle_record_line(line, record) ret[field] = value end end - else - nil end else ret = {} @@ -229,8 +225,6 @@ def handle_record_line(line, record) if ret ret[:record_type] = record.name ret - else - nil end end diff --git a/lib/puppet/util/filetype.rb b/lib/puppet/util/filetype.rb index 2d4c56d33e..306b052870 100644 --- a/lib/puppet/util/filetype.rb +++ b/lib/puppet/util/filetype.rb @@ -109,8 +109,6 @@ def read # this code path is used by many callers so the original default is # being explicitly preserved Puppet::FileSystem.read(@path, :encoding => Encoding.default_external) - else - nil end end diff --git a/lib/puppet/util/ldap/generator.rb b/lib/puppet/util/ldap/generator.rb index 211c44a31b..966e501987 100644 --- a/lib/puppet/util/ldap/generator.rb +++ b/lib/puppet/util/ldap/generator.rb @@ -31,8 +31,6 @@ def name def source if @source @source.to_s - else - nil end end diff --git a/lib/puppet/util/network_device/transport/base.rb b/lib/puppet/util/network_device/transport/base.rb index caa2c9b80b..298c1bc709 100644 --- a/lib/puppet/util/network_device/transport/base.rb +++ b/lib/puppet/util/network_device/transport/base.rb @@ -11,11 +11,9 @@ def initialize @timeout = 10 end - def send(cmd) - end + def send(cmd); end - def expect(prompt) - end + def expect(prompt); end def command(cmd, options = {}) send(cmd) diff --git a/lib/puppet/util/symbolic_file_mode.rb b/lib/puppet/util/symbolic_file_mode.rb index 2701c59d3c..85f9d6fe3f 100644 --- a/lib/puppet/util/symbolic_file_mode.rb +++ b/lib/puppet/util/symbolic_file_mode.rb @@ -5,9 +5,9 @@ module Puppet module Util module SymbolicFileMode - SetUIDBit = ReadBit = 4 + SetUIDBit = ReadBit = 4 SetGIDBit = WriteBit = 2 - StickyBit = ExecBit = 1 + StickyBit = ExecBit = 1 SymbolicMode = { 'x' => ExecBit, 'w' => WriteBit, 'r' => ReadBit } SymbolicSpecialToBit = { 't' => { 'u' => StickyBit, 'g' => StickyBit, 'o' => StickyBit }, diff --git a/lib/puppet/util/windows/file.rb b/lib/puppet/util/windows/file.rb index f62b4cc119..6167aa55c6 100644 --- a/lib/puppet/util/windows/file.rb +++ b/lib/puppet/util/windows/file.rb @@ -127,7 +127,6 @@ def set_attributes(path, flags) INVALID_HANDLE_VALUE = FFI::Pointer.new(-1).address def self.create_file(file_name, desired_access, share_mode, security_attributes, creation_disposition, flags_and_attributes, template_file_handle) - result = CreateFileW(wide_string(file_name.to_s), desired_access, share_mode, security_attributes, creation_disposition, flags_and_attributes, template_file_handle)