Showing 4,217 of 4,217 total issues

Method _show_info_items has 100 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function _show_info_items()
    {
        // Array of text fields
        $text_fields = [
            'name' => 'Name',
Severity: Major
Found in plugins/user/modules/yf_user_profile.class.php - About 4 hrs to fix

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

    class yf_graphics
    {
        /** @var bool Add pages names to the title */
        public $ADD_TITLE_PAGES = true;
        /** @var bool Show auto-parsed (and tried to translate) task name */
    Severity: Minor
    Found in classes/yf_graphics.class.php - About 4 hrs to fix

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

      <?php
      
      /**
       * Redis API wrapper.
       */
      Severity: Minor
      Found in plugins/redis/classes/yf_wrapper_redis.class.php - About 4 hrs to fix

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

        function db_pf($tbl_name = '')
        {
            $_instance = &$GLOBALS[__FUNCTION__];
            if ($_instance === null) {
                $db_class = load_db_class();
        Severity: Major
        Found in .dev/samples/db_funcs.php and 3 other locations - About 4 hrs to fix
        .dev/samples/db_funcs.php on lines 29..45
        .dev/samples/db_funcs.php on lines 80..96
        .dev/samples/db_funcs.php on lines 97..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 162.

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

        function db_m3($tbl_name = '')
        {
            $_instance = &$GLOBALS[__FUNCTION__];
            if ($_instance === null) {
                $db_class = load_db_class();
        Severity: Major
        Found in .dev/samples/db_funcs.php and 3 other locations - About 4 hrs to fix
        .dev/samples/db_funcs.php on lines 29..45
        .dev/samples/db_funcs.php on lines 46..62
        .dev/samples/db_funcs.php on lines 80..96

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

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

        function db_cr($tbl_name = '')
        {
            $_instance = &$GLOBALS[__FUNCTION__];
            if ($_instance === null) {
                $db_class = load_db_class();
        Severity: Major
        Found in .dev/samples/db_funcs.php and 3 other locations - About 4 hrs to fix
        .dev/samples/db_funcs.php on lines 29..45
        .dev/samples/db_funcs.php on lines 46..62
        .dev/samples/db_funcs.php on lines 97..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 162.

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

        function db_t2($tbl_name = '')
        {
            $_instance = &$GLOBALS[__FUNCTION__];
            if ($_instance === null) {
                $db_class = load_db_class();
        Severity: Major
        Found in .dev/samples/db_funcs.php and 3 other locations - About 4 hrs to fix
        .dev/samples/db_funcs.php on lines 46..62
        .dev/samples/db_funcs.php on lines 80..96
        .dev/samples/db_funcs.php on lines 97..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 162.

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

            public function _try_to_find_libs()
            {
                if ( ! $this->AUTO_FIND_PATHS) {
                    return false;
                }
        Severity: Major
        Found in plugins/common/classes/common/yf_image_manip.class.php - About 3 hrs to fix

          Method form_row has 98 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function form_row($content, $extra = [], $replace = [], $form)
              {
                  $name = $extra['name'];
                  $is_html_array = (false !== strpos($name, '['));
                  if ($is_html_array) {
          Severity: Major
          Found in plugins/html/classes/html5fw/yf_html5fw_bs3.class.php - About 3 hrs to fix

            Function start has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
            Open

                public function start()
                {
                    $main = main();
                    if ( ! empty($this->_started) || $main->is_console() || conf('SESSION_OFF') || $this->OFF) {
                        return false;
            Severity: Minor
            Found in plugins/session/classes/yf_session.class.php - About 3 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_menu has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
            Open

                public function _show_menu($params = [])
                {
                    $return_array = isset($params['return_array']) ? $params['return_array'] : false;
                    $force_stpl_name = isset($params['force_stpl_name']) ? $params['force_stpl_name'] : false;
                    $menu_name = $params['name'];
            Severity: Minor
            Found in plugins/sys/classes/yf_core_menu.class.php - About 3 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 _external_response has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
            Open

                public function _external_response()
                {
                    $ip = common()->get_ip();
                    if ( ! in_array($ip, ['185.71.65.92', '185.71.65.189', '149.202.17.210'])) {
                        $this->external_response_errors[] = 'Invalid sender IP address ' . $ip;
            Severity: Minor
            Found in plugins/payment/classes/yf_payment_api__provider_payeer.class.php - About 3 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 has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
            Open

                public function _show_for_object($params = [])
                {
                    if ($this->USE_TREE_MODE) {
                        return $this->_show_for_object_tree($params);
                    }
            Severity: Minor
            Found in plugins/comments/modules/yf_comments.class.php - About 3 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 27 (exceeds 5 allowed). Consider refactoring.
            Open

                public function go($source_file_path = '', $dest_file_path = '', $LIMIT_X = -1, $LIMIT_Y = -1, $watermark_path = '', $ext = '')
                {
                    $_prev_num_errors = count((array) main()->_all_core_error_msgs);
                    $LIMIT_X = (int) ($LIMIT_X != -1 ? $LIMIT_X : THUMB_WIDTH);
                    $LIMIT_Y = (int) ($LIMIT_Y != -1 ? $LIMIT_Y : THUMB_HEIGHT);
            Severity: Minor
            Found in plugins/common/classes/common/yf_make_thumb.class.php - About 3 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 _check has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
            Open

                public function _check($input = [], $user_info = [])
                {
                    // Default banned status
                    $BANNED_STATUS = false;
                    // Nothing to check
            Severity: Minor
            Found in plugins/common/classes/common/yf_user_ban.class.php - About 3 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 allow has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
            Open

                public function allow()
                {
                    if ( ! $this->LOGGING || MAIN_TYPE_ADMIN) {
                        return false;
                    }
            Severity: Minor
            Found in plugins/logs/classes/logs/yf_logs_exec_user.class.php - About 3 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 _skip_by_pattern has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
            Open

                public function _skip_by_pattern($path = '', $_type = 'f', $pattern_include = '', $pattern_exclude = '')
                {
                    if ( ! $path) {
                        return false;
                    }
            Severity: Minor
            Found in plugins/ssh/classes/yf_ssh.class.php - About 3 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 mkdir_m has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
            Open

                public function mkdir_m($dir_name, $dir_mode = 0755, $create_index_htmls = 0, $start_folder = '')
                {
                    if ( ! $dir_name || ! strlen($dir_name)) {
                        return 0;
                    }
            Severity: Minor
            Found in classes/yf_dir.class.php - About 3 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 data_get_latest_currencies has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
            Open

            function data_get_latest_currencies()
            {
                $url = 'http://www.currency-iso.org/dam/downloads/table_a1.xml';
                $f = __DIR__ . '/' . basename($url);
                if (!file_exists($f)) {
            Severity: Minor
            Found in .dev/scripts/currencies/get_latest_currencies.php - About 3 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

                    $rules_cleaned = [
                        'name' => [
                            ['trim', null],
                            ['required', null],
                            ['min_length', '2'],
            Severity: Major
            Found in .dev/tests/unit/class_validate_test.Test.php and 1 other location - About 3 hrs to fix
            .dev/tests/unit/class_validate_test.Test.php on lines 1127..1145

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

            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