puppet-lint-absolute_classname-check 3.1.0 → 5.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: 86140cad9c7e991e50d45bb4bc896788b16a64776749c5cbbb80f29032bc1692
4
- data.tar.gz: 716c53d528e10c3bcda030e1c19cc54c017346556fb98ff580a698fc32542680
3
+ metadata.gz: bab4eb9b4aef059a9c8504154fae11e0255f60d5189917cca60e2cfb34b3303b
4
+ data.tar.gz: cb99d84abdd3643e7716cfbcd8acaa305e01044cacde4ef357a2356027598207
5
5
  SHA512:
6
- metadata.gz: 51b2d31cff4c997644a034a97c909c950ac67e59c3ddec2135b21bcc1a096e0357d48e61fd15d89ddbdfb0643bdac37e3e1f32c956f748c89c79ba348a6e3b52
7
- data.tar.gz: 0ce3da50d95b4643d37b99e526b887c0ae7fa876abbb2c60917420a8c10b69efaa5c59714c09f57f4a42ef18d0cd5df7bc48aaa6620ab6322ca92d0067e90ea8
6
+ metadata.gz: 04e32d38a39f8971047041bef61928e17a4bbf10b2094dd87179ff7596714bf36abefcaa15723effb7f031943024b21868fc84446a0bd002579620f2ae9f0265
7
+ data.tar.gz: 7dd31a3d2d1554008030ae3dba22257573be9a7c9f06e96bcdd251c01728f5e7c1e36e84da23b63ff53b71b8c161408283b7977089dda495f6c544fe217a78f4
@@ -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
@@ -30,12 +30,12 @@ PuppetLint.new_check(:relative_classname_inclusion) do
30
30
  elsif token.type == :CLASS and token.next_code_token.type == :LBRACE
31
31
  s = token.next_code_token
32
32
  while s.type != :COLON
33
- if (s.type == :NAME || s.type == :SSTRING) && s.value.start_with?('::')
33
+ if %i[NAME SSTRING].include?(s.type) && s.value.start_with?('::')
34
34
  notify :warning, {
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 %i[NAME SSTRING].include?(s.type) && 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
data/spec/spec_helper.rb CHANGED
@@ -1,29 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- begin
4
- require 'simplecov'
5
- require 'simplecov-console'
6
- require 'codecov'
7
- rescue LoadError
8
- else
9
- SimpleCov.start do
10
- track_files 'lib/**/*.rb'
11
-
12
- add_filter '/spec'
13
-
14
- enable_coverage :branch
15
-
16
- # do not track vendored files
17
- add_filter '/vendor'
18
- add_filter '/.vendor'
19
- end
20
-
21
- SimpleCov.formatters = [
22
- SimpleCov::Formatter::Console,
23
- SimpleCov::Formatter::Codecov,
24
- ]
25
- end
26
-
27
3
  require 'puppet-lint'
4
+ require 'rspec/collection_matchers'
28
5
 
29
6
  PuppetLint::Plugins.load_spec_helper
metadata CHANGED
@@ -1,91 +1,28 @@
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: 5.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vox Pupuli
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2022-11-29 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: puppet-lint
15
14
  requirement: !ruby/object:Gem::Requirement
16
15
  requirements:
17
- - - ">="
16
+ - - "~>"
18
17
  - !ruby/object:Gem::Version
19
- version: '1.0'
20
- - - "<"
21
- - !ruby/object:Gem::Version
22
- version: '4'
18
+ version: '5.1'
23
19
  type: :runtime
24
20
  prerelease: false
25
21
  version_requirements: !ruby/object:Gem::Requirement
26
22
  requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- version: '1.0'
30
- - - "<"
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
- - - ">="
23
+ - - "~>"
45
24
  - !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'
25
+ version: '5.1'
89
26
  description: " A puppet-lint plugin to check that classes are not included or referenced
90
27
  by their absolute name.\n"
91
28
  email: voxpupuli@groups.io
@@ -104,7 +41,6 @@ homepage: https://github.com/voxpupuli/puppet-lint-absolute_classname-check
104
41
  licenses:
105
42
  - Apache-2.0
106
43
  metadata: {}
107
- post_install_message:
108
44
  rdoc_options: []
109
45
  require_paths:
110
46
  - lib
@@ -112,19 +48,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
112
48
  requirements:
113
49
  - - ">="
114
50
  - !ruby/object:Gem::Version
115
- version: 2.1.0
51
+ version: '3.2'
116
52
  required_rubygems_version: !ruby/object:Gem::Requirement
117
53
  requirements:
118
54
  - - ">="
119
55
  - !ruby/object:Gem::Version
120
56
  version: '0'
121
57
  requirements: []
122
- rubygems_version: 3.2.33
123
- signing_key:
58
+ rubygems_version: 3.6.9
124
59
  specification_version: 4
125
60
  summary: A puppet-lint plugin to check that classes are not included or referenced
126
61
  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
62
+ test_files: []