Showing 4,217 of 4,217 total issues

Function show has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

    public function show()
    {
        $a = $this->_get_page_from_db();
        if ( ! $a) {
            return _404();
Severity: Minor
Found in plugins/static_pages/modules/yf_static_pages.class.php - About 4 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

Function _show_for_object_tree has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

    public function _show_for_object_tree($params = [])
    {
        $OBJECT_NAME = ! empty($params['object_name']) ? $params['object_name'] : $_GET['object'];
        $OBJECT_ID = ! empty($params['object_id']) ? (int) ($params['object_id']) : (int) ($_GET['id']);
        $STPL_NAME_MAIN = ! empty($params['stpl_main']) ? $params['stpl_main'] : 'comments/main_tree';
Severity: Minor
Found in plugins/comments/modules/yf_comments.class.php - About 4 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

Function jquery_sparklines has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

    public function jquery_sparklines($data, $extra = [])
    {
        $extra['id'] = $extra['id'] ?: __FUNCTION__ . '_' . ++$this->_ids[__FUNCTION__];
        if ( ! is_array($data) || ! $data) {
            return false;
Severity: Minor
Found in plugins/charts/classes/yf_charts.class.php - About 4 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

Function scan_dir has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

function scan_dir($start_dir, $FLAT_MODE = true, $include_pattern = '', $exclude_pattern = '')
{
    if ( ! file_exists($start_dir)) {
        return false;
    }
Severity: Minor
Found in .dev/useful/pack_zend.php - About 4 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

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

        $data = [
            'fields' => [
                'id' => ['name' => 'id', 'type' => 'int', 'length' => 10, 'unsigned' => true, 'nullable' => false, 'auto_inc' => true],
                'name' => ['name' => 'name', 'type' => 'varchar', 'length' => 255, 'default' => '', 'nullable' => false],
                'active' => ['name' => 'active', 'type' => 'enum', 'values' => [1 => '1', 0 => '0'], 'default' => '0', 'nullable' => false],
.dev/tests/functional/db/class_db_real_utils_mysql_test.Test.php on lines 258..267

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

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

        $data = [
            'fields' => [
                'id' => ['name' => 'id', 'type' => 'int', 'length' => 10, 'unsigned' => true, 'nullable' => false, 'auto_inc' => true],
                'name' => ['name' => 'name', 'type' => 'varchar', 'length' => 255, 'default' => '', 'nullable' => false],
                'active' => ['name' => 'active', 'type' => 'enum', 'values' => [1 => '1', 0 => '0'], 'default' => '0', 'nullable' => false],
.dev/tests/functional/db/class_db_real_utils_mysql_test.Test.php on lines 237..246

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

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

    public function test_split_sql()
    {
        if ($this->_need_skip_test(__FUNCTION__)) {
            return;
        }
Severity: Major
Found in .dev/tests/functional/db/class_db_real_mysql_test.Test.php and 1 other location - About 4 hrs to fix
.dev/tests/functional/db/class_db_real_utils_mysql_test.Test.php on lines 1460..1469

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

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

    public function test_bug_06()
    {
        $tpl_str = '
            {catch(min_ext)}{if_false(debug_mode)}.min{/if}{/catch}
            {if(css_framework eq "bs2" or css_framework eq "")}
Severity: Major
Found in .dev/tests/unit/tpl/tpl_driver_yf_bugs_test.Test.php and 1 other location - About 4 hrs to fix
.dev/tests/unit/tpl/tpl_driver_yf_core_test.Test.php on lines 99..113

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

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

    public function test_split_sql()
    {
        if ($this->_need_skip_test(__FUNCTION__)) {
            return;
        }
.dev/tests/functional/db/class_db_real_mysql_test.Test.php on lines 504..513

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

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

    public function test_catch_complex()
    {
        $tpl_str = '
            {catch(min_ext)}{if(debug_mode eq 0)}.min{/if}{/catch}
            {if(css_framework eq "bs2" or css_framework eq "")}
Severity: Major
Found in .dev/tests/unit/tpl/tpl_driver_yf_core_test.Test.php and 1 other location - About 4 hrs to fix
.dev/tests/unit/tpl/tpl_driver_yf_bugs_test.Test.php on lines 67..81

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

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 show has 110 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function show($out_type, $params = [])
    {
        if ( ! $out_type || ! in_array($out_type, $this->supported_out_types)) {
            throw new Exception('Assets: unsupported out content type: ' . $out_type);
            return null;
Severity: Major
Found in plugins/assets/classes/yf_assets.class.php - About 4 hrs to fix

    Method _init has 110 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function _init()
        {
            // class
            $this->payment_api = _class('payment_api');
            $this->manage_payment_lib = module('manage_payment_lib');
    Severity: Major
    Found in plugins/payment/admin_modules/yf_manage_payout.class.php - About 4 hrs to fix

      Method _filter_sql_prepare has 110 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function _filter_sql_prepare($filter_data = [], $filter_params = [], $__sql = '', $table = null)
          {
              if ( ! $filter_data) {
                  return '';
              }
      Severity: Major
      Found in plugins/table2/classes/table2/yf_table2_filter.class.php - About 4 hrs to fix

        File yf_image_manip.class.php has 350 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        
        /**
         * Crop & rotate images.
         *
        Severity: Minor
        Found in plugins/common/classes/common/yf_image_manip.class.php - About 4 hrs to fix

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

              public function test_drop_table()
              {
                  if ($this->_need_skip_test(__FUNCTION__)) {
                      return;
                  }
          .dev/tests/functional/db/class_db_real_utils_pgsql.TODO.php on lines 100..111

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

          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

          foreach (['', '*/', '*/*/', '*/*/*/'] as $g) {
              $paths = glob($project_path . $g . 'db_setup.php');
              if ( ! $paths || ! isset($paths[0])) {
                  continue;
              }
          Severity: Major
          Found in .dev/scripts/db/get_installer_data.php and 1 other location - About 4 hrs to fix
          .dev/scripts/scripts_init.php on lines 9..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 170.

          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

          foreach (['', '*/', '*/*/', '*/*/*/'] as $g) {
              $paths = glob($project_path . $g . 'db_setup.php');
              if ( ! $paths || ! isset($paths[0])) {
                  continue;
              }
          Severity: Major
          Found in .dev/scripts/scripts_init.php and 1 other location - About 4 hrs to fix
          .dev/scripts/db/get_installer_data.php on lines 12..29

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

          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

              public function test_drop_table()
              {
                  if ($this->_need_skip_test(__FUNCTION__)) {
                      return;
                  }
          Severity: Major
          Found in .dev/tests/functional/db/class_db_real_utils_pgsql.TODO.php and 1 other location - About 4 hrs to fix
          .dev/tests/functional/db/class_db_real_utils_mysql_test.Test.php on lines 217..228

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

          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 _process_foreaches has 109 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function _process_foreaches($string = '', $replace = [], $stpl_name = '')
              {
                  if (false === strpos($string, '{/foreach') || empty($string)) {
                      return $string;
                  }
          Severity: Major
          Found in plugins/tpl/classes/tpl/yf_tpl_driver_yf.class.php - About 4 hrs to fix

            Method alternate_remote_file_size has 109 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function alternate_remote_file_size($url, $retry = 3)
                {
                    $method = 'GET';
            
                    $time_start = microtime(true);
            Severity: Major
            Found in plugins/common/classes/common/yf_remote_files.class.php - About 4 hrs to fix
              Severity
              Category
              Status
              Source
              Language