diff --git a/.phpci.yml b/.php-censor.yml similarity index 96% rename from .phpci.yml rename to .php-censor.yml index 2f04e827..584aa0ea 100644 --- a/.phpci.yml +++ b/.php-censor.yml @@ -35,7 +35,7 @@ test: failure: email: - committer: true + committer: false complete: email: diff --git a/app/config.example.yml b/app/config.example.yml index 8542ba01..6ce864a1 100644 --- a/app/config.example.yml +++ b/app/config.example.yml @@ -11,6 +11,8 @@ php-censor: language: en per_page: 10 url: 'http://php-censor.local' + email_settings: + from_address: 'no-reply@php-censor.local' worker: host: localhost queue: php-censor-queue diff --git a/phpcs.xml b/phpcs.xml deleted file mode 100644 index 9aa40933..00000000 --- a/phpcs.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - Codestyle ruleset for PHP Censor - - - - PHP Censor - - - - - src/PHPCensor/Migrations/* - src/PHPCensor/Model/Base/* - src/PHPCensor/Languages/* - tests/* - vendor/* - - diff --git a/phpmd.xml b/phpmd.xml deleted file mode 100644 index b1b0a56d..00000000 --- a/phpmd.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - PHP Censor rule set - - - - - - - diff --git a/public/assets/css/main.css b/public/assets/css/main.css index f841185f..48029bdf 100644 --- a/public/assets/css/main.css +++ b/public/assets/css/main.css @@ -440,7 +440,7 @@ } .skin-black .main-header li.user-header { - background-color: #1a2226; + background-color: #222d32; } .skin-black .content-header { diff --git a/src/PHPCensor/Application.php b/src/PHPCensor/Application.php index a3803a70..9965e878 100644 --- a/src/PHPCensor/Application.php +++ b/src/PHPCensor/Application.php @@ -151,6 +151,7 @@ class Application extends b8\Application /** * Check whether we should skip auth (because it is disabled) + * * @return bool */ protected function shouldSkipAuth() diff --git a/src/PHPCensor/Languages/lang.da.php b/src/PHPCensor/Languages/lang.da.php index 9ddead7f..c370da10 100644 --- a/src/PHPCensor/Languages/lang.da.php +++ b/src/PHPCensor/Languages/lang.da.php @@ -366,8 +366,6 @@ Kontrollér venligst nedenstående fejl før du fortsætter.', 'plugin_success' => 'PLUGIN: SUCCES', 'plugin_failed' => 'PLUGIN: FEJL', 'plugin_missing' => 'Plugin findes ikke: %s', - 'tap_version' => 'TapParser understøtter kun TAP version 13.', - 'tap_error' => 'Ugyldig TAP-streng, antallet af tests passer ikke med det angivne antal tests.', // Build Plugins: 'no_tests_performed' => 'Ingen tests udført.', diff --git a/src/PHPCensor/Languages/lang.de.php b/src/PHPCensor/Languages/lang.de.php index a6bb9348..57676a71 100644 --- a/src/PHPCensor/Languages/lang.de.php +++ b/src/PHPCensor/Languages/lang.de.php @@ -389,8 +389,6 @@ generiert. Um es zu verwenden, fügen Sie einfach den folgenden Public Key im Ab 'plugin_success' => 'PLUGIN: ERFOLGREICH', 'plugin_failed' => 'PLUGIN: FEHLGECHLAGEN', 'plugin_missing' => 'Plugin existiert nicht: %s', - 'tap_version' => 'TapParser unterstützt nur TAP version 13', - 'tap_error' => 'Ungültiger TAP String, Anzahl Tests entspricht nicht angegebener Testzahl.', // Build Plugins: 'no_tests_performed' => 'Keine Tests wurden ausgeführt.', diff --git a/src/PHPCensor/Languages/lang.el.php b/src/PHPCensor/Languages/lang.el.php index c4072695..c6a911cd 100644 --- a/src/PHPCensor/Languages/lang.el.php +++ b/src/PHPCensor/Languages/lang.el.php @@ -368,8 +368,6 @@ Services του Bitbucket αποθετηρίου σας.', 'plugin_success' => 'ΠΡΟΣΘΕΤΟ: ΕΠΙΤΥΧΙΑ', 'plugin_failed' => 'ΠΡΟΣΘΕΤΟ: ΑΠΟΤΥΧΙΑ', 'plugin_missing' => 'Το πρόσθετο δεν υπάρχει: %s', - 'tap_version' => 'Το TapParser υποστηρίζει μόνο το TAP έκδοση 13', - 'tap_error' => 'Μη έγκυρη συμβολοσειρά TAP, ο αριθμός των δοκιμών δεν ταιριάζει με την καθορισμένη καταμέτρηση της δοκιμής.', // Build Plugins: 'no_tests_performed' => 'Δεν έγιναν δοκιμές.', diff --git a/src/PHPCensor/Languages/lang.en.php b/src/PHPCensor/Languages/lang.en.php index 0f4906a6..b1786f29 100644 --- a/src/PHPCensor/Languages/lang.en.php +++ b/src/PHPCensor/Languages/lang.en.php @@ -89,6 +89,8 @@ PHP Censor', 'success' => 'Success', 'failed' => 'Failed', 'error' => 'Error', + 'skipped' => 'Skipped', + 'trace' => 'Stack trace', 'manual_build' => 'Manual Build', // Add/Edit Project: @@ -419,8 +421,6 @@ PHP Censor', 'plugin_success' => 'PLUGIN: SUCCESS', 'plugin_failed' => 'PLUGIN: FAILED', 'plugin_missing' => 'Plugin does not exist: %s', - 'tap_version' => 'TapParser only supports TAP version 13', - 'tap_error' => 'Invalid TAP string, number of tests does not match specified test count.', 'failed_allowed' => 'Allowed', // Build Plugins: diff --git a/src/PHPCensor/Languages/lang.es.php b/src/PHPCensor/Languages/lang.es.php index 4c4c33a6..6c3d5a80 100644 --- a/src/PHPCensor/Languages/lang.es.php +++ b/src/PHPCensor/Languages/lang.es.php @@ -357,8 +357,6 @@ PHP Censor', 'plugin_success' => 'PLUGIN: EXITO', 'plugin_failed' => 'PLUGIN: FALLÓ', 'plugin_missing' => 'No existe el plugin: %s', - 'tap_version' => 'TapParser únicamente soporta la verisón 13 de TAP', - 'tap_error' => 'Cadena de caracteres TAP inválida, el número de tests no coincide con la cuenta de tests declarada.', // Build Plugins: 'no_tests_performed' => 'No se ejecutaron tests.', diff --git a/src/PHPCensor/Languages/lang.fr.php b/src/PHPCensor/Languages/lang.fr.php index 386a2497..85d43b2a 100644 --- a/src/PHPCensor/Languages/lang.fr.php +++ b/src/PHPCensor/Languages/lang.fr.php @@ -383,8 +383,6 @@ PHP Censor', 'plugin_success' => 'PLUGIN: RÉUSSI', 'plugin_failed' => 'PLUGIN: ÉCHOUÉ', 'plugin_missing' => 'Le plugins n\'existe pas: %s', - 'tap_version' => 'TapParser supporte seulement les TAP version 13', - 'tap_error' => 'Chaîne de TAP invalide, le nombre de tests ne correspond pas à celui spécifié.', // Build Plugins: 'no_tests_performed' => 'Aucun test n\'a été exécuté.', diff --git a/src/PHPCensor/Languages/lang.it.php b/src/PHPCensor/Languages/lang.it.php index 419a419c..45e9f137 100644 --- a/src/PHPCensor/Languages/lang.it.php +++ b/src/PHPCensor/Languages/lang.it.php @@ -369,8 +369,6 @@ PHP Censor', 'plugin_success' => 'PLUGIN: PASSATO', 'plugin_failed' => 'PLUGIN: FALLITO', 'plugin_missing' => 'Plugin non esistente: %s', - 'tap_version' => 'TapParser supporta solo la versione TAP 13', - 'tap_error' => 'Stringa TAP non valida, il numero dei test non corrisponde con il numero di test contati.', // Build Plugins: 'no_tests_performed' => 'Nessun test è stato eseguito.', diff --git a/src/PHPCensor/Languages/lang.nl.php b/src/PHPCensor/Languages/lang.nl.php index e5ecc72e..046f67c3 100644 --- a/src/PHPCensor/Languages/lang.nl.php +++ b/src/PHPCensor/Languages/lang.nl.php @@ -368,8 +368,6 @@ Gelieve de fouten na te kijken vooraleer verder te gaan.', 'plugin_success' => 'PLUGIN: SUCCES', 'plugin_failed' => 'PLUGIN: GEFAALD', 'plugin_missing' => 'Plugin bestaat niet: %s', - 'tap_version' => 'TapParser ondersteunt enkel TAP versie 13', - 'tap_error' => 'Ongeldige TAP string, aantal tests niet in overeenstemming met opgegeven aantal.', // Build Plugins: 'no_tests_performed' => 'Er werden geen tests uitgevoerd.', diff --git a/src/PHPCensor/Languages/lang.pl.php b/src/PHPCensor/Languages/lang.pl.php index 3c41326d..8ba280a3 100644 --- a/src/PHPCensor/Languages/lang.pl.php +++ b/src/PHPCensor/Languages/lang.pl.php @@ -369,8 +369,6 @@ Przejrzyj powyższą listę błędów przed kontynuowaniem.', 'plugin_success' => 'Plugin: Sukces', 'plugin_failed' => 'Plugin: Niepowodzenie', 'plugin_missing' => 'Plugin nie istnieje: %s', - 'tap_version' => 'TapParser obsługuje tylko TAP w wersji 13', - 'tap_error' => 'Nieprawidłowy łańcuch TAP, liczba testów nie zgadza się z policzoną ilością testów.', // Build Plugins: 'no_tests_performed' => 'Nie przeprowadzono żadnych testów.', diff --git a/src/PHPCensor/Languages/lang.pt-br.php b/src/PHPCensor/Languages/lang.pt-br.php index 53f47d7f..4b27d313 100644 --- a/src/PHPCensor/Languages/lang.pt-br.php +++ b/src/PHPCensor/Languages/lang.pt-br.php @@ -393,8 +393,6 @@ PHP Censor', 'plugin_success' => 'PLUGIN: SUCCESS', 'plugin_failed' => 'PLUGIN: FAILED', 'plugin_missing' => 'Plugin does not exist: %s', - 'tap_version' => 'TapParser only supports TAP version 13', - 'tap_error' => 'Invalid TAP string, number of tests does not match specified test count.', // Build Plugins: 'no_tests_performed' => 'No tests have been performed.', diff --git a/src/PHPCensor/Languages/lang.ru.php b/src/PHPCensor/Languages/lang.ru.php index 6974e02b..65479ae3 100644 --- a/src/PHPCensor/Languages/lang.ru.php +++ b/src/PHPCensor/Languages/lang.ru.php @@ -46,8 +46,8 @@ PHP Censor', // Top Nav 'toggle_navigation' => 'Скрыть/показать панель навигации', - 'n_builds_pending' => '%d сборок ожидает', - 'n_builds_running' => '%d сборок запущено', + 'n_builds_pending' => 'Сборок ожидает: %d', + 'n_builds_running' => 'Сборок запущено: %d', 'edit_profile' => 'Редактировать профиль', 'sign_out' => 'Выйти', 'branch_x' => 'Ветка: %s', @@ -87,6 +87,8 @@ PHP Censor', 'success' => 'Успешно', 'failed' => 'Провал', 'error' => 'Ошибка', + 'skipped' => 'Пропущено', + 'trace' => 'Стек вызова', 'manual_build' => 'Запущена вручную', // Add/Edit Project: @@ -404,8 +406,6 @@ PHP Censor', 'plugin_success' => 'ПЛАГИН: УСПЕШНО', 'plugin_failed' => 'ПЛАГИН: ПРОВАЛ', 'plugin_missing' => 'Плагина не существует: %s', - 'tap_version' => 'TapParser поддерживает только TAP версии 13', - 'tap_error' => 'Некорректная TAP-строка, количество тестов не совпадает с заявленным.', 'failed_allowed' => 'Разрешен', // Build Plugins: diff --git a/src/PHPCensor/Languages/lang.uk.php b/src/PHPCensor/Languages/lang.uk.php index f5aeab25..9b7c6dd5 100644 --- a/src/PHPCensor/Languages/lang.uk.php +++ b/src/PHPCensor/Languages/lang.uk.php @@ -368,8 +368,6 @@ PHP Censor', 'plugin_success' => 'ПЛАГІН: УСПІШНО', 'plugin_failed' => 'ПЛАГІН: НЕВДАЛО', 'plugin_missing' => 'Плагін не існує: %s', - 'tap_version' => 'TapParser підтримує тільки TAP версії 13', - 'tap_error' => 'Некоректний TAP-рядок, кількість тестів не співпадає із вказаними.', // Build Plugins: 'no_tests_performed' => 'Жодних тестів не було запущено.', diff --git a/src/PHPCensor/Languages/lang.zh.php b/src/PHPCensor/Languages/lang.zh.php index 830a9beb..9387097e 100644 --- a/src/PHPCensor/Languages/lang.zh.php +++ b/src/PHPCensor/Languages/lang.zh.php @@ -386,8 +386,6 @@ PHP Censor', 'plugin_success' => 'PLUGIN: SUCCESS', 'plugin_failed' => 'PLUGIN: FAILED', 'plugin_missing' => 'Plugin does not exist: %s', - 'tap_version' => 'TapParser only supports TAP version 13', - 'tap_error' => 'Invalid TAP string, number of tests does not match specified test count.', // Build Plugins: 'no_tests_performed' => 'No tests have been performed.', diff --git a/src/PHPCensor/Plugin/Util/TapParser.php b/src/PHPCensor/Plugin/Util/TapParser.php deleted file mode 100644 index 290f08b6..00000000 --- a/src/PHPCensor/Plugin/Util/TapParser.php +++ /dev/null @@ -1,286 +0,0 @@ -tapString = trim($tapString); - } - - /** - * Parse a given TAP format string and return an array of tests and their status. - */ - public function parse() - { - // Split up the TAP string into an array of lines, then - // trim all of the lines so there's no leading or trailing whitespace. - $this->lines = array_map('rtrim', explode("\n", $this->tapString)); - $this->lineNumber = 0; - - $this->testCount = false; - $this->results = []; - - $header = $this->findTapLog(); - - $line = $this->nextLine(); - if ($line === $header) { - throw new Exception("Duplicated TAP log, please check the configuration."); - } - - while ($line !== false && ($this->testCount === false || count($this->results) < $this->testCount)) { - $this->parseLine($line); - $line = $this->nextLine(); - } - - if (false !== $this->testCount && count($this->results) !== $this->testCount) { - throw new Exception(Lang::get('tap_error')); - } - - return $this->results; - } - - /** Looks for the start of the TAP log in the string. - * - * @return string The TAP header line. - * - * @throws Exception if no TAP log is found or versions mismatch. - */ - protected function findTapLog() - { - // Look for the beginning of the TAP output - do { - $header = $this->nextLine(); - } while ($header !== false && substr($header, 0, 12) !== 'TAP version '); - - // - if ($header === false) { - throw new Exception('No TAP log found, please check the configuration.'); - } elseif ($header !== 'TAP version 13') { - throw new Exception(Lang::get('tap_version')); - } - - return $header; - } - - /** Fetch the next line. - * - * @return string|false The next line or false if the end has been reached. - */ - protected function nextLine() - { - if ($this->lineNumber < count($this->lines)) { - return $this->lines[$this->lineNumber++]; - } - return false; - } - - /** - * @param string $line - * - * @return boolean - */ - protected function testLine($line) - { - if (preg_match(self::TEST_LINE_PATTERN, $line, $matches)) { - $this->results[] = $this->processTestLine( - $matches[1], - isset($matches[2]) ? $matches[2] : '', - isset($matches[3]) ? $matches[3] : null, - isset($matches[4]) ? $matches[4] : null - ); - - return true; - } - - return false; - } - - /** - * @param string $line - * - * @return boolean - */ - protected function yamlLine($line) - { - if (preg_match(self::TEST_YAML_START, $line, $matches)) { - $diagnostic = $this->processYamlBlock($matches[1]); - $test = array_pop($this->results); - if (isset($test['message'], $diagnostic['message'])) { - $test['message'] .= PHP_EOL . $diagnostic['message']; - unset($diagnostic['message']); - } - $this->results[] = array_replace($test, $diagnostic); - - return true; - } - - return false; - } - - /** Parse a single line. - * - * @param string $line - * - * @throws Exception - */ - protected function parseLine($line) - { - if (preg_match(self::TEST_DIAGNOSTIC, $line) || preg_match(self::TEST_COVERAGE, $line) || !$line) { - return; - } - - if (preg_match(self::TEST_COUNTS_PATTERN, $line, $matches)) { - $this->testCount = intval($matches[1]); - - return; - } - - if ($this->testLine($line)) { - return; - } - - if ($this->yamlLine($line)) { - return; - } - - throw new Exception(sprintf('Incorrect TAP data, line %d: %s', $this->lineNumber, $line)); - } - - /** - * Process an individual test line. - * - * @param string $result - * @param string $message - * @param string $directive - * @param string $reason - * - * @return array - */ - protected function processTestLine($result, $message, $directive, $reason) - { - $test = [ - 'pass' => true, - 'message' => $message, - 'severity' => 'success', - ]; - - if ($result !== 'ok') { - $test['pass'] = false; - $test['severity'] = substr($message, 0, 6) === 'Error:' ? 'error' : 'fail'; - $this->failures++; - } - - if ($directive) { - $test = $this->processDirective($test, $directive, $reason); - } - - return $test; - } - - /** Process an indented Yaml block. - * - * @param string $indent The block indentation to ignore. - * - * @return array The processed Yaml content. - */ - protected function processYamlBlock($indent) - { - $startLine = $this->lineNumber + 1; - $endLine = $indent . '...'; - $yamlLines = []; - - do { - $line = $this->nextLine(); - - if ($line === false) { - throw new Exception(Lang::get('tap_error_endless_yaml', $startLine)); - } elseif ($line === $endLine) { - break; - } - - $yamlLines[] = substr($line, strlen($indent)); - } while (true); - - return Yaml::parse(join("\n", $yamlLines)); - } - - /** Process a TAP directive - * - * @param array $test - * @param string $directive - * @param string $reason - * @return array - */ - protected function processDirective($test, $directive, $reason) - { - $test['severity'] = strtolower($directive) === 'skip' ? 'skipped' : 'todo'; - - if (!empty($reason)) { - if (!empty($test['message'])) { - $test['message'] .= ', '.$test['severity'].': '; - } - $test['message'] .= $reason; - } - - return $test; - } - - /** - * Get the total number of failures from the current TAP file. - * @return int - */ - public function getTotalFailures() - { - return $this->failures; - } -} diff --git a/src/PHPCensor/View/layout.phtml b/src/PHPCensor/View/layout.phtml index 254c1975..a144c76d 100644 --- a/src/PHPCensor/View/layout.phtml +++ b/src/PHPCensor/View/layout.phtml @@ -89,7 +89,7 @@