rhosocial/yii2-organization

View on GitHub

Showing 63 of 816 total issues

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

    public function run()
    {
        $model = new SetUpForm(['user' => Yii::$app->user->identity]);
        if ($model->load(Yii::$app->request->post())) {
            try {
Severity: Minor
Found in web/user/controllers/organization/SetUpOrganizationAction.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

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

    public function revokeRole($role)
    {
        $user = $this->memberUser;
        if (!$user) {
            throw new InvalidValueException('Invalid User');
Severity: Minor
Found in Member.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 grid/OrganizationListActionColumn.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

                    return Url::to(['settings', 'id' => $model->getID()]);
    Severity: Major
    Found in grid/OrganizationListActionColumn.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                      return Url::to(['exit', 'id' => $model->getID()]);
      Severity: Major
      Found in grid/OrganizationListActionColumn.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                return $result;
        Severity: Major
        Found in Organization.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                      return '#';
          Severity: Major
          Found in grid/OrganizationListActionColumn.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                            return Url::to(['update', 'id' => $model->getID()]);
            Severity: Major
            Found in grid/OrganizationListActionColumn.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                              return Yii::$app->authManager->checkAccess($this->operator->getGUID(), $permission, ['organization' => $model]);
              Severity: Major
              Found in grid/OrganizationListActionColumn.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                                return Yii::$app->authManager->checkAccess($this->operator->getGUID(), (new ManageMember)->name, ['organization' => $model->organization]);
                Severity: Major
                Found in grid/MemberListActionColumn.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                          return $this->controller->redirect(['member', 'org' => $org]);
                  Severity: Major
                  Found in web/organization/controllers/my/AssignAdminAction.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                    return Url::to(['revoke', 'id' => $model->getID()]);
                    Severity: Major
                    Found in grid/OrganizationListActionColumn.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

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

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

                            public function setSetting($item, $value, $unique = false)
                            {
                                if (empty($this->organizationSettingClass) || !is_string($this->organizationSettingClass)) {
                                    return null;
                                }
                        Severity: Minor
                        Found in Organization.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 execute has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function execute($user, $item, $params)
                            {
                                $class = Yii::$app->user->identityClass;
                                if (is_numeric($user) || is_int($user)) {
                                    $user = $class::find()->id($user)->one();
                        Severity: Minor
                        Found in rbac/rules/SetUpDepartmentRule.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 getOrganization has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function getOrganization($organization)
                            {
                                if (!$organization) {
                                    return null;
                                }
                        Severity: Minor
                        Found in web/user/controllers/OrganizationController.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 setUpBaseOrganization has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                            protected function setUpBaseOrganization($models)
                            {
                                $model = null;
                                $associatedModels = [];
                                if (is_array($models)) {
                        Severity: Minor
                        Found in UserOrganizationTrait.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 initMessages has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                            protected function initMessages()
                            {
                                if (!is_string($this->joinSuccessMessage) || empty($this->joinSuccessMessage)) {
                                    $this->joinSuccessMessage = Yii::t('organization', 'Joined.');
                                }
                        Severity: Minor
                        Found in web/organization/controllers/JoinController.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 execute has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function execute($user, $item, $params)
                            {
                                $class = Yii::$app->user->identityClass;
                                if (is_numeric($user) || is_int($user)) {
                                    $user = $class::find()->id($user)->one();
                        Severity: Minor
                        Found in rbac/rules/RevokeDepartmentRule.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 revokeAdministrator has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function revokeAdministrator()
                            {
                                $host = $this->organization;
                                /* @var $host Organization */
                                if ($this->isCreator()) {
                        Severity: Minor
                        Found in Member.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