rhosocial/rho.social

View on GitHub

Showing 48 of 1,384 total issues

Function actionFollowRefresh has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function actionFollowRefresh()
    {
        Follow::deleteAll(['status' => [self::USER_STATUS_TEST_ACTIVE, self::USER_STATUS_TEST_INACTIVE]]);
        $users = User::find()->active(self::USER_STATUS_TEST_ACTIVE)->all();
        /* @var $users User[] */
Severity: Minor
Found in console_test/modules/user/controllers/BatchController.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 run has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function run($response_type = null, $client_id = null, $state = null, $redirect_uri = null, $scope = null)
    {
        // log user in forcely before validate.
        $checkResult = $this->checkResponseType($response_type);
        if ($checkResult !== true) {
Severity: Minor
Found in rho.social/modules/api/controllers/authorize/ConfirmAction.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 notifyOthers has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function notifyOthers($event)
    {
        // Only logged-in user can send notification.
        if (Yii::$app->user->isGuest) {
            return false;
Severity: Minor
Found in common/models/user/BaseUserItem.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 generateUserInfo has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    private function generateUserInfo($nickname = null, $first_name = null, $last_name = null, $gender = null, $phone = null, $email = null, $password = null)
    {
        if (empty($gender)) {
            $gender = $this->faker->numberBetween() % 2;
        }
Severity: Minor
Found in console_test/modules/user/controllers/BatchController.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 behaviors has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function behaviors()
    {
        return [
            'access' => [
                'class' => AccessControl::className(),
Severity: Minor
Found in my.rho.social/controllers/DefaultController.php - About 1 hr to fix

    Method generateUserInfo has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function generateUserInfo($nickname = null, $first_name = null, $last_name = null, $gender = null, $phone = null, $email = null, $password = null)
        {
            if (empty($gender)) {
                $gender = $this->faker->numberBetween() % 2;
            }
    Severity: Minor
    Found in console_test/modules/user/controllers/BatchController.php - About 1 hr to fix

      Method actionIndex has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function actionIndex($id)
          {
              $user = null;
              if (preg_match(Number::GUID_REGEX, $id)) {
                  $user = User::find()->guid($id)->one();
      Severity: Minor
      Found in console/modules/user/controllers/InfoController.php - About 1 hr to fix

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

            public function getRateLimit($request, $action)
            {
                $allow = 10;
                $window = 600;
                $route = $action->controller->route;
        Severity: Minor
        Found in api.rho.social/modules/v1/models/UserRateLimiter.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

        Method generateUserInfo has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            private function generateUserInfo($nickname = null, $first_name = null, $last_name = null, $gender = null, $phone = null, $email = null, $password = null)
        Severity: Major
        Found in console_test/modules/user/controllers/BatchController.php - About 50 mins to fix

          Function post has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                  post: function (url, parameters, successCallback, failCallback, postFailCallback, postAlwaysCallback) {
          Severity: Minor
          Found in common/assets/common/js/rho.js - About 45 mins to fix

            Function address has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

            rho.my.address = (function ($) {
                var pub = {
                    /**
                     * selector: REQUIRED.
                     * url: REQUIRED.
            Severity: Minor
            Found in my.rho.social/widgets/item/assets/item/js/rho.my.address.js - 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

            Method run has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                public function run($response_type = null, $client_id = null, $state = null, $redirect_uri = null, $scope = null)
            Severity: Minor
            Found in rho.social/modules/api/controllers/authorize/ConfirmAction.php - About 35 mins to fix

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

                  public function actionNew()
                  {
                      if (Yii::$app->request->isAjax && !Yii::$app->request->isPjax) {
                          return $this->actionValidate();
                      }
              Severity: Minor
              Found in my.rho.social/controllers/UrlController.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 actionNew has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function actionNew()
                  {
                      if (Yii::$app->request->isAjax && !Yii::$app->request->isPjax) {
                          return $this->actionValidate();
                      }
              Severity: Minor
              Found in my.rho.social/controllers/EmailController.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 actionNew has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function actionNew()
                  {
                      if (Yii::$app->request->isAjax && !Yii::$app->request->isPjax) {
                          return $this->actionValidate();
                      }
              Severity: Minor
              Found in my.rho.social/controllers/AnniversaryController.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 actionNew has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function actionNew()
                  {
                      if (Yii::$app->request->isAjax && !Yii::$app->request->isPjax) {
                          return $this->actionValidate();
                      }
              Severity: Minor
              Found in my.rho.social/controllers/ImController.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 actionFollowingPhones has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function actionFollowingPhones($id)
                  {
                      $user = User::find()->id($id)->one();
                      if (!$user) {
                          throw new Exception("User $id not found.");
              Severity: Minor
              Found in console_test/controllers/TestController.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 actionNew has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function actionNew()
                  {
                      if (Yii::$app->request->isAjax && !Yii::$app->request->isPjax) {
                          return $this->actionValidate();
                      }
              Severity: Minor
              Found in my.rho.social/controllers/AddressController.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 actionNew has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function actionNew()
                  {
                      if (Yii::$app->request->isAjax && !Yii::$app->request->isPjax) {
                          return $this->actionValidate();
                      }
              Severity: Minor
              Found in my.rho.social/controllers/PhoneController.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 $region . " " . $district->localname;
              Severity: Major
              Found in my.rho.social/widgets/item/AddressItemWidget.php - About 30 mins to fix
                Severity
                Category
                Status
                Source
                Language