Skip to content

Commit a57fd86

Browse files
committed
Change some JSON-check error levels and messages
1 parent 9d21818 commit a57fd86

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

src/Phpbb/TranslationValidator/Validator/FileValidator.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -581,12 +581,12 @@ public function validateJsonFile($originFile)
581581
// Check if the description contains only words and punctuation, not URLs.
582582
elseif (preg_match('/\b(?:www|https)\b|(?:\.[a-z]{2,})/i', $jsonContent['description']))
583583
{
584-
$this->output->addMessage(Output::FATAL, 'The description should only contain words - no URLs.', $originFile);
584+
$this->output->addMessage(Output::ERROR, 'The description should only contain words - no URLs.', $originFile);
585585
}
586586
// Check if the type is correctly defined
587587
if ($jsonContent['type'] != 'phpbb-language')
588588
{
589-
$this->output->addMessage(Output::FATAL, 'File must contain a type with the value "phpbb-language"', $originFile);
589+
$this->output->addMessage(Output::FATAL, 'Type must be exactly: "phpbb-language"', $originFile);
590590
}
591591
// Check if there is a valid version definition
592592
if (!array_key_exists('version', $jsonContent))
@@ -599,12 +599,12 @@ public function validateJsonFile($originFile)
599599
}
600600
elseif (!preg_match('/^(\d+\.)?(\d+\.)?(\*|\d+)$/', $jsonContent['version']))
601601
{
602-
$this->output->addMessage(Output::FATAL, 'The defined version is in the wrong format.', $originFile);
602+
$this->output->addMessage(Output::ERROR, 'The defined version is in the wrong format.', $originFile);
603603
}
604604
// Homepage should be at least an empty string
605605
if (!preg_match('/(?:https?:\/\/|www\.)[^\s]+|(?:\b[a-z0-9-]+\.(?:com|net|org|info|io|co|biz|me|xyz|ai|app|dev|tech|tv|us|uk|de|fr|ru|jp|cn|in)\b)/i', $jsonContent['homepage']) && $jsonContent['homepage'] != '')
606606
{
607-
$this->output->addMessage(Output::FATAL, 'The homepage value allows only URLs or can be left empty.', $originFile);
607+
$this->output->addMessage(Output::ERROR, 'The homepage value allows only URLs or can be left empty.', $originFile);
608608
}
609609
// Check for the correct license value
610610
if ($jsonContent['license'] != 'GPL-2.0-only')
@@ -614,16 +614,16 @@ public function validateJsonFile($originFile)
614614
// Check for the authors
615615
if (!array_key_exists('authors', $jsonContent))
616616
{
617-
$this->output->addMessage(Output::FATAL, 'The authors value is missing.', $originFile);
617+
$this->output->addMessage(Output::ERROR, 'The authors value is missing.', $originFile);
618618
}
619619
// Check for support, authors should at least give one contact option!
620620
if (!array_key_exists('support', $jsonContent))
621621
{
622-
$this->output->addMessage(Output::FATAL, 'The support value is missing.', $originFile);
622+
$this->output->addMessage(Output::ERROR, 'The support value is missing.', $originFile);
623623
}
624624
elseif (count ($jsonContent['support']) < 1)
625625
{
626-
$this->output->addMessage(Output::FATAL, 'The support value has not sub values. Please provide at least one contact option e.g. forum, email.', $originFile);
626+
$this->output->addMessage(Output::ERROR, 'The support value has not sub values. Please provide at least one contact option e.g. forum, email.', $originFile);
627627
}
628628
// Check for the extra-section
629629
if (!array_key_exists('extra', $jsonContent))

0 commit comments

Comments
 (0)