mdmsoft/yii2-admin

View on GitHub

Showing 65 of 114 total issues

File jquery-ui.js has 2049 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*! jQuery UI - v1.11.4 - 2015-05-31
* http://jqueryui.com
* Includes: core.js, widget.js, position.js, autocomplete.js, menu.js
* Copyright 2015 jQuery Foundation and other contributors; Licensed MIT */

Severity: Major
Found in assets/jquery-ui.js - About 5 days to fix

    Function getAssignedMenu has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function getAssignedMenu($userId, $root = null, $callback = null, $refresh = false)
        {
            $config = Configs::instance();
    
            /* @var $manager \yii\rbac\BaseManager */
    Severity: Minor
    Found in components/MenuHelper.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

    Function _create has 203 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        _create: function() {
            // Some browsers only repeat keydown events, not keypress events,
            // so we use the suppressKeyPress flag to determine if we've already
            // handled the keydown event. #7269
            // Unfortunately the code for & in keypress is the same as the up arrow,
    Severity: Major
    Found in assets/jquery-ui.js - About 1 day to fix

      Function position has 147 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      $.fn.position = function( options ) {
          if ( !options || !options.of ) {
              return _position.apply( this, arguments );
          }
      
      
      Severity: Major
      Found in assets/jquery-ui.js - About 5 hrs to fix

        Function isActive has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function isActive($action)
            {
                $uniqueId = $action->getUniqueId();
                if ($uniqueId === Yii::$app->getErrorHandler()->errorAction) {
                    return false;
        Severity: Minor
        Found in components/AccessControl.php - About 4 hrs 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

        Function getMenus has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
        Open

            public function getMenus()
            {
                if ($this->_normalizeMenus === null) {
                    $mid = '/' . $this->getUniqueId() . '/';
                    // resolve core menus
        Severity: Minor
        Found in Module.php - About 3 hrs 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

        Function widget has 73 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        $.widget = function( name, base, prototype ) {
            var fullName, existingConstructor, constructor, basePrototype,
                // proxiedPrototype allows the provided prototype to remain unmodified
                // so that it can be used as a mixin for multiple widgets (#8876)
                proxiedPrototype = {},
        Severity: Major
        Found in assets/jquery-ui.js - About 2 hrs to fix

          Function _create has 70 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              _create: function() {
                  this.activeMenu = this.element;
          
                  // Flag used to prevent firing of the click handler
                  // as the event bubbles up through nested menus
          Severity: Major
          Found in assets/jquery-ui.js - About 2 hrs to fix

            Function _keydown has 68 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                _keydown: function( event ) {
                    var match, prev, character, skip,
                        preventDefault = true;
            
                    switch ( event.keyCode ) {
            Severity: Major
            Found in assets/jquery-ui.js - About 2 hrs to fix

              Method getAssignedMenu has 68 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static function getAssignedMenu($userId, $root = null, $callback = null, $refresh = false)
                  {
                      $config = Configs::instance();
              
                      /* @var $manager \yii\rbac\BaseManager */
              Severity: Major
              Found in components/MenuHelper.php - About 2 hrs to fix

                Function checkRoute has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                Open

                    public static function checkRoute($route, $params = [], $user = null)
                    {
                        $config = Configs::instance();
                        $r = static::normalizeRoute($route, $config->advanced);
                        if ($config->onlyRegisteredRoute && !isset(static::getRegisteredRoutes()[$r])) {
                Severity: Minor
                Found in components/Helper.php - About 2 hrs 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

                Function getDefaultRoutes has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected static function getDefaultRoutes()
                    {
                        if (self::$_defaultRoutes === null) {
                            $manager = Configs::authManager();
                            $roles = $manager->defaultRoles;
                Severity: Minor
                Found in components/Helper.php - About 2 hrs 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 AuthItem.php has 261 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                <?php
                
                namespace mdm\admin\models;
                
                use mdm\admin\components\Configs;
                Severity: Minor
                Found in models/AuthItem.php - About 2 hrs to fix

                  Function keydown has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                              keydown: function( event ) {
                                  if ( this.element.prop( "readOnly" ) ) {
                                      suppressKeyPress = true;
                                      suppressInput = true;
                                      suppressKeyPressRepeat = true;
                  Severity: Major
                  Found in assets/jquery-ui.js - About 2 hrs to fix

                    Function getRoutesByUser has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public static function getRoutesByUser($userId)
                        {
                            if (!isset(self::$_userRoutes[$userId])) {
                                $cache = Configs::cache();
                                if ($cache && ($routes = $cache->get([__METHOD__, $userId])) !== false) {
                    Severity: Minor
                    Found in components/Helper.php - About 1 hr 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

                    Function bridge has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    $.widget.bridge = function( name, object ) {
                        var fullName = object.prototype.widgetFullName || name;
                        $.fn[ name ] = function( options ) {
                            var isMethodCall = typeof options === "string",
                                args = widget_slice.call( arguments, 1 ),
                    Severity: Minor
                    Found in assets/jquery-ui.js - About 1 hr to fix

                      Function getControllerFiles has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                      Open

                          protected function getControllerFiles($module, $namespace, $prefix, &$result)
                          {
                              $path = Yii::getAlias('@' . str_replace('\\', '/', $namespace), false);
                              $token = "Get controllers from '$path'";
                              Yii::beginProfile($token, __METHOD__);
                      Severity: Minor
                      Found in models/Route.php - About 1 hr 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

                      Function getRoutes has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function getRoutes()
                          {
                              $manager = Configs::authManager();
                              // Get advanced configuration
                              $advanced = Configs::instance()->advanced;
                      Severity: Minor
                      Found in models/Route.php - About 1 hr 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

                      Function getUsers has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function getUsers()
                          {
                              $module = Yii::$app->controller->module;
                              if (!$module || !$module instanceof Module) {
                                  return [];
                      Severity: Minor
                      Found in models/AuthItem.php - About 1 hr 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

                      Function refresh has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          refresh: function() {
                              var menus, items,
                                  that = this,
                                  icon = this.options.icons.submenu,
                                  submenus = this.element.find( this.options.menus );
                      Severity: Minor
                      Found in assets/jquery-ui.js - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language