InvalidLicenseString

All Cookstyle Cops


The department is: Chef/Sharing

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


Enabled by default Supports autocorrection Target Chef Version
Enabled Yes All 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

Name Default value Configurable values
Version Added 5.2.0 String
Include
  • **/metadata.rb
Array

© Chef Software, Inc.
Licensed under the Creative Commons Attribution 3.0 Unported License.
The Chef™ Mark and Chef Logo are either registered trademarks/service marks or trademarks/servicemarks of Chef, in the United States and other countries and are used with Chef Inc's permission.
We are not affiliated with, endorsed or sponsored by Chef Inc.
https://docs.chef.io/workstation/cookstyle/chef_sharing_invalidlicensestring/