1
0
Fork 0

Merge pull request #6298 from RyDroid/license-trim

Add a specific message for stupid users that put useless spaces in license
pull/6314/head
Jordi Boggiano 2017-03-26 13:43:20 +02:00 committed by GitHub
commit a1e12fa4d8
1 changed files with 8 additions and 2 deletions

View File

@ -84,10 +84,16 @@ class ConfigValidator
}
$licenseValidator = new SpdxLicenses();
if ('proprietary' !== $manifest['license'] && array() !== $manifest['license'] && !$licenseValidator->validate($manifest['license'])) {
if ('proprietary' !== $manifest['license'] && array() !== $manifest['license'] && !$licenseValidator->validate($manifest['license']) && $licenseValidator->validate(trim($manifest['license']))) {
$warnings[] = sprintf(
'License %s must not contain extra spaces, make sure to trim it.',
json_encode($manifest['license'])
);
} else if ('proprietary' !== $manifest['license'] && array() !== $manifest['license'] && !$licenseValidator->validate($manifest['license'])) {
$warnings[] = sprintf(
'License %s is not a valid SPDX license identifier, see https://spdx.org/licenses/ if you use an open license.'
."\nIf the software is closed-source, you may use \"proprietary\" as license.",
. PHP_EOL .
'If the software is closed-source, you may use "proprietary" as license.',
json_encode($manifest['license'])
);
}