You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Cookstyle catches only default: node['hostname'] violation:
bundle exec cookstyle resources/test.rb
resources/test.rb:1:38: R: [Correctable] Chef/Correctness/LazyEvalNodeAttributeDefaults: When setting a node attribute as the default value for a custom resource property, wrap the node attribute in lazy {} so that its value is available when the resource executes. (https://docs.chef.io/workstation/cookstyle/chef_correctness_lazyevalnodeattributedefaults)
property :hostname, String, default: node['hostname']
^^^^^^^^^^^^^^^^
The text was updated successfully, but these errors were encountered:
Version:
Environment:
Ruby 3.0.3 with Gemfile.lock
Scenario:
Trying to lint/find Chef resources that use node attributes for default property values without
lazy {}
, as described in https://docs.chef.io/custom_resource_glossary/#lazySteps to Reproduce:
Add following properties to Chef resource:
cookbook_name/resources/test.rb
Expected Result:
To have offenses shown for both properties.
Actual Result:
Cookstyle catches only
default: node['hostname']
violation:The text was updated successfully, but these errors were encountered: