Showing 4,217 of 4,217 total issues

Method get_user_info has 65 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function get_user_info()
    {
        if (DEBUG_MODE && $_GET['oauth_clean']) {
            $this->_storage_clean();
        }
Severity: Major
Found in plugins/oauth/classes/oauth/yf_oauth_driver1.class.php - About 2 hrs to fix

    Method btn_active has 65 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function btn_active($name = '', $link = '', $extra = [])
        {
            if (is_array($name)) {
                $extra = $name;
                $name = '';
    Severity: Major
    Found in plugins/table2/classes/yf_table2.class.php - About 2 hrs to fix

      Method show_rss_page has 65 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function show_rss_page($data = [], $params = [])
          {
              require_php_lib('yf_feedcreator');
              $rss = new UniversalFeedCreator();
              if ( ! isset($params['use_cached']) || ! empty($params['use_cached'])) {
      Severity: Major
      Found in plugins/common/classes/common/yf_rss_data.class.php - About 2 hrs to fix

        Method _check has 65 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function _check($target_user_id = 0, $source_user_id = 0)
            {
                if (empty($source_user_id) && ! empty(main()->USER_ID)) {
                    $source_user_id = main()->USER_ID;
                }
        Severity: Major
        Found in plugins/common/classes/common/yf_multi_accounts.class.php - About 2 hrs to fix

          Method join_url has 65 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function join_url($parts, $encode = null)
              {
                  if ($encode === null) {
                      $encode = $this->AUTO_ENCODE_DECODE;
                  }
          Severity: Major
          Found in plugins/common/classes/common/yf_url_to_absolute.class.php - About 2 hrs to fix

            Method _init_sftp_phpseclib has 65 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function _init_sftp_phpseclib($server_info = [])
                {
                    if ( ! $this->DRIVER == 'phpseclib') {
                        return false;
                    }
            Severity: Major
            Found in plugins/ssh/classes/yf_ssh.class.php - About 2 hrs to fix

              Method test_order_by has 65 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

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

                Method test_num2str_uah_ru has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function test_num2str_uah_ru()
                    {
                        //        $this->assertEquals( 'пятьсот пятьдесят пять триллионов четыреста сорок четыре милиарда триста тридцать три миллиона двести двадцать две тысячи сто одиннадцать гривен 99 копеек', common()->num2str( '555 444 333 222 111.999', 'uah', 'ru' ) );
                        //        $this->assertEquals( 'п`ятьсот п`ятьдесят п`ять трильйонів чотиреста сорок чотири мільярда триста тридцять три мільйона двісті двадцять дві тисячі сто одиннадцять гривень 99 копійок', common()->num2str( '555 444 333 222 111.999', 'uah', 'ua' ) );
                        //        $this->assertEquals( 'five hundred fifty five trillions four hundred forty four milliards three hundred thirty three millions two hundred twenty two thousands one hundred eleven grivnas 99 kopecks', common()->num2str( '555 444 333 222 111.999', 'uah', 'en' ) );
                Severity: Major
                Found in .dev/tests/unit/class_num2string_test.Test.php - About 2 hrs to fix

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

                      function twoDigits(d) {
                          if(0 <= d && d < 10) return "0" + d.toString();
                          if(-10 < d && d < 0) return "-0" + (-1*d).toString();
                          return d.toString();
                      }
                  plugins/content/templates/user/js/ng/payment/balance-recharge.js on lines 637..641

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

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

                  function yf_placeholder_img($w = 100, $h = 100, $params = [])
                  {
                      $w = abs((int) $w ?: 100);
                      $h = abs((int) $h ?: 100);
                      $text = $params['text'] ?: $w . ' x ' . $h;
                  Severity: Major
                  Found in functions/yf_placeholder_img.php - About 2 hrs to fix

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

                        function twoDigits(d) {
                            if(0 <= d && d < 10) return "0" + d.toString();
                            if(-10 < d && d < 0) return "-0" + (-1*d).toString();
                            return d.toString();
                        }
                    plugins/content/templates/user/js/ng/payment/balance-recharge.js on lines 646..650

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

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

                        public function radio_box($name, $values = [], $selected = '', $horizontal = true, $type = 2, $add_str = '', $translate = 0)
                        {
                            if (is_array($name)) {
                                $extra = (array) $extra + $name;
                                $name = $extra['name'];
                    Severity: Minor
                    Found in plugins/html/classes/yf_html.class.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

                    Function _get_admin_daily_info has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function _get_admin_daily_info($sql, $days = 60, $admin_ids = [])
                        {
                            if ( ! $admin_ids) {
                                return false;
                            }
                    Severity: Minor
                    Found in plugins/admin/admin_modules/yf_admin.class.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

                    Function _rss_general has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function _rss_general()
                        {
                            foreach ((array) module('comments')->COMMENT_LINKS as $key => $value) {
                                $where .= 'object_name="' . $key . '"';
                                if ($value !== end(module('comments')->COMMENT_LINKS)) {
                    Severity: Minor
                    Found in plugins/comments/modules/comments/yf_comments_integration.class.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

                    Function _process_where_cond has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function _process_where_cond($left, $op, $right)
                        {
                            ! $op && $op = '=';
                            $left = trim(strtolower($left));
                            if (is_string($op)) {
                    Severity: Minor
                    Found in plugins/db/classes/db/yf_db_query_builder_driver.class.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

                    Function go has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function go($sql = '', $url_path = '', $render_type = '', $records_on_page = 0, $num_records = 0, $tpls_path = '', $add_get_vars = 1, $extra = [])
                        {
                            if (is_array($url_path)) {
                                $extra = $url_path;
                                $url_path = '';
                    Severity: Minor
                    Found in plugins/common/classes/common/yf_divide_pages.class.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

                    Function rotate has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function rotate($source_file_path, $dest_file_path, $ANGLE)
                        {
                            // Check source file
                            if ( ! file_exists($source_file_path) || ! filesize($source_file_path) || ! is_readable($source_file_path)) {
                                trigger_error('ROTATE_IMG: Source file is empty', E_USER_WARNING);
                    Severity: Minor
                    Found in plugins/common/classes/common/yf_image_manip.class.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

                    Function _get_available_widgets_hooks has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function _get_available_widgets_hooks()
                        {
                            if (isset($this->_avail_widgets)) {
                                return $this->_avail_widgets;
                            }
                    Severity: Minor
                    Found in plugins/common/classes/common/yf_dashboards.class.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

                    Function product_image_search has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function product_image_search()
                        {
                            $_GET['id'] = (int) ($_GET['id']);
                            if ($_GET['id']) {
                                $product = module('manage_shop')->_product_get_info($_GET['id']);

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

                        public function _recursive_sort_items($items = [], $skip_item_id = 0, $parent_id = 0)
                        {
                            $children = [];
                            $cur_group = MAIN_TYPE_USER ? $_SESSION['user_group'] : $_SESSION['admin_group'];
                            foreach ((array) $items as $id => $info) {
                    Severity: Minor
                    Found in plugins/categories/classes/yf_cats.class.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

                    Severity
                    Category
                    Status
                    Source
                    Language