puppet-lint-unquoted_string-check 2.2.0 → 3.0.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 90b133720a8d70d6127dfef7a5bbed671fe2a5fee5004e986c99094563849029
4
- data.tar.gz: c0bed1bcebd9831348ea4c40b4b113b5a83da6e21d06d759bdabe8cff25dbc29
3
+ metadata.gz: 000ae666e4ca3430beceda4c9e6d473b8ac15b009c458f4f26a23657a556d306
4
+ data.tar.gz: 44ff25f4da80736c8935e7c7ab0ed8fdedb4300c3734f5350ebdd2a2d88aee3a
5
5
  SHA512:
6
- metadata.gz: 398b0a304a60bbd5def94f04e40ac1976ddd3a975a2c23d2c4dfe160cfdd7917371f3030f09c94a6838cbc3e66d9f81c4647d19ce8f313cd41f56ae93734a59f
7
- data.tar.gz: 9e272a8e7425051ad58249f5cd4a26147c6d7cb5731d96456a481c28cccfe16406e7be9e63eceace5574aa466b5a4c7a88381d2fac204db3a58c9c8b1fa0e58c
6
+ metadata.gz: 91cb476de59a0564179f741712b7b5b35c5f19a14833ae73ef0541476224c6676d125d640769f18ce67e6a5a8da51ae13b3dd8f9b04130992239fc866a1afeb4
7
+ data.tar.gz: 1d1c2e3c1fbdee5217c7e8ebff5b9f679656fcb8203cfcd9f049260e10ab875b2e3cc760a4df6983831b9d03815a29e49d31d6810b5829c33525fbe9eb3291d7
data/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [3.0.0](https://github.com/voxpupuli/puppet-lint-unquoted_string-check/tree/3.0.0) (2023-04-21)
6
+
7
+ [Full Changelog](https://github.com/voxpupuli/puppet-lint-unquoted_string-check/compare/2.2.0...3.0.0)
8
+
9
+ **Breaking changes:**
10
+
11
+ - Drop Ruby \< 2.7; Add RuboCop [\#21](https://github.com/voxpupuli/puppet-lint-unquoted_string-check/pull/21) ([bastelfreak](https://github.com/bastelfreak))
12
+
5
13
  ## [2.2.0](https://github.com/voxpupuli/puppet-lint-unquoted_string-check/tree/2.2.0) (2022-11-29)
6
14
 
7
15
  [Full Changelog](https://github.com/voxpupuli/puppet-lint-unquoted_string-check/compare/2.1.0...2.2.0)
@@ -1,27 +1,21 @@
1
- require 'pp'
2
-
3
1
  def type_indexes(type)
4
2
  type_indexes = []
5
3
  tokens.each_index do |token_idx|
6
- if tokens[token_idx].type == type
7
- depth = 0
8
- start = token_idx
9
- tokens[(token_idx + 1)..-1].each_index do |case_token_idx|
10
- idx = case_token_idx + token_idx + 1
11
- if tokens[idx].type == :LBRACE
12
- depth += 1
13
- if depth == 2
14
- type_indexes << {:start => start, :end => idx}
15
- end
16
- elsif tokens[idx].type == :RBRACE
17
- if depth == 2
18
- start = idx
19
- end
20
- depth -= 1
21
- if depth == 0
22
- type_indexes << {:start => start, :end => idx}
23
- break
24
- end
4
+ next unless tokens[token_idx].type == type
5
+
6
+ depth = 0
7
+ start = token_idx
8
+ tokens[(token_idx + 1)..-1].each_index do |case_token_idx|
9
+ idx = case_token_idx + token_idx + 1
10
+ if tokens[idx].type == :LBRACE
11
+ depth += 1
12
+ type_indexes << { start: start, end: idx } if depth == 2
13
+ elsif tokens[idx].type == :RBRACE
14
+ start = idx if depth == 2
15
+ depth -= 1
16
+ if depth == 0
17
+ type_indexes << { start: start, end: idx }
18
+ break
25
19
  end
26
20
  end
27
21
  end
@@ -38,10 +32,10 @@ def notify_tokens(type, sep_type, message)
38
32
  while (s.type != :NEWLINE) && (s.type != :LBRACE)
39
33
  if s.type == :NAME || (s.type == :CLASSREF && !s.value.include?('::'))
40
34
  notify :warning, {
41
- :message => message,
42
- :line => s.line,
43
- :column => s.column,
44
- :token => s,
35
+ message: message,
36
+ line: s.line,
37
+ column: s.column,
38
+ token: s,
45
39
  }
46
40
  end
47
41
  s = s.prev_token
@@ -24,7 +24,7 @@ describe 'unquoted_string_in_case' do
24
24
  EOS
25
25
  end
26
26
 
27
- it 'should not detect any problems' do
27
+ it 'does not detect any problems' do
28
28
  expect(problems).to have(0).problems
29
29
  end
30
30
  end
@@ -46,7 +46,7 @@ describe 'unquoted_string_in_case' do
46
46
  EOS
47
47
  end
48
48
 
49
- it 'should not detect any problems' do
49
+ it 'does not detect any problems' do
50
50
  expect(problems).to have(0).problems
51
51
  end
52
52
  end
@@ -71,7 +71,7 @@ describe 'unquoted_string_in_case' do
71
71
  EOS
72
72
  end
73
73
 
74
- it 'should not detect any problems' do
74
+ it 'does not detect any problems' do
75
75
  expect(problems).to have(0).problems
76
76
  end
77
77
  end
@@ -105,11 +105,11 @@ describe 'unquoted_string_in_case' do
105
105
  EOS
106
106
  end
107
107
 
108
- it 'should create a warning' do
108
+ it 'creates a warning' do
109
109
  expect(problems).to have(7).problems
110
110
  end
111
111
 
112
- it 'should create a warning' do
112
+ it 'creates a warning' do
113
113
  expect(problems).to contain_warning(msg).on_line(2).in_column(11)
114
114
  expect(problems).to contain_warning(msg).on_line(5).in_column(11)
115
115
  expect(problems).to contain_warning(msg).on_line(5).in_column(18)
@@ -137,7 +137,7 @@ describe 'unquoted_string_in_case' do
137
137
  EOS
138
138
  end
139
139
 
140
- it 'should create a warning' do
140
+ it 'creates a warning' do
141
141
  expect(problems).to contain_warning(msg).on_line(2).in_column(11)
142
142
  end
143
143
  end
@@ -154,7 +154,7 @@ describe 'unquoted_string_in_case' do
154
154
  EOS
155
155
  end
156
156
 
157
- it 'should not detect any problems' do
157
+ it 'does not detect any problems' do
158
158
  expect(problems).to have(0).problems
159
159
  end
160
160
  end
@@ -189,11 +189,11 @@ describe 'unquoted_string_in_case' do
189
189
  EOS
190
190
  end
191
191
 
192
- it 'should not detect any problems' do
192
+ it 'does not detect any problems' do
193
193
  expect(problems).to have(0).problems
194
194
  end
195
195
 
196
- it 'should not modify the manifest' do
196
+ it 'does not modify the manifest' do
197
197
  expect(manifest).to eq(code)
198
198
  end
199
199
  end
@@ -215,11 +215,11 @@ describe 'unquoted_string_in_case' 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
 
222
- it 'should not modify the manifest' do
222
+ it 'does not modify the manifest' do
223
223
  expect(manifest).to eq(code)
224
224
  end
225
225
  end
@@ -244,11 +244,11 @@ describe 'unquoted_string_in_case' do
244
244
  EOS
245
245
  end
246
246
 
247
- it 'should not detect any problems' do
247
+ it 'does not detect any problems' do
248
248
  expect(problems).to have(0).problems
249
249
  end
250
250
 
251
- it 'should not modify the manifest' do
251
+ it 'does not modify the manifest' do
252
252
  expect(manifest).to eq(code)
253
253
  end
254
254
  end
@@ -282,11 +282,11 @@ describe 'unquoted_string_in_case' do
282
282
  EOS
283
283
  end
284
284
 
285
- it 'should only detect a single problem' do
285
+ it 'onlies detect a single problem' do
286
286
  expect(problems).to have(7).problem
287
287
  end
288
288
 
289
- it 'should fix the problem' do
289
+ it 'fixes the problem' do
290
290
  expect(problems).to contain_fixed(msg).on_line(2).in_column(11)
291
291
  expect(problems).to contain_fixed(msg).on_line(5).in_column(11)
292
292
  expect(problems).to contain_fixed(msg).on_line(5).in_column(18)
@@ -296,9 +296,9 @@ describe 'unquoted_string_in_case' do
296
296
  expect(problems).to contain_fixed(msg).on_line(14).in_column(11)
297
297
  end
298
298
 
299
- it 'should quote the case statement' do
299
+ it 'quotes the case statement' do
300
300
  expect(manifest).to eq(
301
- <<-EOS
301
+ <<-EOS,
302
302
  case $osfamily {
303
303
  'solaris': {
304
304
  $rootgroup = 'wheel'
@@ -344,17 +344,17 @@ describe 'unquoted_string_in_case' do
344
344
  EOS
345
345
  end
346
346
 
347
- it 'should only detect a single problem' do
347
+ it 'onlies detect a single problem' do
348
348
  expect(problems).to have(1).problem
349
349
  end
350
350
 
351
- it 'should fix the problem' do
351
+ it 'fixes the problem' do
352
352
  expect(problems).to contain_fixed(msg).on_line(2).in_column(11)
353
353
  end
354
354
 
355
- it 'should quote the case statement' do
355
+ it 'quotes the case statement' do
356
356
  expect(manifest).to eq(
357
- <<-EOS
357
+ <<-EOS,
358
358
  case $osfamily {
359
359
  'Solaris': {
360
360
  $rootgroup = 'wheel'
@@ -383,11 +383,11 @@ describe 'unquoted_string_in_case' do
383
383
  EOS
384
384
  end
385
385
 
386
- it 'should not detect any problems' do
386
+ it 'does not detect any problems' do
387
387
  expect(problems).to have(0).problems
388
388
  end
389
389
 
390
- it 'should not modify the manifest' do
390
+ it 'does not modify the manifest' do
391
391
  expect(manifest).to eq(code)
392
392
  end
393
393
  end
@@ -15,7 +15,7 @@ describe 'unquoted_string_in_selector' do
15
15
  EOS
16
16
  end
17
17
 
18
- it 'should not detect any problems' do
18
+ it 'does not detect any problems' do
19
19
  expect(problems).to have(0).problems
20
20
  end
21
21
  end
@@ -31,7 +31,7 @@ describe 'unquoted_string_in_selector' do
31
31
  EOS
32
32
  end
33
33
 
34
- it 'should create a warning' do
34
+ it 'creates a warning' do
35
35
  expect(problems).to contain_warning(msg).on_line(2).in_column(11)
36
36
  end
37
37
  end
@@ -47,7 +47,7 @@ describe 'unquoted_string_in_selector' do
47
47
  EOS
48
48
  end
49
49
 
50
- it 'should create a warning' do
50
+ it 'creates a warning' do
51
51
  expect(problems).to contain_warning(msg).on_line(2).in_column(11)
52
52
  end
53
53
  end
@@ -63,7 +63,7 @@ describe 'unquoted_string_in_selector' do
63
63
  PUPPET
64
64
  end
65
65
 
66
- it 'should not detect any problems' do
66
+ it 'does not detect any problems' do
67
67
  expect(problems).to have(0).problems
68
68
  end
69
69
  end
@@ -89,11 +89,11 @@ describe 'unquoted_string_in_selector' do
89
89
  EOS
90
90
  end
91
91
 
92
- it 'should not detect any problems' do
92
+ it 'does not detect any problems' do
93
93
  expect(problems).to have(0).problems
94
94
  end
95
95
 
96
- it 'should not modify the manifest' do
96
+ it 'does not modify the manifest' do
97
97
  expect(manifest).to eq(code)
98
98
  end
99
99
  end
@@ -109,17 +109,17 @@ describe 'unquoted_string_in_selector' do
109
109
  EOS
110
110
  end
111
111
 
112
- it 'should only detect a single problem' do
112
+ it 'onlies detect a single problem' do
113
113
  expect(problems).to have(1).problem
114
114
  end
115
115
 
116
- it 'should fix the problem' do
116
+ it 'fixes the problem' do
117
117
  expect(problems).to contain_fixed(msg).on_line(2).in_column(11)
118
118
  end
119
119
 
120
- it 'should quote the case statement' do
120
+ it 'quotes the case statement' do
121
121
  expect(manifest).to eq(
122
- <<-EOS
122
+ <<-EOS,
123
123
  $rootgroup = $osfamily ? {
124
124
  'solaris' => 'wheel',
125
125
  /(Darwin|FreeBSD)/ => 'wheel',
@@ -141,17 +141,17 @@ describe 'unquoted_string_in_selector' do
141
141
  EOS
142
142
  end
143
143
 
144
- it 'should only detect a single problem' do
144
+ it 'onlies detect a single problem' do
145
145
  expect(problems).to have(1).problem
146
146
  end
147
147
 
148
- it 'should fix the problem' do
148
+ it 'fixes the problem' do
149
149
  expect(problems).to contain_fixed(msg).on_line(2).in_column(11)
150
150
  end
151
151
 
152
- it 'should quote the case statement' do
152
+ it 'quotes the case statement' do
153
153
  expect(manifest).to eq(
154
- <<-EOS
154
+ <<-EOS,
155
155
  $rootgroup = $osfamily ? {
156
156
  'Solaris' => 'wheel',
157
157
  /(Darwin|FreeBSD)/ => 'wheel',
@@ -180,7 +180,7 @@ describe 'unquoted_string_in_selector' do
180
180
  EOS
181
181
  end
182
182
 
183
- it 'should not detect any problems' do
183
+ it 'does not detect any problems' do
184
184
  expect(problems).to have(0).problems
185
185
  end
186
186
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppet-lint-unquoted_string-check
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 3.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,90 +16,20 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '2.1'
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.1'
29
+ version: '3'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '4'
33
- - !ruby/object:Gem::Dependency
34
- name: rspec
35
- requirement: !ruby/object:Gem::Requirement
36
- requirements:
37
- - - "~>"
38
- - !ruby/object:Gem::Version
39
- version: '3.0'
40
- type: :development
41
- prerelease: false
42
- version_requirements: !ruby/object:Gem::Requirement
43
- requirements:
44
- - - "~>"
45
- - !ruby/object:Gem::Version
46
- version: '3.0'
47
- - !ruby/object:Gem::Dependency
48
- name: rspec-its
49
- requirement: !ruby/object:Gem::Requirement
50
- requirements:
51
- - - "~>"
52
- - !ruby/object:Gem::Version
53
- version: '1.0'
54
- type: :development
55
- prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- requirements:
58
- - - "~>"
59
- - !ruby/object:Gem::Version
60
- version: '1.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: '1.0'
68
- type: :development
69
- prerelease: false
70
- version_requirements: !ruby/object:Gem::Requirement
71
- requirements:
72
- - - "~>"
73
- - !ruby/object:Gem::Version
74
- version: '1.0'
75
- - !ruby/object:Gem::Dependency
76
- name: simplecov
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'
89
- - !ruby/object:Gem::Dependency
90
- name: rake
91
- requirement: !ruby/object:Gem::Requirement
92
- requirements:
93
- - - ">="
94
- - !ruby/object:Gem::Version
95
- version: '0'
96
- type: :development
97
- prerelease: false
98
- version_requirements: !ruby/object:Gem::Requirement
99
- requirements:
100
- - - ">="
101
- - !ruby/object:Gem::Version
102
- version: '0'
32
+ version: '5'
103
33
  description: " A puppet-lint plugin to check that selectors and case statements
104
34
  cases are quoted.\n"
105
35
  email: [email protected]
@@ -110,7 +40,6 @@ files:
110
40
  - CHANGELOG.md
111
41
  - LICENSE
112
42
  - README.md
113
- - lib/puppet-lint-unquoted-string-check/version.rb
114
43
  - lib/puppet-lint/plugins/check_unquoted_string_in_case.rb
115
44
  - spec/puppet-lint/plugins/check_unquoted_string_in_case/check_unquoted_string_in_case_spec.rb
116
45
  - spec/puppet-lint/plugins/check_unquoted_string_in_case/check_unquoted_string_in_selector_spec.rb
@@ -127,7 +56,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
127
56
  requirements:
128
57
  - - ">="
129
58
  - !ruby/object:Gem::Version
130
- version: '2.4'
59
+ version: '2.7'
131
60
  required_rubygems_version: !ruby/object:Gem::Requirement
132
61
  requirements:
133
62
  - - ">="
@@ -139,7 +68,4 @@ signing_key:
139
68
  specification_version: 4
140
69
  summary: A puppet-lint plugin to check that selectors and case statements cases are
141
70
  quoted.
142
- test_files:
143
- - spec/puppet-lint/plugins/check_unquoted_string_in_case/check_unquoted_string_in_case_spec.rb
144
- - spec/puppet-lint/plugins/check_unquoted_string_in_case/check_unquoted_string_in_selector_spec.rb
145
- - spec/spec_helper.rb
71
+ test_files: []
@@ -1,4 +0,0 @@
1
- class PuppetLintUnquotedStringCheck
2
- VERSION = '2.2.0'.freeze
3
- end
4
-