mdmsoft/yii2-admin

View on GitHub

Showing 65 of 114 total issues

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

    $.fn[ name ] = function( options ) {
        var isMethodCall = typeof options === "string",
            args = widget_slice.call( arguments, 1 ),
            returnValue = this;

Severity: Minor
Found in assets/jquery-ui.js - About 1 hr to fix

    Method isActive has 43 lines of code (exceeds 25 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 1 hr to fix

      Method getUsers has 42 lines of code (exceeds 25 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

        Function search has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            public function search($params)
            {
                /* @var \yii\rbac\Manager $authManager */
                $authManager = Configs::authManager();
                $advanced = Configs::instance()->advanced;
        Severity: Minor
        Found in models/searchs/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 save has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            public function save()
            {
                if ($this->validate()) {
                    $manager = Configs::authManager();
                    if ($this->_item === null) {
        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 _on has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            _on: function( suppressDisabledCheck, element, handlers ) {
                var delegateElement,
                    instance = this;
        
                // no suppressDisabledCheck flag, shuffle arguments
        Severity: Minor
        Found in assets/jquery-ui.js - About 1 hr to fix

          Method getRoutes has 38 lines of code (exceeds 25 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

            Function addNew has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                public function addNew($routes)
                {
                    $manager = Configs::authManager();
                    foreach ($routes as $route) {
                        try {
            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 normalizeMenu has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                private static function normalizeMenu(&$assigned, &$menus, $callback, $parent = null)
                {
                    $result = [];
                    $order = [];
                    foreach ($assigned as $id) {
            Severity: Minor
            Found in components/MenuHelper.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

            Method getMenus has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function getMenus()
                {
                    if ($this->_normalizeMenus === null) {
                        $mid = '/' . $this->getUniqueId() . '/';
                        // resolve core menus
            Severity: Minor
            Found in Module.php - About 1 hr to fix

              Method checkRoute has 33 lines of code (exceeds 25 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 1 hr to fix

                Function top has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        top: function( position, data ) {
                            var within = data.within,
                                withinOffset = within.offset.top + within.scrollTop,
                                outerHeight = within.height,
                                offsetTop = within.isWindow ? within.scrollTop : within.offset.top,
                Severity: Minor
                Found in assets/jquery-ui.js - About 1 hr to fix

                  Method search has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function search($params)
                      {
                          /* @var \yii\rbac\Manager $authManager */
                          $authManager = Configs::authManager();
                          $advanced = Configs::instance()->advanced;
                  Severity: Minor
                  Found in models/searchs/AuthItem.php - About 1 hr to fix

                    Function addChildren has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function addChildren($items)
                        {
                            $manager = Configs::authManager();
                            $success = 0;
                            if ($this->_item) {
                    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 removeChildren has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function removeChildren($items)
                        {
                            $manager = Configs::authManager();
                            $success = 0;
                            if ($this->_item !== null) {
                    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

                    Method search has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function search($params)
                        {
                            $query = MenuModel::find()
                                ->from(MenuModel::tableName() . ' t')
                                ->joinWith(['menuParent' => function ($q) {
                    Severity: Minor
                    Found in models/searchs/Menu.php - About 1 hr to fix

                      Function option has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          option: function( key, value ) {
                              var options = key,
                                  parts,
                                  curOption,
                                  i;
                      Severity: Minor
                      Found in assets/jquery-ui.js - About 1 hr to fix

                        Function left has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                left: function( position, data ) {
                                    var within = data.within,
                                        withinOffset = within.offset.left + within.scrollLeft,
                                        outerWidth = within.width,
                                        offsetLeft = within.isWindow ? within.scrollLeft : within.offset.left,
                        Severity: Minor
                        Found in assets/jquery-ui.js - About 1 hr to fix

                          Function _destroy has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              _destroy: function() {
                                  // Destroy (sub)menus
                                  this.element
                                      .removeAttr( "aria-activedescendant" )
                                      .find( ".ui-menu" ).addBack()
                          Severity: Minor
                          Found in assets/jquery-ui.js - About 1 hr to fix

                            Function _initSource has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                _initSource: function() {
                                    var array, url,
                                        that = this;
                                    if ( $.isArray( this.options.source ) ) {
                                        array = this.options.source;
                            Severity: Minor
                            Found in assets/jquery-ui.js - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language