rodjek / puppet-lint

Check that your Puppet manifests conform to the style guide
MIT License
820 stars 204 forks source link

PuppetLint.configuration.ignore_paths ignored by puppet-lint #417

Closed hesco closed 8 years ago

hesco commented 9 years ago
exclude_paths = [
  "fixtures/etc/puppet/modules/apt/manifests/conf.pp",
  "/Users/escoh/sandbox/raas-deployment/fixtures/etc/puppet/modules/**/*",
  "fixtures/etc/puppet/modules/**/*",
  "fixtures/**/*",
  "vendor/**/*",
  "spec/**/*",
  "pkg/**/*",
  "spec/fixtures/modules/**/*",
]

PuppetLint.configuration.ignore_paths = exclude_paths

still reports:

fixtures/etc/puppet/modules/apt/manifests/conf.pp - WARNING: defined type not documented on line 1

Apparently this was broken in v0.5.0, and seems to be broken again in puppet-lint (1.1.0). Perhaps the issue is in here: lib/puppet-lint/tasks/puppet-lint.rb, not sure.

egeland commented 9 years ago

I can confirm this is the case.

$ bundle exec puppet-lint --version
puppet-lint 1.1.0

$ bundle exec puppet --version
4.0.0

$ ruby --version
ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-linux-gnu]

I have excluded vendor/**/* and yet get everything in there checked by puppet-lint:

...
vendor/ruby/2.2.0/gems/puppet-4.0.0/spec/fixtures/integration/node/environment/sitedir/00_a.pp:1:autoloader_layout:ERROR:a not in autoload module layout
vendor/ruby/2.2.0/gems/puppet-4.0.0/spec/fixtures/integration/node/environment/sitedir/01_b.pp:1:autoloader_layout:ERROR:b not in autoload module layout
vendor/ruby/2.2.0/gems/puppet-4.0.0/spec/fixtures/integration/node/environment/sitedir/04_include.pp:2:double_quoted_strings:WARNING:double quoted string containing no variables
...
paul91 commented 9 years ago

Seeing the same behavior on:

$ puppet-lint --version
puppet-lint 1.1.0

$ ruby --version
ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin13]
azhurbilo commented 9 years ago

+1

But I try reproduce lib/puppet-lint/tasks/puppet-lint.rb behaviour with pure ruby

require 'rake'

DEFAULT_PATTERN = '**/*.pp'

matched_files = FileList[DEFAULT_PATTERN]
matched_files = matched_files.exclude(*["modules/**/*","manifests/**/*"])

puts matched_files

and it works fine

mterzo commented 8 years ago

Fixed in: efb196751d7ed8dd2a78693366840f93110055fd

rnelson0 commented 8 years ago

Puppet-lint 2.0.0 is now available. It was previously identified that this issue was fixed in master, but please confirm that you no longer see this behavior with 2.0.0 before we close the ticket. Thank you!

hesco commented 8 years ago

Thank you! I have installed the the upgraded package and look forward to another opportunity to see if this feature works.

rnelson0 commented 8 years ago

I tested this with v2.0.0. When I remove all configuration ignore_paths settings, it wants to check ALL .pp files. When I use this diff of my Rakefile, everything is copacetic:

@@ -37,9 +34,10 @@ PuppetLint.configuration.disable_arrow_alignment
 PuppetLint.configuration.disable_class_inherits_from_params_class
 PuppetLint.configuration.disable_class_parameter_defaults
 PuppetLint.configuration.fail_on_warnings = true
+PuppetLint.configuration.ignore_paths = exclude_paths

 PuppetLint::RakeTask.new :lint do |config|
-  config.ignore_paths = exclude_paths
+  #config.ignore_paths = exclude_paths
 end

As such, this appears to be working and I will close it. Thanks everyone!