puppetlabs / puppet-lint

Check that your Puppet manifests conform to the style guide
https://puppetlabs.github.io/puppet-lint/
MIT License
20 stars 13 forks source link

Legacy fact check should detect/remediate unscoped legacy facts. #129

Open binford2k opened 1 year ago

binford2k commented 1 year ago

This spec test validates that an unscoped fact like $osfamily is not detected or remediated. I think that it should be detected, especially in context of Puppet 8 deprecating those facts.

This means that people writing code that shadows those legacy facts by using the same variable name will now trigger a warning. If they genuinely want to do that, then they can configure the linter to skip that code 😁

@joshcooper @bastelfreak

alexjfisher commented 1 year ago

Already picked up by http://puppet-lint.com/checks/variable_scope/ surely?

alexjfisher commented 1 year ago

and tested here. https://github.com/puppetlabs/puppet-lint/blob/cc275ca0da4a7589b3194790d7e6353595e54499/spec/unit/puppet-lint/plugins/check_classes/variable_scope_spec.rb#L15

binford2k commented 1 year ago

@alexjfisher I think that it should still correct this. If the user dislikes that style and disables that check, the legacy fact check should still identify known obsoleted facts.

fbhdk commented 7 months ago

I agree that legacy_facts should detect this, also in order for --fix to correct these. It will save a lot of people a lot of time.