Foodcritic


#1

Hi All,

I have just published a cookbook on supermarket.chef.io, but looking at
foodcritic tab I have seen a couple of messages:

FC031: Cookbook without metadata file
FC045: Consider setting cookbook name in metadata

metadata.rb and metadata.json are present, and as far as I have understood
they are correct.

This is the metadata.rb file:

name 'empty’
maintainer 'john q. citizen’
maintainer_email 'john.q.citizen@test.test’
license 'Apache 2.0’
description 'Installs/Configures empty’
long_description IO.read(File.join(File.dirname(FILE), ‘README.md’))
version ‘0.3.0’

And metadata.json is generated with the command:

knife cookbook metadata …

Could someone help me to understand what’s wrong with foodcritic?

Bests,
Vincenzo


#2

Have a peek at https://github.com/opscode/supermarket/issues/906.

On Fri, Jan 16, 2015 at 8:23 AM, Vincenzo D’Amore v.damore@gmail.com
wrote:

Hi All,

I have just published a cookbook on supermarket.chef.io, but looking at
foodcritic tab I have seen a couple of messages:

FC031: Cookbook without metadata file
FC045: Consider setting cookbook name in metadata

metadata.rb and metadata.json are present, and as far as I have understood
they are correct.

This is the metadata.rb file:

name 'empty’
maintainer 'john q. citizen’
maintainer_email 'john.q.citizen@test.test’
license 'Apache 2.0’
description 'Installs/Configures empty’
long_description IO.read(File.join(File.dirname(FILE), ‘README.md’))
version ‘0.3.0’

And metadata.json is generated with the command:

knife cookbook metadata …

Could someone help me to understand what’s wrong with foodcritic?

Bests,
Vincenzo


#3

Thanks.

I have tried using a “static” metadata.rb, but I’m not sure I got the
answer, because foodcritic doesn’t change its results.

On Fri, Jan 16, 2015 at 2:41 PM, David Petzel davidpetzel@gmail.com wrote:

Have a peek at https://github.com/opscode/supermarket/issues/906.

On Fri, Jan 16, 2015 at 8:23 AM, Vincenzo D’Amore v.damore@gmail.com
wrote:

Hi All,

I have just published a cookbook on supermarket.chef.io, but looking at
foodcritic tab I have seen a couple of messages:

FC031: Cookbook without metadata file
FC045: Consider setting cookbook name in metadata

metadata.rb and metadata.json are present, and as far as I have
understood they are correct.

This is the metadata.rb file:

name 'empty’
maintainer 'john q. citizen’
maintainer_email 'john.q.citizen@test.test’
license 'Apache 2.0’
description 'Installs/Configures empty’
long_description IO.read(File.join(File.dirname(FILE), ‘README.md’))
version ‘0.3.0’

And metadata.json is generated with the command:

knife cookbook metadata …

Could someone help me to understand what’s wrong with foodcritic?

Bests,
Vincenzo


Vincenzo D’Amore
email: v.damore@gmail.com
skype: free.dev
mobile: +39 349 8513251


#4

Assuming you used stove to publish the cookbook to supermarket, the
metadata.rb is not uploaded (only the metadata.json file is). So your
left with supermarket looking for a file that isn’t uploaded.

On Sun, Jan 18, 2015 at 6:52 PM, Vincenzo D’Amore v.damore@gmail.com
wrote:

Thanks.

I have tried using a “static” metadata.rb, but I’m not sure I got the
answer, because foodcritic doesn’t change its results.


#5

Hi David,

Sorry if I answer only now, I have been busy until today.

Yes, I used stove to publish the cookbook.
But foodcritic warnings, refers to metadata.rb file, how is it possibile if
the metadata.rb file is not uploaded?

FC031: Cookbook without metadata file:
/tmp/cook/e9de15062054dd2bd87383d9/empty/metadata.rb:1
FC045: Consider setting cookbook name in metadata:
/tmp/cook/e9de15062054dd2bd87383d9/empty/metadata.rb:1

On Mon, Jan 19, 2015 at 10:58 PM, David Petzel davidpetzel@gmail.com
wrote:

Assuming you used stove to publish the cookbook to supermarket, the
metadata.rb is not uploaded (only the metadata.json file is). So your
left with supermarket looking for a file that isn’t uploaded.

On Sun, Jan 18, 2015 at 6:52 PM, Vincenzo D’Amore v.damore@gmail.com
wrote:

Thanks.

I have tried using a “static” metadata.rb, but I’m not sure I got the
answer, because foodcritic doesn’t change its results.


Vincenzo D’Amore
email: v.damore@gmail.com
skype: free.dev
mobile: +39 349 8513251


#6

By design, stove strips the file out before upload, refer to
https://github.com/sethvargo/stove/pull/59 for much more detail on the
matter.

On Tue, Jan 27, 2015 at 7:08 PM, Vincenzo D’Amore v.damore@gmail.com
wrote:

Hi David,

Sorry if I answer only now, I have been busy until today.

Yes, I used stove to publish the cookbook.
But foodcritic warnings, refers to metadata.rb file, how is it possibile
if the metadata.rb file is not uploaded?

FC031: Cookbook without metadata file:
/tmp/cook/e9de15062054dd2bd87383d9/empty/metadata.rb:1
FC045: Consider setting cookbook name in metadata:
/tmp/cook/e9de15062054dd2bd87383d9/empty/metadata.rb:1


#7

Thanks, I have already read this thread, so maybe I lost something I read
it again…

Ok, I got that uploading metadata.rb is wrong, because contain code that
could certainly create a security issues and/or external dependency to be
satisfied.

I have also found this interesting part:

However, I think this is a bug that needs to be fixed in Chef. The rest of
Chef core is designed to prefer the metadata.rb over the metadata.json
(which was a bad design decision IMO), but nonetheless, the internal Chef
libraries are designed to fallback to reading the metadata.json when
metadata.rb is not present.

But when I use stove without the metadata.rb file I receive an error, I
seems stove cannot release anything without a metadata.rb file.

Which tool should I to use to release a cookbook instead of stove? Now I’m
looking at knife, which seems to be older than stove…

On Wed, Jan 28, 2015 at 1:14 AM, David Petzel davidpetzel@gmail.com wrote:

By design, stove strips the file out before upload, refer to
https://github.com/sethvargo/stove/pull/59 for much more detail on the
matter.

On Tue, Jan 27, 2015 at 7:08 PM, Vincenzo D’Amore v.damore@gmail.com
wrote:

Hi David,

Sorry if I answer only now, I have been busy until today.

Yes, I used stove to publish the cookbook.
But foodcritic warnings, refers to metadata.rb file, how is it possibile
if the metadata.rb file is not uploaded?

FC031: Cookbook without metadata file:
/tmp/cook/e9de15062054dd2bd87383d9/empty/metadata.rb:1
FC045: Consider setting cookbook name in metadata:
/tmp/cook/e9de15062054dd2bd87383d9/empty/metadata.rb:1


Vincenzo D’Amore
email: v.damore@gmail.com
skype: free.dev
mobile: +39 349 8513251


#8

Your using the right tool. And doing things right. I think the key thing is
to “just ignore supermarket’s foodcritic statement”. Anyone using stove is
going to have that error reported, and its questionable if it even belongs
there. Its acceptable that your source code as metadata.rb, it just won’t
be uploaded to supermarkey.

On Tue, Jan 27, 2015 at 7:33 PM, Vincenzo D’Amore v.damore@gmail.com
wrote:

Thanks, I have already read this thread, so maybe I lost something I read
it again…

Ok, I got that uploading metadata.rb is wrong, because contain code that
could certainly create a security issues and/or external dependency to be
satisfied.

I have also found this interesting part:

However, I think this is a bug that needs to be fixed in Chef. The rest
of Chef core is designed to prefer the metadata.rb over the metadata.json
(which was a bad design decision IMO), but nonetheless, the internal Chef
libraries are designed to fallback to reading the metadata.json when
metadata.rb is not present.

But when I use stove without the metadata.rb file I receive an error, I
seems stove cannot release anything without a metadata.rb file.

Which tool should I to use to release a cookbook instead of stove? Now I’m
looking at knife, which seems to be older than stove…

On Wed, Jan 28, 2015 at 1:14 AM, David Petzel davidpetzel@gmail.com
wrote:

By design, stove strips the file out before upload, refer to
https://github.com/sethvargo/stove/pull/59 for much more detail on the
matter.

On Tue, Jan 27, 2015 at 7:08 PM, Vincenzo D’Amore v.damore@gmail.com
wrote:

Hi David,

Sorry if I answer only now, I have been busy until today.

Yes, I used stove to publish the cookbook.
But foodcritic warnings, refers to metadata.rb file, how is it possibile
if the metadata.rb file is not uploaded?

FC031: Cookbook without metadata file:
/tmp/cook/e9de15062054dd2bd87383d9/empty/metadata.rb:1
FC045: Consider setting cookbook name in metadata:
/tmp/cook/e9de15062054dd2bd87383d9/empty/metadata.rb:1


Vincenzo D’Amore
email: v.damore@gmail.com
skype: free.dev
mobile: +39 349 8513251