pulsarvp/vps-tools

View on GitHub

Showing 156 of 201 total issues

Function equal has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

        public static function equal ($array, $strict = false)
        {
            if (is_array($array))
            {
                if ($strict)
Severity: Minor
Found in src/helpers/ArrayHelper.php - About 2 hrs 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 actionSendElk has 53 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        public function actionSendElk ()
        {
            $logs = Log::find()->orderBy([ 'dt' => SORT_ASC ])->all();
            if (Yii::$app->settings->get('log_ssl_use'))
            {
Severity: Major
Found in src/modules/log/controllers/LogConsoleController.php - About 2 hrs to fix

    Function printTable has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

            public static function printTable ($data, $headers = [])
            {
                // Count max length for every column.
                $lengths = [];
    
    
    Severity: Minor
    Found in src/helpers/Console.php - About 2 hrs 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 safeUp has 52 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            public function safeUp ()
            {
                $settingModel = 'setting';
                if (Yii::$app->has('settings') and Yii::$app->settings->hasMethod('getTableName'))
                    $settingModel = Yii::$app->settings->getTableName();
    Severity: Major
    Found in src/modules/log/migrations/m191121_081552_db.php - About 2 hrs to fix

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

              public function search ($params)
              {
                  $this->load($params);
      
                  if (!empty($this->status))
      Severity: Major
      Found in src/modules/queue/models/search/QueueInformationSearch.php - About 2 hrs to fix

        Method init has 51 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                public function init ()
                {
                    $access = ( !is_null(Yii::$app->getModule('users')) and Yii::$app->getModule('users')->useAccessControl );
                    $rules = [
                        [
        Severity: Major
        Found in src/modules/user/filters/AccessControl.php - About 2 hrs to fix

          Method rules has 50 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  public function rules ()
                  {
                      switch ($this->type)
                      {
                          case 'command':
          Severity: Minor
          Found in src/modules/setting/models/Setting.php - About 2 hrs to fix

            Method getGridView has 49 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    private function getGridView ($searchModel, $dataProvider)
                    {
                        return GridView::widget([
                            'dataProvider' => $dataProvider,
                            'filterModel'  => $searchModel,
            Severity: Minor
            Found in src/modules/queue/controllers/QueueRedisController.php - About 1 hr to fix

              Function filterConfig has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
              Open

                      private function filterConfig ($config)
                      {
                          $setNullComponents = false;
              
                          // Remove unnecessary components for migrations.
              Severity: Minor
              Found in src/console/Application.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 actionIndex has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
              Open

                      public function actionIndex ()
                      {
                          $get = Yii::$app->request->get();
              
                          $query = Log::find();
              Severity: Minor
              Found in src/modules/log/controllers/LogController.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 sendMessage has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
              Open

                      public function sendMessage ($data)
                      {
                          if ($this->use)
                          {
                              try
              Severity: Minor
              Found in src/components/KafkaRest.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 authOAuth2 has 45 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      protected function authOAuth2 ($client, $authUrlParams = [])
                      {
                          $get = Yii::$app->request->get();
                          if (isset($get[ 'error' ]))
                          {
              Severity: Minor
              Found in src/auth/AuthAction.php - About 1 hr to fix

                Function rules has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                Open

                        public function rules ()
                        {
                            switch ($this->type)
                            {
                                case 'command':
                Severity: Minor
                Found in src/modules/setting/models/Setting.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 authOAuth2 has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                Open

                        protected function authOAuth2 ($client, $authUrlParams = [])
                        {
                            $get = Yii::$app->request->get();
                            if (isset($get[ 'error' ]))
                            {
                Severity: Minor
                Found in src/auth/AuthAction.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 42 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        public function behaviors ()
                        {
                            return [
                                'access' => [
                                    'class' => AccessControl::className(),
                Severity: Minor
                Found in src/modules/user/controllers/UserController.php - About 1 hr to fix

                  Method safeUp has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          public function safeUp ()
                          {
                              $settings = [
                                  'footer_copyright_from'      => [
                                      'value'       => 2018,
                  Severity: Minor
                  Found in src/migrations/settings/m180902_145448_footer_setting.php - About 1 hr to fix

                    Method read has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            public function read ()
                            {
                                try
                                {
                                    $ch = curl_init();
                    Severity: Minor
                    Found in src/components/KafkaRest.php - About 1 hr to fix

                      Method sendMessage has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              public function sendMessage ($data)
                              {
                                  if ($this->use)
                                  {
                                      try
                      Severity: Minor
                      Found in src/components/KafkaRest.php - About 1 hr to fix

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

                                public function actionLogout ()
                                {
                                    if (Yii::$app->session->get('isTempUser'))
                                    {
                                        $originalUserId = Yii::$app->session->get('originalUserID');
                        Severity: Minor
                        Found in src/modules/user/controllers/UserController.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 beforeSave has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                        Open

                                public function beforeSave ($insert)
                                {
                                    if ($parent = parent::beforeSave($insert))
                                    {
                                        if ($this->isNewRecord)
                        Severity: Minor
                        Found in src/base/BaseModel.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

                        Severity
                        Category
                        Status
                        Source
                        Language