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

FC044 False Positive #761

Open
jaymzh opened this issue May 21, 2018 · 0 comments
Open

FC044 False Positive #761

jaymzh opened this issue May 21, 2018 · 0 comments

Comments

@jaymzh
Copy link
Collaborator

jaymzh commented May 21, 2018

Using any local hash in an attributes file seems to trigger this:

data = {}

# process each specified file
{}.each do |name, filepath|
  # specify the default hash first
  data[name] = {}

  # skip if the file doesn't exist (could be Internap host)
  next unless File.exists?(filepath)

  Chef::Log.info("Processing file: #{filepath}")
  File.open(filepath).readlines.each do |line|
    k, v = line.strip.split('=', 2)
    data[name][k] = v                                   # THIS LINE TRIGGERS FC044
  end
end

default['ape'] = data

yields this:

FC044: Avoid bare attribute keys: /tmp/foo/attributes/test.rb:18
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