|
|
|
@ -20,6 +20,8 @@ use Composer\IO\IOInterface;
|
|
|
|
|
use Composer\Json\JsonFile;
|
|
|
|
|
use Composer\Pcre\Preg;
|
|
|
|
|
use Composer\Spdx\SpdxLicenses;
|
|
|
|
|
use Seld\JsonLint\DuplicateKeyException;
|
|
|
|
|
use Seld\JsonLint\JsonParser;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Validates a composer configuration.
|
|
|
|
@ -77,6 +79,14 @@ class ConfigValidator
|
|
|
|
|
return array($errors, $publishErrors, $warnings);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$jsonParser = new JsonParser();
|
|
|
|
|
try {
|
|
|
|
|
$jsonParser->parse(file_get_contents($file), JsonParser::DETECT_KEY_CONFLICTS);
|
|
|
|
|
} catch (DuplicateKeyException $e) {
|
|
|
|
|
$details = $e->getDetails();
|
|
|
|
|
$warnings[] = 'Key '.$details['key'].' is a duplicate in '.$file.' at line '.$details['line'];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// validate actual data
|
|
|
|
|
if (empty($manifest['license'])) {
|
|
|
|
|
$warnings[] = 'No license specified, it is recommended to do so. For closed-source software you may use "proprietary" as license.';
|
|
|
|
|