puppet-resource_api 1.8.13 → 1.8.18

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +94 -25
  3. data/README.md +9 -9
  4. data/docs/README.md +1 -1
  5. data/docs/hands-on-lab/01-installing-prereqs.md +1 -1
  6. data/docs/hands-on-lab/04-adding-a-new-transport.md +1 -1
  7. data/docs/hands-on-lab/07-implementing-a-task.md +1 -1
  8. data/lib/puppet/resource_api/base_context.rb +3 -1
  9. data/lib/puppet/resource_api/data_type_handling.rb +11 -2
  10. data/lib/puppet/resource_api/glue.rb +9 -2
  11. data/lib/puppet/resource_api/io_context.rb +2 -0
  12. data/lib/puppet/resource_api/parameter.rb +4 -2
  13. data/lib/puppet/resource_api/property.rb +65 -5
  14. data/lib/puppet/resource_api/puppet_context.rb +2 -0
  15. data/lib/puppet/resource_api/read_only_parameter.rb +2 -0
  16. data/lib/puppet/resource_api/simple_provider.rb +6 -4
  17. data/lib/puppet/resource_api/transport/wrapper.rb +2 -0
  18. data/lib/puppet/resource_api/transport.rb +15 -0
  19. data/lib/puppet/resource_api/type_definition.rb +59 -3
  20. data/lib/puppet/resource_api/value_creator.rb +2 -0
  21. data/lib/puppet/resource_api/version.rb +3 -1
  22. data/lib/puppet/resource_api.rb +41 -46
  23. data/lib/puppet/util/network_device/simple/device.rb +2 -0
  24. data/puppet-resource_api.gemspec +7 -8
  25. metadata +3 -19
  26. data/.dependency_decisions.yml +0 -98
  27. data/.fixtures.yml +0 -8
  28. data/.gitignore +0 -15
  29. data/.rspec +0 -3
  30. data/.rubocop.yml +0 -159
  31. data/.travis.yml +0 -79
  32. data/CODEOWNERS +0 -2
  33. data/Gemfile +0 -61
  34. data/HISTORY.md +0 -413
  35. data/Rakefile +0 -66
  36. data/appveyor.yml +0 -41
  37. data/bin/console +0 -14
  38. data/bin/setup +0 -8
  39. data/codecov.yml +0 -3
  40. data/contrib/README.md +0 -7
  41. data/contrib/pre-commit +0 -16
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Provides accessor methods for the type being provided
2
4
  module Puppet::ResourceApi
3
5
  # pre-declare class
@@ -15,7 +17,7 @@ module Puppet::ResourceApi
15
17
 
16
18
  # rubocop complains when this is named has_feature?
17
19
  def feature?(feature)
18
- (definition[:features] && definition[:features].include?(feature))
20
+ definition[:features]&.include?(feature)
19
21
  end
20
22
 
21
23
  def title_patterns
@@ -34,10 +36,56 @@ module Puppet::ResourceApi
34
36
  Puppet::ResourceApi::DataTypeHandling.validate_ensure(definition)
35
37
 
36
38
  definition[:features] ||= []
37
- supported_features = %w[supports_noop canonicalize remote_resource simple_get_filter].freeze
39
+ supported_features = %w[supports_noop canonicalize custom_insync remote_resource simple_get_filter].freeze
38
40
  unknown_features = definition[:features] - supported_features
39
41
  Puppet.warning("Unknown feature detected: #{unknown_features.inspect}") unless unknown_features.empty?
40
42
  end
43
+
44
+ # This call creates a new parameter or property with all work-arounds or
45
+ # customizations required by the Resource API applied. Under the hood,
46
+ # this maps to the relevant DSL methods in Puppet::Type. See
47
+ # https://puppet.com/docs/puppet/6.0/custom_types.html#reference-5883
48
+ # for details.
49
+ #
50
+ # type: the Resource API Type the attribute is being created in
51
+ # attribute_name: the name of the attribute being created
52
+ # param_or_property: Whether to call the :newparam or :newproperty method
53
+ # parent: The type of attribute to create: Property, ReadOnly, or Parameter
54
+ # options: The hash of attribute options, including type, desc, default, and behaviour
55
+ def create_attribute_in(type, attribute_name, param_or_property, parent, options)
56
+ type.send(param_or_property, attribute_name.to_sym, parent: parent) do
57
+ if options[:desc]
58
+ desc "#{options[:desc]} (a #{options[:type]})"
59
+ end
60
+
61
+ # The initialize method is called when puppet core starts building up
62
+ # type objects. The core passes in a hash of shape { resource:
63
+ # #<Puppet::Type::TypeName> }. We use this to pass through the
64
+ # required configuration data to the parent (see
65
+ # Puppet::ResourceApi::Property, Puppet::ResourceApi::Parameter and
66
+ # Puppet::ResourceApi::ReadOnlyParameter).
67
+ define_method(:initialize) do |resource_hash|
68
+ super(type.name, self.class.data_type, attribute_name, resource_hash, type)
69
+ end
70
+
71
+ # get pops data type object for this parameter or property
72
+ define_singleton_method(:data_type) do
73
+ @rsapi_data_type ||= Puppet::ResourceApi::DataTypeHandling.parse_puppet_type(
74
+ attribute_name,
75
+ options[:type],
76
+ )
77
+ end
78
+
79
+ # from ValueCreator call create_values which makes alias values and
80
+ # default values for properties and params
81
+ Puppet::ResourceApi::ValueCreator.create_values(
82
+ self,
83
+ data_type,
84
+ param_or_property,
85
+ options,
86
+ )
87
+ end
88
+ end
41
89
  end
42
90
 
43
91
  # RSAPI Transport schema
@@ -88,6 +136,13 @@ module Puppet::ResourceApi
88
136
  }.keys
89
137
  end
90
138
 
139
+ def insyncable_attributes
140
+ @insyncable_attributes ||= attributes.reject { |_name, options|
141
+ # Only attributes without any behavior are normal Puppet Properties and get insynced
142
+ options.key?(:behaviour)
143
+ }.keys
144
+ end
145
+
91
146
  def validate_schema(definition, attr_key)
92
147
  raise Puppet::DevError, '%{type_class} must be a Hash, not `%{other_type}`' % { type_class: self.class.name, other_type: definition.class } unless definition.is_a?(Hash)
93
148
  @attributes = definition[attr_key]
@@ -110,6 +165,7 @@ module Puppet::ResourceApi
110
165
  Puppet.warning('`%{name}` has no documentation, add it using a `desc` key' % { name: definition[:name] }) unless definition.key? :desc
111
166
 
112
167
  attributes.each do |key, attr|
168
+ raise Puppet::DevError, '`rsapi_custom_insync_trigger` cannot be specified as an attribute; it is reserved for propertyless types with the custom_insync feature' if key == :rsapi_custom_insync_trigger # rubocop:disable Metrics/LineLength
113
169
  raise Puppet::DevError, "`#{definition[:name]}.#{key}` must be a Hash, not a #{attr.class}" unless attr.is_a? Hash
114
170
  raise Puppet::DevError, "`#{definition[:name]}.#{key}` has no type" unless attr.key? :type
115
171
  Puppet.warning('`%{name}.%{key}` has no documentation, add it using a `desc` key' % { name: definition[:name], key: key }) unless attr.key? :desc
@@ -194,7 +250,7 @@ module Puppet::ResourceApi
194
250
  if is_sensitive
195
251
  bad_vals[key] = '<< redacted value >> ' + error_message unless error_message.nil?
196
252
  else
197
- bad_vals[key] = value unless error_message.nil?
253
+ bad_vals[key] = "#{value} (#{error_message})" unless error_message.nil?
198
254
  end
199
255
  end
200
256
  bad_vals
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Puppet; module ResourceApi; end; end # predeclare the main module # rubocop:disable Style/Documentation,Style/ClassAndModuleChildren
2
4
 
3
5
  # This module is responsible for setting default and alias values for the
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Puppet
2
4
  module ResourceApi
3
- VERSION = '1.8.13'.freeze
5
+ VERSION = '1.8.18'
4
6
  end
5
7
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'pathname'
2
4
  require 'puppet/resource_api/data_type_handling'
3
5
  require 'puppet/resource_api/glue'
@@ -123,6 +125,22 @@ module Puppet::ResourceApi
123
125
  @rsapi_title
124
126
  end
125
127
 
128
+ def rsapi_canonicalized_target_state
129
+ @rsapi_canonicalized_target_state ||= begin
130
+ # skip puppet's injected metaparams
131
+ actual_params = @parameters.select { |k, _v| type_definition.attributes.key? k }
132
+ target_state = Hash[actual_params.map { |k, v| [k, v.rs_value] }]
133
+ target_state = my_provider.canonicalize(context, [target_state]).first if type_definition.feature?('canonicalize')
134
+ target_state
135
+ end
136
+ @rsapi_canonicalized_target_state
137
+ end
138
+
139
+ def rsapi_current_state
140
+ refresh_current_state unless @rsapi_current_state
141
+ @rsapi_current_state
142
+ end
143
+
126
144
  def to_resource
127
145
  to_resource_shim(super)
128
146
  end
@@ -166,6 +184,21 @@ module Puppet::ResourceApi
166
184
  raise_missing_params if @missing_params.any?
167
185
  end
168
186
 
187
+ # If the custom_insync feature is specified but no insyncable attributes are included
188
+ # in the definition, add the hidden rsapi_custom_insync_trigger property.
189
+ # This property exists *only* to allow a resource without properties to still execute an
190
+ # insync check; there's no point in specifying it in a manifest as it can only have one
191
+ # value; it cannot be specified in a type definition as it should only exist in this case.
192
+ if type_definition.feature?('custom_insync') && type_definition.insyncable_attributes.empty?
193
+ custom_insync_trigger_options = {
194
+ type: 'Enum[do_not_specify_in_manifest]',
195
+ desc: 'A hidden property which enables a type with custom insync to perform an insync check without specifying any insyncable properties',
196
+ default: 'do_not_specify_in_manifest',
197
+ }
198
+
199
+ type_definition.create_attribute_in(self, :rsapi_custom_insync_trigger, :newproperty, Puppet::ResourceApi::Property, custom_insync_trigger_options)
200
+ end
201
+
169
202
  definition[:attributes].each do |name, options|
170
203
  # puts "#{name}: #{options.inspect}"
171
204
 
@@ -189,43 +222,7 @@ module Puppet::ResourceApi
189
222
  parent = Puppet::ResourceApi::Property
190
223
  end
191
224
 
192
- # This call creates a new parameter or property with all work-arounds or
193
- # customizations required by the Resource API applied. Under the hood,
194
- # this maps to the relevant DSL methods in Puppet::Type. See
195
- # https://puppet.com/docs/puppet/6.0/custom_types.html#reference-5883
196
- # for details.
197
- send(param_or_property, name.to_sym, parent: parent) do
198
- if options[:desc]
199
- desc "#{options[:desc]} (a #{options[:type]})"
200
- end
201
-
202
- # The initialize method is called when puppet core starts building up
203
- # type objects. The core passes in a hash of shape { resource:
204
- # #<Puppet::Type::TypeName> }. We use this to pass through the
205
- # required configuration data to the parent (see
206
- # Puppet::ResourceApi::Property, Puppet::ResourceApi::Parameter and
207
- # Puppet::ResourceApi::ReadOnlyParameter).
208
- define_method(:initialize) do |resource_hash|
209
- super(definition[:name], self.class.data_type, name, resource_hash)
210
- end
211
-
212
- # get pops data type object for this parameter or property
213
- define_singleton_method(:data_type) do
214
- @rsapi_data_type ||= Puppet::ResourceApi::DataTypeHandling.parse_puppet_type(
215
- name,
216
- options[:type],
217
- )
218
- end
219
-
220
- # from ValueCreator call create_values which makes alias values and
221
- # default values for properties and params
222
- Puppet::ResourceApi::ValueCreator.create_values(
223
- self,
224
- data_type,
225
- param_or_property,
226
- options,
227
- )
228
- end
225
+ type_definition.create_attribute_in(self, name, param_or_property, parent, options)
229
226
  end
230
227
 
231
228
  def self.instances
@@ -279,11 +276,9 @@ module Puppet::ResourceApi
279
276
  end
280
277
 
281
278
  def retrieve
282
- refresh_current_state unless @rsapi_current_state
283
-
284
- Puppet.debug("Current State: #{@rsapi_current_state.inspect}")
279
+ Puppet.debug("Current State: #{rsapi_current_state.inspect}")
285
280
 
286
- result = Puppet::Resource.new(self.class, title, parameters: @rsapi_current_state)
281
+ result = Puppet::Resource.new(self.class, title, parameters: rsapi_current_state)
287
282
  # puppet needs ensure to be a symbol
288
283
  result[:ensure] = result[:ensure].to_sym if type_definition.ensurable? && result[:ensure].is_a?(String)
289
284
 
@@ -302,10 +297,7 @@ module Puppet::ResourceApi
302
297
  raise_missing_attrs
303
298
 
304
299
  # puts 'flush'
305
- # skip puppet's injected metaparams
306
- actual_params = @parameters.select { |k, _v| type_definition.attributes.key? k }
307
- target_state = Hash[actual_params.map { |k, v| [k, v.rs_value] }]
308
- target_state = my_provider.canonicalize(context, [target_state]).first if type_definition.feature?('canonicalize')
300
+ target_state = rsapi_canonicalized_target_state
309
301
 
310
302
  retrieve unless @rsapi_current_state
311
303
 
@@ -464,7 +456,7 @@ MESSAGE
464
456
  definition[auto].each do |type, values|
465
457
  Puppet.debug("Registering #{auto} for #{type}: #{values.inspect}")
466
458
  send(auto, type.downcase.to_sym) do
467
- [values].flatten.map do |v|
459
+ resolved = [values].flatten.map do |v|
468
460
  match = %r{\A\$(.*)\Z}.match(v) if v.is_a? String
469
461
  if match.nil?
470
462
  v
@@ -472,6 +464,9 @@ MESSAGE
472
464
  self[match[1].to_sym]
473
465
  end
474
466
  end
467
+ # Flatten to handle any resolved array properties and filter any nil
468
+ # values resulting from unspecified optional parameters:
469
+ resolved.flatten.reject { |v| v.nil? }
475
470
  end
476
471
  end
477
472
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'hocon'
2
4
  require 'hocon/config_syntax'
3
5
 
@@ -12,14 +12,13 @@ Gem::Specification.new do |spec|
12
12
  spec.summary = 'This library provides a simple way to write new native resources for puppet.'
13
13
  spec.homepage = 'https://github.com/puppetlabs/puppet-resource_api'
14
14
 
15
- # on out internal jenkins, there is no git, but since it is a clean machine, we don't need to worry about anything else
16
- spec.files = if system('git --help > /dev/null')
17
- `git ls-files -z`.split("\x0")
18
- else
19
- Dir.glob('**/*')
20
- end.reject do |f|
21
- f.match(%r{^(test|spec|features)/})
22
- end
15
+ base = "#{__dir__}#{File::SEPARATOR}"
16
+ dirs =
17
+ Dir[File.join(__dir__, 'lib/**/*')] +
18
+ Dir[File.join(__dir__, 'docs/**/*')]
19
+ spec.files =
20
+ dirs.select { |path| File.file?(path) }.map { |path| path.sub(base, '') } +
21
+ %w[CHANGELOG.md CONTRIBUTING.md README.md LICENSE NOTICE puppet-resource_api.gemspec]
23
22
 
24
23
  spec.bindir = 'exe'
25
24
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppet-resource_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.13
4
+ version: 1.8.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Schmitt
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-04-21 00:00:00.000000000 Z
11
+ date: 2023-07-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hocon
@@ -31,27 +31,11 @@ executables: []
31
31
  extensions: []
32
32
  extra_rdoc_files: []
33
33
  files:
34
- - ".dependency_decisions.yml"
35
- - ".fixtures.yml"
36
- - ".gitignore"
37
- - ".rspec"
38
- - ".rubocop.yml"
39
- - ".travis.yml"
40
34
  - CHANGELOG.md
41
- - CODEOWNERS
42
35
  - CONTRIBUTING.md
43
- - Gemfile
44
- - HISTORY.md
45
36
  - LICENSE
46
37
  - NOTICE
47
38
  - README.md
48
- - Rakefile
49
- - appveyor.yml
50
- - bin/console
51
- - bin/setup
52
- - codecov.yml
53
- - contrib/README.md
54
- - contrib/pre-commit
55
39
  - docs/README.md
56
40
  - docs/hands-on-lab/01-installing-prereqs.md
57
41
  - docs/hands-on-lab/02-connecting-to-the-lightbulbs-emulator.png
@@ -99,7 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
99
83
  - !ruby/object:Gem::Version
100
84
  version: '0'
101
85
  requirements: []
102
- rubygems_version: 3.0.0
86
+ rubygems_version: 3.0.3
103
87
  signing_key:
104
88
  specification_version: 4
105
89
  summary: This library provides a simple way to write new native resources for puppet.
@@ -1,98 +0,0 @@
1
- ---
2
- - - :permit
3
- - MIT
4
- - :who: DavidS
5
- :why: standard license
6
- :versions: []
7
- :when: 2017-07-28 11:11:09.971500380 Z
8
- - - :permit
9
- - Apache 2.0
10
- - :who: DavidS
11
- :why: standard license
12
- :versions: []
13
- :when: 2017-07-28 11:12:21.086779416 Z
14
- - - :permit
15
- - ruby
16
- - :who: DavidS
17
- :why: standard license
18
- :versions: []
19
- :when: 2017-07-28 11:12:28.578927478 Z
20
- - - :permit
21
- - Simplified BSD
22
- - :who: DavidS
23
- :why: standard license
24
- :versions: []
25
- :when: 2017-07-28 11:12:36.924605442 Z
26
- - - :permit
27
- - New BSD
28
- - :who: DavidS
29
- :why: standard license
30
- :versions: []
31
- :when: 2017-07-28 11:14:00.252514982 Z
32
- - - :permit
33
- - Apache License, v2
34
- - :who: DavidS
35
- :why: standard license
36
- :versions: []
37
- :when: 2017-07-28 11:14:07.999759997 Z
38
- - - :permit
39
- - Ruby or LGPLv3+
40
- - :who: DavidS
41
- :why: standard license
42
- :versions: []
43
- :when: 2017-07-28 11:18:47.915684798 Z
44
- - - :license
45
- - bundler
46
- - MIT
47
- - :who: DavidS
48
- :why: See https://rubygems.org/gems/bundler
49
- :versions: []
50
- :when: 2017-07-28 11:22:12.975947786 Z
51
- - - :license
52
- - minitar
53
- - ruby
54
- - :who: DavidS
55
- :why: https://rubygems.org/gems/minitar
56
- :versions: []
57
- :when: 2017-07-28 11:22:50.609762862 Z
58
- - - :license
59
- - colored
60
- - MIT
61
- - :who: DavidS
62
- :why: https://github.com/defunkt/colored/blob/829bde0f8832406be1cacc5c99c49d976e05ccfc/LICENSE
63
- :versions: []
64
- :when: 2017-07-28 11:23:25.554994001 Z
65
- - - :permit
66
- - ISC
67
- - :who: scotje
68
- :why: MIT equivalent
69
- :versions: []
70
- :when: 2017-08-11 01:30:32.594531000 Z
71
- - - :license
72
- - facter
73
- - Apache 2.0
74
- - :who: DavidS
75
- :why: https://github.com/puppetlabs/facter/blob/d6e1d4bcb087683239ff5ee6bd72978d262b9c39/LICENSE
76
- :versions: []
77
- :when: 2017-08-31 13:26:57.197893553 Z
78
- - - :license
79
- - codecov
80
- - MIT
81
- - :who: DavidS
82
- :why: https://github.com/codecov/codecov-ruby/blob/d5f85a0ece83845a577e26f8ce735ae10de767c0/LICENSE.txt
83
- :versions: []
84
- :when: 2017-10-11 12:15:00.000000000 Z
85
- - - :license
86
- - blankslate
87
- - MIT
88
- - :who: DavidS
89
- :why: https://github.com/masover/blankslate/blob/f0a73b80c34bc3ad94dc3195d12a227a8fe30019/MIT-LICENSE
90
- :versions: []
91
- :when: 2017-11-17 14:05:09.534340925 Z
92
- - - :license
93
- - puppetlabs_spec_helper
94
- - Apache 2.0
95
- - :who: DavidS
96
- :why:
97
- :versions: []
98
- :when: 2018-03-09 18:04:29.175843919 Z
data/.fixtures.yml DELETED
@@ -1,8 +0,0 @@
1
- # This file can be used to install module depdencies for unit testing
2
- # See https://github.com/puppetlabs/puppetlabs_spec_helper#using-fixtures for details
3
- ---
4
- fixtures:
5
- forge_modules:
6
- # stdlib: "puppetlabs/stdlib"
7
- symlinks:
8
- test_module: "#{source_dir}/spec/fixtures/test_module"
data/.gitignore DELETED
@@ -1,15 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
10
-
11
- # rspec failure tracking
12
- .rspec_status
13
-
14
- # puppetlabs_spec_helper automatic fixtures
15
- spec/fixtures/modules/test_module
data/.rspec DELETED
@@ -1,3 +0,0 @@
1
- --format documentation
2
- --color
3
- --order rand
data/.rubocop.yml DELETED
@@ -1,159 +0,0 @@
1
- ---
2
- require: rubocop-rspec
3
- AllCops:
4
- TargetRubyVersion: '2.1'
5
- Include:
6
- - "**/*.rb"
7
- Exclude:
8
- - bin/*
9
- - ".vendor/**/*"
10
- - Gemfile
11
- - Rakefile
12
- - pkg/**/*
13
- - spec/fixtures/**/*
14
- - vendor/**/*
15
- Metrics/LineLength:
16
- Description: People have wide screens, use them.
17
- Max: 200
18
- RSpec/BeforeAfterAll:
19
- Description: Beware of using after(:all) as it may cause state to leak between tests.
20
- A necessary evil in acceptance testing.
21
- Exclude:
22
- - spec/acceptance/**/*.rb
23
- RSpec/HookArgument:
24
- Description: Prefer explicit :each argument, matching existing module's style
25
- EnforcedStyle: each
26
- RSpec/SubjectStub:
27
- Exclude:
28
- - 'spec/puppet/resource_api/base_context_spec.rb'
29
- Style/BlockDelimiters:
30
- Description: Prefer braces for chaining. Mostly an aesthetical choice. Better to
31
- be consistent then.
32
- EnforcedStyle: braces_for_chaining
33
- Style/ClassAndModuleChildren:
34
- Description: Compact style reduces the required amount of indentation.
35
- EnforcedStyle: compact
36
- # this needs to be easily usable in the gemspec
37
- Exclude:
38
- - 'lib/puppet/resource_api/version.rb'
39
- Style/EmptyElse:
40
- Description: Enforce against empty else clauses, but allow `nil` for clarity.
41
- EnforcedStyle: empty
42
- Style/FormatString:
43
- Description: Following the main puppet project's style, prefer the % format format.
44
- EnforcedStyle: percent
45
- Style/FormatStringToken:
46
- Description: Following the main puppet project's style, prefer the simpler template
47
- tokens over annotated ones.
48
- EnforcedStyle: template
49
- Style/Lambda:
50
- Description: Prefer the keyword for easier discoverability.
51
- EnforcedStyle: literal
52
- Style/RegexpLiteral:
53
- Description: Community preference. See https://github.com/voxpupuli/modulesync_config/issues/168
54
- EnforcedStyle: percent_r
55
- Style/TernaryParentheses:
56
- Description: Checks for use of parentheses around ternary conditions. Enforce parentheses
57
- on complex expressions for better readability, but seriously consider breaking
58
- it up.
59
- EnforcedStyle: require_parentheses_when_complex
60
- Style/TrailingCommaInArguments:
61
- Description: Prefer always trailing comma on multiline argument lists. This makes
62
- diffs, and re-ordering nicer.
63
- EnforcedStyleForMultiline: comma
64
- Style/SymbolArray:
65
- Description: Using percent style obscures symbolic intent of array's contents.
66
- EnforcedStyle: brackets
67
- Layout/EndOfLine:
68
- Enabled: false
69
- Style/CollectionMethods:
70
- Enabled: true
71
- Style/MethodCalledOnDoEndBlock:
72
- Enabled: true
73
- Style/StringMethods:
74
- Enabled: true
75
- Metrics/AbcSize:
76
- Enabled: false
77
- Metrics/BlockLength:
78
- Enabled: false
79
- Metrics/ClassLength:
80
- Enabled: false
81
- Metrics/CyclomaticComplexity:
82
- Enabled: false
83
- Metrics/MethodLength:
84
- Enabled: false
85
- Metrics/ModuleLength:
86
- Enabled: false
87
- Metrics/ParameterLists:
88
- Enabled: false
89
- Metrics/PerceivedComplexity:
90
- Enabled: false
91
- RSpec/DescribeClass:
92
- Enabled: false
93
- RSpec/ExampleLength:
94
- Enabled: false
95
- RSpec/MessageExpectation:
96
- Enabled: false
97
- RSpec/MultipleExpectations:
98
- Enabled: false
99
- RSpec/NestedGroups:
100
- Enabled: false
101
- Style/AsciiComments:
102
- Enabled: false
103
- Style/IfUnlessModifier:
104
- Enabled: false
105
- Style/SymbolProc:
106
- Enabled: false
107
-
108
- # local overrides
109
-
110
- # overridden for local conventions
111
- Naming/FileName:
112
- Exclude:
113
- - 'puppet-resource_api.gemspec'
114
-
115
- # metaprogramming makes everything "fun"
116
- Lint/NestedMethodDefinition:
117
- Exclude:
118
- - 'lib/puppet/resource_api.rb'
119
-
120
- # Interacting with external API makes message spies pretty useless
121
- RSpec/MessageSpies:
122
- Enabled: false
123
-
124
- # If neighbouring parameters are both hashes, it helps to have braces round both.
125
- Style/BracesAroundHashParameters:
126
- Exclude:
127
- - 'spec/puppet/resource_api/base_context_spec.rb'
128
-
129
- # requires 2.3's squiggly HEREDOC support, which we can't use, yet
130
- # see http://www.virtuouscode.com/2016/01/06/about-the-ruby-squiggly-heredoc-syntax/
131
- Layout/IndentHeredoc:
132
- Enabled: false
133
-
134
- # Updated in 0.53 (or thereabouts)
135
- Style/TrailingCommaInArrayLiteral:
136
- Description: Prefer always trailing comma on multiline literals. This makes diffs,
137
- and re-ordering nicer.
138
- EnforcedStyleForMultiline: comma
139
- Style/TrailingCommaInHashLiteral:
140
- Description: Prefer always trailing comma on multiline literals. This makes diffs,
141
- and re-ordering nicer.
142
- EnforcedStyleForMultiline: comma
143
-
144
- # Add allowing "is", as it is a technical term in puppet
145
- Naming/UncommunicativeMethodParamName:
146
- Description: Checks for method parameter names that contain capital letters, end in
147
- numbers, or do not meet a minimal length.
148
- Enabled: true
149
- MinNameLength: 3
150
- AllowNamesEndingInNumbers: true
151
- AllowedNames:
152
- - io
153
- - id
154
- - is
155
- ForbiddenNames: []
156
-
157
- # This cop breaks syntax highlighting in VSCode
158
- Layout/ClosingHeredocIndentation:
159
- Enabled: false