puppet-lint-absolute_classname-check 3.0.1 → 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: 0242bd18a491a4b01bfddbc2c16a09bdd988dfb2629c0e09297504f2e679cbfb
4
- data.tar.gz: 15079e58e64171b9147a451c6bd937c70aa493c0a0c4cb28cd653e4c8adddaf4
3
+ metadata.gz: 44d9484de2d04ad14e0eb4ed9c17424b72c319a94b49fb823622a98fa85771d5
4
+ data.tar.gz: 589a21445dbf0baade77d8bc94c0217573b0767c838e86dd71d365d6dc43f8f4
5
5
  SHA512:
6
- metadata.gz: ee1bf3d638248a5d8af48107cc7eb4f00c6ac5dcfa388b909f1a49fd00a08966c43d1963abbc21252a876b3488445609409cb55af377faaa40ba2b2584378b78
7
- data.tar.gz: 356f61d658b2b154fae41285f5bcd192b3eaa44fc268443c842052683d64837faf3a9835be8c06b492d094c0dd476a419b02f5ff97c5fd887e0a4d9ab8d5c0db
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
data/spec/spec_helper.rb CHANGED
@@ -1,5 +1,29 @@
1
- require 'coveralls'
2
- Coveralls.wear!
1
+ # frozen_string_literal: true
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
3
26
 
4
27
  require 'puppet-lint'
28
+
5
29
  PuppetLint::Plugins.load_spec_helper
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.0.1
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: 2021-06-19 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: '1.0'
19
+ version: '3.0'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '3.0'
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
- - !ruby/object:Gem::Version
29
- version: '1.0'
30
- - - "<"
31
28
  - !ruby/object:Gem::Version
32
29
  version: '3.0'
33
- - !ruby/object:Gem::Dependency
34
- name: coveralls
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: rake
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
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-collection_matchers
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: rspec-its
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
- - - ">="
30
+ - - "<"
101
31
  - !ruby/object:Gem::Version
102
- version: '0'
32
+ version: '5'
103
33
  description: " A puppet-lint plugin to check that classes are not included or referenced
104
34
  by their absolute name.\n"
105
35
  email: voxpupuli@groups.io
@@ -126,19 +56,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
126
56
  requirements:
127
57
  - - ">="
128
58
  - !ruby/object:Gem::Version
129
- version: 2.1.0
59
+ version: 2.7.0
130
60
  required_rubygems_version: !ruby/object:Gem::Requirement
131
61
  requirements:
132
62
  - - ">="
133
63
  - !ruby/object:Gem::Version
134
64
  version: '0'
135
65
  requirements: []
136
- rubygems_version: 3.2.15
66
+ rubygems_version: 3.2.33
137
67
  signing_key:
138
68
  specification_version: 4
139
69
  summary: A puppet-lint plugin to check that classes are not included or referenced
140
70
  by their absolute name.
141
- test_files:
142
- - spec/puppet-lint/plugins/check_absolute_classname/relative_classname_inclusion_spec.rb
143
- - spec/puppet-lint/plugins/check_classname_reference/relative_classname_reference_spec.rb
144
- - spec/spec_helper.rb
71
+ test_files: []