Closed haidangwa closed 5 years ago
I am experiencing the same issue on the following versions:
$ chef --version
Chef Development Kit Version: 2.5.3
chef-client version: 13.8.5
delivery version: master (73ebb72a6c42b3d2ff5370c476be800fee7e5427)
berks version: 6.3.1
kitchen version: ERROR
inspec version: 1.51.21
$ foodcritic --version
foodcritic 12.3.0
Could this be resulting from a missing chef_dsl_metadata
file for the combination of Chef & foodcritic that I'm using? As far as I can see there is no entry for Chef 13.8
I've researched this further. Even if I generate a chef_dsl_metadata/chef_13.8.5.json
(beause I am using Chef 13.8.5) by following these instructions, this false-positive persists when I use node.force_default
.
I noticed that in the generated file force_default
is not present in the dsl_methods
list, but if I add it to that list then no false-positive FC019 occurs.
In an old solution to #181, PR #364 added Chef::Node::Attribute.public_instance_methods
to chef_node_methods
as a solution to the FC019 false-positive discussed in #181.
I've tried adding Chef::Node::Attribute.public_instance_methods
to chef_dsl_methods
in chef_dsl_metadata/Rakefile
and have found that the files generated from this modified Rakefile no longer produce a false-positive FC019.
I'm unsure if this is a suitable solution, so I would like some input from the foodcritic community. I may make a PR soon requesting commentary on this fix.
This looks like a re-occurrence of #181
chefdk: 2.4.17
My cookbook wraps the ssh_known_hosts cookbook. Foodcritic throws this FC019 violation exactly as discussed in #181.
My Gemfile:
FC019: Access node attributes in a consistent manner
: The line that it complains about simply doesChanging this to use
node.default
instead will get rid of the violation warning.