puppet-lint-absolute_classname-check 3.1.0 → 4.0.0

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
2
  SHA256:
3
- metadata.gz: 86140cad9c7e991e50d45bb4bc896788b16a64776749c5cbbb80f29032bc1692
4
- data.tar.gz: 716c53d528e10c3bcda030e1c19cc54c017346556fb98ff580a698fc32542680
3
+ metadata.gz: 44d9484de2d04ad14e0eb4ed9c17424b72c319a94b49fb823622a98fa85771d5
4
+ data.tar.gz: 589a21445dbf0baade77d8bc94c0217573b0767c838e86dd71d365d6dc43f8f4
5
5
  SHA512:
6
- metadata.gz: 51b2d31cff4c997644a034a97c909c950ac67e59c3ddec2135b21bcc1a096e0357d48e61fd15d89ddbdfb0643bdac37e3e1f32c956f748c89c79ba348a6e3b52
7
- data.tar.gz: 0ce3da50d95b4643d37b99e526b887c0ae7fa876abbb2c60917420a8c10b69efaa5c59714c09f57f4a42ef18d0cd5df7bc48aaa6620ab6322ca92d0067e90ea8
6
+ metadata.gz: 57dc43ecd8829bc7baff9186b430a47050c51513f59326db2b4e28c8e99cf50340d21776ea7d0f09578e4a9772a621a195f21d2ab0d739932ccb0c4ec951e513
7
+ data.tar.gz: 4c37050af7045255fba3f396ff56fcaae3e8160f22e2ce2786ab68ba230756f5ac7d87d42ad1bc3a22134d117d6febfe028195886366815276a5658b538ec14a
@@ -2,8 +2,8 @@ PuppetLint.new_check(:relative_classname_inclusion) do
2
2
  def check
3
3
  message = 'class included by absolute name (::$class)'
4
4
 
5
- tokens.each_with_index do |token, token_idx|
6
- if [:NAME,:FUNCTION_NAME].include?(token.type) && ['include','contain','require'].include?(token.value)
5
+ tokens.each_with_index do |token, _token_idx|
6
+ if %i[NAME FUNCTION_NAME].include?(token.type) && %w[include contain require].include?(token.value)
7
7
  s = token.next_code_token
8
8
  next if s.nil?
9
9
  next if s.type == :FARROW
@@ -11,7 +11,7 @@ PuppetLint.new_check(:relative_classname_inclusion) do
11
11
  in_function = 0
12
12
  while s.type != :NEWLINE
13
13
  n = s.next_code_token
14
- if [:NAME, :FUNCTION_NAME, :SSTRING,].include?(s.type)
14
+ if %i[NAME FUNCTION_NAME SSTRING].include?(s.type)
15
15
  if n && n.type == :LPAREN
16
16
  in_function += 1
17
17
  elsif in_function > 0 && n && n.type == :RPAREN
@@ -21,7 +21,7 @@ PuppetLint.new_check(:relative_classname_inclusion) do
21
21
  message: message,
22
22
  line: s.line,
23
23
  column: s.column,
24
- token: s
24
+ token: s,
25
25
  }
26
26
  end
27
27
  end
@@ -35,7 +35,7 @@ PuppetLint.new_check(:relative_classname_inclusion) do
35
35
  message: message,
36
36
  line: s.line,
37
37
  column: s.column,
38
- token: s
38
+ token: s,
39
39
  }
40
40
  end
41
41
  s = s.next_token
@@ -47,7 +47,7 @@ PuppetLint.new_check(:relative_classname_inclusion) do
47
47
  message: message,
48
48
  line: s.line,
49
49
  column: s.column,
50
- token: s
50
+ token: s,
51
51
  }
52
52
  end
53
53
  end
@@ -2,20 +2,20 @@ PuppetLint.new_check(:relative_classname_reference) do
2
2
  def check
3
3
  message = 'absolute class name reference'
4
4
 
5
- tokens.each_with_index do |token, token_idx|
6
- if token.type == :TYPE and token.value == 'Class' and token.next_code_token.type == :LBRACK
7
- s = token.next_code_token
8
- while s.type != :RBRACK
9
- if (s.type == :NAME || s.type == :SSTRING) && s.value.start_with?('::')
10
- notify :warning, {
11
- message: message,
12
- line: s.line,
13
- column: s.column,
14
- token: s
15
- }
16
- end
17
- s = s.next_token
5
+ tokens.each_with_index do |token, _token_idx|
6
+ next unless token.type == :TYPE and token.value == 'Class' and token.next_code_token.type == :LBRACK
7
+
8
+ s = token.next_code_token
9
+ while s.type != :RBRACK
10
+ if (s.type == :NAME || s.type == :SSTRING) && s.value.start_with?('::')
11
+ notify :warning, {
12
+ message: message,
13
+ line: s.line,
14
+ column: s.column,
15
+ token: s,
16
+ }
18
17
  end
18
+ s = s.next_token
19
19
  end
20
20
  end
21
21
  end
@@ -35,11 +35,11 @@ describe 'relative_classname_inclusion' do
35
35
  EOS
36
36
  end
37
37
 
38
- it 'should detect 12 problems' do
38
+ it 'detects 12 problems' do
39
39
  expect(problems).to have(12).problems
40
40
  end
41
41
 
42
- it 'should create warnings' do
42
+ it 'creates warnings' do
43
43
  expect(problems).to contain_warning(msg).on_line(1).in_column(17)
44
44
  expect(problems).to contain_warning(msg).on_line(2).in_column(17)
45
45
  expect(problems).to contain_warning(msg).on_line(6).in_column(17)
@@ -70,7 +70,7 @@ describe 'relative_classname_inclusion' do
70
70
  EOS
71
71
  end
72
72
 
73
- it 'should not detect a problem' do
73
+ it 'does not detect a problem' do
74
74
  expect(problems).to have(0).problems
75
75
  end
76
76
  end
@@ -85,7 +85,7 @@ describe 'relative_classname_inclusion' do
85
85
  EOS
86
86
  end
87
87
 
88
- it 'should detect no problems' do
88
+ it 'detects no problems' do
89
89
  expect(problems).to have(0).problems
90
90
  end
91
91
  end
@@ -102,7 +102,7 @@ describe 'relative_classname_inclusion' do
102
102
  EOS
103
103
  end
104
104
 
105
- it 'should detect no problems' do
105
+ it 'detects no problems' do
106
106
  expect(problems).to have(0).problems
107
107
  end
108
108
  end
@@ -148,11 +148,11 @@ describe 'relative_classname_inclusion' do
148
148
  EOS
149
149
  end
150
150
 
151
- it 'should detect 12 problems' do
151
+ it 'detects 12 problems' do
152
152
  expect(problems).to have(12).problems
153
153
  end
154
154
 
155
- it 'should fix the problems' do
155
+ it 'fixes the problems' do
156
156
  expect(problems).to contain_fixed(msg).on_line(1).in_column(17)
157
157
  expect(problems).to contain_fixed(msg).on_line(2).in_column(17)
158
158
  expect(problems).to contain_fixed(msg).on_line(6).in_column(17)
@@ -167,9 +167,9 @@ describe 'relative_classname_inclusion' do
167
167
  expect(problems).to contain_fixed(msg).on_line(24).in_column(31)
168
168
  end
169
169
 
170
- it 'should should remove colons' do
170
+ it 'shoulds remove colons' do
171
171
  expect(manifest).to eq(
172
- <<-EOS
172
+ <<-EOS,
173
173
  include foobar
174
174
  include('foobar')
175
175
  include(foobar(baz))
@@ -215,7 +215,7 @@ describe 'relative_classname_inclusion' do
215
215
  EOS
216
216
  end
217
217
 
218
- it 'should not detect any problems' do
218
+ it 'does not detect any problems' do
219
219
  expect(problems).to have(0).problems
220
220
  end
221
221
  end
@@ -230,7 +230,7 @@ describe 'relative_classname_inclusion' do
230
230
  EOS
231
231
  end
232
232
 
233
- it 'should not detect any problems' do
233
+ it 'does not detect any problems' do
234
234
  expect(problems).to have(0).problems
235
235
  end
236
236
  end
@@ -21,11 +21,11 @@ describe 'relative_classname_reference' do
21
21
  EOS
22
22
  end
23
23
 
24
- it 'should detect 6 problems' do
24
+ it 'detects 6 problems' do
25
25
  expect(problems).to have(6).problems
26
26
  end
27
27
 
28
- it 'should create warnings' do
28
+ it 'creates warnings' do
29
29
  expect(problems).to contain_warning(msg).on_line(1).in_column(15)
30
30
  expect(problems).to contain_warning(msg).on_line(1).in_column(31)
31
31
  expect(problems).to contain_warning(msg).on_line(5).in_column(28)
@@ -50,7 +50,7 @@ describe 'relative_classname_reference' do
50
50
  EOS
51
51
  end
52
52
 
53
- it 'should not detect a problem' do
53
+ it 'does not detect a problem' do
54
54
  expect(problems).to have(0).problems
55
55
  end
56
56
  end
@@ -82,11 +82,11 @@ describe 'relative_classname_reference' do
82
82
  EOS
83
83
  end
84
84
 
85
- it 'should detect 6 problems' do
85
+ it 'detects 6 problems' do
86
86
  expect(problems).to have(6).problems
87
87
  end
88
88
 
89
- it 'should fix the problems' do
89
+ it 'fixes the problems' do
90
90
  expect(problems).to contain_fixed(msg).on_line(1).in_column(15)
91
91
  expect(problems).to contain_fixed(msg).on_line(1).in_column(31)
92
92
  expect(problems).to contain_fixed(msg).on_line(5).in_column(28)
@@ -95,9 +95,9 @@ describe 'relative_classname_reference' do
95
95
  expect(problems).to contain_fixed(msg).on_line(10).in_column(43)
96
96
  end
97
97
 
98
- it 'should should remove colons' do
98
+ it 'shoulds remove colons' do
99
99
  expect(manifest).to eq(
100
- <<-EOS
100
+ <<-EOS,
101
101
  Class[foo] -> Class['bar']
102
102
 
103
103
  file { '/path':
@@ -129,7 +129,7 @@ describe 'relative_classname_reference' do
129
129
  EOS
130
130
  end
131
131
 
132
- it 'should not detect any problems' do
132
+ it 'does not detect any problems' do
133
133
  expect(problems).to have(0).problems
134
134
  end
135
135
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppet-lint-absolute_classname-check
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0
4
+ version: 4.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vox Pupuli
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-11-29 00:00:00.000000000 Z
11
+ date: 2023-04-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: puppet-lint
@@ -16,76 +16,20 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.0'
19
+ version: '3.0'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '4'
22
+ version: '5'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: '1.0'
29
+ version: '3.0'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '4'
33
- - !ruby/object:Gem::Dependency
34
- name: rake
35
- requirement: !ruby/object:Gem::Requirement
36
- requirements:
37
- - - ">="
38
- - !ruby/object:Gem::Version
39
- version: '0'
40
- type: :development
41
- prerelease: false
42
- version_requirements: !ruby/object:Gem::Requirement
43
- requirements:
44
- - - ">="
45
- - !ruby/object:Gem::Version
46
- version: '0'
47
- - !ruby/object:Gem::Dependency
48
- name: rspec
49
- requirement: !ruby/object:Gem::Requirement
50
- requirements:
51
- - - ">="
52
- - !ruby/object:Gem::Version
53
- version: '0'
54
- type: :development
55
- prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- requirements:
58
- - - ">="
59
- - !ruby/object:Gem::Version
60
- version: '0'
61
- - !ruby/object:Gem::Dependency
62
- name: rspec-collection_matchers
63
- requirement: !ruby/object:Gem::Requirement
64
- requirements:
65
- - - ">="
66
- - !ruby/object:Gem::Version
67
- version: '0'
68
- type: :development
69
- prerelease: false
70
- version_requirements: !ruby/object:Gem::Requirement
71
- requirements:
72
- - - ">="
73
- - !ruby/object:Gem::Version
74
- version: '0'
75
- - !ruby/object:Gem::Dependency
76
- name: rspec-its
77
- requirement: !ruby/object:Gem::Requirement
78
- requirements:
79
- - - ">="
80
- - !ruby/object:Gem::Version
81
- version: '0'
82
- type: :development
83
- prerelease: false
84
- version_requirements: !ruby/object:Gem::Requirement
85
- requirements:
86
- - - ">="
87
- - !ruby/object:Gem::Version
88
- version: '0'
32
+ version: '5'
89
33
  description: " A puppet-lint plugin to check that classes are not included or referenced
90
34
  by their absolute name.\n"
91
35
  email: voxpupuli@groups.io
@@ -112,7 +56,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
112
56
  requirements:
113
57
  - - ">="
114
58
  - !ruby/object:Gem::Version
115
- version: 2.1.0
59
+ version: 2.7.0
116
60
  required_rubygems_version: !ruby/object:Gem::Requirement
117
61
  requirements:
118
62
  - - ">="
@@ -124,7 +68,4 @@ signing_key:
124
68
  specification_version: 4
125
69
  summary: A puppet-lint plugin to check that classes are not included or referenced
126
70
  by their absolute name.
127
- test_files:
128
- - spec/puppet-lint/plugins/check_absolute_classname/relative_classname_inclusion_spec.rb
129
- - spec/puppet-lint/plugins/check_classname_reference/relative_classname_reference_spec.rb
130
- - spec/spec_helper.rb
71
+ test_files: []