Showing 4,217 of 4,217 total issues

Method _generate_sitemap has 103 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function _generate_sitemap()
    {
        main()->NO_GRAPHICS = true;
        if ( ! $this->SITE_MAP_ENABLED) {
            return false;
Severity: Major
Found in plugins/site_map/modules/yf_site_map.class.php - About 4 hrs to fix

    Method _validate_rules_cleanup has 103 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function _validate_rules_cleanup($validate_rules = [])
        {
            // Trim names with spaces
            foreach ((array) $validate_rules as $name => $raw) {
                $trimmed = trim($name);
    Severity: Major
    Found in classes/yf_validate.class.php - About 4 hrs to fix

      File class_db_real_migrator_mysql.Test__off__.php has 337 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      
      require_once __DIR__ . '/db_real_abstract.php';
      
      /**
      Severity: Minor
      Found in .dev/tests/functional/db/class_db_real_migrator_mysql.Test__off__.php - About 4 hrs to fix

        Function _tree_items has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
        Open

            public function _tree_items(&$data, $extra = [])
            {
                if ($extra['show_controls'] && ! is_callable($extra['show_controls'])) {
                    $r = [
                        'edit_link' => isset($extra['edit_link']) ? $extra['edit_link'] : url('/@object/edit_item/%d/@page'),
        Severity: Minor
        Found in plugins/html/classes/html/yf_html_tree.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 go has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
        Open

            public function go()
            {
                if ( ! db()->QUERY_LOG) {
                    return false;
                }
        Severity: Minor
        Found in plugins/logs/classes/logs/yf_logs_db_queries.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 _loop_detected has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
        Open

            public function _loop_detected($cur_url)
            {
                if ( ! $this->LOOP_DEFENCE) {
                    return false;
                }
        Severity: Minor
        Found in classes/yf_redirect.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

        Method _show_for_object has 102 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function _show_for_object($params = [])
            {
                if ($this->USE_TREE_MODE) {
                    return $this->_show_for_object_tree($params);
                }
        Severity: Major
        Found in plugins/comments/modules/yf_comments.class.php - About 4 hrs to fix

          Method _process_where has 102 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function _process_where(array $where, $func_name = 'where', $return_array = false)
              {
                  $sql = '';
                  if ($count = count((array) $where)) {
                      $all_numeric = $this->_is_where_all_numeric($where);
          Severity: Major
          Found in plugins/db/classes/db/yf_db_query_builder_driver.class.php - About 4 hrs to fix

            Method _filter_array has 102 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function _filter_array(&$data, $filter = [], $filter_params = [], $table = null)
                {
                    if ( ! $data || ! $filter) {
                        return false;
                    }
            Severity: Major
            Found in plugins/table2/classes/table2/yf_table2_filter.class.php - About 4 hrs to fix

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

                  public function read($filename)
                  {
                      // split the file into lines, we'll process it line by line
                      $config_file = file($filename);
              
              

                Method _do_debug_db_connection_queries has 102 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function _do_debug_db_connection_queries($db, $connect_trace = [])
                    {
                        if ( ! $this->SHOW_DB_QUERY_LOG) {
                            return '';
                        }
                Severity: Major
                Found in classes/yf_debug.class.php - About 4 hrs to fix

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

                      public function read($filename)
                      {
                          // split the file into lines, we'll process it line by line
                          $config_file = file($filename);
                  
                  
                  Severity: Major
                  Found in plugins/search/admin_modules/yf_manage_sphinx.class.php - About 4 hrs to fix

                    Method _get_modules_from_files has 101 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function _get_modules_from_files($include_framework = true, $with_sub_modules = false)
                        {
                            $admin_modules_array = [];
                    
                            $pattern_include = '-f ~/' . preg_quote(ADMIN_MODULES_DIR, '~') . '.*' . preg_quote(YF_CLS_EXT, '~') . '$~';
                    Severity: Major
                    Found in plugins/sys/classes/core_api/yf_core_api_admin_modules.class.php - About 4 hrs to fix

                      File sys_log_core_errors.sql_php.php has 335 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      <?php
                      
                      return [
                          'fields' => [
                              'id' => [
                      Severity: Minor
                      Found in plugins/logs/share/db/sql_php/sys_log_core_errors.sql_php.php - About 4 hrs to fix

                        Method test_whereid has 101 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function test_whereid()
                            {
                                if ($this->_need_skip_test(__FUNCTION__)) {
                                    return;
                                }
                        Severity: Major
                        Found in .dev/tests/unit/db/class_db_offline_query_builder_test.Test.php - About 4 hrs to fix

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

                                  if ( ! empty($_GET['id'])) {
                                      $file_name = urldecode($_GET['id']);
                                      $file_path = $file_name;
                                      $dir_name = dirname($file_path);
                                  } else {
                          Severity: Major
                          Found in plugins/sys/admin_modules/yf_file_manager.class.php and 1 other location - About 4 hrs to fix
                          plugins/sys/admin_modules/yf_file_manager.class.php on lines 229..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 163.

                          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 ( ! empty($_GET['id'])) {
                                      $file_name = urldecode($_GET['id']);
                                      $file_path = $file_name;
                                      $dir_name = dirname($file_path);
                                  } else {
                          Severity: Major
                          Found in plugins/sys/admin_modules/yf_file_manager.class.php and 1 other location - About 4 hrs to fix
                          plugins/sys/admin_modules/yf_file_manager.class.php on lines 176..191

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

                          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

                          yf_payment_api__provider_webmoney has 32 functions (exceeds 20 allowed). Consider refactoring.
                          Open

                          class yf_payment_api__provider_webmoney extends yf_payment_api__provider_remote
                          {
                              // номер перевода в системе учета отправителя; любое целое число без знака (целое число > 0; максимально 2^31 - 1), должно быть уникальным в пределах WMID, который подписывает запрос.
                              // Два перевода с одним и тем же tranid с одного WMID (даже с разных кошельков) осуществить невозможно.
                              // Уникальность значения tranid контролируется в интервале не менее одного года.
                          Severity: Minor
                          Found in plugins/payment/classes/yf_payment_api__provider_webmoney.class.php - About 4 hrs to fix

                            Method text has 100 lines of code (exceeds 25 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: Major
                            Found in plugins/table2/classes/yf_table2.class.php - About 4 hrs to fix

                              yf_ssh has 32 functions (exceeds 20 allowed). Consider refactoring.
                              Open

                              class yf_ssh
                              {
                                  // TODO: chained mode like in form and table, mass actions on one server, array of servers, named group(s) of servers:
                                  // ssh('s23.dev')->exec('service memcached restart');
                                  // ssh('s23*.dev')->exec('service memcached restart');
                              Severity: Minor
                              Found in plugins/ssh/classes/yf_ssh.class.php - About 4 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language