openvox 9.0.0.pre.beta2 → 9.0.0.pre.rc2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +91 -26
  3. data/Gemfile +5 -3
  4. data/Gemfile.lock +666 -0
  5. data/HISTORY.md +311 -0
  6. data/Rakefile +5 -6
  7. data/ext/debian/puppet.default +2 -2
  8. data/ext/debian/puppet.init +2 -2
  9. data/ext/windows/service/daemon.rb +1 -2
  10. data/lib/hiera/scope.rb +0 -2
  11. data/lib/puppet/agent/disabler.rb +1 -1
  12. data/lib/puppet/agent/locker.rb +1 -1
  13. data/lib/puppet/agent.rb +79 -7
  14. data/lib/puppet/application/agent.rb +19 -4
  15. data/lib/puppet/application/ssl.rb +7 -6
  16. data/lib/puppet/application.rb +1 -2
  17. data/lib/puppet/configurer/fact_handler.rb +5 -1
  18. data/lib/puppet/confine.rb +1 -2
  19. data/lib/puppet/environments.rb +3 -12
  20. data/lib/puppet/face/epp.rb +0 -2
  21. data/lib/puppet/file_bucket/dipper.rb +0 -2
  22. data/lib/puppet/file_serving/content.rb +1 -2
  23. data/lib/puppet/file_serving/mount.rb +1 -2
  24. data/lib/puppet/functions/tree_each.rb +1 -1
  25. data/lib/puppet/generate/type.rb +1 -1
  26. data/lib/puppet/gettext/config.rb +0 -2
  27. data/lib/puppet/graph/simple_graph.rb +0 -2
  28. data/lib/puppet/http/service.rb +46 -17
  29. data/lib/puppet/indirector/facts/facter.rb +13 -12
  30. data/lib/puppet/indirector/file_bucket_file/file.rb +0 -2
  31. data/lib/puppet/interface/action.rb +1 -1
  32. data/lib/puppet/module.rb +1 -6
  33. data/lib/puppet/node.rb +5 -1
  34. data/lib/puppet/parser/ast.rb +1 -2
  35. data/lib/puppet/parser/compiler/catalog_validator.rb +1 -2
  36. data/lib/puppet/parser/files.rb +0 -2
  37. data/lib/puppet/parser/resource.rb +0 -4
  38. data/lib/puppet/parser/scope.rb +1 -5
  39. data/lib/puppet/pops/adaptable.rb +0 -2
  40. data/lib/puppet/pops/loader/base_loader.rb +0 -2
  41. data/lib/puppet/pops/loader/loader.rb +0 -2
  42. data/lib/puppet/pops/loader/runtime3_type_loader.rb +0 -2
  43. data/lib/puppet/pops/loaders.rb +0 -2
  44. data/lib/puppet/pops/lookup/hiera_config.rb +0 -2
  45. data/lib/puppet/pops/lookup/interpolation.rb +0 -2
  46. data/lib/puppet/pops/lookup/key_recorder.rb +2 -4
  47. data/lib/puppet/pops/lookup/lookup_key.rb +0 -2
  48. data/lib/puppet/pops/merge_strategy.rb +1 -1
  49. data/lib/puppet/pops/migration/migration_checker.rb +1 -2
  50. data/lib/puppet/pops/parser/lexer2.rb +2 -2
  51. data/lib/puppet/pops/parser/lexer_support.rb +0 -2
  52. data/lib/puppet/pops/parser/locatable.rb +2 -4
  53. data/lib/puppet/pops/parser/locator.rb +9 -18
  54. data/lib/puppet/pops/puppet_stack.rb +1 -1
  55. data/lib/puppet/pops/time/timespan.rb +0 -2
  56. data/lib/puppet/pops/types/class_loader.rb +1 -3
  57. data/lib/puppet/pops/types/iterable.rb +0 -2
  58. data/lib/puppet/pops/types/p_runtime_type.rb +0 -2
  59. data/lib/puppet/pops/types/p_timespan_type.rb +1 -3
  60. data/lib/puppet/pops/types/puppet_object.rb +2 -4
  61. data/lib/puppet/pops/types/type_acceptor.rb +1 -2
  62. data/lib/puppet/pops/types/type_factory.rb +1 -1
  63. data/lib/puppet/pops/types/types.rb +1 -8
  64. data/lib/puppet/pops/utils.rb +0 -6
  65. data/lib/puppet/pops/validation/checker4_0.rb +2 -6
  66. data/lib/puppet/pops/visitor.rb +1 -1
  67. data/lib/puppet/property/ensure.rb +0 -4
  68. data/lib/puppet/provider/nameservice.rb +0 -2
  69. data/lib/puppet/provider/network_device.rb +1 -2
  70. data/lib/puppet/provider/package/pkgdmg.rb +0 -2
  71. data/lib/puppet/provider/package/portage.rb +1 -1
  72. data/lib/puppet/provider/package/portupgrade.rb +2 -2
  73. data/lib/puppet/provider/parsedfile.rb +0 -2
  74. data/lib/puppet/provider/service/base.rb +2 -4
  75. data/lib/puppet/provider/service/launchd.rb +1 -1
  76. data/lib/puppet/provider/service/openwrt.rb +1 -2
  77. data/lib/puppet/provider/service/service.rb +1 -2
  78. data/lib/puppet/provider/service/smf.rb +6 -6
  79. data/lib/puppet/provider/service/systemd.rb +0 -41
  80. data/lib/puppet/provider/service/upstart.rb +1 -1
  81. data/lib/puppet/provider/user/directoryservice.rb +3 -5
  82. data/lib/puppet/reference/metaparameter.rb +1 -1
  83. data/lib/puppet/settings.rb +0 -2
  84. data/lib/puppet/test/test_helper.rb +1 -2
  85. data/lib/puppet/transaction/event.rb +0 -1
  86. data/lib/puppet/transaction/persistence.rb +0 -2
  87. data/lib/puppet/type/component.rb +1 -2
  88. data/lib/puppet/type/file.rb +1 -3
  89. data/lib/puppet/type/resources.rb +0 -2
  90. data/lib/puppet/type/user.rb +0 -2
  91. data/lib/puppet/type.rb +4 -15
  92. data/lib/puppet/util/at_fork/noop.rb +3 -6
  93. data/lib/puppet/util/fileparsing.rb +0 -6
  94. data/lib/puppet/util/filetype.rb +0 -2
  95. data/lib/puppet/util/ldap/generator.rb +0 -2
  96. data/lib/puppet/util/network_device/transport/base.rb +2 -4
  97. data/lib/puppet/util/rdoc/code_objects.rb +1 -1
  98. data/lib/puppet/util/rdoc/parser/puppet_parser_core.rb +3 -2
  99. data/lib/puppet/util/selinux.rb +16 -1
  100. data/lib/puppet/util/symbolic_file_mode.rb +2 -2
  101. data/lib/puppet/util/windows/file.rb +0 -1
  102. data/lib/puppet/version.rb +1 -1
  103. data/man/man8/puppet-agent.8 +7 -3
  104. data/tasks/vox.rake +2 -2
  105. metadata +4 -2
@@ -122,8 +122,6 @@ module Puppet::Environments
122
122
  env = get(name)
123
123
  if env
124
124
  Puppet::Settings::EnvironmentConf.static_for(env, Puppet[:environment_timeout], Puppet[:static_catalogs], Puppet[:rich_data])
125
- else
126
- nil
127
125
  end
128
126
  end
129
127
  end
@@ -221,8 +219,6 @@ module Puppet::Environments
221
219
  envdir = validated_directory(File.join(@environment_dir, name.to_s))
222
220
  if envdir
223
221
  Puppet::Settings::EnvironmentConf.load_from(envdir, @global_module_path)
224
- else
225
- nil
226
222
  end
227
223
  end
228
224
 
@@ -257,8 +253,6 @@ module Puppet::Environments
257
253
  envdir = Puppet::Environments::Directories.real_path(envdir).to_s
258
254
  if Puppet::FileSystem.directory?(envdir) && Puppet::Node::Environment.valid_name?(env_name)
259
255
  envdir
260
- else
261
- nil
262
256
  end
263
257
  end
264
258
 
@@ -325,8 +319,7 @@ module Puppet::Environments
325
319
  # Called when the environment is created.
326
320
  #
327
321
  # @param [Puppet::Node::Environment] env
328
- def created(env)
329
- end
322
+ def created(env); end
330
323
 
331
324
  # Is the environment with this name expired?
332
325
  #
@@ -339,8 +332,7 @@ module Puppet::Environments
339
332
  # The environment with this name was evicted.
340
333
  #
341
334
  # @param [Symbol] env_name The symbolic environment name
342
- def evicted(env_name)
343
- end
335
+ def evicted(env_name); end
344
336
  end
345
337
 
346
338
  def self.cache_expiration_service=(service)
@@ -536,8 +528,7 @@ module Puppet::Environments
536
528
  @guards = 0
537
529
  end
538
530
 
539
- def touch
540
- end
531
+ def touch; end
541
532
 
542
533
  def expired?(now)
543
534
  false
@@ -558,8 +558,6 @@ Puppet::Face.define(:epp, '0.0.1') do
558
558
  template_file
559
559
  elsif Puppet::FileSystem.exist?(file)
560
560
  file
561
- else
562
- nil
563
561
  end
564
562
  end
565
563
  end
@@ -153,8 +153,6 @@ class Puppet::FileBucket::Dipper
153
153
  return nil
154
154
  end
155
155
  newsum
156
- else
157
- nil
158
156
  end
159
157
  end
160
158
 
@@ -25,8 +25,7 @@ class Puppet::FileServing::Content < Puppet::FileServing::Base
25
25
 
26
26
  # This is no longer used, but is still called by the file server implementations when interacting
27
27
  # with their model abstraction.
28
- def collect(source_permissions = nil)
29
- end
28
+ def collect(source_permissions = nil); end
30
29
 
31
30
  # Read the content of our file in.
32
31
  def content
@@ -36,6 +36,5 @@ class Puppet::FileServing::Mount
36
36
  end
37
37
 
38
38
  # A noop.
39
- def validate
40
- end
39
+ def validate; end
41
40
  end
@@ -30,7 +30,7 @@
30
30
  # `tree_each($data) |$value| { <PUPPET CODE BLOCK> }`
31
31
  #
32
32
  # The parameter `$path` is always given as an `Array` containing the path that when applied to
33
- # the tree as `$data.dig(*$path) yields the `$value`.
33
+ # the tree as `$data.dig(*$path)` yields the `$value`.
34
34
  # The `$value` is the value at that path.
35
35
  #
36
36
  # For `Array` values, the path will contain `Integer` entries with the array index,
@@ -124,7 +124,7 @@ module Puppet
124
124
  environment.modules.each do |mod|
125
125
  directory = File.join(Puppet::Util::Autoload.cleanpath(mod.plugin_directory), 'puppet', 'type')
126
126
  unless Puppet::FileSystem.exist?(directory)
127
- Puppet.debug "Skipping '#{mod.name}' module because it contains no custom types."
127
+ Puppet.debug "Skipping '#{mod.name}' module because there is no readable puppet/type/ directory under: #{directory}"
128
128
  next
129
129
  end
130
130
 
@@ -196,8 +196,6 @@ module Puppet::GettextConfig
196
196
  WINDOWS_PATH
197
197
  elsif !Puppet::Util::Platform.windows? && Puppet::FileSystem.exist?(POSIX_PATH)
198
198
  POSIX_PATH
199
- else
200
- nil
201
199
  end
202
200
  end
203
201
 
@@ -433,8 +433,6 @@ class Puppet::Graph::SimpleGraph
433
433
  elsif dependents(f).include?(t)
434
434
  m = (dependents(f) & direct_dependencies_of(t)).first
435
435
  path_between(f, m) + path_between(m, t)
436
- else
437
- nil
438
436
  end
439
437
  end
440
438
 
@@ -32,23 +32,10 @@ class Puppet::HTTP::Service
32
32
  #
33
33
  # @api private
34
34
  def self.create_service(client, session, name, server = nil, port = nil)
35
- # this is the entry point for creating all services, check and issue warning here.
36
- unless Puppet.settings.set_by_config? :server
37
- if Puppet.features.root?
38
- Puppet.deprecation_warning('OpenVox will not default to `server=puppet` as of version 9.0. Please update your configuration appropriately.')
39
- else
40
- Puppet.deprecation_warning('OpenVox no longer defaults to `server=puppet` when running as a non-privileged user. (Did you mean to run as root?)')
41
-
42
- case name
43
- when :ca
44
- raise ArgumentError, 'Neither `server` nor `ca_server` is specified.' unless Puppet.settings.set_by_config? :ca_server
45
- when :report
46
- raise ArgumentError, 'Neither `server` nor `report_server` is specified.' unless Puppet.settings.set_by_config? :report_server
47
- when :fileserver, :puppet, :puppetserver
48
- raise ArgumentError, 'Required setting `server` is not specified.'
49
- end
50
- end
51
- end
35
+ # Resolvers that already know which server to use (SRV records,
36
+ # server_list, or an explicit URL) pass it in. Only fall back on the
37
+ # `server` setting, and complain if it is missing, when they don't.
38
+ check_server_setting(name) if server.nil?
52
39
 
53
40
  case name
54
41
  when :ca
@@ -66,6 +53,48 @@ class Puppet::HTTP::Service
66
53
  end
67
54
  end
68
55
 
56
+ # Verify that the setting a service falls back on when no explicit server is
57
+ # given has been configured. OpenVox no longer defaults `server` to `puppet`.
58
+ #
59
+ # @param [Symbol] name the type of service being created
60
+ #
61
+ # @raise [ArgumentError] if the service cannot determine which server to use
62
+ #
63
+ # @api private
64
+ def self.check_server_setting(name)
65
+ return if Puppet.settings.set_by_config? :server
66
+
67
+ # These services fall back on their own setting before `server`. It has to
68
+ # resolve to a host: `ca_server = $server` without `server` is set but empty.
69
+ case name
70
+ when :ca
71
+ return if Puppet.settings.set_by_config?(:ca_server) && !Puppet[:ca_server].empty?
72
+ when :report
73
+ return if Puppet.settings.set_by_config?(:report_server) && !Puppet[:report_server].empty?
74
+ end
75
+
76
+ if Puppet.features.root?
77
+ error_message = <<~MSG
78
+ OpenVox does not default to `server=puppet` as of version 9.0. Please update your configuration appropriately by providing a specific server of your choice.
79
+
80
+ You can update the server setting in puppet.conf by running a command similar to:
81
+ puppet config --section main set server YOUR_SERVER_NAME
82
+ MSG
83
+ raise ArgumentError, error_message
84
+ end
85
+
86
+ Puppet.deprecation_warning('OpenVox no longer defaults to `server=puppet` when running as a non-privileged user. (Did you mean to run as root?)')
87
+
88
+ case name
89
+ when :ca
90
+ raise ArgumentError, 'Neither `server` nor `ca_server` is specified.'
91
+ when :report
92
+ raise ArgumentError, 'Neither `server` nor `report_server` is specified.'
93
+ when :fileserver, :puppet, :puppetserver
94
+ raise ArgumentError, 'Required setting `server` is not specified.'
95
+ end
96
+ end
97
+
69
98
  # Check if the service named is included in the list of available services.
70
99
  #
71
100
  # @param [Symbol] name
@@ -62,21 +62,22 @@ class Puppet::Node::Facts::Facter < Puppet::Indirector::Code
62
62
  end
63
63
  end.flatten + Puppet[:factpath].split(File::PATH_SEPARATOR)
64
64
 
65
- dirs = dirs.select do |dir|
66
- next false unless FileTest.directory?(dir)
67
-
68
- # Even through we no longer directly load facts in the terminus,
69
- # print out each .rb in the facts directory as module
70
- # developers may find that information useful for debugging purposes
71
- if Puppet::Util::Log.sendlevel?(:info)
72
- Puppet.info _("Loading facts")
73
- Dir.glob("#{dir}/*.rb").each do |file|
74
- Puppet.debug { "Loading facts from #{file}" }
65
+ dirs.select! { |dir| FileTest.directory?(dir) }
66
+
67
+ # Even though we no longer directly load facts in the terminus,
68
+ # print out each .rb in the facts directory as module
69
+ # developers may find that information useful for debugging purposes
70
+ unless dirs.empty?
71
+ Puppet.info _("Loading facts")
72
+ if Puppet::Util::Log.sendlevel?(:debug)
73
+ dirs.each do |dir|
74
+ Dir.glob("#{dir}/*.rb").each do |file|
75
+ Puppet.debug { "Loading facts from #{file}" }
76
+ end
75
77
  end
76
78
  end
77
-
78
- true
79
79
  end
80
+
80
81
  dirs << request.options[:custom_dir] if request.options[:custom_dir]
81
82
  Puppet.runtime[:facter].search(*dirs)
82
83
  end
@@ -37,8 +37,6 @@ module Puppet::FileBucketFile
37
37
  Puppet.info _("FileBucket read %{checksum}") % { checksum: checksum }
38
38
  model.new(Puppet::FileSystem.binread(contents_file))
39
39
  end
40
- else
41
- nil
42
40
  end
43
41
  end
44
42
 
@@ -49,7 +49,7 @@ class Puppet::Interface::Action
49
49
 
50
50
  # The name of this action
51
51
  # @return [Symbol]
52
- attr_reader :name
52
+ attr_reader :name
53
53
 
54
54
  # The face this action is attached to
55
55
  # @return [Puppet::Interface]
data/lib/puppet/module.rb CHANGED
@@ -91,8 +91,7 @@ class Puppet::Module
91
91
  end
92
92
 
93
93
  # @deprecated The puppetversion module metadata field is no longer used.
94
- def puppetversion=(something)
95
- end
94
+ def puppetversion=(something); end
96
95
 
97
96
  # @deprecated The puppetversion module metadata field is no longer used.
98
97
  def validate_puppet_version
@@ -172,8 +171,6 @@ class Puppet::Module
172
171
 
173
172
  if Puppet::FileSystem.exist?(full_path)
174
173
  full_path
175
- else
176
- nil
177
174
  end
178
175
  end
179
176
 
@@ -205,8 +202,6 @@ class Puppet::Module
205
202
 
206
203
  if Puppet::FileSystem.exist?(full_path)
207
204
  full_path
208
- else
209
- nil
210
205
  end
211
206
  end
212
207
 
data/lib/puppet/node.rb CHANGED
@@ -155,7 +155,11 @@ class Puppet::Node
155
155
  def merge(params)
156
156
  params.each do |name, value|
157
157
  if @parameters.include?(name)
158
- Puppet::Util::Warnings.warnonce(_("The node parameter '%{param_name}' for node '%{node_name}' was already set to '%{value}'. It could not be set to '%{desired_value}'") % { param_name: name, node_name: @name, value: @parameters[name], desired_value: value })
158
+ if @parameters[name] == value
159
+ Puppet::Util::Warnings.notice_once(_("The node parameter '%{param_name}' for node '%{node_name}' was already set to '%{value}'. It could not be set to '%{desired_value}'") % { param_name: name, node_name: @name, value: @parameters[name], desired_value: value })
160
+ else
161
+ Puppet::Util::Warnings.warnonce(_("The node parameter '%{param_name}' for node '%{node_name}' was already set to '%{value}'. It could not be set to '%{desired_value}'") % { param_name: name, node_name: @name, value: @parameters[name], desired_value: value })
162
+ end
159
163
  else
160
164
  @parameters[name] = value
161
165
  end
@@ -18,8 +18,7 @@ class Puppet::Parser::AST
18
18
 
19
19
  # Evaluate the current object. Just a stub method, since the subclass
20
20
  # should override this method.
21
- def evaluate(scope)
22
- end
21
+ def evaluate(scope); end
23
22
 
24
23
  # The version of the evaluate method that should be called, because it
25
24
  # correctly handles errors. It is critical to use this method because
@@ -25,8 +25,7 @@ class Puppet::Parser::Compiler
25
25
  end
26
26
 
27
27
  # Validate some aspect of the catalog and raise a `CatalogValidationError` on failure
28
- def validate
29
- end
28
+ def validate; end
30
29
  end
31
30
 
32
31
  class CatalogValidationError < Puppet::Error
@@ -76,8 +76,6 @@ module Puppet::Parser::Files
76
76
 
77
77
  if file && mod
78
78
  yield(mod, file)
79
- else
80
- nil
81
79
  end
82
80
  end
83
81
  end
@@ -38,8 +38,6 @@ class Puppet::Parser::Resource < Puppet::Resource
38
38
 
39
39
  if @parameters.has_key?(param)
40
40
  @parameters[param].value
41
- else
42
- nil
43
41
  end
44
42
  end
45
43
 
@@ -90,7 +88,6 @@ class Puppet::Parser::Resource < Puppet::Resource
90
88
  def exported=(value)
91
89
  if value
92
90
  @virtual = true
93
- else
94
91
  end
95
92
  @exported = value
96
93
  end
@@ -226,7 +223,6 @@ class Puppet::Parser::Resource < Puppet::Resource
226
223
  if value.is_a?(Array)
227
224
  value = value.flatten.reject { |v| v.nil? || :undef == v }
228
225
  end
229
- else
230
226
  end
231
227
  result[param.name] = value
232
228
  end)
@@ -336,8 +336,6 @@ class Puppet::Parser::Scope
336
336
  value.to_i(8)
337
337
  when /^-?\d+$/
338
338
  value.to_i
339
- else
340
- nil
341
339
  end
342
340
  end
343
341
 
@@ -566,8 +564,6 @@ class Puppet::Parser::Scope
566
564
  def inherited_scope
567
565
  if resource && resource.type == TYPENAME_CLASS && !resource.resource_type.parent.nil?
568
566
  qualified_scope(resource.resource_type.parent)
569
- else
570
- nil
571
567
  end
572
568
  end
573
569
 
@@ -680,7 +676,7 @@ class Puppet::Parser::Scope
680
676
  target.merge!(inherited.to_hash(recursive))
681
677
  end
682
678
  else
683
- target = Hash.new
679
+ target = {}
684
680
  end
685
681
 
686
682
  # add all local scopes
@@ -142,8 +142,6 @@ module Adaptable
142
142
  attr_name = self_attr_name
143
143
  if o.instance_variable_defined?(attr_name)
144
144
  o.send(:remove_instance_variable, attr_name)
145
- else
146
- nil
147
145
  end
148
146
  end
149
147
 
@@ -56,8 +56,6 @@ class BaseLoader < Loader
56
56
  @named_values[typed_name]
57
57
  elsif parent
58
58
  parent.loaded_entry(typed_name, check_dependencies)
59
- else
60
- nil
61
59
  end
62
60
  end
63
61
  end
@@ -116,8 +116,6 @@ class Loader
116
116
  found = get_entry(typed_name)
117
117
  if found
118
118
  found.value
119
- else
120
- nil
121
119
  end
122
120
  end
123
121
 
@@ -62,8 +62,6 @@ class Runtime3TypeLoader < BaseLoader
62
62
  te
63
63
  when :resource_type_pp
64
64
  @resource_3x_loader.nil? ? nil : find_impl(typed_name)
65
- else
66
- nil
67
65
  end
68
66
  end
69
67
 
@@ -401,8 +401,6 @@ class Loaders
401
401
  # Create pcore resource type loader, if applicable
402
402
  pcore_resource_type_loader = if load_from_pcore && env_path
403
403
  Loader::ModuleLoaders.pcore_resource_type_loader_from(parent_loader, self, env_path)
404
- else
405
- nil
406
404
  end
407
405
  @runtime3_type_loader = add_loader_by_name(Loader::Runtime3TypeLoader.new(parent_loader, self, environment, pcore_resource_type_loader))
408
406
 
@@ -681,8 +681,6 @@ class HieraConfigV5 < HieraConfig
681
681
  expand_uris([he[location_key]], lookup_invocation)
682
682
  when KEY_MAPPED_PATHS
683
683
  expand_mapped_paths(entry_datadir, he[location_key], lookup_invocation)
684
- else
685
- nil
686
684
  end
687
685
  end
688
686
  next if @config_path.nil? && !locations.nil? && locations.empty? # Default config and no existing paths found
@@ -103,8 +103,6 @@ module Interpolation
103
103
  if default_key_exists
104
104
  lookup_invocation.report_found_in_defaults(root_key,
105
105
  lookup_invocation.default_values[root_key])
106
- else
107
- nil
108
106
  end
109
107
  else
110
108
  lookup_invocation.report_found(root_key, val)
@@ -4,8 +4,7 @@
4
4
  # @api private
5
5
  #
6
6
  class Puppet::Pops::Lookup::KeyRecorder
7
- def initialize
8
- end
7
+ def initialize; end
9
8
 
10
9
  # rubocop:disable Naming/MemoizedInstanceVariableName
11
10
  def self.singleton
@@ -16,6 +15,5 @@ class Puppet::Pops::Lookup::KeyRecorder
16
15
  # Records a key
17
16
  # (This implementation does nothing)
18
17
  #
19
- def record(key)
20
- end
18
+ def record(key); end
21
19
  end
@@ -47,8 +47,6 @@ class LookupKey
47
47
  EMPTY_HASH
48
48
  when Array
49
49
  EMPTY_ARRAY
50
- else
51
- nil
52
50
  end
53
51
  else
54
52
  undig(pruned)
@@ -30,7 +30,7 @@ module Puppet::Pops
30
30
  raise ArgumentError, _("The hash given as 'merge' must contain the name of a strategy in string form for the key 'strategy'")
31
31
  end
32
32
 
33
- merge_options = merge.size == 1 ? EMPTY_HASH : merge
33
+ merge_options = merge.size == 1 ? EMPTY_HASH : merge
34
34
  else
35
35
  merge_strategy = merge
36
36
  merge_options = EMPTY_HASH
@@ -4,8 +4,7 @@
4
4
  # @api private
5
5
  #
6
6
  class Puppet::Pops::Migration::MigrationChecker
7
- def initialize
8
- end
7
+ def initialize; end
9
8
 
10
9
  # rubocop:disable Naming/MemoizedInstanceVariableName
11
10
  def self.singleton
@@ -55,6 +55,7 @@ class Lexer2
55
55
  TOKEN_LESSEQUAL = [:LESSEQUAL, '<=', 2].freeze
56
56
  TOKEN_LESSTHAN = [:LESSTHAN, '<', 1].freeze
57
57
 
58
+ # rubocop:disable Layout/ExtraSpacing
58
59
  TOKEN_FARROW = [:FARROW, '=>', 2].freeze
59
60
  TOKEN_PARROW = [:PARROW, '+>', 2].freeze
60
61
 
@@ -106,11 +107,9 @@ class Lexer2
106
107
  TOKEN_HEREDOC = [:HEREDOC, nil, 0].freeze
107
108
 
108
109
  # EPP_START is currently a marker token, may later get syntax
109
- # rubocop:disable Layout/ExtraSpacing
110
110
  TOKEN_EPPSTART = [:EPP_START, nil, 0].freeze
111
111
  TOKEN_EPPEND = [:EPP_END, '%>', 2].freeze
112
112
  TOKEN_EPPEND_TRIM = [:EPP_END_TRIM, '-%>', 3].freeze
113
- # rubocop:enable Layout/ExtraSpacing
114
113
 
115
114
  # This is used for unrecognized tokens, will always be a single character. This particular instance
116
115
  # is not used, but is kept here for documentation purposes.
@@ -141,6 +140,7 @@ class Lexer2
141
140
  'attr' => [:ATTR, 'attr', 4],
142
141
  'private' => [:PRIVATE, 'private', 7],
143
142
  }
143
+ # rubocop:enable Layout/ExtraSpacing
144
144
 
145
145
  KEYWORDS.each { |_k, v| v[1].freeze; v.freeze }
146
146
  KEYWORDS.freeze
@@ -132,8 +132,6 @@ module LexerSupport
132
132
  @locator
133
133
  when :offset
134
134
  @offset
135
- else
136
- nil
137
135
  end
138
136
  end
139
137
 
@@ -3,12 +3,10 @@
3
3
  # Interface for something that is "locatable" (holds offset and length).
4
4
  class Puppet::Pops::Parser::Locatable
5
5
  # The offset in the locator's content
6
- def offset
7
- end
6
+ def offset; end
8
7
 
9
8
  # The length in the locator from the given offset
10
- def length
11
- end
9
+ def length; end
12
10
 
13
11
  # This class is useful for testing
14
12
  class Fixed < Puppet::Pops::Parser::Locatable
@@ -17,42 +17,34 @@ class Locator
17
17
  end
18
18
 
19
19
  # Returns the file name associated with the string content
20
- def file
21
- end
20
+ def file; end
22
21
 
23
22
  # Returns the string content
24
- def string
25
- end
23
+ def string; end
26
24
 
27
25
  def to_s
28
26
  "Locator for file #{file}"
29
27
  end
30
28
 
31
29
  # Returns the position on line (first position on a line is 1)
32
- def pos_on_line(offset)
33
- end
30
+ def pos_on_line(offset); end
34
31
 
35
32
  # Returns the line number (first line is 1) for the given offset
36
- def line_for_offset(offset)
37
- end
33
+ def line_for_offset(offset); end
38
34
 
39
35
  # Returns the offset on line (first offset on a line is 0).
40
36
  #
41
- def offset_on_line(offset)
42
- end
37
+ def offset_on_line(offset); end
43
38
 
44
39
  # Returns the character offset for a given reported offset
45
- def char_offset(byte_offset)
46
- end
40
+ def char_offset(byte_offset); end
47
41
 
48
42
  # Returns the length measured in number of characters from the given start and end byte offset
49
- def char_length(offset, end_offset)
50
- end
43
+ def char_length(offset, end_offset); end
51
44
 
52
45
  # Extracts the text from offset with given length (measured in what the locator uses for offset)
53
46
  # @returns String - the extracted text
54
- def extract_text(offset, length)
55
- end
47
+ def extract_text(offset, length); end
56
48
 
57
49
  def extract_tree_text(ast)
58
50
  first = ast.offset
@@ -71,8 +63,7 @@ class Locator
71
63
  # Returns the line index - an array of line offsets for the start position of each line, starting at 0 for
72
64
  # the first line.
73
65
  #
74
- def line_index
75
- end
66
+ def line_index; end
76
67
 
77
68
  # Common byte based impl that works for all rubies (stringscanner is byte based
78
69
  def self.compute_line_index(string)
@@ -29,7 +29,7 @@ module Puppet
29
29
  # as well as a nil line number are supported. Such stack frames
30
30
  # will be represented with the text `unknown` and `0´ respectively.
31
31
  module PuppetStack
32
- @stack = Puppet::ThreadLocal.new { Array.new }
32
+ @stack = Puppet::ThreadLocal.new { [] }
33
33
 
34
34
  def self.stack(file, line, obj, message, args, &block)
35
35
  file = 'unknown' if file.nil? || file == ''
@@ -42,8 +42,6 @@ module Time
42
42
  to_int <=> o
43
43
  when Float
44
44
  to_f <=> o
45
- else
46
- nil
47
45
  end
48
46
  end
49
47
 
@@ -69,9 +69,7 @@ class ClassLoader
69
69
  when PFloatType ; Float
70
70
  when PUndefType ; NilClass
71
71
  when PCallableType ; Proc
72
- # rubocop:enable Layout/SpaceBeforeSemicolon
73
- else
74
- nil
72
+ # rubocop:enable Layout/SpaceBeforeSemicolon
75
73
  end
76
74
  end
77
75
  private_class_method :provide_from_type