puppet-lint 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -0,0 +1,56 @@
1
+ # Puppet-lint
2
+
3
+ The goal of this project is to implement as many of the recommended Puppet
4
+ style guidelines from the [Puppetlabs style
5
+ guide](http://docs.puppetlabs.com/guides/style_guide.html).
6
+
7
+ ## Installation
8
+
9
+ gem install puppet-lint
10
+
11
+ ## Testing your manifests
12
+
13
+ You can test a single manifest file by running
14
+
15
+ puppet-lint <path to file>
16
+
17
+ If you want to test your entire Puppet manifest directory, you can add
18
+ `require 'puppet-lint/tasks/puppet-lint'` to your Rakefile and then run
19
+
20
+ rake lint
21
+
22
+ ## Implemented tests
23
+
24
+ At the moment, the following tests have been implemented:
25
+
26
+ ### Spacing, Indentation & Whitespace
27
+
28
+ * Must use two-space soft tabs.
29
+ * Must not use literal tab characters.
30
+ * Must not contain trailing white space.
31
+ * Should not exceed an 80 character line width
32
+ * An exception has been made for `source => 'puppet://...'` lines as
33
+ splitting these over multiple lines decreases the readability of the
34
+ manifests.
35
+ * Should align arrows (`=>`) within blocks of attributes.
36
+
37
+ ### Quoting
38
+
39
+ * All strings that do not contain variables should be enclosed in single
40
+ quotes.
41
+ * All strings that contain variables must be enclosed in double quotes.
42
+ * All variables should be enclosed in braces when interpolated in a string.
43
+
44
+ ### Resources
45
+
46
+ * All resource titles should be quoted.
47
+ * If a resource declaration includes an `ensure` attribute, it should be the
48
+ first attribute specified.
49
+ * File modes should be represented as a 4 digit string enclosed in single
50
+ quotes.
51
+
52
+ ## Reporting bugs or incorrect results
53
+
54
+ If you find a bug in puppet-lint or its results, please create an issue in the
55
+ [repo issues tracker](https://github.com/rodjek/puppet-lint/issues/). Bonus
56
+ points will be awarded if you also include a patch that fixes the issue.
data/lib/puppet-lint.rb CHANGED
@@ -5,7 +5,7 @@ require 'puppet'
5
5
  class PuppetLint::NoCodeError < StandardError; end
6
6
 
7
7
  class PuppetLint
8
- VERSION = '0.0.6'
8
+ VERSION = '0.0.7'
9
9
 
10
10
  attr_reader :code, :file
11
11
 
@@ -0,0 +1,25 @@
1
+ require 'puppet-lint'
2
+ require 'rake'
3
+ require 'rake/tasklib'
4
+
5
+ class PuppetLint
6
+ class RakeTask < ::Rake::TaskLib
7
+ def initialize(*args)
8
+ desc 'Run puppet-lint'
9
+
10
+ task :lint do
11
+ RakeFileUtils.send(:verbose, true) do
12
+ linter = PuppetLint.new
13
+ Dir.glob('**/*.pp').each do |puppet_file|
14
+ puts "Evaluating #{puppet_file}"
15
+ linter.file = puppet_file
16
+ linter.run
17
+ end
18
+ fail if linter.errors?
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
24
+
25
+ PuppetLint::RakeTask.new
data/puppet-lint.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'puppet-lint'
3
- s.version = '0.0.6'
3
+ s.version = '0.0.7'
4
4
  s.homepage = 'https://github.com/rodjek/puppet-lint/'
5
5
  s.summary = 'Ensure your Puppet manifests conform with the Puppetlabs style guide'
6
6
  s.description = 'Checks your Puppet manifests against the Puppetlabs
@@ -14,8 +14,8 @@ Gem::Specification.new do |s|
14
14
  'lib/puppet-lint/plugins/check_strings.rb',
15
15
  'lib/puppet-lint/plugins/check_whitespace.rb',
16
16
  'lib/puppet-lint/plugins.rb',
17
+ 'lib/puppet-lint/tasks/puppet-lint.rb',
17
18
  'lib/puppet-lint.rb',
18
- 'lib/tasks/puppet-lint.rake',
19
19
  'LICENSE',
20
20
  'puppet-lint.gemspec',
21
21
  'Rakefile',
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppet-lint
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 6
10
- version: 0.0.6
9
+ - 7
10
+ version: 0.0.7
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tim Sharpe
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-08-19 00:00:00 Z
18
+ date: 2011-08-21 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: rspec
@@ -48,8 +48,8 @@ files:
48
48
  - lib/puppet-lint/plugins/check_strings.rb
49
49
  - lib/puppet-lint/plugins/check_whitespace.rb
50
50
  - lib/puppet-lint/plugins.rb
51
+ - lib/puppet-lint/tasks/puppet-lint.rb
51
52
  - lib/puppet-lint.rb
52
- - lib/tasks/puppet-lint.rake
53
53
  - LICENSE
54
54
  - puppet-lint.gemspec
55
55
  - Rakefile
@@ -1,12 +0,0 @@
1
- require 'rubygems'
2
- require 'puppet-lint'
3
-
4
- task :lint do
5
- linter = PuppetLint.new
6
- Dir.glob('**/*.pp').each do |puppet_file|
7
- puts "Evaluating #{puppet_file}"
8
- linter.file = puppet_file
9
- linter.run
10
- end
11
- fail if linter.errors?
12
- end