当我尝试在default.rb中包含一个关于apache cookbook课程的收件人时,我收到了一个foodcritic错误:
//this method is binding the data on the list
override fun onBindViewHolder(holder: CustomAdapterExercise.ViewHolder, position: Int) {
if (holder.itemViewType == typeAdd) {
holder.bindAdd(addList[0])
}
else{
if(position != exerciseList.size){
holder.bindItems(exerciseList[position])
}
}
if (selectedPosition == position && position != exerciseList.size) {
holder.itemView.setBackgroundColor(Color.parseColor("#000000"))
}
else {
holder.itemView.setBackgroundColor(Color.parseColor("#ffffff"))
}
holder.itemView.setOnClickListener {
selectedPosition = position
notifyDataSetChanged()
}
}
websites.rb
#
# Cookbook:: apache
# Recipe:: default
#
# Copyright:: 2017, The Authors, All Rights Reserved.
# Install apached package
package 'apache2' do
package_name 'httpd'
action :install
end
service 'apache2' do
service_name 'httpd'
action [:start, :enable]
end
include_recipe 'apache::websites'
当我在default.rb上运行foodcritic时
file 'default www' do
path '/var/ww/html/index.html'
content 'Hello world!'
end
当我按照recomendation并在metadata.rb中添加依赖项并运行 knife cookbook upload apache 时,我得到了这个:
FC007: Ensure recipe dependencies are reflected in cookbook metadata:
default.rb:17
以下是我的metadeta.rb
ERROR: RuntimeError: Cookbook depends on itself in cookbook apache, please
remove the this unnecessary self-dependency
Chef和ruby的新手,关于Stack Overflow的第一个问题。 我添加依赖是错误的吗? 有什么事情会导致这个问题吗?
答案 0 :(得分:1)
FC007激活错误。您确定正确运行foodcritic
吗?只需在cookbook文件夹的基础上运行foodcritic .
(即与metadata.rb
相同的地方)。这应该检测到食谱的名称而不是标记包含。