mirror of
https://github.com/inspec/inspec
synced 2024-11-26 22:50:36 +00:00
inspec check: Allow 'Proprietary' as a valid license term.
Signed-off-by: James Stocks <jstocks@chef.io>
This commit is contained in:
commit
2f42803a90
3 changed files with 9 additions and 5 deletions
|
@ -91,9 +91,9 @@ module Inspec
|
|||
warnings.push("Missing profile #{field} in #{ref}")
|
||||
end
|
||||
|
||||
# if version is set, ensure it is in SPDX format
|
||||
if !params[:license].nil? && !Spdx.valid_license?(params[:license])
|
||||
warnings.push("License '#{params[:license]}' needs to be in SPDX format. See https://spdx.org/licenses/.")
|
||||
# if license is set, ensure it is in SPDX format or marked as proprietary
|
||||
if !params[:license].nil? && !valid_license?(params[:license])
|
||||
warnings.push("License '#{params[:license]}' needs to be in SPDX format or marked as 'Proprietary'. See https://spdx.org/licenses/.")
|
||||
end
|
||||
|
||||
[errors, warnings]
|
||||
|
@ -112,6 +112,10 @@ module Inspec
|
|||
false
|
||||
end
|
||||
|
||||
def valid_license?(value)
|
||||
value =~ /^Proprietary[,;]?\b/ || Spdx.valid_license?(value)
|
||||
end
|
||||
|
||||
def method_missing(sth, *args)
|
||||
@logger.warn "#{ref} doesn't support: #{sth} #{args}"
|
||||
@missing_methods.push(sth)
|
||||
|
|
|
@ -3,6 +3,6 @@ title: InSpec Profile
|
|||
maintainer: The Authors
|
||||
copyright: The Authors
|
||||
copyright_email: you@example.com
|
||||
license: Apache-2.0
|
||||
license: Proprietary, All rights reserved
|
||||
summary: An InSpec Compliance Profile
|
||||
version: 0.1.0
|
||||
|
|
|
@ -294,7 +294,7 @@ describe Inspec::Profile do
|
|||
|
||||
it 'prints ok messages and counts the controls' do
|
||||
logger.expect :info, nil, ["Checking profile in #{home}/mock/profiles/#{profile_id}"]
|
||||
logger.expect :warn, nil, ["License 'Invalid License Name' needs to be in SPDX format. See https://spdx.org/licenses/."]
|
||||
logger.expect :warn, nil, ["License 'Invalid License Name' needs to be in SPDX format or marked as 'Proprietary'. See https://spdx.org/licenses/."]
|
||||
logger.expect :warn, nil, ['No controls or tests were defined.']
|
||||
logger.expect :info, nil, ["Metadata OK."]
|
||||
|
||||
|
|
Loading…
Reference in a new issue