puppet-lint-variable_contains_upcase 1.4.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: fa3be1ddcdaaf7ce120b5fec3d514a852f564ebb944af0fd06d86e59c2ad089b
4
- data.tar.gz: 69ca8e2ac14b1ff274f3d726dc47186cf0fd962be083d29d7a9f68a47c2a18a5
3
+ metadata.gz: 5aeea4e1cd7a95624619b745d5ae2580d4961df1934a75ac05ac039dee222802
4
+ data.tar.gz: dd9e968fb93dfcfad9841ddc3bd0ff3e562c81d05bf4d1f560e82c83952f36c6
5
5
  SHA512:
6
- metadata.gz: 70f8082c662cc879ad9612ba0a53206d99ddf9ac7c0da8cde607e24f58c424905aa5dcfdb177e96e947e656435c120557be845bdb98af26966ac2db03c3b66ee
7
- data.tar.gz: b05501872468a4b0cd5320263b264e7680e975ddb781a6c65674c6c3352d1861d52e97af7aada89c67be250aba29fc496f29bedc8a1237b26d6e10bfd846fdfd
6
+ metadata.gz: 433c99d89ddbdecd274b8d3a1024ab6222ba8acf3ffcb656d6b6e582f2c23cae73fb903f10863d2a53c7cb8510a168ce6d0c01c6e857564535824236e1a8176a
7
+ data.tar.gz: 7b4094b7fddb887d2bdb8304104e930bbc9192e3c208b113822f59391e674d97575bbd256e4e481496ea36c1679e9a0830d9c39f916e86e8e7625d915dcd1915
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,6 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'puppet-lint'
4
+ require 'rspec/collection_matchers'
2
5
 
3
6
  PuppetLint::Plugins.load_spec_helper
metadata CHANGED
@@ -1,108 +1,32 @@
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: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Spence
8
- autorequire:
8
+ - Vox Pupuli
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-04-21 00:00:00.000000000 Z
11
+ date: 1980-01-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: puppet-lint
15
15
  requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '1.0'
20
- - - "<"
21
- - !ruby/object:Gem::Version
22
- version: '5'
23
- type: :runtime
24
- prerelease: false
25
- version_requirements: !ruby/object:Gem::Requirement
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- version: '1.0'
30
- - - "<"
31
- - !ruby/object:Gem::Version
32
- 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
16
  requirements:
58
17
  - - "~>"
59
18
  - !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
19
+ version: '5.1'
20
+ type: :runtime
69
21
  prerelease: false
70
22
  version_requirements: !ruby/object:Gem::Requirement
71
23
  requirements:
72
24
  - - "~>"
73
25
  - !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'
26
+ version: '5.1'
103
27
  description: " Extends puppet-lint to ensure that your variables are all lower
104
28
  case\n"
105
- email: chris@spence.org.uk
29
+ email: voxpupuli@groups.io
106
30
  executables: []
107
31
  extensions: []
108
32
  extra_rdoc_files: []
@@ -116,7 +40,6 @@ homepage: https://github.com/fiddyspence/puppetlint-variablecase
116
40
  licenses:
117
41
  - MIT
118
42
  metadata: {}
119
- post_install_message:
120
43
  rdoc_options: []
121
44
  require_paths:
122
45
  - lib
@@ -124,17 +47,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
124
47
  requirements:
125
48
  - - ">="
126
49
  - !ruby/object:Gem::Version
127
- version: '0'
50
+ version: '3.2'
128
51
  required_rubygems_version: !ruby/object:Gem::Requirement
129
52
  requirements:
130
53
  - - ">="
131
54
  - !ruby/object:Gem::Version
132
55
  version: '0'
133
56
  requirements: []
134
- rubygems_version: 3.1.2
135
- signing_key:
57
+ rubygems_version: 3.6.9
136
58
  specification_version: 4
137
59
  summary: puppet-lint variable_case check
138
- test_files:
139
- - spec/spec_helper.rb
140
- - spec/puppet-lint/plugins/variable_contains_upcase_spec.rb
60
+ test_files: []