Skip to content
Snippets Groups Projects
Commit f8e020ff authored by Thomas Müller's avatar Thomas Müller
Browse files

Merge pull request #20390 from owncloud/appcheckcode-no-duplicate-requirement

Do not allow two different version requirements
parents a8ea3aca fe04451c
No related branches found
No related tags found
No related merge requests found
...@@ -131,6 +131,10 @@ class CheckCode extends Command { ...@@ -131,6 +131,10 @@ class CheckCode extends Command {
} }
}); });
$infoChecker->listen('InfoChecker', 'duplicateRequirement', function($minMax) use ($output) {
$output->writeln("<error>Duplicate $minMax ownCloud version requirement found</error>");
});
$infoChecker->listen('InfoChecker', 'differentVersions', function($versionFile, $infoXML) use ($output) { $infoChecker->listen('InfoChecker', 'differentVersions', function($versionFile, $infoXML) use ($output) {
$output->writeln("<error>Different versions provided (appinfo/version: $versionFile - appinfo/info.xml: $infoXML)</error>"); $output->writeln("<error>Different versions provided (appinfo/version: $versionFile - appinfo/info.xml: $infoXML)</error>");
}); });
......
...@@ -77,6 +77,21 @@ class InfoChecker extends BasicEmitter { ...@@ -77,6 +77,21 @@ class InfoChecker extends BasicEmitter {
$info = $this->infoParser->parse($appPath . '/appinfo/info.xml'); $info = $this->infoParser->parse($appPath . '/appinfo/info.xml');
if (isset($info['dependencies']['owncloud']['@attributes']['min-version']) && ($info['requiremin'] || $info['require'])) {
$this->emit('InfoChecker', 'duplicateRequirement', ['min']);
$errors[] = [
'type' => 'duplicateRequirement',
'field' => 'min',
];
}
if (isset($info['dependencies']['owncloud']['@attributes']['max-version']) && $info['requiremax']) {
$this->emit('InfoChecker', 'duplicateRequirement', ['max']);
$errors[] = [
'type' => 'duplicateRequirement',
'field' => 'max',
];
}
foreach ($info as $key => $value) { foreach ($info as $key => $value) {
if(is_array($value)) { if(is_array($value)) {
$value = json_encode($value); $value = json_encode($value);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment