pulsarvp/vps-tools

View on GitHub

Showing 201 of 201 total issues

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

        public function checkCollation ($encoding = 'utf8', $exception = true)
        {
            $variables = [
                'character_set_client',
                'character_set_connection',
Severity: Minor
Found in src/db/Migration.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 actionCreate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

        public function actionCreate ()
        {
            $r = Yii::$app->request;
            $post = $r->post();

Severity: Minor
Found in src/modules/export/controllers/ExportController.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 info has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

        public static function info ($path, $names = null)
        {
            $data = [];

            $ffprobe = self::binpath('ffprobe');
Severity: Minor
Found in src/helpers/FFmpegHelper.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 toSeconds has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

        public static function toSeconds ($time)
        {
            // 06:23:16.213
            preg_match('/(\d{2}):(\d{2}):(\d{2})[\.:](\d{3})/', $time, $match);
            if (count($match) == 5)
Severity: Minor
Found in src/helpers/TimeHelper.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 setValue has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

        public static function setValue (&$array, $key, $value)
        {
            if (is_array($array) and ( is_string($key) or is_numeric($key) ))
            {
                if (( $pos = strpos($key, '.') ) === false)
Severity: Minor
Found in src/helpers/ArrayHelper.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 actionEdit has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

        public function actionEdit ()
        {
            if (Yii::$app->request->isAjax)
            {
                $setting = Setting::findOne([ 'name' => Yii::$app->request->post('name') ]);
Severity: Minor
Found in src/modules/setting/controllers/SettingController.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 actionVisible has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

        public function actionVisible ()
        {
            if (Yii::$app->request->isAjax)
            {
                $id = Yii::$app->request->post('id');
Severity: Minor
Found in src/modules/menu/controllers/MenuController.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 actionDelete has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

        public function actionDelete ()
        {
            if (Yii::$app->request->isAjax)
            {
                $id = Yii::$app->request->post('id');
Severity: Minor
Found in src/modules/menu/controllers/MenuController.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

Identical blocks of code found in 2 locations. Consider refactoring.
Open

            if (isset($get[ 'search' ]))
            {
                $query->andWhere([ 'or', [ 'like', 'email', $get[ 'search' ] ], [ 'like', 'action', $get[ 'search' ] ], [ 'like', 'url', $get[ 'search' ] ] ]);
                $this->data('search', $get[ 'search' ]);
            }
Severity: Minor
Found in src/modules/log/controllers/LogController.php and 1 other location - About 30 mins to fix
src/modules/user/controllers/UserController.php on lines 223..227

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

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

Identical blocks of code found in 2 locations. Consider refactoring.
Open

            if (isset($get[ 'search' ]))
            {
                $query->andWhere([ 'or', [ 'like', 'email', $get[ 'search' ] ], [ 'like', 'action', $get[ 'search' ] ], [ 'like', 'url', $get[ 'search' ] ] ]);
                $this->data('search', $get[ 'search' ]);
            }
Severity: Minor
Found in src/modules/user/controllers/UserController.php and 1 other location - About 30 mins to fix
src/modules/log/controllers/LogController.php on lines 71..75

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

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

Avoid too many return statements within this method.
Open

                        return false;
Severity: Major
Found in src/modules/queue/models/search/QueueInformationSearch.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

                                    return false;
    Severity: Major
    Found in src/db/Migration.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                                  return true;
      Severity: Major
      Found in src/modules/user/models/User.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                        return false;
        Severity: Major
        Found in src/db/Migration.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                              return true;
          Severity: Major
          Found in src/modules/queue/models/search/QueueInformationSearch.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                        return null;
            Severity: Major
            Found in src/helpers/HumanHelper.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                          return false;
              Severity: Major
              Found in src/modules/user/models/User.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                            return $provider;
                Severity: Major
                Found in src/modules/queue/models/search/QueueInformationSearch.php - About 30 mins to fix

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

                  <?php
                      /**
                       * Message translations.
                       */
                      return [
                  Severity: Minor
                  Found in src/modules/apiapp/messages/ru/apiapp.php and 1 other location - About 30 mins to fix
                  src/modules/log/messages/ru/log.php on lines 1..25

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

                  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 2 locations. Consider refactoring.
                  Open

                  <?php
                      /**
                       * @author    Evgenii Kuteiko <kuteiko@mail.ru>
                       * @copyright Copyright (c) 2018
                       * @date      2018-05-24
                  Severity: Minor
                  Found in src/modules/log/messages/ru/log.php and 1 other location - About 30 mins to fix
                  src/modules/apiapp/messages/ru/apiapp.php on lines 1..23

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

                  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

                  Severity
                  Category
                  Status
                  Source
                  Language