ruby - puppet-lint 忽略 ignore_paths 选项

标签 ruby puppet rakefile

我正在使用 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/bundlespec/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/

相关文章:

c++ - 谷歌 SketchUp API

ruby-on-rails - 解析逗号分隔值

ruby-on-rails - ruby 中的整型变量声明

mysql - 无法使用 exec 写入文件

ruby - <echo> rakefile 中的 ant 任务是否等效?

ruby-on-rails - ActionView::Template::Error (application.css 未预编译) Rails

vagrant - 如何在 Puppet 配置的 Vagrant 项目中跨环境共享 list

puppet - 在 puppet 中 @@ 叫什么,它有什么作用?

在 Heroku 上安装 Ruby 应用程序 : rake aborted. KeyError: key not found

ruby - Rake 迁移错误 - 事件记录中的 "undefined method" "migrate"