我正在使用 https://github.com/garethr/puppet-module-skeleton作为我的 Puppet 模块骨架。 对于特定模块,我然后通过 rake 使用 puppet-lint。我的Rakefile中的相关部分如下:
require 'puppet-lint/tasks/puppet-lint'
PuppetLint.configuration.relative = true
PuppetLint.configuration.send("disable_80chars")
PuppetLint.configuration.log_format = "%{path}:%{linenumber}:%{check}:%{KIND}:%{message}"
PuppetLint.configuration.fail_on_warnings = true
# Forsake support for Puppet 2.6.2 for the benefit of cleaner code.
# http://puppet-lint.com/checks/class_parameter_defaults/
PuppetLint.configuration.send('disable_class_parameter_defaults')
# http://puppet-lint.com/checks/class_inherits_from_params_class/
PuppetLint.configuration.send('disable_class_inherits_from_params_class')
exclude_paths = [
"pkg/**/*",
"vendor/**/*",
"spec/**/*",
]
PuppetLint.configuration.ignore_paths = exclude_paths
运行 bundle exec rake lint
时,我从 puppet-lint 得到了预期的输出,除了 puppet-lint 正在检查文件,例如 vendor/bundle
和spec/fixtures/modules
也是如此。除了无意之外,它似乎与上述 Rakefile 片段的最后六行相矛盾。怎么了?
最佳答案
正如您所链接的,这目前已损坏
此提交已修复:https://github.com/rodjek/puppet-lint/commit/0f2e2db90d5a14382eafbdfebff74048a487372f
但是,这是在1.1.0
所以你可以直接在 bundler 中使用 Github 引用(或者等待下一个版本)
source "http://rubygems.org"
group :test do
gem "puppet-lint", :git => 'https://github.com/rodjek/puppet-lint.git'
end
或者使用您发布的解决方法:
Rake::Task[:lint].clear
PuppetLint::RakeTask.new :lint do |config|
config.disable_checks = [
'80chars',
'class_parameter_defaults',
'class_inherits_from_params_class'
]
config.log_format = "%{path}:%{linenumber}:%{check}:%{KIND}:%{message}"
config.fail_on_warnings = true
#config.relative = true
config.ignore_paths = exclude_paths
end
关于ruby - puppet-lint 忽略 ignore_paths 选项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27138893/