puppet-lint-trailing_comma-check 0.4.1 → 0.4.3

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: 86adcccda246662d25e00fa8d9daa1527e6203493c1ee0cbd2bda4e2c4b769cc
4
- data.tar.gz: 26976dd1f21925da59d0a0ddc11339ab7a9a1044ae740267b237d601d1547637
3
+ metadata.gz: e41a473856855e19fc39972572b59cac85c269c727bd8039f336d99f6a33e26f
4
+ data.tar.gz: f52de49ea2fcc778284152f288c30f2496eea22a1b8b795950a6e462d738fbf7
5
5
  SHA512:
6
- metadata.gz: 294d7eb8f6f53ea7c349b961ad0a6216aae23c95294b15c7b4089d42507e0743eb3685732c66cdbdfdeb119ff48a5caf95080c14ecee91485f89f2500bca42a7
7
- data.tar.gz: 6b239638d055253653177221acf1a5c9d0b8e6611bd0825c611017236c64761995c0d79f96d93e3db5e3791f9f072486e57d83fd0f1b274e0d6cd4ffc25e3563
6
+ metadata.gz: 5e8e7368247209d0c36040c0fb95c74cbe6a9779397b75dc3800ef95c7de9532ff7bfa42543f6e3f3b44d573600e4ff2a40ff44ba04f5eee3be30fb69d43adcc
7
+ data.tar.gz: 46cffcde63d6f3d46230c0fad39764eb062fe09d125636c94a0ef3be911cf83bc465125459ee0f64d7a2996d6a9e18c5fb581a7864aa3115b188ecc1a56c7365
data/README.md CHANGED
@@ -2,11 +2,11 @@ puppet-lint-trailing_comma-check
2
2
  =================================
3
3
 
4
4
  [![License](https://img.shields.io/github/license/voxpupuli/puppet-lint-trailing_comma-check.svg)](https://github.com/voxpupuli/puppet-lint-trailing_comma-check/blob/master/LICENSE)
5
- [![Build Status](https://img.shields.io/travis/voxpupuli/puppet-lint-trailing_comma-check.svg)](https://travis-ci.org/voxpupuli/puppet-lint-trailing_comma-check)
6
- [![Gem Version](https://img.shields.io/gem/v/puppet-lint-trailing_comma-check.svg)](https://rubygems.org/gems/puppet-lint-trailing_comma-check)
7
- [![Gem Downloads](https://img.shields.io/gem/dt/puppet-lint-trailing_comma-check.svg)](https://rubygems.org/gems/puppet-lint-trailing_comma-check)
5
+ [![Test](https://github.com/voxpupuli/puppet-lint-trailing_comma-check/actions/workflows/test.yml/badge.svg)](https://github.com/voxpupuli/puppet-lint-trailing_comma-check/actions/workflows/test.yml)
6
+ [![Release](https://github.com/voxpupuli/puppet-lint-trailing_comma-check/actions/workflows/release.yml/badge.svg)](https://github.com/voxpupuli/puppet-lint-trailing_comma-check/actions/workflows/release.yml)
7
+ [![RubyGem Version](https://img.shields.io/gem/v/puppet-lint-trailing_comma-check.svg)](https://rubygems.org/gems/puppet-lint-trailing_comma-check)
8
+ [![RubyGem Downloads](https://img.shields.io/gem/dt/puppet-lint-trailing_comma-check.svg)](https://rubygems.org/gems/puppet-lint-trailing_comma-check)
8
9
  [![Coverage Status](https://coveralls.io/repos/github/voxpupuli/puppet-lint-trailing_comma-check/badge.svg?branch=master)](https://coveralls.io/github/voxpupuli/puppet-lint-trailing_comma-check?branch=master)
9
- [![Dependency Status](https://gemnasium.com/badges/github.com/voxpupuli/puppet-lint-trailing_comma-check.svg)](https://gemnasium.com/github.com/voxpupuli/puppet-lint-trailing_comma-check)
10
10
  [![Donated by Camptocamp](https://img.shields.io/badge/donated%20by-camptocamp-fb7047.svg)](#transfer-notice)
11
11
 
12
12
  A puppet-lint plugin to check for missing trailing commas.
@@ -70,3 +70,17 @@ The maintainer preferred that Puppet Community take ownership of the module for
70
70
  Existing pull requests and issues were transferred over, please fork and continue to contribute here instead of Camptocamp.
71
71
 
72
72
  Previously: https://github.com/camptocamp/puppet-lint-trailing_comma-check
73
+
74
+ ## License
75
+
76
+ This gem is licensed under the Apache-2 license.
77
+
78
+ ## Release information
79
+
80
+ To make a new release, please do:
81
+ * update the version in the gemspec file
82
+ * Install gems with `bundle install --with release --path .vendor`
83
+ * generate the changelog with `bundle exec rake changelog`
84
+ * Check if the new version matches the closed issues/PRs in the changelog
85
+ * Create a PR with it
86
+ * After it got merged, push a tag. GitHub actions will do the actual release to rubygems and GitHub Packages
@@ -13,6 +13,11 @@ PuppetLint.new_check(:trailing_comma) do
13
13
  # Ignore resource references
14
14
  next if token.prev_code_token && \
15
15
  token.prev_code_token.type == :CLASSREF
16
+
17
+ # Ignore data types
18
+ next if token.prev_code_token && \
19
+ token.prev_code_token.type == :TYPE
20
+
16
21
  arrays << {
17
22
  :start => token_idx,
18
23
  :end => real_idx,
@@ -62,7 +67,7 @@ PuppetLint.new_check(:trailing_comma) do
62
67
  # Ensure that we aren't matching a function return type:
63
68
  token.prev_code_token.type != :RSHIFT && \
64
69
  # Or a conditional matching a type:
65
- token.prev_code_token.type != :MATCH
70
+ ! [:MATCH, :NOMATCH].include?(token.prev_code_token.type)
66
71
  real_idx = 0
67
72
 
68
73
  tokens[token_idx+1..-1].each_with_index do |cur_token, cur_token_idx|
@@ -10,6 +10,11 @@ describe 'trailing_comma' do
10
10
  class { '::apache':
11
11
  timeout => '100',
12
12
  docroot => '/var/www',
13
+ Enum[
14
+ 'a',
15
+ 'b',
16
+ 'c'
17
+ ] $test = 'c',
13
18
  }
14
19
 
15
20
  class{ '::nginx': }
@@ -66,6 +71,16 @@ describe 'trailing_comma' do
66
71
  if $var =~ Sensitive {
67
72
  $foo = $var.unwrap
68
73
  }
74
+
75
+ if $var !~ Mymodule::MyType {
76
+ fail("encountered error ${err}")
77
+ }
78
+
79
+ $test = [
80
+ 'a',
81
+ 'b',
82
+ 'c',
83
+ ],
69
84
  EOS
70
85
  }
71
86
 
@@ -79,7 +94,12 @@ describe 'trailing_comma' do
79
94
  <<-EOS
80
95
  class { '::apache':
81
96
  timeout => '100',
82
- docroot => '/var/www'
97
+ docroot => '/var/www',
98
+ Enum[
99
+ 'a',
100
+ 'b',
101
+ 'c'
102
+ ] $test = 'c'
83
103
  }
84
104
 
85
105
  class{ '::nginx': }
@@ -125,20 +145,27 @@ describe 'trailing_comma' do
125
145
  '/etc/baz.conf', '/etc/baz.conf.d'
126
146
  ],
127
147
  }
148
+
149
+ $test = [
150
+ 'a',
151
+ 'b',
152
+ 'c'
153
+ ]
128
154
  EOS
129
155
  }
130
156
 
131
- it 'should detect 6 problems' do
132
- expect(problems).to have(6).problems
157
+ it 'should detect 7 problems' do
158
+ expect(problems).to have(7).problems
133
159
  end
134
160
 
135
161
  it 'should create warnings' do
136
- expect(problems).to contain_warning(msg).on_line(3).in_column(32)
137
- expect(problems).to contain_warning(msg).on_line(10).in_column(27)
138
- expect(problems).to contain_warning(msg).on_line(24).in_column(18)
139
- expect(problems).to contain_warning(msg).on_line(33).in_column(23)
140
- expect(problems).to contain_warning(msg).on_line(39).in_column(26)
141
- expect(problems).to contain_warning(msg).on_line(41).in_column(25)
162
+ expect(problems).to contain_warning(msg).on_line(8).in_column(24)
163
+ expect(problems).to contain_warning(msg).on_line(15).in_column(27)
164
+ expect(problems).to contain_warning(msg).on_line(29).in_column(18)
165
+ expect(problems).to contain_warning(msg).on_line(38).in_column(23)
166
+ expect(problems).to contain_warning(msg).on_line(44).in_column(26)
167
+ expect(problems).to contain_warning(msg).on_line(46).in_column(25)
168
+ expect(problems).to contain_warning(msg).on_line(58).in_column(14)
142
169
  end
143
170
  end
144
171
 
@@ -219,6 +246,11 @@ describe 'trailing_comma' do
219
246
  class { '::apache':
220
247
  timeout => '100',
221
248
  docroot => '/var/www',
249
+ Enum[
250
+ 'a',
251
+ 'b',
252
+ 'c'
253
+ ] $test = 'c',
222
254
  }
223
255
 
224
256
  class{ '::nginx': }
@@ -264,6 +296,12 @@ describe 'trailing_comma' do
264
296
  '/etc/baz.conf', '/etc/baz.conf.d'
265
297
  ],
266
298
  }
299
+
300
+ $test = [
301
+ 'a',
302
+ 'b',
303
+ 'c',
304
+ ],
267
305
  EOS
268
306
  }
269
307
 
@@ -281,7 +319,12 @@ describe 'trailing_comma' do
281
319
  <<-EOS
282
320
  class { '::apache':
283
321
  timeout => '100',
284
- docroot => '/var/www'
322
+ docroot => '/var/www',
323
+ Enum[
324
+ 'a',
325
+ 'b',
326
+ 'c'
327
+ ] $test = 'c'
285
328
  }
286
329
 
287
330
  class{ '::nginx': }
@@ -327,20 +370,27 @@ describe 'trailing_comma' do
327
370
  '/etc/baz.conf', '/etc/baz.conf.d'
328
371
  ],
329
372
  }
373
+
374
+ $test = [
375
+ 'a',
376
+ 'b',
377
+ 'c'
378
+ ]
330
379
  EOS
331
380
  }
332
381
 
333
- it 'should detect 6 problems' do
334
- expect(problems).to have(6).problems
382
+ it 'should detect 7 problems' do
383
+ expect(problems).to have(7).problems
335
384
  end
336
385
 
337
386
  it 'should create a warning' do
338
- expect(problems).to contain_fixed(msg).on_line(3).in_column(32)
339
- expect(problems).to contain_fixed(msg).on_line(10).in_column(27)
340
- expect(problems).to contain_fixed(msg).on_line(24).in_column(18)
341
- expect(problems).to contain_fixed(msg).on_line(33).in_column(23)
342
- expect(problems).to contain_fixed(msg).on_line(39).in_column(26)
343
- expect(problems).to contain_fixed(msg).on_line(41).in_column(25)
387
+ expect(problems).to contain_fixed(msg).on_line(8).in_column(24)
388
+ expect(problems).to contain_fixed(msg).on_line(15).in_column(27)
389
+ expect(problems).to contain_fixed(msg).on_line(29).in_column(18)
390
+ expect(problems).to contain_fixed(msg).on_line(38).in_column(23)
391
+ expect(problems).to contain_fixed(msg).on_line(44).in_column(26)
392
+ expect(problems).to contain_fixed(msg).on_line(46).in_column(25)
393
+ expect(problems).to contain_fixed(msg).on_line(58).in_column(14)
344
394
  end
345
395
 
346
396
  it 'should add trailing commas' do
@@ -349,6 +399,11 @@ describe 'trailing_comma' do
349
399
  class { '::apache':
350
400
  timeout => '100',
351
401
  docroot => '/var/www',
402
+ Enum[
403
+ 'a',
404
+ 'b',
405
+ 'c'
406
+ ] $test = 'c',
352
407
  }
353
408
 
354
409
  class{ '::nginx': }
@@ -394,7 +449,13 @@ describe 'trailing_comma' do
394
449
  '/etc/baz.conf', '/etc/baz.conf.d'
395
450
  ],
396
451
  }
397
- EOS
452
+
453
+ $test = [
454
+ 'a',
455
+ 'b',
456
+ 'c',
457
+ ]
458
+ EOS
398
459
  )
399
460
  end
400
461
  end
data/spec/spec_helper.rb CHANGED
@@ -1,5 +1,28 @@
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'
5
28
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppet-lint-trailing_comma-check
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
- - Puppet Community
7
+ - Vox Pupuli
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-24 00:00:00.000000000 Z
11
+ date: 2022-10-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: puppet-lint
@@ -73,21 +73,7 @@ dependencies:
73
73
  - !ruby/object:Gem::Version
74
74
  version: '1.0'
75
75
  - !ruby/object:Gem::Dependency
76
- name: mime-types
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: coveralls
76
+ name: simplecov
91
77
  requirement: !ruby/object:Gem::Requirement
92
78
  requirements:
93
79
  - - ">="
@@ -114,9 +100,8 @@ dependencies:
114
100
  - - ">="
115
101
  - !ruby/object:Gem::Version
116
102
  version: '0'
117
- description: |2
118
- A puppet-lint plugin to check for missing trailing commas.
119
- email: raphael.pinson@camptocamp.com
103
+ description: " A puppet-lint plugin to check for missing trailing commas.\n"
104
+ email: voxpupuli@groups.io
120
105
  executables: []
121
106
  extensions: []
122
107
  extra_rdoc_files: []
@@ -145,8 +130,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
145
130
  - !ruby/object:Gem::Version
146
131
  version: '0'
147
132
  requirements: []
148
- rubyforge_project:
149
- rubygems_version: 2.7.7
133
+ rubygems_version: 3.2.33
150
134
  signing_key:
151
135
  specification_version: 4
152
136
  summary: A puppet-lint plugin to check for missing trailing commas.