pulsarvp/vps-tools

View on GitHub

Showing 201 of 201 total issues

File ExportController.php has 262 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

    /**
     * @author    Evgenii Kuteiko <kuteiko@mail.ru>
     * @author    Anna Manaenkova <anna.manaenkova@phystech.edu>
Severity: Minor
Found in src/modules/export/controllers/ExportController.php - About 2 hrs to fix

    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 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

                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

                Similar blocks of code found in 3 locations. Consider refactoring.
                Open

                <?php
                
                    use yii\db\Migration;
                
                    /**
                Severity: Major
                Found in src/log/migrations/m171130_084514_logstash.php and 2 other locations - About 1 hr to fix
                src/log/migrations/m171130_084513_setting.php on lines 1..26
                src/migrations/kafka/m190120_180719_kafka_rest.php on lines 1..17

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 117.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 3 locations. Consider refactoring.
                Open

                <?php
                
                    use vps\tools\db\Migration;
                
                    class m190120_180719_kafka_rest extends Migration
                Severity: Major
                Found in src/migrations/kafka/m190120_180719_kafka_rest.php and 2 other locations - About 1 hr to fix
                src/log/migrations/m171130_084513_setting.php on lines 1..26
                src/log/migrations/m171130_084514_logstash.php on lines 1..26

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 117.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 3 locations. Consider refactoring.
                Open

                <?php
                
                    use yii\db\Migration;
                
                    /**
                Severity: Major
                Found in src/log/migrations/m171130_084513_setting.php and 2 other locations - About 1 hr to fix
                src/log/migrations/m171130_084514_logstash.php on lines 1..26
                src/migrations/kafka/m190120_180719_kafka_rest.php on lines 1..17

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 117.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                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 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

                  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

                  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
                      Severity
                      Category
                      Status
                      Source
                      Language