rodjek / puppet-lint

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

Let command line args override config from files #880

Closed usev6 closed 5 years ago

usev6 commented 5 years ago

Arguments given on the command line should override those from config files. That implies that config files must be read first. Only peeking into the command line args can show if config files should be used at all.

This change might break existing setups.

Fixes #879.

rodjek commented 5 years ago

Thanks @usev6, can you add a test to spec/puppet-lint/bin_spec.rb for this behaviour?

usev6 commented 5 years ago

Yes, adding a test for this behaviour makes a lot of sense. I'll try to come up with something later today.

usev6 commented 5 years ago

I have to admit, that I don't have much experience with rspec. But I think the test I added should work. I thought about doing the whole test in a temporary directory, because that would allow to create a .puppet-lint.rc file unconditionally. Or would there even be a way to mock the reading of options from ~/.puppet-lint.rc?

rodjek commented 5 years ago

Thanks for that @usev6, I refactored the test a bit to run the test inside a temporary directory (removing the need for the .puppet-lint.rc existence check)

usev6 commented 5 years ago

@rodjek thanks for cleaning up the test. And while I'm at it: Thanks for puppet-lint. Also the tutorial at http://puppet-lint.com/developer/tutorial/ was very helpful and made writing two small plugins very easy -- though I never wrote a gem before.