puppet-lint 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +1 -0
- data/lib/puppet-lint.rb +1 -1
- data/lib/puppet-lint/plugins/check_strings.rb +3 -1
- data/puppet-lint.gemspec +1 -1
- data/spec/puppet-lint/check_strings_spec.rb +7 -0
- metadata +3 -3
data/README.md
CHANGED
@@ -38,6 +38,7 @@ At the moment, the following tests have been implemented:
|
|
38
38
|
|
39
39
|
* All strings that do not contain variables should be enclosed in single
|
40
40
|
quotes.
|
41
|
+
* An exception has been made for double quoted strings containing \n or \t.
|
41
42
|
* All strings that contain variables must be enclosed in double quotes.
|
42
43
|
* All variables should be enclosed in braces when interpolated in a string.
|
43
44
|
* Variables standing by themselves should not be quoted.
|
data/lib/puppet-lint.rb
CHANGED
@@ -25,7 +25,9 @@ class PuppetLint::Plugins::CheckStrings < PuppetLint::CheckPlugin
|
|
25
25
|
token = tokens[token_idx]
|
26
26
|
|
27
27
|
if token.first == :STRING
|
28
|
-
|
28
|
+
unless token.last[:value].include? "\t" or token.last[:value].include? "\n"
|
29
|
+
warn "double quoted string containing no variables on line #{token.last[:line]}"
|
30
|
+
end
|
29
31
|
end
|
30
32
|
|
31
33
|
if token.first == :DQPRE and token.last[:value] == ""
|
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.1.
|
3
|
+
s.version = '0.1.4'
|
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
|
@@ -48,4 +48,11 @@ describe PuppetLint::Plugins::CheckStrings do
|
|
48
48
|
its(:warnings) { should be_empty }
|
49
49
|
its(:errors) { should be_empty }
|
50
50
|
end
|
51
|
+
|
52
|
+
describe 'double quoted string containing newline but no variables' do
|
53
|
+
let(:code) { '"foo\n"' }
|
54
|
+
|
55
|
+
its(:warnings) { should be_empty }
|
56
|
+
its(:errors) { should be_empty }
|
57
|
+
end
|
51
58
|
end
|
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:
|
4
|
+
hash: 19
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 4
|
10
|
+
version: 0.1.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Tim Sharpe
|