Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ Metrics/ClassLength:
Metrics/CyclomaticComplexity:
Max: 33

# Offense count: 80
# Offense count: 81
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
Metrics/MethodLength:
Max: 108
Max: 111

# Offense count: 26
# Configuration parameters: AllowedMethods, AllowedPatterns.
Expand Down
4 changes: 4 additions & 0 deletions lib/puppet-lint/optparser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ def self.build(args = [])
PuppetLint.configuration.ignore_paths = paths.split(',')
end

opts.on('--top-scope-variables VARS', 'A comma separated list of allowed top scope variables') do |vars|
PuppetLint.configuration.top_scope_variables = vars.split(',')
end

PuppetLint.configuration.checks.each do |check|
opts.on("--no-#{check}-check", "Skip the #{check} check.") do
PuppetLint.configuration.send(:"disable_#{check}")
Expand Down
4 changes: 4 additions & 0 deletions spec/fixtures/test/manifests/top_scope_variables.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# dummy resource to test --top-scope-variables
define test::top_scope_variables() {
notice($::role)
}
12 changes: 12 additions & 0 deletions spec/unit/puppet-lint/bin_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,18 @@ def initialize(args)
its(:stdout) { is_expected.to eq('') }
end

context 'when passed top scope variables option' do
let(:args) do
[
'--top-scope-variables=role',
'spec/fixtures/test/manifests/top_scope_variables.pp',
]
end

its(:exitstatus) { is_expected.to eq(0) }
its(:stdout) { is_expected.to eq('') }
end

context 'when limited to errors only' do
let(:args) do
[
Expand Down
Loading