Hide publish errors entirely with --no-check-publish instead of downgrading to warning, fixes #12196
parent
99430ca669
commit
8eedfd0ecb
|
@ -68,7 +68,7 @@ EOT
|
||||||
|
|
||||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||||
{
|
{
|
||||||
$file = $input->getArgument('file') ?: Factory::getComposerFile();
|
$file = $input->getArgument('file') ?? Factory::getComposerFile();
|
||||||
$io = $this->getIO();
|
$io = $this->getIO();
|
||||||
|
|
||||||
if (!file_exists($file)) {
|
if (!file_exists($file)) {
|
||||||
|
@ -144,16 +144,16 @@ EOT
|
||||||
{
|
{
|
||||||
$doPrintSchemaUrl = false;
|
$doPrintSchemaUrl = false;
|
||||||
|
|
||||||
if ($errors) {
|
if (\count($errors) > 0) {
|
||||||
$io->writeError('<error>' . $name . ' is invalid, the following errors/warnings were found:</error>');
|
$io->writeError('<error>' . $name . ' is invalid, the following errors/warnings were found:</error>');
|
||||||
} elseif ($publishErrors) {
|
} elseif (\count($publishErrors) > 0) {
|
||||||
$io->writeError('<info>' . $name . ' is valid for simple usage with Composer but has</info>');
|
$io->writeError('<info>' . $name . ' is valid for simple usage with Composer but has</info>');
|
||||||
$io->writeError('<info>strict errors that make it unable to be published as a package</info>');
|
$io->writeError('<info>strict errors that make it unable to be published as a package</info>');
|
||||||
$doPrintSchemaUrl = $printSchemaUrl;
|
$doPrintSchemaUrl = $printSchemaUrl;
|
||||||
} elseif ($warnings) {
|
} elseif (\count($warnings) > 0) {
|
||||||
$io->writeError('<info>' . $name . ' is valid, but with a few warnings</info>');
|
$io->writeError('<info>' . $name . ' is valid, but with a few warnings</info>');
|
||||||
$doPrintSchemaUrl = $printSchemaUrl;
|
$doPrintSchemaUrl = $printSchemaUrl;
|
||||||
} elseif ($lockErrors) {
|
} elseif (\count($lockErrors) > 0) {
|
||||||
$io->write('<info>' . $name . ' is valid but your composer.lock has some '.($checkLock ? 'errors' : 'warnings').'</info>');
|
$io->write('<info>' . $name . ' is valid but your composer.lock has some '.($checkLock ? 'errors' : 'warnings').'</info>');
|
||||||
} else {
|
} else {
|
||||||
$io->write('<info>' . $name . ' is valid</info>');
|
$io->write('<info>' . $name . ' is valid</info>');
|
||||||
|
@ -163,13 +163,13 @@ EOT
|
||||||
$io->writeError('<warning>See https://getcomposer.org/doc/04-schema.md for details on the schema</warning>');
|
$io->writeError('<warning>See https://getcomposer.org/doc/04-schema.md for details on the schema</warning>');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($errors) {
|
if (\count($errors) > 0) {
|
||||||
$errors = array_map(static function ($err): string {
|
$errors = array_map(static function ($err): string {
|
||||||
return '- ' . $err;
|
return '- ' . $err;
|
||||||
}, $errors);
|
}, $errors);
|
||||||
array_unshift($errors, '# General errors');
|
array_unshift($errors, '# General errors');
|
||||||
}
|
}
|
||||||
if ($warnings) {
|
if (\count($warnings) > 0) {
|
||||||
$warnings = array_map(static function ($err): string {
|
$warnings = array_map(static function ($err): string {
|
||||||
return '- ' . $err;
|
return '- ' . $err;
|
||||||
}, $warnings);
|
}, $warnings);
|
||||||
|
@ -180,22 +180,17 @@ EOT
|
||||||
$extraWarnings = [];
|
$extraWarnings = [];
|
||||||
|
|
||||||
// If checking publish errors, display them as errors, otherwise just show them as warnings
|
// If checking publish errors, display them as errors, otherwise just show them as warnings
|
||||||
if ($publishErrors) {
|
if (\count($publishErrors) > 0 && $checkPublish) {
|
||||||
$publishErrors = array_map(static function ($err): string {
|
$publishErrors = array_map(static function ($err): string {
|
||||||
return '- ' . $err;
|
return '- ' . $err;
|
||||||
}, $publishErrors);
|
}, $publishErrors);
|
||||||
|
|
||||||
if ($checkPublish) {
|
|
||||||
array_unshift($publishErrors, '# Publish errors');
|
array_unshift($publishErrors, '# Publish errors');
|
||||||
$errors = array_merge($errors, $publishErrors);
|
$errors = array_merge($errors, $publishErrors);
|
||||||
} else {
|
|
||||||
array_unshift($publishErrors, '# Publish warnings');
|
|
||||||
$extraWarnings = array_merge($extraWarnings, $publishErrors);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If checking lock errors, display them as errors, otherwise just show them as warnings
|
// If checking lock errors, display them as errors, otherwise just show them as warnings
|
||||||
if ($lockErrors) {
|
if (\count($lockErrors) > 0) {
|
||||||
if ($checkLock) {
|
if ($checkLock) {
|
||||||
array_unshift($lockErrors, '# Lock file errors');
|
array_unshift($lockErrors, '# Lock file errors');
|
||||||
$errors = array_merge($errors, $lockErrors);
|
$errors = array_merge($errors, $lockErrors);
|
||||||
|
|
Loading…
Reference in New Issue