Showing 4,217 of 4,217 total issues

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

        if (preg_match('/(?P<text>.+?)["\']{1},[\s\t]*%(?P<args>[a-z]+.+)$/ims', $input, $m)) {
            foreach (explode(';%', $m['args']) as $arg) {
                $attr_name = $attr_val = '';
                if (false !== strpos($arg, '=')) {
                    list($attr_name, $attr_val) = explode('=', trim($arg));
Severity: Major
Found in plugins/tpl/classes/yf_tpl.class.php and 1 other location - About 6 hrs to fix
plugins/locale/admin_modules/locale_editor/yf_locale_editor_collect.class.php on lines 231..244

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

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 allow_deny_box($name = '', $desc = '', $extra = [], $replace = [])
    {
        if (is_array($desc)) {
            $extra = (array) $extra + $desc;
            $desc = '';
Severity: Major
Found in plugins/form2/classes/yf_form2.class.php and 1 other location - About 6 hrs to fix
plugins/form2/classes/yf_form2.class.php on lines 1906..1926

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

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

        if (preg_match('~(?P<text>.+?)["\']{1},[\s\t]*%(?P<args>[a-z]+.+)$~ims', $in, $m)) {
            foreach (explode(';%', $m['args']) as $arg) {
                $attr_name = $attr_val = '';
                if (false !== strpos($arg, '=')) {
                    list($attr_name, $attr_val) = explode('=', trim($arg));
plugins/tpl/classes/yf_tpl.class.php on lines 907..920

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

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

Function _check_block_rights has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
Open

    public function _check_block_rights($block_id = 0, $OBJECT = '', $ACTION = '')
    {
        if (empty($block_id) || empty($OBJECT)) {
            return false;
        }
Severity: Minor
Found in plugins/sys/classes/yf_core_blocks.class.php - About 6 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 select has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
Open

    public function select()
    {
        $sql = '';
        $fields = func_get_args();
        if ( ! count((array) $fields) || $fields === []) {
Severity: Minor
Found in plugins/db/classes/db/yf_db_query_builder_driver.class.php - About 6 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 join has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
Open

    public function join($table, $on, $join_type = '', $is_select = false)
    {
        $join_types = [
            'left',
            'right',
Severity: Minor
Found in plugins/db/classes/db/yf_db_query_builder_driver.class.php - About 6 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 _add_revision has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
Open

    public function _add_revision($type, $action, $ids = false)
    {
        if (empty($ids) || empty($action) || empty($type)) {
            return false;
        }

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 _skip_by_pattern has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
Open

    public function _skip_by_pattern($path = '', $_is_dir = false, $pattern_include = '', $pattern_exclude = '')
    {
        if ( ! $path) {
            return false;
        }
Severity: Minor
Found in classes/yf_dir.class.php - About 6 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 _debug_DEBUG_YF has 151 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function _debug_DEBUG_YF(&$params = [])
    {
        if ( ! $this->SHOW_SETTINGS) {
            return '';
        }
Severity: Major
Found in classes/yf_debug.class.php - About 6 hrs to fix

    Method product_set_edit has 150 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function product_set_edit()
        {
            $product_set_id = (int) $_GET['id'];
            $a = db()->from('shop_product_sets')->whereid($product_set_id)->get();
    
    

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

      <?php
      
      class yf_manage_payment_operation
      {
          public $payment_api = null;
      Severity: Minor
      Found in plugins/payment/admin_modules/yf_manage_payment_operation.class.php - About 5 hrs to fix

        Method test_select_box has 149 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function test_select_box()
            {
                $html = html();
                $def_class = $html->CLASS_SELECT_BOX;
                $def_opt_class = $html->CLASS_SELECT_OPTION_DEFAULT;
        Severity: Major
        Found in .dev/tests/unit/class_html_test.Test.php - About 5 hrs to fix

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

          <?php
          
          /**
           * Admin modules list handler.
           *
          Severity: Minor
          Found in plugins/admin/admin_modules/yf_admin_modules.class.php - About 5 hrs to fix

            Method api_payout has 148 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function api_payout($method, $options)
                {
                    if ( ! $this->ENABLE) {
                        return  null;
                    }
            Severity: Major
            Found in plugins/payment/classes/yf_payment_api__provider_privat24.class.php - About 5 hrs to fix

              Function _on_validate_ok has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function _on_validate_ok($params = [], $form = null)
                  {
                      $p = $params ?: $_POST;
                      $lang = $p['lang_to'];
                      $lang_from = $p['lang_from'] ?: 'en';

              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 edit has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function edit($params = [])
                  {
                      if (is_string($params)) {
                          $params = ['table' => $params];
                      }
              Severity: Minor
              Found in plugins/sys/classes/yf_admin_methods.class.php - About 5 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 _rewrite_replace_links has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function _rewrite_replace_links($body = '', $standalone = false, $force_rewrite = false, $for_site_id = false)
                  {
                      if (MAIN_TYPE_ADMIN && ! $force_rewrite) {
                          return $body;
                      }
              Severity: Minor
              Found in plugins/rewrite/classes/yf_rewrite.class.php - About 5 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 add has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function add($object_name, $ids = [], $action = null, $extra = [])
                  {
                      if ( ! $this->ENABLED) {
                          return false;
                      }
              Severity: Minor
              Found in plugins/db/admin_modules/yf_manage_revisions.class.php - About 5 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 text has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function text($name, $desc = '', $extra = [])
                  {
                      // Shortcut: use second param as $extra
                      if (is_array($desc)) {
                          $extra = (array) $extra + $desc;
              Severity: Minor
              Found in plugins/table2/classes/yf_table2.class.php - About 5 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 _view_widget_items has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function _view_widget_items($name_ids = [], $items_configs = [])
                  {
                      $list_of_hooks = $this->_get_available_widgets_hooks();
              
                      $_orig_object = $_GET['object'];
              Severity: Minor
              Found in plugins/common/classes/common/yf_dashboards.class.php - About 5 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

              Severity
              Category
              Status
              Source
              Language