puppet-lint-numericvariable 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/LICENSE +21 -0
- data/README.md +5 -0
- data/lib/puppet-lint/plugins/numeric_variable.rb +15 -0
- data/spec/puppet-lint/plugins/numeric_variable_spec.rb +26 -0
- data/spec/spec_helper.rb +3 -0
- metadata +123 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
MGEzZTRjYTY5NjU0YTUxOTA1YTk4NjBiNjU0NTc4ZDM0NzgxZTIyOA==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
YjA1MjU5MmI0ZmZkYzc4MDBhNDIwY2I5NWUwYTNiZWIyZTJlNGE2Mg==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
MDViZGUxNGQ3YThlYTA5MGIzYjY2NDAxMzFlNmExYWU5OTA1OTY0MTE4ZjM1
|
10
|
+
YmRhNTc1NzUyMDU5ZmExYTlmMzU0NjUwMTRhYTE3YmQyMDA3YTk2MTVhNzM4
|
11
|
+
MjA1MzcxMmMzOWM5ZDJmNTFjMTExZWE2NGI5ZjA2NDA4NzJlNjc=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
YjU1YzlhMGU5NWQzNzVkYTRhYjQxNDNjMjgyOTE2YmIwYmU0OGQzZGU3ZTM3
|
14
|
+
YWQ4YzE1ZTk0YTIyNDk4OWY2M2U1ZjE1MTM3Yjc1NDg3ODgzZGIxYmZmZGY2
|
15
|
+
NmM3MTE1MzRiZmM0NzY3YjE2NDQ0ZTJkZmNkZDQ4YmYwMjJiMWU=
|
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,5 @@
|
|
1
|
+
# Puppet lint check for numeric named variables
|
2
|
+
|
3
|
+
[![Build Status](https://travis-ci.org/fiddyspence/puppetlint-numericvariable.png?branch=master)](https://travis-ci.org/fiddyspence/puppetlint-numericvariable)
|
4
|
+
|
5
|
+
The future parser disallows numeric variables, so let's check them before we upgrade
|
@@ -0,0 +1,15 @@
|
|
1
|
+
PuppetLint.new_check(:numeric_variable) do
|
2
|
+
def check
|
3
|
+
tokens.select { |r|
|
4
|
+
VARIABLE_TYPES.include? r.type
|
5
|
+
}.each do |token|
|
6
|
+
if token.value.match(/^[0-9]+$/)
|
7
|
+
notify :warning, {
|
8
|
+
:message => 'variable is solely numeric',
|
9
|
+
:line => token.line,
|
10
|
+
:column => token.column,
|
11
|
+
}
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'numeric_variable' do
|
4
|
+
let(:msg) { 'variable is solely numeric' }
|
5
|
+
|
6
|
+
context 'a variable that is a number' do
|
7
|
+
let(:code) { "$3 = 'foo'" }
|
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
|
+
context 'a variable that is partially a number' do
|
18
|
+
let(:code) { "$l33t = 'foo'" }
|
19
|
+
|
20
|
+
it 'should only detect a single problem' do
|
21
|
+
expect(problems).to have(0).problem
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,123 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: puppet-lint-numericvariable
|
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: 2015-02-05 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 not numeric
|
84
|
+
|
85
|
+
'
|
86
|
+
email: chris@spence.org.uk
|
87
|
+
executables: []
|
88
|
+
extensions: []
|
89
|
+
extra_rdoc_files: []
|
90
|
+
files:
|
91
|
+
- LICENSE
|
92
|
+
- README.md
|
93
|
+
- lib/puppet-lint/plugins/numeric_variable.rb
|
94
|
+
- spec/puppet-lint/plugins/numeric_variable_spec.rb
|
95
|
+
- spec/spec_helper.rb
|
96
|
+
homepage: https://github.com/fiddyspence/puppetlint-numericvariable
|
97
|
+
licenses:
|
98
|
+
- MIT
|
99
|
+
metadata: {}
|
100
|
+
post_install_message:
|
101
|
+
rdoc_options: []
|
102
|
+
require_paths:
|
103
|
+
- lib
|
104
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
105
|
+
requirements:
|
106
|
+
- - ! '>='
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: '0'
|
109
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
110
|
+
requirements:
|
111
|
+
- - ! '>='
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: '0'
|
114
|
+
requirements: []
|
115
|
+
rubyforge_project:
|
116
|
+
rubygems_version: 2.4.1
|
117
|
+
signing_key:
|
118
|
+
specification_version: 4
|
119
|
+
summary: puppet-lint numeric_variable check
|
120
|
+
test_files:
|
121
|
+
- spec/puppet-lint/plugins/numeric_variable_spec.rb
|
122
|
+
- spec/spec_helper.rb
|
123
|
+
has_rdoc:
|