|
172 | 172 | # Must clear as it will not override the existing puppet-lint rake task since we require to import for
|
173 | 173 | # the PuppetLint::RakeTask
|
174 | 174 | 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 |
176 | 177 | 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}") |
197 | 197 | end
|
| 198 | +PuppetLint::RakeTask.new(:lint) |
198 | 199 |
|
199 | 200 | desc 'Run puppet-lint and fix issues automatically'
|
200 | 201 | PuppetLint::RakeTask.new(:lint_fix) do |config|
|
201 |
| - config.fail_on_warnings = true |
202 | 202 | 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 |
| - ] |
221 | 203 | end
|
222 | 204 |
|
223 | 205 | require 'puppet-syntax/tasks/puppet-syntax'
|
|
0 commit comments