Skip to content

Commit a4bed8a

Browse files
committed
Restructure PuppetLint rake tasks so they can be configurable
1 parent caa3191 commit a4bed8a

File tree

1 file changed

+22
-40
lines changed

1 file changed

+22
-40
lines changed

lib/puppetlabs_spec_helper/rake_tasks.rb

Lines changed: 22 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -172,52 +172,34 @@
172172
# Must clear as it will not override the existing puppet-lint rake task since we require to import for
173173
# the PuppetLint::RakeTask
174174
Rake::Task[:lint].clear
175-
# Relative is not able to be set within the context of PuppetLint::RakeTask
175+
# Utilize PuppetLint global configuration so that these settings can be tweaked by
176+
# spec_helper.rb in an individual module
176177
PuppetLint.configuration.relative = true
177-
PuppetLint::RakeTask.new(:lint) do |config|
178-
config.fail_on_warnings = true
179-
config.disable_checks = %w[
180-
80chars
181-
140chars
182-
class_inherits_from_params_class
183-
class_parameter_defaults
184-
disable_autoloader_layout
185-
documentation
186-
single_quote_string_with_variables
187-
]
188-
config.ignore_paths = [
189-
'.vendor/**/*.pp',
190-
'bundle/**/*.pp',
191-
'pkg/**/*.pp',
192-
'spec/**/*.pp',
193-
'tests/**/*.pp',
194-
'types/**/*.pp',
195-
'vendor/**/*.pp',
196-
]
178+
PuppetLint.configuration.ignore_paths ||= []
179+
PuppetLint.configuration.ignore_paths << '.vendor/**/*.pp'
180+
PuppetLint.configuration.ignore_paths << 'bundle/**/*.pp'
181+
PuppetLint.configuration.ignore_paths << 'pkg/**/*.pp'
182+
PuppetLint.configuration.ignore_paths << 'spec/**/*.pp'
183+
PuppetLint.configuration.ignore_paths << 'tests/**/*.pp'
184+
PuppetLint.configuration.ignore_paths << 'types/**/*.pp'
185+
PuppetLint.configuration.ignore_paths << 'vendor/**/*.pp'
186+
puppet_lint_disable_checks = %w[
187+
80chars
188+
140chars
189+
class_inherits_from_params_class
190+
class_parameter_defaults
191+
disable_autoloader_layout
192+
documentation
193+
single_quote_string_with_variables
194+
]
195+
puppet_lint_disable_checks.each do |check|
196+
PuppetLint.configuration.send("disable_#{check}")
197197
end
198+
PuppetLint::RakeTask.new(:lint)
198199

199200
desc 'Run puppet-lint and fix issues automatically'
200201
PuppetLint::RakeTask.new(:lint_fix) do |config|
201-
config.fail_on_warnings = true
202202
config.fix = true
203-
config.disable_checks = %w[
204-
80chars
205-
140chars
206-
class_inherits_from_params_class
207-
class_parameter_defaults
208-
disable_autoloader_layout
209-
documentation
210-
single_quote_string_with_variables
211-
]
212-
config.ignore_paths = [
213-
'.vendor/**/*.pp',
214-
'bundle/**/*.pp',
215-
'pkg/**/*.pp',
216-
'spec/**/*.pp',
217-
'tests/**/*.pp',
218-
'types/**/*.pp',
219-
'vendor/**/*.pp',
220-
]
221203
end
222204

223205
require 'puppet-syntax/tasks/puppet-syntax'

0 commit comments

Comments
 (0)