puppet-lint-duplicate_class_parameters-check 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: ad8bf84346ce09b36f6268ffea85e13b34696e28
4
- data.tar.gz: c8fa8c9006fd3714de3703cc8d592ccad9003f65
2
+ SHA256:
3
+ metadata.gz: d3b64e4aadbcf743b16ed650778e90c64362c3c2fa87586a3db25a3c5588e1fe
4
+ data.tar.gz: 7b20846a265a8d9643668df2c692e5d53c3441e25914e46f66c6e1cbcd34a5b9
5
5
  SHA512:
6
- metadata.gz: 6ce98b5eda889442bd9e61784a6d2023962353e1890fa2288a478fc267113604742e89a5654a59f1ec9479c3320c5f6d66fcfc0b19bb5b0b09421c22c5a45c35
7
- data.tar.gz: 28d2c4abfc70af9604093b7ee0752d26360a4da08752898ba49bab5b839eb24fd75b1159d77eb1dd7056f2bb33a612c35da6a2e58e4e151f011537f7f0d9a1f8
6
+ metadata.gz: 62f18dd0efb26da270255bdef226551df53e4d5645cee3d9adb81a7dab04fbcc1bce1119f54c12de50c45e177e1234581f99c7280456073e4e8e84309614c9a4
7
+ data.tar.gz: c0bbe56fb14bb4910c9f52dc24ce0b184a80ee13cc7fa14e868518ae615ff0903a620a4ee08238f31925584f1f5a587233fe43c4382009c98af7bddaebb102a0
@@ -3,6 +3,7 @@ PuppetLint.new_check(:duplicate_class_parameters) do
3
3
  class_indexes.each do |class_idx|
4
4
  seen = Hash.new(0)
5
5
  inside = nil
6
+ level = 0
6
7
 
7
8
  # if there are no params there is nothing to do, return early.
8
9
  return if class_idx[:param_tokens].nil?
@@ -10,6 +11,15 @@ PuppetLint.new_check(:duplicate_class_parameters) do
10
11
  class_idx[:param_tokens].each do |token|
11
12
  class_name = class_idx[:name_token].value
12
13
 
14
+ case token.type
15
+ when :LBRACK, :LBRACE
16
+ level += 1
17
+ when :RBRACK, :RBRACE
18
+ level -= 1
19
+ end
20
+
21
+ next unless level.zero?
22
+
13
23
  if token.type == :VARIABLE
14
24
  next_type = token.next_code_token.type
15
25
 
@@ -162,4 +162,22 @@ describe 'duplicate_class_parameters' do
162
162
  end
163
163
  end
164
164
 
165
+ context 'class with a structure using a variable and assigned in another variable' do
166
+ let(:code) do
167
+ <<-EOS
168
+ class complex_structure_assignation (
169
+ Optional[String] $hostname = undef,
170
+ Array[String] $aliases = ["www.${hostname}"],
171
+ ) {
172
+ if $hostname {
173
+ # ...
174
+ }
175
+ }
176
+ EOS
177
+ end
178
+
179
+ it 'should not detect any problems' do
180
+ expect(problems).to have(0).problems
181
+ end
182
+ end
165
183
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppet-lint-duplicate_class_parameters-check
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dean Wilson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-18 00:00:00.000000000 Z
11
+ date: 2019-08-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: puppet-lint
@@ -161,10 +161,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
161
161
  version: '0'
162
162
  requirements: []
163
163
  rubyforge_project:
164
- rubygems_version: 2.6.11
164
+ rubygems_version: 2.7.3
165
165
  signing_key:
166
166
  specification_version: 4
167
167
  summary: puppet-lint duplicate class parameters check
168
168
  test_files:
169
- - spec/spec_helper.rb
170
169
  - spec/puppet-lint/plugins/puppet-lint_duplicate_class_parameters_spec.rb
170
+ - spec/spec_helper.rb