puppet-lint-topscope-variable-check 1.2.0 → 2.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: 8168088835aca0348f181b125582456955c20cb0dee175dd62f72ba1df6607bc
4
- data.tar.gz: 646719472eedfae47ad5ad0a3cd5d3f57bc5bf6ef3e7f8f0f6a845f27052ed95
3
+ metadata.gz: bba7e72103955d229936058c4d9e8243a35ea6282e519f0cdf667586584b55b8
4
+ data.tar.gz: 43eed19d3b88fd0480b5e720969cdc67377deb45f3007607fdad90acec3333ca
5
5
  SHA512:
6
- metadata.gz: e0585fb8efa9c97dade2f2a3ee3d725d1ccb0c59e220a105420b19100b33c73631b0de286e084b06c79d015ac3faa768044f243c54f4a5500821350a522d8d00
7
- data.tar.gz: 23f37b88e4b10d51b8b05702e87081d554e048546193e9e633edc31a1a0350671ff3d01472702e8d7440c197cf2a9d0f63880440cb2b9c993a9827ac2d277392
6
+ metadata.gz: c733eeba2facfaab46f1538cc909c539b6af2cb1563c7b0cd8596bf4587e115284767834b55cfdb23b2604e8ae542b7ccda55d2c5470d1450cfe0000e5797f3a
7
+ data.tar.gz: b27d7fedd03fedd7f0a20a25c9d638edefc93fc702930bfe8c9222b9adb66771c4bbf0c7f597ff4e0d73d2011ca62c82cb008aba107d5bdea2295b91a9758b53
@@ -5,14 +5,15 @@ PuppetLint.new_check(:topscope_variable) do
5
5
  return if class_list.first.nil?
6
6
 
7
7
  tokens.select { |x| x.type == :VARIABLE }.each do |token|
8
- next if token.value !~ /^::[a-z0-9_][a-zA-Z0-9_]+::/
8
+ next unless /^::[a-z0-9_][a-zA-Z0-9_]+::/.match?(token.value)
9
+
9
10
  fixed = token.value.sub(/^::/, '')
10
11
  notify(
11
12
  :warning,
12
13
  message: "use $#{fixed} instead of $#{token.value}",
13
14
  line: token.line,
14
15
  column: token.column,
15
- token: token
16
+ token: token,
16
17
  )
17
18
  end
18
19
  end
@@ -2,6 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  describe 'topscope_variable' do
4
4
  let(:msg) { 'use $foo::bar instead of $::foo::bar' }
5
+
5
6
  context 'with fix disabled' do
6
7
  context 'with correct topscope' do
7
8
  let(:code) do
@@ -14,7 +15,7 @@ describe 'topscope_variable' do
14
15
  PUP
15
16
  end
16
17
 
17
- it 'should not detect any problems' do
18
+ it 'does not detect any problems' do
18
19
  expect(problems).to have(0).problem
19
20
  end
20
21
  end
@@ -30,7 +31,7 @@ describe 'topscope_variable' do
30
31
  PUP
31
32
  end
32
33
 
33
- it 'should detect one problem' do
34
+ it 'detects one problem' do
34
35
  expect(problems).to have(1).problem
35
36
  end
36
37
  end
@@ -46,7 +47,7 @@ describe 'topscope_variable' do
46
47
  PUP
47
48
  end
48
49
 
49
- it 'should detect one problem' do
50
+ it 'detects one problem' do
50
51
  expect(problems).to have(1).problem
51
52
  end
52
53
  end
@@ -62,7 +63,7 @@ describe 'topscope_variable' do
62
63
  PUP
63
64
  end
64
65
 
65
- it 'should not detect any problems' do
66
+ it 'does not detect any problems' do
66
67
  expect(problems).to have(0).problem
67
68
  end
68
69
  end
@@ -78,7 +79,7 @@ describe 'topscope_variable' do
78
79
  PUP
79
80
  end
80
81
 
81
- it 'should detect one problem' do
82
+ it 'detects one problem' do
82
83
  expect(problems).to have(1).problem
83
84
  end
84
85
  end
@@ -94,7 +95,7 @@ describe 'topscope_variable' do
94
95
  PUP
95
96
  end
96
97
 
97
- it 'should not detect any problems' do
98
+ it 'does not detect any problems' do
98
99
  expect(problems).to have(0).problem
99
100
  end
100
101
  end
@@ -110,7 +111,7 @@ describe 'topscope_variable' do
110
111
  PUP
111
112
  end
112
113
 
113
- it 'should not detect any problems' do
114
+ it 'does not detect any problems' do
114
115
  expect(problems).to have(0).problem
115
116
  end
116
117
  end
@@ -136,7 +137,7 @@ describe 'topscope_variable' do
136
137
  PUP
137
138
  end
138
139
 
139
- it 'should not detect any problems' do
140
+ it 'does not detect any problems' do
140
141
  expect(problems).to have(0).problem
141
142
  end
142
143
  end
@@ -152,15 +153,15 @@ describe 'topscope_variable' do
152
153
  PUP
153
154
  end
154
155
 
155
- it 'should detect one problem' do
156
+ it 'detects one problem' do
156
157
  expect(problems).to have(1).problem
157
158
  end
158
159
 
159
- it 'should fix the problem' do
160
+ it 'fixes the problem' do
160
161
  expect(problems).to contain_fixed(msg).on_line(3).in_column(16)
161
162
  end
162
163
 
163
- it 'should remove :: after the $' do
164
+ it 'removes :: after the $' do
164
165
  expect(manifest).to eq <<~PUP
165
166
  class foo::blub {
166
167
  notify { 'foo':
@@ -182,15 +183,15 @@ describe 'topscope_variable' do
182
183
  PUP
183
184
  end
184
185
 
185
- it 'should detect one problem' do
186
+ it 'detects one problem' do
186
187
  expect(problems).to have(1).problem
187
188
  end
188
189
 
189
- it 'should fix the problem' do
190
+ it 'fixes the problem' do
190
191
  expect(problems).to contain_fixed('use $some_component_module::bar instead of $::some_component_module::bar').on_line(3).in_column(16)
191
192
  end
192
193
 
193
- it 'should remove :: after the $' do
194
+ it 'removes :: after the $' do
194
195
  expect(manifest).to eq <<~PUP
195
196
  class profile::foo {
196
197
  notify { 'foo':
@@ -212,15 +213,15 @@ describe 'topscope_variable' do
212
213
  PUP
213
214
  end
214
215
 
215
- it 'should detect one problem' do
216
+ it 'detects one problem' do
216
217
  expect(problems).to have(1).problem
217
218
  end
218
219
 
219
- it 'should fix the problem' do
220
+ it 'fixes the problem' do
220
221
  expect(problems).to contain_fixed(msg).on_line(3).in_column(20)
221
222
  end
222
223
 
223
- it 'should remove :: after the $' do
224
+ it 'removes :: after the $' do
224
225
  expect(manifest).to eq <<~PUP
225
226
  class foo::blub {
226
227
  notify { 'foo':
@@ -238,7 +239,8 @@ describe 'topscope_variable' do
238
239
  include ::foo
239
240
  PUP
240
241
  end
241
- it 'should not detect any problems' do
242
+
243
+ it 'does not detect any problems' do
242
244
  expect(problems).to have(0).problem
243
245
  end
244
246
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppet-lint-topscope-variable-check
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 2.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: 2023-02-24 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,96 +16,20 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '2.0'
19
+ version: '3'
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: '2.0'
29
+ version: '3'
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: '12.0'
40
- - - "<"
41
- - !ruby/object:Gem::Version
42
- version: '14'
43
- type: :development
44
- prerelease: false
45
- version_requirements: !ruby/object:Gem::Requirement
46
- requirements:
47
- - - ">="
48
- - !ruby/object:Gem::Version
49
- version: '12.0'
50
- - - "<"
51
- - !ruby/object:Gem::Version
52
- version: '14'
53
- - !ruby/object:Gem::Dependency
54
- name: rspec
55
- requirement: !ruby/object:Gem::Requirement
56
- requirements:
57
- - - "~>"
58
- - !ruby/object:Gem::Version
59
- version: '3.0'
60
- type: :development
61
- prerelease: false
62
- version_requirements: !ruby/object:Gem::Requirement
63
- requirements:
64
- - - "~>"
65
- - !ruby/object:Gem::Version
66
- version: '3.0'
67
- - !ruby/object:Gem::Dependency
68
- name: rspec-collection_matchers
69
- requirement: !ruby/object:Gem::Requirement
70
- requirements:
71
- - - "~>"
72
- - !ruby/object:Gem::Version
73
- version: '1.0'
74
- type: :development
75
- prerelease: false
76
- version_requirements: !ruby/object:Gem::Requirement
77
- requirements:
78
- - - "~>"
79
- - !ruby/object:Gem::Version
80
- version: '1.0'
81
- - !ruby/object:Gem::Dependency
82
- name: rspec-its
83
- requirement: !ruby/object:Gem::Requirement
84
- requirements:
85
- - - "~>"
86
- - !ruby/object:Gem::Version
87
- version: '1.0'
88
- type: :development
89
- prerelease: false
90
- version_requirements: !ruby/object:Gem::Requirement
91
- requirements:
92
- - - "~>"
93
- - !ruby/object:Gem::Version
94
- version: '1.0'
95
- - !ruby/object:Gem::Dependency
96
- name: simplecov
97
- requirement: !ruby/object:Gem::Requirement
98
- requirements:
99
- - - ">="
100
- - !ruby/object:Gem::Version
101
- version: '0'
102
- type: :development
103
- prerelease: false
104
- version_requirements: !ruby/object:Gem::Requirement
105
- requirements:
106
- - - ">="
107
- - !ruby/object:Gem::Version
108
- version: '0'
32
+ version: '5'
109
33
  description: " A puppet-lint plugin to check that topscope variable names don't
110
34
  start with ::.\n"
111
35
  email: voxpupuli@groups.io
@@ -130,7 +54,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
130
54
  requirements:
131
55
  - - ">="
132
56
  - !ruby/object:Gem::Version
133
- version: '0'
57
+ version: 2.7.0
134
58
  required_rubygems_version: !ruby/object:Gem::Requirement
135
59
  requirements:
136
60
  - - ">="
@@ -141,6 +65,4 @@ rubygems_version: 3.2.33
141
65
  signing_key:
142
66
  specification_version: 4
143
67
  summary: A puppet-lint plugin to check topscope variables.
144
- test_files:
145
- - spec/puppet-lint/plugins/topscope_variable_spec.rb
146
- - spec/spec_helper.rb
68
+ test_files: []