yiisoft/yii2

View on GitHub

Showing 1,072 of 2,359 total issues

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

    File BaseHtml.php has 901 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

      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 BaseActiveRecord.php has 826 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

        File Formatter.php has 800 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 Request.php has 778 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 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 QueryBuilder.php has 763 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 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

                      QueryBuilder has 74 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      class QueryBuilder extends \yii\base\BaseObject
                      {
                          /**
                           * The prefix for automatically generated query binding parameters.
                           */
                      Severity: Major
                      Found in framework/db/QueryBuilder.php - About 1 day to fix

                        BaseHtml has 73 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

                            File BaseConsole.php has 568 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

                              BaseActiveRecord has 65 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 Query.php has 543 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/Query.php - About 1 day to fix

                                  File Schema.php has 539 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

                                    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
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language