2016-07-25 44 views
2

我们正在使用foodcritic来制作我们所有的厨师食谱,并且最近遇到了这个问题。厨师 - Foodcritic FC019假阳性

使用foodcritic 6.3.0

foodcritic .输出是

FC019: Access node attributes in a consistent manner: ./recipes/configure_topics.rb:6 
FC019: Access node attributes in a consistent manner: ./recipes/configure_topics.rb:10 
FC019: Access node attributes in a consistent manner: ./recipes/configure_topics.rb:12 

configure_topics.rb具有以下内容

# 
# Cookbook Name:: kafka 
# Recipe:: configure_topics 
# 

node['kafka']['topics'].each do |topic, flag| 
    bash "create #{topic} topic" do 
     user "root" 
     code <<-EOH 
     /opt/kafka/bin/kafka-topics.sh --zookeeper #{node['kafka']['broker']['zookeeper']['connect']} --create --topiC#{topic} --partitions 1 --replication-factor 1 
     EOH 
     not_if "/opt/kafka/bin/kafka-topics.sh --zookeeper #{node['kafka']['broker']['zookeeper']['connect']} --list | grep #{topic}" 
    end 
end 

如该代码所示,访问属性的码元方法没有使用,所以FC019不应该显示在这里,对吗?

我已经用foodcritic在他们的github here上打开了以下问题,但是我还没有收到回复。

有什么我可以做的改变我的食谱,所以它不会在过渡期间抛出这些警告?谢谢。

+1

您可以禁用每行的特定警告(只需在受影响行的末尾添加'〜FC019')。那样有用吗? – StephenKing

+1

同一食谱中是否有其他文件使用属性符号? –

+0

@KarenB,确实是这个问题。例如,我的属性默认文件使用点符号'default.kafka.version'。一旦我修复所有这些以使用字符串符号,警告就消失了。谢谢您的帮助! – Bjorn248

回答

3

由于@KarenB涉嫌支票,支票是针对the entire cookbook。您可能会将其他格式中的其他格式用于烹饪书中的其他任何格式,因此这些格式被标记为最少使用,因此是错误。

+0

正如我在回应@KarenB时所说的,这是问题所在。属性默认文件使用点符号。谢谢! – Bjorn248