puppet-lint 0.3.2 → 0.4.0.pre1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. data/.gitignore +2 -0
  2. data/Gemfile +0 -1
  3. data/README.md +3 -1
  4. data/Rakefile +0 -19
  5. data/lib/puppet-lint.rb +65 -74
  6. data/lib/puppet-lint/bin.rb +21 -0
  7. data/lib/puppet-lint/checkplugin.rb +22 -0
  8. data/lib/puppet-lint/{plugin.rb → checks.rb} +66 -31
  9. data/lib/puppet-lint/configuration.rb +105 -0
  10. data/lib/puppet-lint/lexer.rb +94 -31
  11. data/lib/puppet-lint/lexer/token.rb +38 -2
  12. data/lib/puppet-lint/monkeypatches.rb +2 -0
  13. data/lib/puppet-lint/monkeypatches/string_percent.rb +52 -0
  14. data/lib/puppet-lint/monkeypatches/string_prepend.rb +7 -0
  15. data/lib/puppet-lint/plugins.rb +42 -0
  16. data/lib/puppet-lint/plugins/check_comments.rb +8 -1
  17. data/lib/puppet-lint/plugins/check_resources.rb +25 -3
  18. data/lib/puppet-lint/plugins/check_strings.rb +53 -6
  19. data/lib/puppet-lint/plugins/check_whitespace.rb +69 -26
  20. data/lib/puppet-lint/version.rb +1 -1
  21. data/puppet-lint.gemspec +0 -1
  22. data/spec/puppet-lint/configuration_spec.rb +1 -0
  23. data/spec/puppet-lint/lexer_spec.rb +2 -2
  24. data/spec/puppet-lint/plugins/check_comments/slash_comments_spec.rb +22 -0
  25. data/spec/puppet-lint/plugins/check_resources/file_mode_spec.rb +119 -6
  26. data/spec/puppet-lint/plugins/check_resources/unquoted_file_mode_spec.rb +30 -3
  27. data/spec/puppet-lint/plugins/check_resources/unquoted_resource_title_spec.rb +103 -3
  28. data/spec/puppet-lint/plugins/check_strings/double_quoted_strings_spec.rb +39 -0
  29. data/spec/puppet-lint/plugins/check_strings/only_variable_string_spec.rb +23 -0
  30. data/spec/puppet-lint/plugins/check_strings/quoted_booleans_spec.rb +88 -0
  31. data/spec/puppet-lint/plugins/check_strings/variables_not_enclosed_spec.rb +44 -0
  32. data/spec/puppet-lint/plugins/check_whitespace/arrow_alignment_spec.rb +171 -6
  33. data/spec/puppet-lint/plugins/check_whitespace/hard_tabs_spec.rb +22 -0
  34. data/spec/puppet-lint/plugins/check_whitespace/trailing_whitespace_spec.rb +44 -0
  35. data/spec/puppet-lint_spec.rb +1 -1
  36. metadata +10 -22
@@ -13,4 +13,26 @@ describe 'hard_tabs' do
13
13
  })
14
14
  }
15
15
  end
16
+
17
+ describe 'hard tabs indents' do
18
+ before do
19
+ PuppetLint.configuration.fix = true
20
+ end
21
+
22
+ after do
23
+ PuppetLint.configuration.fix = false
24
+ end
25
+
26
+ let(:code) { "\tfoo => bar," }
27
+
28
+ its(:problems) {
29
+ should have_problem({
30
+ :kind => :fixed,
31
+ :message => 'tab character found',
32
+ :linenumber => 1,
33
+ :column => 1,
34
+ })
35
+ }
36
+ its(:manifest) { should == " foo => bar," }
37
+ end
16
38
  end
@@ -13,4 +13,48 @@ describe 'trailing_whitespace' do
13
13
  })
14
14
  }
15
15
  end
16
+
17
+ describe 'single line with trailing whitespace w/fix' do
18
+ before do
19
+ PuppetLint.configuration.fix = true
20
+ end
21
+
22
+ after do
23
+ PuppetLint.configuration.fix = false
24
+ end
25
+
26
+ let(:code) { "foo " }
27
+
28
+ its(:problems) {
29
+ should have_problem({
30
+ :kind => :fixed,
31
+ :message => 'trailing whitespace found',
32
+ :linenumber => 1,
33
+ :column => 4,
34
+ })
35
+ }
36
+ its(:manifest) { should == 'foo' }
37
+ end
38
+
39
+ describe 'multiple lines with trailing whitespace w/fix' do
40
+ before do
41
+ PuppetLint.configuration.fix = true
42
+ end
43
+
44
+ after do
45
+ PuppetLint.configuration.fix = false
46
+ end
47
+
48
+ let(:code) { "foo \nbar" }
49
+
50
+ its(:problems) {
51
+ should have_problem({
52
+ :kind => :fixed,
53
+ :message => 'trailing whitespace found',
54
+ :linenumber => 1,
55
+ :column => 4,
56
+ })
57
+ }
58
+ its(:manifest) { should == "foo\nbar" }
59
+ end
16
60
  end
@@ -5,7 +5,7 @@ describe PuppetLint do
5
5
 
6
6
  it 'should accept manifests as a string' do
7
7
  subject.code = "class foo { }"
8
- subject.data.should_not be_nil
8
+ subject.code.should_not be_nil
9
9
  end
10
10
 
11
11
  it 'should have support for % with a hash' do
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppet-lint
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
5
- prerelease:
4
+ version: 0.4.0.pre1
5
+ prerelease: 6
6
6
  platform: ruby
7
7
  authors:
8
8
  - Tim Sharpe
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-19 00:00:00.000000000 Z
12
+ date: 2013-01-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -27,22 +27,6 @@ dependencies:
27
27
  - - ! '>='
28
28
  - !ruby/object:Gem::Version
29
29
  version: '0'
30
- - !ruby/object:Gem::Dependency
31
- name: rdoc
32
- requirement: !ruby/object:Gem::Requirement
33
- none: false
34
- requirements:
35
- - - ! '>='
36
- - !ruby/object:Gem::Version
37
- version: '0'
38
- type: :development
39
- prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ! '>='
44
- - !ruby/object:Gem::Version
45
- version: '0'
46
30
  - !ruby/object:Gem::Dependency
47
31
  name: rcov
48
32
  requirement: !ruby/object:Gem::Requirement
@@ -76,10 +60,14 @@ files:
76
60
  - bin/puppet-lint
77
61
  - lib/puppet-lint.rb
78
62
  - lib/puppet-lint/bin.rb
63
+ - lib/puppet-lint/checkplugin.rb
64
+ - lib/puppet-lint/checks.rb
79
65
  - lib/puppet-lint/configuration.rb
80
66
  - lib/puppet-lint/lexer.rb
81
67
  - lib/puppet-lint/lexer/token.rb
82
- - lib/puppet-lint/plugin.rb
68
+ - lib/puppet-lint/monkeypatches.rb
69
+ - lib/puppet-lint/monkeypatches/string_percent.rb
70
+ - lib/puppet-lint/monkeypatches/string_prepend.rb
83
71
  - lib/puppet-lint/plugins.rb
84
72
  - lib/puppet-lint/plugins/check_classes.rb
85
73
  - lib/puppet-lint/plugins/check_comments.rb
@@ -148,9 +136,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
148
136
  required_rubygems_version: !ruby/object:Gem::Requirement
149
137
  none: false
150
138
  requirements:
151
- - - ! '>='
139
+ - - ! '>'
152
140
  - !ruby/object:Gem::Version
153
- version: '0'
141
+ version: 1.3.1
154
142
  requirements: []
155
143
  rubyforge_project:
156
144
  rubygems_version: 1.8.23