mdmsoft/yii2-admin

View on GitHub

Showing 65 of 114 total issues

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

    _createWidget: function( options, element ) {
        element = $( element || this.defaultElement || this )[ 0 ];
        this.element = $( element );
        this.uuid = widget_uuid++;
        this.eventNamespace = "." + this.widgetName + this.uuid;
Severity: Minor
Found in assets/jquery-ui.js - About 1 hr to fix

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

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

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

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

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

            Function getDimensions has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function getDimensions( elem ) {
                var raw = elem[0];
                if ( raw.nodeType === 9 ) {
                    return {
                        width: elem.width(),
            Severity: Minor
            Found in assets/jquery-ui.js - About 1 hr to fix

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

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

                Function filterRecursive has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected static function filterRecursive($items, $user)
                    {
                        $result = [];
                        foreach ($items as $i => $item) {
                            $url = ArrayHelper::getValue($item, 'url', '#');
                Severity: Minor
                Found in components/Helper.php - About 55 mins 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 getItems has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function getItems()
                    {
                        $manager = Configs::authManager();
                        $advanced = Configs::instance()->advanced;
                        $available = [];
                Severity: Minor
                Found in models/AuthItem.php - About 55 mins 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 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function save()
                    {
                        if ($this->validate()) {
                            $manager = Configs::authManager();
                            $class = $this->className;
                Severity: Minor
                Found in models/BizRule.php - About 45 mins 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

                Consider simplifying this complex logical expression.
                Open

                        if ($this->validate()) {
                
                            $search = mb_strtolower(trim((string)$this->name));
                            $desc = mb_strtolower(trim((string)$this->description));
                            $ruleName = $this->ruleName;
                Severity: Major
                Found in models/searchs/AuthItem.php - About 40 mins to fix

                  Consider simplifying this complex logical expression.
                  Open

                              if (term == '' || menu.name.toLowerCase().indexOf(term) >= 0 ||
                                  (menu.parent_name && menu.parent_name.toLowerCase().indexOf(term) >= 0) ||
                                  (menu.route && menu.route.toLowerCase().indexOf(term) >= 0)) {
                                  result.push(menu);
                                  limit--;
                  Severity: Major
                  Found in views/menu/_script.js - About 40 mins to fix

                    Function getSavedRoutes has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public static function getSavedRoutes()
                        {
                            if (self::$_routes === null) {
                                self::$_routes = [];
                                foreach (Configs::authManager()->getPermissions() as $name => $value) {
                    Severity: Minor
                    Found in models/Menu.php - About 35 mins 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

                    Avoid too many return statements within this method.
                    Open

                                    return true;
                    Severity: Major
                    Found in components/Helper.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                  return isset($routes['/*']);
                      Severity: Major
                      Found in components/Helper.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                            return true;
                        Severity: Major
                        Found in components/Helper.php - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                      return false;
                          Severity: Major
                          Found in components/AccessControl.php - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                    return true;
                            Severity: Major
                            Found in components/AccessControl.php - About 30 mins to fix

                              Function getRegisteredRoutes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  public static function getRegisteredRoutes()
                                  {
                                      if (self::$_routes === null) {
                                          self::$_routes = [];
                                          $manager = Configs::authManager();
                              Severity: Minor
                              Found in components/Helper.php - About 25 mins 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 getActionRoutes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  protected function getActionRoutes($controller, &$result)
                                  {
                                      $token = "Get actions of controller '" . $controller->uniqueId . "'";
                                      Yii::beginProfile($token, __METHOD__);
                                      try {
                              Severity: Minor
                              Found in models/Route.php - About 25 mins 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

                              Severity
                              Category
                              Status
                              Source
                              Language