diff --git a/.travis.yml b/.travis.yml index cb5087ec8..34a4e5f63 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: php dist: trusty -sudo: required +sudo: false php: - '5.4' @@ -13,7 +13,10 @@ matrix: include: - php: '5.3' dist: precise + sudo: required env: + - PHPCS_VERSION=2.9.1 + - LOCALE_GEN=1 - ENABLE_LDAP=1 services: @@ -35,13 +38,12 @@ notifications: # also see: test/setup_vendor.sh before_script: - php -m - - sudo locale-gen en_US.UTF-8 de_DE.UTF-8 fr_FR.UTF-8 + - sh -c '[ -z $LOCALE_GEN ] || sudo locale-gen en_US.UTF-8 de_DE.UTF-8 fr_FR.UTF-8' - sh -c '[ -z $ENABLE_LDAP ] || phpenv config-add test/travis-ldap.ini' - test/travis_database.sh - test/setup_vendor.sh script: # also see: modules/test/application/clicommands/PhpCommand.php - # phpcs is disabled until fixed... - # - php phpcs.phar -p --standard=icingaweb2.ruleset.xml --extensions=php --encoding=utf-8 application/ library/Icinga modules/ test/ + - php phpcs.phar - php phpunit.phar -c modules/test/phpunit.xml --verbose diff --git a/icingaweb2.ruleset.xml b/icingaweb2.ruleset.xml index 020f26c26..6e1b31e4e 100644 --- a/icingaweb2.ruleset.xml +++ b/icingaweb2.ruleset.xml @@ -3,8 +3,27 @@ The default PSR-2 standard with specifically excluded non-critical sniffs - + + + 0 + + + 0 + + + 0 + + + library/Icinga/Application/Cli.php + library/Icinga/Application/EmbeddedWeb.php + library/Icinga/Application/functions.php + library/Icinga/Application/LegacyWeb.php + library/Icinga/Application/Web.php + library/Icinga/File/Pdf.php + modules/doc/library/Doc/Renderer/DocSectionRenderer.php + modules/monitoring/library/Monitoring/Plugin.php + */test/php/* @@ -25,5 +44,6 @@ */modules/monitoring/library/Monitoring/Backend/Ido/Query/* + */modules/monitoring/library/Monitoring/Backend/Livestatus/Query/* diff --git a/library/Icinga/Exception/Http/BaseHttpException.php b/library/Icinga/Exception/Http/BaseHttpException.php index 781fa906d..cad41c622 100644 --- a/library/Icinga/Exception/Http/BaseHttpException.php +++ b/library/Icinga/Exception/Http/BaseHttpException.php @@ -5,7 +5,6 @@ namespace Icinga\Exception\Http; use Icinga\Exception\IcingaException; - /** * Base class for HTTP exceptions */ diff --git a/library/Icinga/Exception/Http/HttpExceptionInterface.php b/library/Icinga/Exception/Http/HttpExceptionInterface.php index 559b1d27a..c5e0cc749 100644 --- a/library/Icinga/Exception/Http/HttpExceptionInterface.php +++ b/library/Icinga/Exception/Http/HttpExceptionInterface.php @@ -3,7 +3,6 @@ namespace Icinga\Exception\Http; - interface HttpExceptionInterface { /** diff --git a/library/Icinga/Util/Json.php b/library/Icinga/Util/Json.php index 0f757c745..b41da82d5 100644 --- a/library/Icinga/Util/Json.php +++ b/library/Icinga/Util/Json.php @@ -25,7 +25,7 @@ class Json { if (version_compare(phpversion(), '5.4.0', '<')) { $encoded = json_encode($value); - } else if (version_compare(phpversion(), '5.5.0', '<')) { + } elseif (version_compare(phpversion(), '5.5.0', '<')) { $encoded = json_encode($value, $options); } else { $encoded = json_encode($value, $options, $depth); diff --git a/library/Icinga/Web/Form.php b/library/Icinga/Web/Form.php index 08b66f933..9d0d5d707 100644 --- a/library/Icinga/Web/Form.php +++ b/library/Icinga/Web/Form.php @@ -772,7 +772,8 @@ class Form extends Zend_Form $action = $action->without(array_keys($this->getElements())); } - // TODO(el): Re-evalute this necessity. JavaScript could use the container's URL if there's no action set. + // TODO(el): Re-evalute this necessity. + // JavaScript could use the container'sURL if there's no action set. // We MUST set an action as JS gets confused otherwise, if // this form is being displayed in an additional column $this->setAction($action); diff --git a/library/Icinga/Web/Response/JsonResponse.php b/library/Icinga/Web/Response/JsonResponse.php index 744456c82..d0da9a4f3 100644 --- a/library/Icinga/Web/Response/JsonResponse.php +++ b/library/Icinga/Web/Response/JsonResponse.php @@ -176,8 +176,10 @@ class JsonResponse extends Response 'status' => $this->status ); switch ($this->status) { + /** @noinspection PhpMissingBreakStatementInspection */ case static::STATUS_ERROR: $body['message'] = $this->getErrorMessage(); + // Fallthrough case static::STATUS_FAIL: $failData = $this->getFailData(); if ($failData !== null || $this->status === static::STATUS_FAIL) { diff --git a/library/Icinga/Web/Widget/Chart/InlinePie.php b/library/Icinga/Web/Widget/Chart/InlinePie.php index aa0046d35..a88fc8a12 100644 --- a/library/Icinga/Web/Widget/Chart/InlinePie.php +++ b/library/Icinga/Web/Widget/Chart/InlinePie.php @@ -74,14 +74,15 @@ class InlinePie extends AbstractWidget * @var string */ private $template =<<<'EOD' - - + {noscript} EOD; private $noscript =<<<'EOD' EOD; diff --git a/library/Icinga/Web/Widget/Tabs.php b/library/Icinga/Web/Widget/Tabs.php index 2bc296939..979b5ef0a 100644 --- a/library/Icinga/Web/Widget/Tabs.php +++ b/library/Icinga/Web/Widget/Tabs.php @@ -36,7 +36,9 @@ EOT; */ private $dropdownTpl = <<< 'EOT'