puppet-lint-variable_contains_upcase 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ MWMzYmI5ZDk0NWQwYzk4YjdlNzIwN2Y1YjU1ZGJlNTNjODE1YTg0ZA==
5
+ data.tar.gz: !binary |-
6
+ MTRhNmEyYjQ0ODkyZGY1YjcyZGNlMTQwMGI0YWJhOWNiM2YxNTdiNA==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ NTI1ZTU5N2M0MjEyZTUxNDQyNDgwOTBiZTIwNzcxNTQ2YjkzNzVmMjMzMGY4
10
+ YmI3NTFhNTNhZDRhZDk5YzcyYzZkM2FmNWE5NTY4NGQ4MmU2MjM3MTc5YjYy
11
+ Mjg1NThjNTU1MmJlOGI3ZTlhYWQzZjIyM2RhOGFiZmEzMjQ2ZTM=
12
+ data.tar.gz: !binary |-
13
+ ZTljODlkMjNiZDJkZTc3M2I3NjgyYjFiMWMxZTUzMzE2MjdkMmE5MzRhMGMx
14
+ Nzc0ZjlkYjc3YzJmOGM3Y2E4ODI5YTA0Y2I5ZDcxYjdhNjliYmI1YTg0Mzc2
15
+ ODJkMGQ0NTEyOTAxYzE5ZGE2NDExOTU2ZGNmMzI4OGRhMWM5MmM=
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014 Chris Spence
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,4 @@
1
+ # Puppet lint check for upcase variables
2
+
3
+ The future parser disallows mixed case variables, so this check implements
4
+ warnings for them
@@ -0,0 +1,15 @@
1
+ PuppetLint.new_check(:variable_contains_upcase) do
2
+ def check
3
+ tokens.select { |r|
4
+ VARIABLE_TYPES.include? r.type
5
+ }.each do |token|
6
+ if token.value.match(/[A-Z]/)
7
+ notify :warning, {
8
+ :message => 'variable contains a capital letter',
9
+ :line => token.line,
10
+ :column => token.column,
11
+ }
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,29 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'variable_contains_upcase' do
4
+ let(:msg) { 'variable contains a capital letter' }
5
+
6
+ context 'a variable containing a capital' do
7
+ let(:code) { '$fOobar' }
8
+
9
+ it 'should only detect a single problem' do
10
+ expect(problems).to have(1).problem
11
+ end
12
+
13
+ it 'should create a warning' do
14
+ expect(problems).to contain_warning(msg).on_line(1).in_column(1)
15
+ end
16
+ end
17
+
18
+ context 'variable containing a capital' do
19
+ let(:code) { '" $fOobar"' }
20
+
21
+ it 'should only detect a single problem' do
22
+ expect(problems).to have(1).problem
23
+ end
24
+
25
+ it 'should create a warning' do
26
+ expect(problems).to contain_warning(msg).on_line(1).in_column(3)
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,3 @@
1
+ require 'puppet-lint'
2
+
3
+ PuppetLint::Plugins.load_spec_helper
metadata ADDED
@@ -0,0 +1,124 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: puppet-lint-variable_contains_upcase
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Chris Spence
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-08-19 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: puppet-lint
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '3.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '3.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec-its
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '1.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '1.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec-collection_matchers
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '1.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: '1.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ! '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ! '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: ! ' Extends puppet-lint to ensure that your variables are all lower
84
+ case
85
+
86
+ '
87
+ email: chris@spence.org.uk
88
+ executables: []
89
+ extensions: []
90
+ extra_rdoc_files: []
91
+ files:
92
+ - LICENSE
93
+ - README.md
94
+ - lib/puppet-lint/plugins/variable_contains_upcase.rb
95
+ - spec/puppet-lint/plugins/variable_contains_upcase_spec.rb
96
+ - spec/spec_helper.rb
97
+ homepage: https://github.com/fiddyspence/puppetlint-variablecase
98
+ licenses:
99
+ - MIT
100
+ metadata: {}
101
+ post_install_message:
102
+ rdoc_options: []
103
+ require_paths:
104
+ - lib
105
+ required_ruby_version: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ required_rubygems_version: !ruby/object:Gem::Requirement
111
+ requirements:
112
+ - - ! '>='
113
+ - !ruby/object:Gem::Version
114
+ version: '0'
115
+ requirements: []
116
+ rubyforge_project:
117
+ rubygems_version: 2.4.1
118
+ signing_key:
119
+ specification_version: 4
120
+ summary: puppet-lint variable_case check
121
+ test_files:
122
+ - spec/puppet-lint/plugins/variable_contains_upcase_spec.rb
123
+ - spec/spec_helper.rb
124
+ has_rdoc: