puppet-lint-variable_contains_upcase 1.4.0 → 2.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: fa3be1ddcdaaf7ce120b5fec3d514a852f564ebb944af0fd06d86e59c2ad089b
4
- data.tar.gz: 69ca8e2ac14b1ff274f3d726dc47186cf0fd962be083d29d7a9f68a47c2a18a5
3
+ metadata.gz: 53f83cc785ebbf6c955776bca8ed589bbf4125ec5863de41bfba6a79791a03a9
4
+ data.tar.gz: d516ef68f776c3321f2cd756100390e96915f5d22167f1513fe613b6d235033a
5
5
  SHA512:
6
- metadata.gz: 70f8082c662cc879ad9612ba0a53206d99ddf9ac7c0da8cde607e24f58c424905aa5dcfdb177e96e947e656435c120557be845bdb98af26966ac2db03c3b66ee
7
- data.tar.gz: b05501872468a4b0cd5320263b264e7680e975ddb781a6c65674c6c3352d1861d52e97af7aada89c67be250aba29fc496f29bedc8a1237b26d6e10bfd846fdfd
6
+ metadata.gz: 7abcd5a41b439ac9baa565b14bead8edd7be0663b7ae4a85384e866f2259d2b120d1be415c2ec3900bbf0972f32f2650c36dfe55e8a82171b80ef753f2fcf7b9
7
+ data.tar.gz: 3f9e5d48e21a05df17d3d94266cadc64f9cf4fe9a8db47ee4f9b4beb22486b576324701cc67cced2a714d2760c9196d7686cc6eca8c82e966d18b6cceae5a25c
data/README.md CHANGED
@@ -1,6 +1,29 @@
1
1
  # Puppet lint check for upcase variables
2
2
 
3
- [![Build Status](https://travis-ci.org/fiddyspence/puppetlint-variablecase.png?branch=master)](https://travis-ci.org/fiddyspence/puppetlint-variablecase)
3
+ [![License](https://img.shields.io/github/license/voxpupuli/puppet-lint-variable_contains_upcase.svg)](https://github.com/voxpupuli/puppet-lint-variable_contains_upcase/blob/master/LICENSE)
4
+ [![Test](https://github.com/voxpupuli/puppet-lint-variable_contains_upcase/actions/workflows/test.yml/badge.svg)](https://github.com/voxpupuli/puppet-lint-variable_contains_upcase/actions/workflows/test.yml)
5
+ [![Release](https://github.com/voxpupuli/puppet-lint-variable_contains_upcase/actions/workflows/release.yml/badge.svg)](https://github.com/voxpupuli/puppet-lint-variable_contains_upcase/actions/workflows/release.yml)
6
+ [![RubyGem Version](https://img.shields.io/gem/v/puppet-lint-variable_contains_upcase.svg)](https://rubygems.org/gems/puppet-lint-variable_contains_upcase)
7
+ [![RubyGem Downloads](https://img.shields.io/gem/dt/puppet-lint-variable_contains_upcase.svg)](https://rubygems.org/gems/puppet-lint-variable_contains_upcase)
8
+ [![Donated by Chris Spence](https://img.shields.io/badge/donated%20by-Chris%%20Spence-fb7047.svg)](#transfer-notice)
4
9
 
5
10
  The future parser disallows mixed case variables, so this check implements
6
11
  warnings for them
12
+
13
+ ## Transfer Notice
14
+
15
+ This plugin was originally authored by [Chris Spence](https://github.com/fiddyspence).
16
+ The maintainer preferred that [Vox Pupuli](https://voxpupuli.org/) take ownership of the module for future improvement and maintenance.
17
+
18
+ ## License
19
+
20
+ This gem is licensed under the MIT license.
21
+
22
+ ## Release information
23
+
24
+ To make a new release, please do:
25
+ * Update the version in the `puppet-lint-variable_contains_upcase.gemspec` file
26
+ * Install gems with `bundle install --with release --path .vendor`
27
+ * generate the changelog with `bundle exec rake changelog`
28
+ * Create a PR with it
29
+ * After it got merged, push a tag. A github workflow will do the actual release
@@ -1,18 +1,19 @@
1
1
  PuppetLint.new_check(:variable_contains_upcase) do
2
2
  def check
3
- tokens.select { |r|
3
+ tokens.select do |r|
4
4
  Set[:VARIABLE, :UNENC_VARIABLE].include? r.type
5
- }.each do |token|
6
- if token.value.gsub(/\[.+?\]/, '').match(/[A-Z]/)
7
- notify :warning, {
8
- :message => 'variable contains a capital letter',
9
- :line => token.line,
10
- :column => token.column,
11
- :token => token,
12
- }
13
- end
5
+ end.each do |token|
6
+ next unless /[A-Z]/.match?(token.value.gsub(/\[.+?\]/, ''))
7
+
8
+ notify :warning, {
9
+ message: 'variable contains a capital letter',
10
+ line: token.line,
11
+ column: token.column,
12
+ token: token,
13
+ }
14
14
  end
15
15
  end
16
+
16
17
  def fix(problem)
17
18
  problem[:token].value.downcase!
18
19
  end
@@ -6,11 +6,11 @@ describe 'variable_contains_upcase' do
6
6
  context 'a variable containing a capital' do
7
7
  let(:code) { '$fOobar' }
8
8
 
9
- it 'should only detect a single problem' do
9
+ it 'onlies detect a single problem' do
10
10
  expect(problems).to have(1).problem
11
11
  end
12
12
 
13
- it 'should create a warning' do
13
+ it 'creates a warning' do
14
14
  expect(problems).to contain_warning(msg).on_line(1).in_column(1)
15
15
  end
16
16
  end
@@ -18,11 +18,11 @@ describe 'variable_contains_upcase' do
18
18
  context 'variable containing a capital' do
19
19
  let(:code) { '" $fOobar"' }
20
20
 
21
- it 'should only detect a single problem' do
21
+ it 'onlies detect a single problem' do
22
22
  expect(problems).to have(1).problem
23
23
  end
24
24
 
25
- it 'should create a warning' do
25
+ it 'creates a warning' do
26
26
  expect(problems).to contain_warning(msg).on_line(1).in_column(3)
27
27
  end
28
28
  end
@@ -39,15 +39,15 @@ describe 'variable_contains_upcase' do
39
39
  context 'fix variable containing a capital' do
40
40
  let(:code) { '" $fOobar"' }
41
41
 
42
- it 'should only detect a single problem' do
42
+ it 'onlies detect a single problem' do
43
43
  expect(problems).to have(1).problem
44
44
  end
45
45
 
46
- it 'should fix the manifest' do
46
+ it 'fixes the manifest' do
47
47
  expect(problems).to contain_fixed(msg).on_line(1).in_column(3)
48
48
  end
49
49
 
50
- it 'should downcase the variable name' do
50
+ it 'downcases the variable name' do
51
51
  expect(manifest).to eq('" $foobar"')
52
52
  end
53
53
  end
@@ -55,21 +55,23 @@ describe 'variable_contains_upcase' do
55
55
  context 'a hash with an upcase key should not fail' do
56
56
  let(:code) { ' $myhash["Foo"]' }
57
57
 
58
- it 'should not detect a single problem' do
58
+ it 'does not detect a single problem' do
59
59
  expect(problems).to have(0).problem
60
60
  end
61
61
  end
62
+
62
63
  context 'a hash with an upcase key should not fail' do
63
64
  let(:code) { ' $myhash["Foo"]["bAr"]' }
64
65
 
65
- it 'should not detect a single problem' do
66
+ it 'does not detect a single problem' do
66
67
  expect(problems).to have(0).problem
67
68
  end
68
69
  end
70
+
69
71
  context 'a hash variable with an upcase key should fail' do
70
72
  let(:code) { ' $myHash["foo"]["bar"]' }
71
73
 
72
- it 'should detect a single problem' do
74
+ it 'detects a single problem' do
73
75
  expect(problems).to have(1).problem
74
76
  end
75
77
  end
data/spec/spec_helper.rb CHANGED
@@ -1,3 +1,29 @@
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
26
+
1
27
  require 'puppet-lint'
2
28
 
3
29
  PuppetLint::Plugins.load_spec_helper
metadata CHANGED
@@ -1,10 +1,11 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppet-lint-variable_contains_upcase
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Spence
8
+ - Vox Pupuli
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
@@ -16,7 +17,7 @@ dependencies:
16
17
  requirements:
17
18
  - - ">="
18
19
  - !ruby/object:Gem::Version
19
- version: '1.0'
20
+ version: '3'
20
21
  - - "<"
21
22
  - !ruby/object:Gem::Version
22
23
  version: '5'
@@ -26,83 +27,13 @@ dependencies:
26
27
  requirements:
27
28
  - - ">="
28
29
  - !ruby/object:Gem::Version
29
- version: '1.0'
30
+ version: '3'
30
31
  - - "<"
31
32
  - !ruby/object:Gem::Version
32
33
  version: '5'
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: rake
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-json_expectations
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'
103
34
  description: " Extends puppet-lint to ensure that your variables are all lower
104
35
  case\n"
105
- email: chris@spence.org.uk
36
+ email: voxpupuli@groups.io
106
37
  executables: []
107
38
  extensions: []
108
39
  extra_rdoc_files: []
@@ -124,17 +55,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
124
55
  requirements:
125
56
  - - ">="
126
57
  - !ruby/object:Gem::Version
127
- version: '0'
58
+ version: 2.7.0
128
59
  required_rubygems_version: !ruby/object:Gem::Requirement
129
60
  requirements:
130
61
  - - ">="
131
62
  - !ruby/object:Gem::Version
132
63
  version: '0'
133
64
  requirements: []
134
- rubygems_version: 3.1.2
65
+ rubygems_version: 3.2.33
135
66
  signing_key:
136
67
  specification_version: 4
137
68
  summary: puppet-lint variable_case check
138
- test_files:
139
- - spec/spec_helper.rb
140
- - spec/puppet-lint/plugins/variable_contains_upcase_spec.rb
69
+ test_files: []