Skip to content
This repository has been archived by the owner on Sep 19, 2020. It is now read-only.

Erroneous FC109 when calling a method extended to Chef::Node object #797

Open
stgarf opened this issue Apr 15, 2019 · 0 comments
Open

Erroneous FC109 when calling a method extended to Chef::Node object #797

stgarf opened this issue Apr 15, 2019 · 0 comments

Comments

@stgarf
Copy link

stgarf commented Apr 15, 2019

We have a NodeHelpers module and extend the Chef::Node object with it.

module NodeHelpers
  def envparser
    chef_gem_install('environment-parser', node['parsers']['environment_parser']['version'])
    require 'environment/parser'
    EnvironmentParser.new(node.chef_environment)
  end
  def phase
    envparser.phase
  end
end

class Chef
  class Node
    include NodeHelpers
  end
end
  • Try to use the phase method:

FoodCritic returns the follow lint warning presumably because it doesn't know about the helper libraries and how Chef::Node is being extended. Any way to get FC to know about the added methods and not complain here? (edit: formatting)

FC019: Access node attributes in a consistent manner

default['sensu_server']['digest']['password'] = "/#{node.phase}/sigint/sensu_server/digest/password"
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant