mdmsoft/yii2-admin

View on GitHub

Showing 114 of 114 total issues

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

    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 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 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/AccessControl.php - About 30 mins to fix

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

                  public function getAppRoutes($module = null)
                  {
                      if ($module === null) {
                          $module = Yii::$app;
                      } elseif (is_string($module)) {
              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

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

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

                  public static function filterActionColumn($buttons = [], $user = null)
                  {
                      if (is_array($buttons)) {
                          $result = [];
                          foreach ($buttons as $button) {
              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 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

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

                  public function checkRule()
                  {
                      $name = $this->ruleName;
                      if (!Configs::authManager()->getRule($name)) {
                          try {
              Severity: Minor
              Found in models/AuthItem.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 normalizeRoute has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected static function normalizeRoute($route, $advanced = false)
                  {
                      if ($route === '') {
                          $normalized = '/' . Yii::$app->controller->getRoute();
                      } elseif (strncmp($route, '/', 1) === 0) {
              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

              Severity
              Category
              Status
              Source
              Language