puppet-lint 0.2.0.pre1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/.travis.yml +1 -14
- data/Gemfile +2 -0
- data/Rakefile +5 -0
- data/bin/puppet-lint +1 -99
- data/lib/puppet-lint.rb +4 -12
- data/lib/puppet-lint/bin.rb +115 -0
- data/lib/puppet-lint/configuration.rb +6 -2
- data/lib/puppet-lint/lexer.rb +135 -83
- data/lib/puppet-lint/lexer/token.rb +62 -0
- data/lib/puppet-lint/plugin.rb +57 -51
- data/lib/puppet-lint/plugins.rb +2 -0
- data/lib/puppet-lint/plugins/check_classes.rb +161 -45
- data/lib/puppet-lint/plugins/check_comments.rb +33 -0
- data/lib/puppet-lint/plugins/check_conditionals.rb +8 -10
- data/lib/puppet-lint/plugins/check_documentation.rb +41 -0
- data/lib/puppet-lint/plugins/check_resources.rb +28 -2
- data/lib/puppet-lint/plugins/check_strings.rb +6 -4
- data/lib/puppet-lint/plugins/check_variables.rb +1 -1
- data/lib/puppet-lint/plugins/check_whitespace.rb +26 -49
- data/lib/puppet-lint/tasks/puppet-lint.rb +2 -1
- data/lib/puppet-lint/version.rb +1 -1
- data/puppet-lint.gemspec +1 -0
- data/spec/fixtures/test/manifests/fail.pp +2 -0
- data/spec/fixtures/test/manifests/init.pp +3 -0
- data/spec/fixtures/test/manifests/warning.pp +2 -0
- data/spec/puppet-lint/bin_spec.rb +266 -0
- data/spec/puppet-lint/configuration_spec.rb +51 -0
- data/spec/puppet-lint/lexer/token_spec.rb +18 -0
- data/spec/puppet-lint/lexer_spec.rb +738 -0
- data/spec/puppet-lint/{check_classes_spec.rb → plugins/check_classes_spec.rb} +74 -7
- data/spec/puppet-lint/plugins/check_comments_spec.rb +40 -0
- data/spec/puppet-lint/{check_conditionals_spec.rb → plugins/check_conditionals_spec.rb} +19 -0
- data/spec/puppet-lint/plugins/check_documentation_spec.rb +55 -0
- data/spec/puppet-lint/{check_resources_spec.rb → plugins/check_resources_spec.rb} +65 -0
- data/spec/puppet-lint/{check_strings_spec.rb → plugins/check_strings_spec.rb} +18 -1
- data/spec/puppet-lint/{check_variables_spec.rb → plugins/check_variables_spec.rb} +0 -0
- data/spec/puppet-lint/plugins/check_whitespace_spec.rb +291 -0
- data/spec/puppet-lint_spec.rb +10 -0
- data/spec/spec_helper.rb +5 -0
- metadata +58 -24
- data/spec/puppet-lint/check_whitespace_spec.rb +0 -120
data/spec/spec_helper.rb
CHANGED
@@ -1,5 +1,10 @@
|
|
1
|
+
require 'rspec/autorun'
|
1
2
|
require 'puppet-lint'
|
2
3
|
|
4
|
+
RSpec.configure do |c|
|
5
|
+
c.mock_framework = :rspec
|
6
|
+
end
|
7
|
+
|
3
8
|
#class PuppetLint::Warning < Exception; end
|
4
9
|
#class PuppetLint::Error < Exception; end
|
5
10
|
#PuppetLint::CheckPlugin.any_instance.stub(:warn) do |arg|
|
metadata
CHANGED
@@ -1,15 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: puppet-lint
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 23
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
9
|
- 0
|
10
|
-
|
11
|
-
- 1
|
12
|
-
version: 0.2.0.pre1
|
10
|
+
version: 0.2.0
|
13
11
|
platform: ruby
|
14
12
|
authors:
|
15
13
|
- Tim Sharpe
|
@@ -17,7 +15,7 @@ autorequire:
|
|
17
15
|
bindir: bin
|
18
16
|
cert_chain: []
|
19
17
|
|
20
|
-
date: 2012-
|
18
|
+
date: 2012-08-23 00:00:00 -07:00
|
21
19
|
default_executable:
|
22
20
|
dependencies:
|
23
21
|
- !ruby/object:Gem::Dependency
|
@@ -48,6 +46,20 @@ dependencies:
|
|
48
46
|
version: "0"
|
49
47
|
type: :development
|
50
48
|
version_requirements: *id002
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
name: rcov
|
51
|
+
prerelease: false
|
52
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
53
|
+
none: false
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
hash: 3
|
58
|
+
segments:
|
59
|
+
- 0
|
60
|
+
version: "0"
|
61
|
+
type: :development
|
62
|
+
version_requirements: *id003
|
51
63
|
description: |-
|
52
64
|
Checks your Puppet manifests against the Puppetlabs
|
53
65
|
style guide and alerts you to any discrepancies.
|
@@ -67,12 +79,16 @@ files:
|
|
67
79
|
- Rakefile
|
68
80
|
- bin/puppet-lint
|
69
81
|
- lib/puppet-lint.rb
|
82
|
+
- lib/puppet-lint/bin.rb
|
70
83
|
- lib/puppet-lint/configuration.rb
|
71
84
|
- lib/puppet-lint/lexer.rb
|
85
|
+
- lib/puppet-lint/lexer/token.rb
|
72
86
|
- lib/puppet-lint/plugin.rb
|
73
87
|
- lib/puppet-lint/plugins.rb
|
74
88
|
- lib/puppet-lint/plugins/check_classes.rb
|
89
|
+
- lib/puppet-lint/plugins/check_comments.rb
|
75
90
|
- lib/puppet-lint/plugins/check_conditionals.rb
|
91
|
+
- lib/puppet-lint/plugins/check_documentation.rb
|
76
92
|
- lib/puppet-lint/plugins/check_resources.rb
|
77
93
|
- lib/puppet-lint/plugins/check_strings.rb
|
78
94
|
- lib/puppet-lint/plugins/check_variables.rb
|
@@ -80,12 +96,22 @@ files:
|
|
80
96
|
- lib/puppet-lint/tasks/puppet-lint.rb
|
81
97
|
- lib/puppet-lint/version.rb
|
82
98
|
- puppet-lint.gemspec
|
83
|
-
- spec/
|
84
|
-
- spec/
|
85
|
-
- spec/
|
86
|
-
- spec/puppet-lint/
|
87
|
-
- spec/puppet-lint/
|
88
|
-
- spec/puppet-lint/
|
99
|
+
- spec/fixtures/test/manifests/fail.pp
|
100
|
+
- spec/fixtures/test/manifests/init.pp
|
101
|
+
- spec/fixtures/test/manifests/warning.pp
|
102
|
+
- spec/puppet-lint/bin_spec.rb
|
103
|
+
- spec/puppet-lint/configuration_spec.rb
|
104
|
+
- spec/puppet-lint/lexer/token_spec.rb
|
105
|
+
- spec/puppet-lint/lexer_spec.rb
|
106
|
+
- spec/puppet-lint/plugins/check_classes_spec.rb
|
107
|
+
- spec/puppet-lint/plugins/check_comments_spec.rb
|
108
|
+
- spec/puppet-lint/plugins/check_conditionals_spec.rb
|
109
|
+
- spec/puppet-lint/plugins/check_documentation_spec.rb
|
110
|
+
- spec/puppet-lint/plugins/check_resources_spec.rb
|
111
|
+
- spec/puppet-lint/plugins/check_strings_spec.rb
|
112
|
+
- spec/puppet-lint/plugins/check_variables_spec.rb
|
113
|
+
- spec/puppet-lint/plugins/check_whitespace_spec.rb
|
114
|
+
- spec/puppet-lint_spec.rb
|
89
115
|
- spec/spec_helper.rb
|
90
116
|
has_rdoc: true
|
91
117
|
homepage: https://github.com/rodjek/puppet-lint/
|
@@ -108,14 +134,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
108
134
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
109
135
|
none: false
|
110
136
|
requirements:
|
111
|
-
- - "
|
137
|
+
- - ">="
|
112
138
|
- !ruby/object:Gem::Version
|
113
|
-
hash:
|
139
|
+
hash: 3
|
114
140
|
segments:
|
115
|
-
-
|
116
|
-
|
117
|
-
- 1
|
118
|
-
version: 1.3.1
|
141
|
+
- 0
|
142
|
+
version: "0"
|
119
143
|
requirements: []
|
120
144
|
|
121
145
|
rubyforge_project:
|
@@ -124,10 +148,20 @@ signing_key:
|
|
124
148
|
specification_version: 3
|
125
149
|
summary: Ensure your Puppet manifests conform with the Puppetlabs style guide
|
126
150
|
test_files:
|
127
|
-
- spec/
|
128
|
-
- spec/
|
129
|
-
- spec/
|
130
|
-
- spec/puppet-lint/
|
131
|
-
- spec/puppet-lint/
|
132
|
-
- spec/puppet-lint/
|
151
|
+
- spec/fixtures/test/manifests/fail.pp
|
152
|
+
- spec/fixtures/test/manifests/init.pp
|
153
|
+
- spec/fixtures/test/manifests/warning.pp
|
154
|
+
- spec/puppet-lint/bin_spec.rb
|
155
|
+
- spec/puppet-lint/configuration_spec.rb
|
156
|
+
- spec/puppet-lint/lexer/token_spec.rb
|
157
|
+
- spec/puppet-lint/lexer_spec.rb
|
158
|
+
- spec/puppet-lint/plugins/check_classes_spec.rb
|
159
|
+
- spec/puppet-lint/plugins/check_comments_spec.rb
|
160
|
+
- spec/puppet-lint/plugins/check_conditionals_spec.rb
|
161
|
+
- spec/puppet-lint/plugins/check_documentation_spec.rb
|
162
|
+
- spec/puppet-lint/plugins/check_resources_spec.rb
|
163
|
+
- spec/puppet-lint/plugins/check_strings_spec.rb
|
164
|
+
- spec/puppet-lint/plugins/check_variables_spec.rb
|
165
|
+
- spec/puppet-lint/plugins/check_whitespace_spec.rb
|
166
|
+
- spec/puppet-lint_spec.rb
|
133
167
|
- spec/spec_helper.rb
|
@@ -1,120 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require 'spec_helper'
|
3
|
-
|
4
|
-
describe PuppetLint::Plugins::CheckWhitespace do
|
5
|
-
subject do
|
6
|
-
klass = described_class.new
|
7
|
-
klass.run(defined?(fullpath).nil? ? {:fullpath => ''} : {:fullpath => fullpath}, code)
|
8
|
-
klass
|
9
|
-
end
|
10
|
-
|
11
|
-
describe 'selectors inside a resource' do
|
12
|
-
let(:code) { "
|
13
|
-
file { 'foo':
|
14
|
-
ensure => $ensure,
|
15
|
-
require => $ensure ? {
|
16
|
-
present => Class['tomcat::install'],
|
17
|
-
absent => undef,
|
18
|
-
},
|
19
|
-
}"
|
20
|
-
}
|
21
|
-
|
22
|
-
its(:problems) { should be_empty }
|
23
|
-
end
|
24
|
-
|
25
|
-
describe 'selectors in the middle of a resource' do
|
26
|
-
let(:code) { "
|
27
|
-
file { 'foo':
|
28
|
-
ensure => $ensure ? {
|
29
|
-
present => directory,
|
30
|
-
absent => undef,
|
31
|
-
},
|
32
|
-
owner => 'tomcat6',
|
33
|
-
}"
|
34
|
-
}
|
35
|
-
|
36
|
-
its(:problems) { should be_empty }
|
37
|
-
end
|
38
|
-
|
39
|
-
describe 'file resource with a source line > 80c' do
|
40
|
-
let(:code) { "
|
41
|
-
file {
|
42
|
-
source => 'puppet:///modules/certificates/etc/ssl/private/wildcard.example.com.crt',
|
43
|
-
}"
|
44
|
-
}
|
45
|
-
|
46
|
-
its(:problems) { should be_empty }
|
47
|
-
end
|
48
|
-
|
49
|
-
describe 'selector inside a resource' do
|
50
|
-
let(:code) { "
|
51
|
-
ensure => $ensure ? {
|
52
|
-
present => directory,
|
53
|
-
absent => undef,
|
54
|
-
},
|
55
|
-
owner => 'foo4',
|
56
|
-
group => 'foo4',
|
57
|
-
mode => '0755'," }
|
58
|
-
|
59
|
-
its(:problems) { should be_empty }
|
60
|
-
end
|
61
|
-
|
62
|
-
describe 'selector inside a hash inside a resource' do
|
63
|
-
let(:code) { "
|
64
|
-
server => {
|
65
|
-
ensure => ensure => $ensure ? {
|
66
|
-
present => directory,
|
67
|
-
absent => undef,
|
68
|
-
},
|
69
|
-
ip => '192.168.1.1'
|
70
|
-
},
|
71
|
-
owner => 'foo4',
|
72
|
-
group => 'foo4',
|
73
|
-
mode => '0755'," }
|
74
|
-
|
75
|
-
its(:problems) { should be_empty }
|
76
|
-
end
|
77
|
-
|
78
|
-
|
79
|
-
describe 'length of lines with UTF-8 characters' do
|
80
|
-
let(:code) { "
|
81
|
-
# ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
|
82
|
-
# ┃ Configuration ┃
|
83
|
-
# ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛"
|
84
|
-
}
|
85
|
-
its(:problems) {
|
86
|
-
should be_empty
|
87
|
-
}
|
88
|
-
end
|
89
|
-
|
90
|
-
describe 'issue #37' do
|
91
|
-
let(:code) { "
|
92
|
-
class { 'lvs::base':
|
93
|
-
virtualeservers => {
|
94
|
-
'192.168.2.13' => {
|
95
|
-
vport => '11025',
|
96
|
-
service => 'smtp',
|
97
|
-
scheduler => 'wlc',
|
98
|
-
protocol => 'tcp',
|
99
|
-
checktype => 'external',
|
100
|
-
checkcommand => '/path/to/checkscript',
|
101
|
-
real_servers => {
|
102
|
-
'server01' => {
|
103
|
-
real_server => '192.168.2.14',
|
104
|
-
real_port => '25',
|
105
|
-
forwarding => 'masq',
|
106
|
-
},
|
107
|
-
'server02' => {
|
108
|
-
real_server => '192.168.2.15',
|
109
|
-
real_port => '25',
|
110
|
-
forwarding => 'masq',
|
111
|
-
}
|
112
|
-
}
|
113
|
-
}
|
114
|
-
}
|
115
|
-
}"
|
116
|
-
}
|
117
|
-
|
118
|
-
its(:problems) { should be_empty }
|
119
|
-
end
|
120
|
-
end
|