rodjek / puppet-lint

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

Command line options do not override options from config files #879

Closed usev6 closed 5 years ago

usev6 commented 5 years ago

The documentation for configuration files currently states:

Flags specified on the command line take final precedence and override all config file options.

IMHO that behaviour makes sense and I guess most users will expect that behaviour.

Unfortunately the opposite seems to be true: Options from config files will override options given on the command line:

$ git clone https://github.com/rodjek/puppet-lint.git
$ cd puppet-lint
$ echo '$foo = 42' > test.pp
$ echo '--only-checks=80chars' > .puppet-lint.rc
$ sed -i '/enabled_checks.each/a\
      pp check' lib/puppet-lint/checks.rb   ## debug output: all enabled checks
$ ./bin/puppet-lint --only-checks=140chars test.pp   ## config file has precedence over command line arg
:"80chars"
$ > .puppet-lint.rc
$ ./bin/puppet-lint --only-checks=140chars test.pp   ## it works with empty config file
:"140chars"