yiisoft/yii2

View on GitHub

Function validation has a Cognitive Complexity of 198 (exceeds 5 allowed). Consider refactoring.
Open

yii.validation = (function ($) {
    var pub = {
        isEmpty: function (value) {
            return value === null || value === undefined || ($.isArray(value) && value.length === 0) || value === '';
        },
Severity: Minor
Found in framework/assets/yii.validation.js - About 4 days to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

File mimeTypes.php has 986 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * MIME types.
 *
 * This file contains most commonly used MIME types
Severity: Major
Found in framework/helpers/mimeTypes.php - About 2 days to fix

    Function yii has a Cognitive Complexity of 106 (exceeds 5 allowed). Consider refactoring.
    Open

    window.yii = (function ($) {
        var pub = {
            /**
             * List of JS or CSS URLs that can be loaded multiple times via AJAX requests.
             * Each item may be represented as either an absolute URL or a relative one.
    Severity: Minor
    Found in framework/assets/yii.js - About 2 days to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    File BaseHtml.php has 876 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /**
     * @link http://www.yiiframework.com/
     * @copyright Copyright (c) 2008 Yii Software LLC
     * @license http://www.yiiframework.com/license/
    Severity: Major
    Found in framework/helpers/BaseHtml.php - About 2 days to fix

      File QueryBuilder.php has 840 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      /**
       * @link http://www.yiiframework.com/
       * @copyright Copyright (c) 2008 Yii Software LLC
       * @license http://www.yiiframework.com/license/
      Severity: Major
      Found in framework/db/QueryBuilder.php - About 2 days to fix

        File Formatter.php has 799 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        /**
         * @link http://www.yiiframework.com/
         * @copyright Copyright (c) 2008 Yii Software LLC
         * @license http://www.yiiframework.com/license/
        Severity: Major
        Found in framework/i18n/Formatter.php - About 1 day to fix

          File BaseActiveRecord.php has 779 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          /**
           * @link http://www.yiiframework.com/
           * @copyright Copyright (c) 2008 Yii Software LLC
           * @license http://www.yiiframework.com/license/
          Severity: Major
          Found in framework/db/BaseActiveRecord.php - About 1 day to fix

            Function validation has 363 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            yii.validation = (function ($) {
                var pub = {
                    isEmpty: function (value) {
                        return value === null || value === undefined || ($.isArray(value) && value.length === 0) || value === '';
                    },
            Severity: Major
            Found in framework/assets/yii.validation.js - About 1 day to fix

              File Request.php has 766 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              <?php
              /**
               * @link http://www.yiiframework.com/
               * @copyright Copyright (c) 2008 Yii Software LLC
               * @license http://www.yiiframework.com/license/
              Severity: Major
              Found in framework/web/Request.php - About 1 day to fix

                Function yii has 311 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                window.yii = (function ($) {
                    var pub = {
                        /**
                         * List of JS or CSS URLs that can be loaded multiple times via AJAX requests.
                         * Each item may be represented as either an absolute URL or a relative one.
                Severity: Major
                Found in framework/assets/yii.js - About 1 day to fix

                  File DbManager.php has 653 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  <?php
                  /**
                   * @link http://www.yiiframework.com/
                   * @copyright Copyright (c) 2008 Yii Software LLC
                   * @license http://www.yiiframework.com/license/
                  Severity: Major
                  Found in framework/rbac/DbManager.php - About 1 day to fix

                    Request has 76 functions (exceeds 20 allowed). Consider refactoring.
                    Open

                    class Request extends \yii\base\Request
                    {
                        /**
                         * The name of the HTTP header for sending CSRF token.
                         */
                    Severity: Major
                    Found in framework/web/Request.php - About 1 day to fix

                      BaseHtml has 71 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      class BaseHtml
                      {
                          /**
                           * @var string Regular expression used for attribute name validation.
                           * @since 2.0.12
                      Severity: Major
                      Found in framework/helpers/BaseHtml.php - About 1 day to fix

                        File MessageController.php has 577 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        <?php
                        /**
                         * @link http://www.yiiframework.com/
                         * @copyright Copyright (c) 2008 Yii Software LLC
                         * @license http://www.yiiframework.com/license/
                        Severity: Major
                        Found in framework/console/controllers/MessageController.php - About 1 day to fix

                          BaseActiveRecord has 63 functions (exceeds 20 allowed). Consider refactoring.
                          Open

                          abstract class BaseActiveRecord extends Model implements ActiveRecordInterface
                          {
                              /**
                               * @event Event an event that is triggered when the record is initialized via [[init()]].
                               */
                          Severity: Major
                          Found in framework/db/BaseActiveRecord.php - About 1 day to fix

                            File BaseConsole.php has 545 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            <?php
                            /**
                             * @link http://www.yiiframework.com/
                             * @copyright Copyright (c) 2008 Yii Software LLC
                             * @license http://www.yiiframework.com/license/
                            Severity: Major
                            Found in framework/helpers/BaseConsole.php - About 1 day to fix

                              File PhpManager.php has 538 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              <?php
                              /**
                               * @link http://www.yiiframework.com/
                               * @copyright Copyright (c) 2008 Yii Software LLC
                               * @license http://www.yiiframework.com/license/
                              Severity: Major
                              Found in framework/rbac/PhpManager.php - About 1 day to fix

                                File Schema.php has 532 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

                                <?php
                                /**
                                 * @link http://www.yiiframework.com/
                                 * @copyright Copyright (c) 2008 Yii Software LLC
                                 * @license http://www.yiiframework.com/license/
                                Severity: Major
                                Found in framework/db/pgsql/Schema.php - About 1 day to fix

                                  Function getDefaultHelp has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      protected function getDefaultHelp()
                                      {
                                          $commands = $this->getCommandDescriptions();
                                          $this->stdout($this->getDefaultHelpHeader());
                                          if (!empty($commands)) {
                                  Severity: Minor
                                  Found in framework/console/controllers/HelpController.php - About 1 day to fix

                                  Cognitive Complexity

                                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                  A method's cognitive complexity is based on a few simple rules:

                                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                  • Code is considered more complex for each "break in the linear flow of the code"
                                  • Code is considered more complex when "flow breaking structures are nested"

                                  Further reading

                                  File yii.activeForm.js has 530 lines of code (exceeds 250 allowed). Consider refactoring.
                                  Open

                                  /**
                                   * Yii form widget.
                                   *
                                   * This is the JavaScript widget used by the yii\widgets\ActiveForm widget.
                                   *
                                  Severity: Major
                                  Found in framework/assets/yii.activeForm.js - About 1 day to fix
                                    Severity
                                    Category
                                    Status