Class: PDK::Validate::PuppetLint
Constant Summary
BaseValidator::ALLOW_EMPTY_TARGETS, BaseValidator::IGNORE_DOTFILES, BaseValidator::INVOKE_STYLE
Class Method Summary
collapse
allow_empty_targets?, cmd_path, ignore_dotfiles?, ignore_pathspec, invoke, parse_targets, process_invalid, process_skipped
Class Method Details
.cmd ⇒ Object
10
11
12
|
# File 'lib/pdk/validate/puppet/puppet_lint.rb', line 10
def self.cmd
'puppet-lint'
end
|
.name ⇒ Object
6
7
8
|
# File 'lib/pdk/validate/puppet/puppet_lint.rb', line 6
def self.name
'puppet-lint'
end
|
.parse_options(options, targets) ⇒ Object
22
23
24
25
26
27
28
|
# File 'lib/pdk/validate/puppet/puppet_lint.rb', line 22
def self.parse_options(options, targets)
cmd_options = ['--json', '--relative']
cmd_options << '--fix' if options[:auto_correct]
cmd_options.concat(targets)
end
|
.parse_output(report, result, targets) ⇒ Object
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
# File 'lib/pdk/validate/puppet/puppet_lint.rb', line 30
def self.parse_output(report, result, targets)
begin
json_data = JSON.parse(result[:stdout]).flatten
rescue JSON::ParserError
raise PDK::Validate::ParseOutputError, result[:stdout]
end
targets.reject { |target| json_data.any? { |j| j['path'] == target } }.each do |target|
report.add_event(
file: target,
source: name,
severity: 'ok',
state: :passed,
)
end
json_data.each do |offense|
report.add_event(
file: offense['path'],
source: name,
line: offense['line'],
column: offense['column'],
message: offense['message'],
test: offense['check'],
severity: (offense['kind'] == 'fixed') ? 'corrected' : offense['kind'],
state: :failure,
)
end
end
|
.pattern ⇒ Object
14
15
16
|
# File 'lib/pdk/validate/puppet/puppet_lint.rb', line 14
def self.pattern
'**/*.pp'
end
|
.spinner_text(_targets = nil) ⇒ Object
18
19
20
|
# File 'lib/pdk/validate/puppet/puppet_lint.rb', line 18
def self.spinner_text(_targets = nil)
_('Checking Puppet manifest style (%{pattern}).') % { pattern: pattern }
end
|