puppet-lint ignoring the ignore_paths option

1.3k views Asked by At

I am using https://github.com/garethr/puppet-module-skeleton as my Puppet module skeleton. For a particular module I am then using puppet-lint via rake. The relevant sections in my Rakefile are as follows:

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

When running bundle exec rake lint I get the expected output from puppet-lint, except that puppet-lint is checking files in, for example, vendor/bundle and spec/fixtures/modules as well. Besides not beeing intended, it seems to contradict the last six lines of the above Rakefile snippet. What's wrong?

1

There are 1 answers

3
Peter Souter On

As you linked, this is currently broken

It has been fixed in this commit: https://github.com/rodjek/puppet-lint/commit/0f2e2db90d5a14382eafbdfebff74048a487372f

However, this was made after the release of 1.1.0

So you can either use the direct Github reference in bundler (or wait for the next release)

source "http://rubygems.org"

group :test do
  gem "puppet-lint", :git => 'https://github.com/rodjek/puppet-lint.git'
end

Or use the work-around you posted:

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