Skip to main content

InvalidLicenseString

All Cookstyle Cops


The department is: Chef/Sharing

The full name of the cop is: Chef/Sharing/InvalidLicenseString


Enabled by defaultSupports autocorrectionTarget Chef Version
EnabledYesAll Versions

metadata.rb license field should include a SPDX compliant string or “all right reserved” (not case sensitive)

list of valid SPDX.org license strings. To build an array run this ruby:

require 'json'
require 'net/http'
json_data = JSON.parse(Net::HTTP.get(URI('https://raw.githubusercontent.com/spdx/license-list-data/master/json/licenses.json')))
licenses = json_data['licenses'].map {|l| l['licenseId'] }.sort

Examples

incorrect

license 'Apache 2.0'

correct

license 'Apache-2.0'
license 'all rights reserved'

Configurable attributes

NameDefault valueConfigurable values
Version Added5.2.0String
Include
  • **/metadata.rb
Array

Was this page helpful?