puppet-lint 2.3.2 → 2.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +1 -0
- data/.rubocop.yml +1 -1
- data/.travis.yml +2 -1
- data/CHANGELOG.md +17 -0
- data/Rakefile +3 -0
- data/appveyor.yml +1 -1
- data/lib/puppet-lint.rb +2 -1
- data/lib/puppet-lint/checks.rb +3 -3
- data/lib/puppet-lint/configuration.rb +2 -2
- data/lib/puppet-lint/lexer.rb +6 -6
- data/lib/puppet-lint/monkeypatches.rb +51 -0
- data/lib/puppet-lint/optparser.rb +1 -1
- data/lib/puppet-lint/plugins/check_classes/arrow_on_right_operand_line.rb +1 -1
- data/lib/puppet-lint/plugins/check_classes/autoloader_layout.rb +1 -1
- data/lib/puppet-lint/plugins/check_classes/class_inherits_from_params_class.rb +1 -1
- data/lib/puppet-lint/plugins/check_classes/code_on_top_scope.rb +1 -1
- data/lib/puppet-lint/plugins/check_classes/inherits_across_namespaces.rb +1 -1
- data/lib/puppet-lint/plugins/check_classes/names_containing_dash.rb +1 -1
- data/lib/puppet-lint/plugins/check_classes/names_containing_uppercase.rb +1 -1
- data/lib/puppet-lint/plugins/check_classes/nested_classes_or_defines.rb +1 -1
- data/lib/puppet-lint/plugins/check_classes/parameter_order.rb +1 -1
- data/lib/puppet-lint/plugins/check_classes/right_to_left_relationship.rb +1 -1
- data/lib/puppet-lint/plugins/check_classes/variable_scope.rb +1 -1
- data/lib/puppet-lint/plugins/check_comments/slash_comments.rb +1 -1
- data/lib/puppet-lint/plugins/check_comments/star_comments.rb +1 -1
- data/lib/puppet-lint/plugins/check_conditionals/case_without_default.rb +1 -1
- data/lib/puppet-lint/plugins/check_conditionals/selector_inside_resource.rb +1 -1
- data/lib/puppet-lint/plugins/check_documentation/documentation.rb +1 -1
- data/lib/puppet-lint/plugins/check_nodes/unquoted_node_name.rb +2 -2
- data/lib/puppet-lint/plugins/check_resources/duplicate_params.rb +1 -1
- data/lib/puppet-lint/plugins/check_resources/ensure_first_param.rb +1 -1
- data/lib/puppet-lint/plugins/check_resources/ensure_not_symlink_target.rb +1 -1
- data/lib/puppet-lint/plugins/check_resources/file_mode.rb +1 -1
- data/lib/puppet-lint/plugins/check_resources/unquoted_file_mode.rb +1 -1
- data/lib/puppet-lint/plugins/check_resources/unquoted_resource_title.rb +1 -1
- data/lib/puppet-lint/plugins/check_strings/double_quoted_strings.rb +1 -1
- data/lib/puppet-lint/plugins/check_strings/only_variable_string.rb +1 -1
- data/lib/puppet-lint/plugins/check_strings/puppet_url_without_modules.rb +1 -1
- data/lib/puppet-lint/plugins/check_strings/quoted_booleans.rb +1 -1
- data/lib/puppet-lint/plugins/check_strings/single_quote_string_with_variables.rb +1 -1
- data/lib/puppet-lint/plugins/check_strings/variables_not_enclosed.rb +1 -1
- data/lib/puppet-lint/plugins/check_variables/variable_contains_dash.rb +1 -1
- data/lib/puppet-lint/plugins/check_variables/variable_is_lowercase.rb +1 -1
- data/lib/puppet-lint/plugins/check_whitespace/140chars.rb +1 -1
- data/lib/puppet-lint/plugins/check_whitespace/2sp_soft_tabs.rb +1 -1
- data/lib/puppet-lint/plugins/check_whitespace/80chars.rb +1 -1
- data/lib/puppet-lint/plugins/check_whitespace/arrow_alignment.rb +1 -1
- data/lib/puppet-lint/plugins/check_whitespace/hard_tabs.rb +1 -1
- data/lib/puppet-lint/plugins/check_whitespace/trailing_whitespace.rb +1 -1
- data/lib/puppet-lint/tasks/puppet-lint.rb +1 -1
- data/lib/puppet-lint/tasks/release_test.rb +84 -0
- data/lib/puppet-lint/version.rb +1 -1
- data/spec/puppet-lint/bin_spec.rb +3 -3
- data/spec/puppet-lint/checks_spec.rb +4 -4
- data/spec/puppet-lint/configuration_spec.rb +10 -2
- data/spec/puppet-lint/lexer_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -1
- metadata +50 -82
- checksums.yaml +0 -7
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
|
@@ -62,7 +62,7 @@ Style/MethodCalledOnDoEndBlock:
|
|
|
62
62
|
Style/RegexpLiteral:
|
|
63
63
|
EnforcedStyle: percent_r
|
|
64
64
|
Style/TrailingCommaInArguments:
|
|
65
|
-
EnforcedStyleForMultiline:
|
|
65
|
+
EnforcedStyleForMultiline: no_comma
|
|
66
66
|
Style/TrailingCommaInLiteral:
|
|
67
67
|
EnforcedStyleForMultiline: comma
|
|
68
68
|
Style/FormatStringToken:
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## [2.3.3](https://github.com/rodjek/puppet-lint/tree/2.3.3) (2017-09-28)
|
|
4
|
+
[Full Changelog](https://github.com/rodjek/puppet-lint/compare/2.3.2...2.3.3)
|
|
5
|
+
|
|
6
|
+
**Closed issues:**
|
|
7
|
+
|
|
8
|
+
- 2.3.2 - Rakefile's ignore\_paths not respected [\#760](https://github.com/rodjek/puppet-lint/issues/760)
|
|
9
|
+
- 2.3.1 - Puppet lint fails with 1.8.7-p371 and Puppet 3.8.0 [\#759](https://github.com/rodjek/puppet-lint/issues/759)
|
|
10
|
+
- 2.3.1: puppet-lint does not show errors/warnings --error-level option. [\#756](https://github.com/rodjek/puppet-lint/issues/756)
|
|
11
|
+
|
|
12
|
+
**Merged pull requests:**
|
|
13
|
+
|
|
14
|
+
- Add some basic acceptance tests [\#764](https://github.com/rodjek/puppet-lint/pull/764) ([rodjek](https://github.com/rodjek))
|
|
15
|
+
- Restore Ruby 1.8.7 support [\#763](https://github.com/rodjek/puppet-lint/pull/763) ([rodjek](https://github.com/rodjek))
|
|
16
|
+
- Don't override ignore\_paths set in rake task with default value [\#762](https://github.com/rodjek/puppet-lint/pull/762) ([rodjek](https://github.com/rodjek))
|
|
17
|
+
- Add spec for issue raised in \#754 \#756 [\#761](https://github.com/rodjek/puppet-lint/pull/761) ([rodjek](https://github.com/rodjek))
|
|
18
|
+
- Fix setup of default log\_format in PuppetLink.configuration when it is empty. [\#757](https://github.com/rodjek/puppet-lint/pull/757) ([zekefast](https://github.com/zekefast))
|
|
19
|
+
|
|
3
20
|
## [2.3.2](https://github.com/rodjek/puppet-lint/tree/2.3.2) (2017-09-27)
|
|
4
21
|
[Full Changelog](https://github.com/rodjek/puppet-lint/compare/2.3.1...2.3.2)
|
|
5
22
|
|
data/Rakefile
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
require 'rake'
|
|
2
2
|
require 'rspec/core/rake_task'
|
|
3
3
|
require 'puppet-lint'
|
|
4
|
+
require 'puppet-lint/tasks/release_test'
|
|
4
5
|
|
|
5
6
|
task :default => :test
|
|
6
7
|
|
|
@@ -27,4 +28,6 @@ rescue LoadError
|
|
|
27
28
|
$stderr.puts 'Rubocop is not available for this version of Ruby.'
|
|
28
29
|
end
|
|
29
30
|
|
|
31
|
+
task :ci => [:test, :release_test]
|
|
32
|
+
|
|
30
33
|
# vim: syntax=ruby
|
data/appveyor.yml
CHANGED
data/lib/puppet-lint.rb
CHANGED
|
@@ -8,6 +8,7 @@ require 'puppet-lint/configuration'
|
|
|
8
8
|
require 'puppet-lint/data'
|
|
9
9
|
require 'puppet-lint/checks'
|
|
10
10
|
require 'puppet-lint/bin'
|
|
11
|
+
require 'puppet-lint/monkeypatches'
|
|
11
12
|
|
|
12
13
|
class PuppetLint::NoCodeError < StandardError; end
|
|
13
14
|
class PuppetLint::NoFix < StandardError; end
|
|
@@ -89,7 +90,7 @@ class PuppetLint
|
|
|
89
90
|
#
|
|
90
91
|
# Returns a format String to be used with String#%.
|
|
91
92
|
def log_format
|
|
92
|
-
if configuration.log_format
|
|
93
|
+
if configuration.log_format.nil? || configuration.log_format.empty?
|
|
93
94
|
## recreate previous old log format as far as thats possible.
|
|
94
95
|
format = '%{KIND}: %{message} on line %{line}'
|
|
95
96
|
format.prepend('%{path} - ') if configuration.with_filename
|
data/lib/puppet-lint/checks.rb
CHANGED
|
@@ -68,7 +68,7 @@ class PuppetLint::Checks
|
|
|
68
68
|
|
|
69
69
|
@problems
|
|
70
70
|
rescue => e
|
|
71
|
-
puts <<-END.gsub(%r{^ {6}}, '')
|
|
71
|
+
$stdout.puts <<-END.gsub(%r{^ {6}}, '')
|
|
72
72
|
Whoops! It looks like puppet-lint has encountered an error that it doesn't
|
|
73
73
|
know how to handle. Please open an issue at https://github.com/rodjek/puppet-lint
|
|
74
74
|
and paste the following output into the issue description.
|
|
@@ -80,7 +80,7 @@ class PuppetLint::Checks
|
|
|
80
80
|
END
|
|
81
81
|
|
|
82
82
|
if File.readable?(fileinfo)
|
|
83
|
-
puts [
|
|
83
|
+
$stdout.puts [
|
|
84
84
|
'file contents:',
|
|
85
85
|
'```',
|
|
86
86
|
File.read(fileinfo),
|
|
@@ -88,7 +88,7 @@ class PuppetLint::Checks
|
|
|
88
88
|
].join("\n")
|
|
89
89
|
end
|
|
90
90
|
|
|
91
|
-
puts [
|
|
91
|
+
$stdout.puts [
|
|
92
92
|
'error:',
|
|
93
93
|
'```',
|
|
94
94
|
"#{e.class}: #{e.message}",
|
|
@@ -50,9 +50,9 @@ class PuppetLint
|
|
|
50
50
|
#
|
|
51
51
|
# <option>=(value)
|
|
52
52
|
def method_missing(method, *args, &_block)
|
|
53
|
-
super unless method.to_s =~ %r{^(
|
|
53
|
+
super unless method.to_s =~ %r{^(\w+)=?$}
|
|
54
54
|
|
|
55
|
-
option = Regexp.last_match(
|
|
55
|
+
option = Regexp.last_match(1)
|
|
56
56
|
add_option(option.to_s) if settings[option].nil?
|
|
57
57
|
settings[option] = args[0] unless args.empty?
|
|
58
58
|
end
|
data/lib/puppet-lint/lexer.rb
CHANGED
|
@@ -170,7 +170,7 @@ class PuppetLint
|
|
|
170
170
|
# \v == vertical tab
|
|
171
171
|
# \f == form feed
|
|
172
172
|
# \p{Zs} == ASCII + Unicode non-linebreaking whitespace
|
|
173
|
-
WHITESPACE_RE = %r{[\t\v\f\p{Zs}]}
|
|
173
|
+
WHITESPACE_RE = RUBY_VERSION == '1.8.7' ? %r{[\t\v\f ]} : %r{[\t\v\f\p{Zs}]}
|
|
174
174
|
|
|
175
175
|
# Internal: Access the internal token storage.
|
|
176
176
|
#
|
|
@@ -266,7 +266,7 @@ class PuppetLint
|
|
|
266
266
|
else
|
|
267
267
|
heredoc_tag = heredoc_queue.shift
|
|
268
268
|
heredoc_name = heredoc_tag[%r{\A"?(.+?)"?(:.+?)?(/.*)?\Z}, 1]
|
|
269
|
-
str_contents = StringScanner.new(code[i + length..-1]).scan_until(%r{\|?\s*-?\s*#{heredoc_name}})
|
|
269
|
+
str_contents = StringScanner.new(code[(i + length)..-1]).scan_until(%r{\|?\s*-?\s*#{heredoc_name}})
|
|
270
270
|
interpolate_heredoc(str_contents, heredoc_tag)
|
|
271
271
|
length += str_contents.size
|
|
272
272
|
end
|
|
@@ -282,8 +282,8 @@ class PuppetLint
|
|
|
282
282
|
unless heredoc_queue.empty?
|
|
283
283
|
heredoc_tag = heredoc_queue.shift
|
|
284
284
|
heredoc_name = heredoc_tag[%r{\A"?(.+?)"?(:.+?)?(/.*)?\Z}, 1]
|
|
285
|
-
str_contents = StringScanner.new(code[i + length..-1]).scan_until(%r{\|?\s*-?\s*#{heredoc_name}})
|
|
286
|
-
_ = code[0..i + length].split("\n")
|
|
285
|
+
str_contents = StringScanner.new(code[(i + length)..-1]).scan_until(%r{\|?\s*-?\s*#{heredoc_name}})
|
|
286
|
+
_ = code[0..(i + length)].split("\n")
|
|
287
287
|
interpolate_heredoc(str_contents, heredoc_tag)
|
|
288
288
|
length += str_contents.size
|
|
289
289
|
end
|
|
@@ -557,8 +557,8 @@ class PuppetLint
|
|
|
557
557
|
|
|
558
558
|
str = string.scan_until(regexp)
|
|
559
559
|
begin
|
|
560
|
-
str =~ %r{\A(
|
|
561
|
-
[Regexp.last_match(
|
|
560
|
+
str =~ %r{\A(.*?)([$]+|\|?\s*-?#{Regexp.escape(eos_text)})\Z}m
|
|
561
|
+
[Regexp.last_match(1), Regexp.last_match(2)]
|
|
562
562
|
rescue
|
|
563
563
|
[nil, nil]
|
|
564
564
|
end
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
begin
|
|
2
|
+
'%{test}' % { :test => 'replaced' } == 'replaced' # rubocop:disable Style/FormatString
|
|
3
|
+
rescue
|
|
4
|
+
# monkeypatch String#% into Ruby 1.8.7
|
|
5
|
+
class String
|
|
6
|
+
Percent = instance_method('%') unless defined?(Percent)
|
|
7
|
+
|
|
8
|
+
def %(*a, &b)
|
|
9
|
+
a.flatten!
|
|
10
|
+
|
|
11
|
+
string = case a.last
|
|
12
|
+
when Hash
|
|
13
|
+
expand(a.pop)
|
|
14
|
+
else
|
|
15
|
+
self
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
if a.empty?
|
|
19
|
+
string
|
|
20
|
+
else
|
|
21
|
+
Percent.bind(string).call(a, &b)
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def expand!(vars = {})
|
|
26
|
+
loop do
|
|
27
|
+
changed = false
|
|
28
|
+
vars.each do |var, value|
|
|
29
|
+
var = var.to_s
|
|
30
|
+
var.gsub!(%r{[^a-zA-Z0-9_]}, '')
|
|
31
|
+
changed = gsub!(%r{\%\{#{var}\}}, value.to_s)
|
|
32
|
+
end
|
|
33
|
+
break unless changed
|
|
34
|
+
end
|
|
35
|
+
self
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def expand(opts = {})
|
|
39
|
+
dup.expand!(opts)
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
unless String.respond_to?(:prepend)
|
|
45
|
+
# monkeypatch String#prepend into Ruby 1.8.7
|
|
46
|
+
class String
|
|
47
|
+
def prepend(lead)
|
|
48
|
+
replace("#{lead}#{self}")
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
@@ -44,7 +44,7 @@ class PuppetLint::OptParser
|
|
|
44
44
|
opts.on(
|
|
45
45
|
'--error-level LEVEL',
|
|
46
46
|
[:all, :warning, :error],
|
|
47
|
-
'The level of error to return (warning, error or all).'
|
|
47
|
+
'The level of error to return (warning, error or all).'
|
|
48
48
|
) do |el|
|
|
49
49
|
PuppetLint.configuration.error_level = el
|
|
50
50
|
end
|
|
@@ -11,7 +11,7 @@ PuppetLint.new_check(:class_inherits_from_params_class) do
|
|
|
11
11
|
:warning,
|
|
12
12
|
:message => 'class inheriting from params class',
|
|
13
13
|
:line => class_idx[:inherited_token].line,
|
|
14
|
-
:column => class_idx[:inherited_token].column
|
|
14
|
+
:column => class_idx[:inherited_token].column
|
|
15
15
|
)
|
|
16
16
|
end
|
|
17
17
|
end
|
|
@@ -16,7 +16,7 @@ PuppetLint.new_check(:inherits_across_namespaces) do
|
|
|
16
16
|
:warning,
|
|
17
17
|
:message => 'class inherits across module namespaces',
|
|
18
18
|
:line => class_idx[:inherited_token].line,
|
|
19
|
-
:column => class_idx[:inherited_token].column
|
|
19
|
+
:column => class_idx[:inherited_token].column
|
|
20
20
|
)
|
|
21
21
|
end
|
|
22
22
|
end
|
|
@@ -17,7 +17,7 @@ PuppetLint.new_check(:names_containing_dash) do
|
|
|
17
17
|
:error,
|
|
18
18
|
:message => "#{obj_type} name containing a dash",
|
|
19
19
|
:line => class_idx[:name_token].line,
|
|
20
|
-
:column => class_idx[:name_token].column
|
|
20
|
+
:column => class_idx[:name_token].column
|
|
21
21
|
)
|
|
22
22
|
end
|
|
23
23
|
end
|
|
@@ -18,7 +18,7 @@ PuppetLint.new_check(:names_containing_uppercase) do
|
|
|
18
18
|
:message => "#{obj_type} '#{class_idx[:name_token].value}' contains illegal uppercase",
|
|
19
19
|
:line => class_idx[:name_token].line,
|
|
20
20
|
:column => class_idx[:name_token].column,
|
|
21
|
-
:token => class_idx[:name_token]
|
|
21
|
+
:token => class_idx[:name_token]
|
|
22
22
|
)
|
|
23
23
|
end
|
|
24
24
|
end
|
|
@@ -14,7 +14,7 @@ PuppetLint.new_check(:unquoted_node_name) do
|
|
|
14
14
|
:check => :syntax,
|
|
15
15
|
:message => 'Syntax error (try running `puppet parser validate <file>`)',
|
|
16
16
|
:line => node.line,
|
|
17
|
-
:column => node.column
|
|
17
|
+
:column => node.column
|
|
18
18
|
)
|
|
19
19
|
next
|
|
20
20
|
end
|
|
@@ -29,7 +29,7 @@ PuppetLint.new_check(:unquoted_node_name) do
|
|
|
29
29
|
:message => 'unquoted node name found',
|
|
30
30
|
:line => token.line,
|
|
31
31
|
:column => token.column,
|
|
32
|
-
:token => token
|
|
32
|
+
:token => token
|
|
33
33
|
)
|
|
34
34
|
end
|
|
35
35
|
end
|
|
@@ -73,7 +73,7 @@ PuppetLint.new_check(:arrow_alignment) do
|
|
|
73
73
|
:token => arrow_tok,
|
|
74
74
|
:arrow_column => arrow_column[level_idx],
|
|
75
75
|
:newline => arrows_on_line.index(arrow_tok) != 0,
|
|
76
|
-
:newline_indent => param_column[level_idx] - 1
|
|
76
|
+
:newline_indent => param_column[level_idx] - 1
|
|
77
77
|
)
|
|
78
78
|
end
|
|
79
79
|
end
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
require 'rake'
|
|
2
|
+
require 'open3'
|
|
3
|
+
require 'English'
|
|
4
|
+
|
|
5
|
+
def run_cmd(message, *cmd)
|
|
6
|
+
print(" #{message}... ")
|
|
7
|
+
|
|
8
|
+
if Open3.respond_to?(:capture2e)
|
|
9
|
+
output, status = Open3.capture2e(*cmd)
|
|
10
|
+
else
|
|
11
|
+
output = ''
|
|
12
|
+
|
|
13
|
+
Open3.popen3(*cmd) do |stdin, stdout, stderr|
|
|
14
|
+
stdin.close
|
|
15
|
+
output += stdout.read
|
|
16
|
+
output += stderr.read
|
|
17
|
+
end
|
|
18
|
+
status = $CHILD_STATUS.dup
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
if status.success?
|
|
22
|
+
puts 'Done'
|
|
23
|
+
else
|
|
24
|
+
puts 'FAILED'
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
[output.strip, status.success?]
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
task :release_test do
|
|
31
|
+
branch = if ENV['APPVEYOR']
|
|
32
|
+
ENV['APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH']
|
|
33
|
+
elsif ENV['TRAVIS']
|
|
34
|
+
ENV['TRAVIS_PULL_REQUEST_BRANCH']
|
|
35
|
+
else
|
|
36
|
+
false
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
if branch && branch !~ %r{\A\d+_\d+_\d+_release\Z}
|
|
40
|
+
puts 'Skipping release tests on feature branch'
|
|
41
|
+
exit
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
modules_to_test = [
|
|
45
|
+
'puppetlabs/puppetlabs-apt',
|
|
46
|
+
'puppetlabs/puppetlabs-tomcat',
|
|
47
|
+
'puppetlabs/puppetlabs-apache',
|
|
48
|
+
'puppetlabs/puppetlabs-mysql',
|
|
49
|
+
'puppetlabs/puppetlabs-ntp',
|
|
50
|
+
'puppetlabs/puppetlabs-chocolatey',
|
|
51
|
+
'voxpupuli/puppet-archive',
|
|
52
|
+
'voxpupuli/puppet-collectd',
|
|
53
|
+
'garethr/garethr-docker',
|
|
54
|
+
'sensu/sensu-puppet',
|
|
55
|
+
'jenkinsci/puppet-jenkins',
|
|
56
|
+
]
|
|
57
|
+
|
|
58
|
+
FileUtils.mkdir_p('tmp')
|
|
59
|
+
Dir.chdir('tmp') do
|
|
60
|
+
modules_to_test.each do |module_name|
|
|
61
|
+
puts "Testing #{module_name}..."
|
|
62
|
+
module_dir = File.basename(module_name)
|
|
63
|
+
|
|
64
|
+
if File.directory?(module_dir)
|
|
65
|
+
Dir.chdir(module_dir) do
|
|
66
|
+
_, success = run_cmd('Updating repository', 'git', 'pull', '--rebase')
|
|
67
|
+
next unless success
|
|
68
|
+
end
|
|
69
|
+
else
|
|
70
|
+
_, success = run_cmd('Cloning repository', 'git', 'clone', "https://github.com/#{module_name}")
|
|
71
|
+
next unless success
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
Dir.chdir(module_dir) do
|
|
75
|
+
output, success = run_cmd('Running puppet-lint', 'bundle', 'exec', 'puppet-lint', '--relative', '--no-documentation-check', 'manifests')
|
|
76
|
+
unless output.empty?
|
|
77
|
+
output.split("\n").each do |line|
|
|
78
|
+
puts " #{line}"
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
end
|
data/lib/puppet-lint/version.rb
CHANGED
|
@@ -69,7 +69,7 @@ describe PuppetLint::Bin do
|
|
|
69
69
|
[
|
|
70
70
|
"#{args[0]} - WARNING: optional parameter listed before required parameter on line 2",
|
|
71
71
|
"#{args[1]} - ERROR: test::foo not in autoload module layout on line 2",
|
|
72
|
-
].join("\n")
|
|
72
|
+
].join("\n")
|
|
73
73
|
)
|
|
74
74
|
end
|
|
75
75
|
end
|
|
@@ -165,7 +165,7 @@ describe PuppetLint::Bin do
|
|
|
165
165
|
'',
|
|
166
166
|
" define test::warning($foo='bar', $baz) { }",
|
|
167
167
|
' ^',
|
|
168
|
-
].join("\n")
|
|
168
|
+
].join("\n")
|
|
169
169
|
)
|
|
170
170
|
end
|
|
171
171
|
end
|
|
@@ -397,7 +397,7 @@ describe PuppetLint::Bin do
|
|
|
397
397
|
[
|
|
398
398
|
'IGNORED: double quoted string containing no variables on line 3',
|
|
399
399
|
' for a good reason',
|
|
400
|
-
].join("\n")
|
|
400
|
+
].join("\n")
|
|
401
401
|
)
|
|
402
402
|
end
|
|
403
403
|
end
|
|
@@ -40,7 +40,7 @@ describe PuppetLint::Checks do
|
|
|
40
40
|
:column => 2,
|
|
41
41
|
:path => anything,
|
|
42
42
|
:fullpath => anything,
|
|
43
|
-
:filename => anything
|
|
43
|
+
:filename => anything
|
|
44
44
|
)
|
|
45
45
|
end
|
|
46
46
|
end
|
|
@@ -62,7 +62,7 @@ describe PuppetLint::Checks do
|
|
|
62
62
|
:column => 2,
|
|
63
63
|
:path => anything,
|
|
64
64
|
:fullpath => anything,
|
|
65
|
-
:filename => anything
|
|
65
|
+
:filename => anything
|
|
66
66
|
)
|
|
67
67
|
end
|
|
68
68
|
end
|
|
@@ -111,7 +111,7 @@ describe PuppetLint::Checks do
|
|
|
111
111
|
instance_double(
|
|
112
112
|
PuppetLint::CheckPlugin,
|
|
113
113
|
:run => [{ :kind => :error, :check => :arrow_alignment }],
|
|
114
|
-
:fix_problems => [{ :kind => :fixed, :check => :arrow_alignment }]
|
|
114
|
+
:fix_problems => [{ :kind => :fixed, :check => :arrow_alignment }]
|
|
115
115
|
)
|
|
116
116
|
end
|
|
117
117
|
let(:mock_hard_tabs) do
|
|
@@ -203,7 +203,7 @@ describe PuppetLint::Checks do
|
|
|
203
203
|
end
|
|
204
204
|
|
|
205
205
|
it 'checks the configuration for each check to see if it is enabled' do
|
|
206
|
-
expect(enabled_checks.sort).to eq(expected_enabled_checks.sort)
|
|
206
|
+
expect(enabled_checks.map(&:to_s).sort).to eq(expected_enabled_checks.map(&:to_s).sort)
|
|
207
207
|
end
|
|
208
208
|
end
|
|
209
209
|
|
|
@@ -31,7 +31,7 @@ describe PuppetLint::Configuration do
|
|
|
31
31
|
expect(subject.foobarbaz).to be_nil
|
|
32
32
|
end
|
|
33
33
|
|
|
34
|
-
it 'should
|
|
34
|
+
it 'should be able to explicitly add options' do
|
|
35
35
|
subject.add_option('bar')
|
|
36
36
|
|
|
37
37
|
expect(subject.bar).to be_nil
|
|
@@ -40,6 +40,14 @@ describe PuppetLint::Configuration do
|
|
|
40
40
|
expect(subject.bar).to eq('aoeui')
|
|
41
41
|
end
|
|
42
42
|
|
|
43
|
+
it 'should be able to add options on the fly' do
|
|
44
|
+
expect(subject.test_option).to eq(nil)
|
|
45
|
+
|
|
46
|
+
subject.test_option = 'test'
|
|
47
|
+
|
|
48
|
+
expect(subject.test_option).to eq('test')
|
|
49
|
+
end
|
|
50
|
+
|
|
43
51
|
it 'should be able to set sane defaults' do
|
|
44
52
|
subject.defaults
|
|
45
53
|
|
|
@@ -52,7 +60,7 @@ describe PuppetLint::Configuration do
|
|
|
52
60
|
'fix' => false,
|
|
53
61
|
'show_ignored' => false,
|
|
54
62
|
'json' => false,
|
|
55
|
-
'ignore_paths' => ['vendor/**/*.pp']
|
|
63
|
+
'ignore_paths' => ['vendor/**/*.pp']
|
|
56
64
|
)
|
|
57
65
|
end
|
|
58
66
|
end
|
|
@@ -1525,7 +1525,7 @@ END
|
|
|
1525
1525
|
expect(token.value).to eq("\t")
|
|
1526
1526
|
end
|
|
1527
1527
|
|
|
1528
|
-
it 'should parse unicode spaces' do
|
|
1528
|
+
it 'should parse unicode spaces', :unless => RUBY_VERSION == '1.8.7' do
|
|
1529
1529
|
token = @lexer.tokenise("\xc2\xa0").first
|
|
1530
1530
|
expect(token.type).to eq(:WHITESPACE)
|
|
1531
1531
|
expect(token.value).to eq("\xc2\xa0")
|
data/spec/spec_helper.rb
CHANGED
|
@@ -131,7 +131,7 @@ RSpec.configure do |config|
|
|
|
131
131
|
config.include(
|
|
132
132
|
RSpec::LintExampleGroup,
|
|
133
133
|
:type => :lint,
|
|
134
|
-
:file_path => Regexp.compile(%w[spec puppet-lint plugins].join('[\\\/]'))
|
|
134
|
+
:file_path => Regexp.compile(%w[spec puppet-lint plugins].join('[\\\/]'))
|
|
135
135
|
)
|
|
136
136
|
|
|
137
137
|
config.expect_with(:rspec) do |c|
|
metadata
CHANGED
|
@@ -1,29 +1,40 @@
|
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: puppet-lint
|
|
3
|
-
version: !ruby/object:Gem::Version
|
|
4
|
-
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
hash: 5
|
|
5
|
+
prerelease:
|
|
6
|
+
segments:
|
|
7
|
+
- 2
|
|
8
|
+
- 3
|
|
9
|
+
- 3
|
|
10
|
+
version: 2.3.3
|
|
5
11
|
platform: ruby
|
|
6
|
-
authors:
|
|
12
|
+
authors:
|
|
7
13
|
- Tim Sharpe
|
|
8
14
|
autorequire:
|
|
9
15
|
bindir: bin
|
|
10
16
|
cert_chain: []
|
|
11
|
-
|
|
17
|
+
|
|
18
|
+
date: 2017-09-28 00:00:00 +10:00
|
|
19
|
+
default_executable:
|
|
12
20
|
dependencies: []
|
|
21
|
+
|
|
13
22
|
description: |-
|
|
14
23
|
Checks your Puppet manifests against the Puppetlabs
|
|
15
24
|
style guide and alerts you to any discrepancies.
|
|
16
25
|
email: tim@sharpe.id.au
|
|
17
|
-
executables:
|
|
26
|
+
executables:
|
|
18
27
|
- puppet-lint
|
|
19
28
|
extensions: []
|
|
29
|
+
|
|
20
30
|
extra_rdoc_files: []
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
-
|
|
26
|
-
-
|
|
31
|
+
|
|
32
|
+
files:
|
|
33
|
+
- .gitignore
|
|
34
|
+
- .rspec
|
|
35
|
+
- .rubocop.yml
|
|
36
|
+
- .rubocop_todo.yml
|
|
37
|
+
- .travis.yml
|
|
27
38
|
- CHANGELOG.md
|
|
28
39
|
- Gemfile
|
|
29
40
|
- LICENSE
|
|
@@ -39,6 +50,7 @@ files:
|
|
|
39
50
|
- lib/puppet-lint/data.rb
|
|
40
51
|
- lib/puppet-lint/lexer.rb
|
|
41
52
|
- lib/puppet-lint/lexer/token.rb
|
|
53
|
+
- lib/puppet-lint/monkeypatches.rb
|
|
42
54
|
- lib/puppet-lint/optparser.rb
|
|
43
55
|
- lib/puppet-lint/plugins.rb
|
|
44
56
|
- lib/puppet-lint/plugins/check_classes/arrow_on_right_operand_line.rb
|
|
@@ -79,6 +91,7 @@ files:
|
|
|
79
91
|
- lib/puppet-lint/plugins/check_whitespace/hard_tabs.rb
|
|
80
92
|
- lib/puppet-lint/plugins/check_whitespace/trailing_whitespace.rb
|
|
81
93
|
- lib/puppet-lint/tasks/puppet-lint.rb
|
|
94
|
+
- lib/puppet-lint/tasks/release_test.rb
|
|
82
95
|
- lib/puppet-lint/version.rb
|
|
83
96
|
- puppet-lint.gemspec
|
|
84
97
|
- spec/fixtures/test/manifests/fail.pp
|
|
@@ -138,84 +151,39 @@ files:
|
|
|
138
151
|
- spec/puppet-lint/plugins/check_whitespace/trailing_whitespace_spec.rb
|
|
139
152
|
- spec/puppet-lint_spec.rb
|
|
140
153
|
- spec/spec_helper.rb
|
|
154
|
+
has_rdoc: true
|
|
141
155
|
homepage: https://github.com/rodjek/puppet-lint/
|
|
142
156
|
licenses: []
|
|
143
|
-
|
|
157
|
+
|
|
144
158
|
post_install_message:
|
|
145
159
|
rdoc_options: []
|
|
146
|
-
|
|
160
|
+
|
|
161
|
+
require_paths:
|
|
147
162
|
- lib
|
|
148
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
|
149
|
-
|
|
163
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
164
|
+
none: false
|
|
165
|
+
requirements:
|
|
150
166
|
- - ">="
|
|
151
|
-
- !ruby/object:Gem::Version
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
167
|
+
- !ruby/object:Gem::Version
|
|
168
|
+
hash: 3
|
|
169
|
+
segments:
|
|
170
|
+
- 0
|
|
171
|
+
version: "0"
|
|
172
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
173
|
+
none: false
|
|
174
|
+
requirements:
|
|
155
175
|
- - ">="
|
|
156
|
-
- !ruby/object:Gem::Version
|
|
157
|
-
|
|
176
|
+
- !ruby/object:Gem::Version
|
|
177
|
+
hash: 3
|
|
178
|
+
segments:
|
|
179
|
+
- 0
|
|
180
|
+
version: "0"
|
|
158
181
|
requirements: []
|
|
182
|
+
|
|
159
183
|
rubyforge_project:
|
|
160
|
-
rubygems_version:
|
|
184
|
+
rubygems_version: 1.6.2
|
|
161
185
|
signing_key:
|
|
162
|
-
specification_version:
|
|
186
|
+
specification_version: 3
|
|
163
187
|
summary: Ensure your Puppet manifests conform with the Puppetlabs style guide
|
|
164
|
-
test_files:
|
|
165
|
-
|
|
166
|
-
- spec/fixtures/test/manifests/ignore.pp
|
|
167
|
-
- spec/fixtures/test/manifests/ignore_multiple_block.pp
|
|
168
|
-
- spec/fixtures/test/manifests/ignore_multiple_line.pp
|
|
169
|
-
- spec/fixtures/test/manifests/ignore_reason.pp
|
|
170
|
-
- spec/fixtures/test/manifests/init.pp
|
|
171
|
-
- spec/fixtures/test/manifests/malformed.pp
|
|
172
|
-
- spec/fixtures/test/manifests/mismatched_control_comment.pp
|
|
173
|
-
- spec/fixtures/test/manifests/unterminated_control_comment.pp
|
|
174
|
-
- spec/fixtures/test/manifests/url_interpolation.pp
|
|
175
|
-
- spec/fixtures/test/manifests/warning.pp
|
|
176
|
-
- spec/puppet-lint/bin_spec.rb
|
|
177
|
-
- spec/puppet-lint/checks_spec.rb
|
|
178
|
-
- spec/puppet-lint/configuration_spec.rb
|
|
179
|
-
- spec/puppet-lint/data_spec.rb
|
|
180
|
-
- spec/puppet-lint/ignore_overrides_spec.rb
|
|
181
|
-
- spec/puppet-lint/lexer/token_spec.rb
|
|
182
|
-
- spec/puppet-lint/lexer_spec.rb
|
|
183
|
-
- spec/puppet-lint/plugins/check_classes/arrow_on_right_operand_line_spec.rb
|
|
184
|
-
- spec/puppet-lint/plugins/check_classes/autoloader_layout_spec.rb
|
|
185
|
-
- spec/puppet-lint/plugins/check_classes/class_inherits_from_params_class_spec.rb
|
|
186
|
-
- spec/puppet-lint/plugins/check_classes/code_on_top_scope_spec.rb
|
|
187
|
-
- spec/puppet-lint/plugins/check_classes/inherits_across_namespaces_spec.rb
|
|
188
|
-
- spec/puppet-lint/plugins/check_classes/name_contains_uppercase_spec.rb
|
|
189
|
-
- spec/puppet-lint/plugins/check_classes/names_containing_dash_spec.rb
|
|
190
|
-
- spec/puppet-lint/plugins/check_classes/nested_classes_or_defines_spec.rb
|
|
191
|
-
- spec/puppet-lint/plugins/check_classes/parameter_order_spec.rb
|
|
192
|
-
- spec/puppet-lint/plugins/check_classes/right_to_left_relationship_spec.rb
|
|
193
|
-
- spec/puppet-lint/plugins/check_classes/variable_scope_spec.rb
|
|
194
|
-
- spec/puppet-lint/plugins/check_comments/slash_comments_spec.rb
|
|
195
|
-
- spec/puppet-lint/plugins/check_comments/star_comments_spec.rb
|
|
196
|
-
- spec/puppet-lint/plugins/check_conditionals/case_without_default_spec.rb
|
|
197
|
-
- spec/puppet-lint/plugins/check_conditionals/selector_inside_resource_spec.rb
|
|
198
|
-
- spec/puppet-lint/plugins/check_documentation/documentation_spec.rb
|
|
199
|
-
- spec/puppet-lint/plugins/check_nodes/unquoted_node_name_spec.rb
|
|
200
|
-
- spec/puppet-lint/plugins/check_resources/duplicate_params_spec.rb
|
|
201
|
-
- spec/puppet-lint/plugins/check_resources/ensure_first_param_spec.rb
|
|
202
|
-
- spec/puppet-lint/plugins/check_resources/ensure_not_symlink_target_spec.rb
|
|
203
|
-
- spec/puppet-lint/plugins/check_resources/file_mode_spec.rb
|
|
204
|
-
- spec/puppet-lint/plugins/check_resources/unquoted_file_mode_spec.rb
|
|
205
|
-
- spec/puppet-lint/plugins/check_resources/unquoted_resource_title_spec.rb
|
|
206
|
-
- spec/puppet-lint/plugins/check_strings/double_quoted_strings_spec.rb
|
|
207
|
-
- spec/puppet-lint/plugins/check_strings/only_variable_string_spec.rb
|
|
208
|
-
- spec/puppet-lint/plugins/check_strings/puppet_url_without_modules_spec.rb
|
|
209
|
-
- spec/puppet-lint/plugins/check_strings/quoted_booleans_spec.rb
|
|
210
|
-
- spec/puppet-lint/plugins/check_strings/single_quote_string_with_variables_spec.rb
|
|
211
|
-
- spec/puppet-lint/plugins/check_strings/variables_not_enclosed_spec.rb
|
|
212
|
-
- spec/puppet-lint/plugins/check_variables/variable_contains_dash_spec.rb
|
|
213
|
-
- spec/puppet-lint/plugins/check_variables/variable_is_lowercase_spec.rb
|
|
214
|
-
- spec/puppet-lint/plugins/check_whitespace/140chars_spec.rb
|
|
215
|
-
- spec/puppet-lint/plugins/check_whitespace/2sp_soft_tabs_spec.rb
|
|
216
|
-
- spec/puppet-lint/plugins/check_whitespace/80chars_spec.rb
|
|
217
|
-
- spec/puppet-lint/plugins/check_whitespace/arrow_alignment_spec.rb
|
|
218
|
-
- spec/puppet-lint/plugins/check_whitespace/hard_tabs_spec.rb
|
|
219
|
-
- spec/puppet-lint/plugins/check_whitespace/trailing_whitespace_spec.rb
|
|
220
|
-
- spec/puppet-lint_spec.rb
|
|
221
|
-
- spec/spec_helper.rb
|
|
188
|
+
test_files: []
|
|
189
|
+
|
checksums.yaml
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
SHA1:
|
|
3
|
-
metadata.gz: fbb487b62428cd625a1cf3d397b31caae02add69
|
|
4
|
-
data.tar.gz: 07c43049840cb8f2fbb145582eb2bc2b8ef2080a
|
|
5
|
-
SHA512:
|
|
6
|
-
metadata.gz: 7e15459e1239a53a0bacd8f02bce2d762a19e30801778dce52359e0fdc19ece26f1a0557bfd656ec87fcaf0fc9e1ff1e3c0d9648e1a9713f43509f05ae18e9c7
|
|
7
|
-
data.tar.gz: da721067ae63f5a41452ef969fe5871c16edc155ff89e602860afe200a5df5fc52013a8d5150a2916791a7302c87742857e23bc2f0f2af6c4fe90d457ea1b4e6
|