Chef 13 Upgrade: `knife-cookbook-doc` Rubocop Updates

As part of an upgrade from Chef 12 to Chef 13, this is one of the posts in which I've been detailing the issues I've encountered, and how I've resolved them .

As mentioned in 'Chef 13 Upgrade: knife-cookbook-doc gem upgrade' I use the knife-cookbook-doc gem to autogenerate my cookbook documentation, with formatting of the formats:

# attributes.rb
#<> Caddy base download URL: Required to override until https://github.com/dzabel/chef-caddy/pull/1 is merged
default['caddy']['url'] = 'https://caddyserver.com/download/linux/amd64?'

# resources/site.rb
=begin
#<
@property fqdn to configure a site for. When Chef Envrionment is `staging`, the FQDN that is configured will be `staging.{fqdn}`
#>
=end
property :fqdn

However, with the upgrade to Chef 13, Rubocop has been throwing a number of errors, Do not use block comments.

This was an easy fix to add to my .rubocop.yml, allowing me to simply ignore them in the source files I was using them:

Style/BlockComments:
  Exclude:
    - 'attributes/default.rb'
    - 'recipes/*.rb'
    - 'resources/*.rb'

And although not technically part of the Chef 13 upgrade, I also wanted to note that I have the following exception for my attributes files, as they use the first format, which Rubocop isn't happy about, either.

Layout/LeadingCommentSpace:
  Exclude:
    - 'attributes/default.rb'
*****

Written by Jamie Tanna on 09 March 2018, and last updated on 30 April 2018.

Content for this article is shared under the terms of the Creative Commons Attribution Non Commercial Share Alike 4.0 International, and code is shared under Apache License 2.0.

Tags

Categories