Showing 3,246 of 4,217 total issues

Method _go has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public function _go($location, $rewrite = true, $redirect_type = 'hybrid', $text = '', $ttl = 3, $params = [])
Severity: Minor
Found in classes/yf_redirect.class.php - About 45 mins to fix

    Function _auto_update_items_orders has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function _auto_update_items_orders($lang)
        {
            if ( ! $lang) {
                return false;
            }
    Severity: Minor
    Found in plugins/content/admin_modules/yf_manage_faq.class.php - About 45 mins 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 checkdnsrr has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function checkdnsrr($hostName, $recType = '')
        {
            if ( ! empty($hostName)) {
                if ($recType == '') {
                    $recType = 'MX';
    Severity: Minor
    Found in classes/yf_utils.class.php - About 45 mins 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_latest_describe has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function _get_latest_describe($sql = '')
        {
            if ( ! $this->sphinx_connection) {
                $this->_connect();
            }
    Severity: Minor
    Found in plugins/search/classes/yf_sphinxsearch.class.php - About 45 mins 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 init_site_id has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function init_site_id()
        {
            $this->PROFILING && $this->_timing[] = [microtime(true), __CLASS__, __FUNCTION__, $this->trace_string(), func_get_args()];
            if ( ! conf('SITE_ID')) {
                $site_id = 1;
    Severity: Minor
    Found in classes/yf_main.class.php - About 45 mins 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_avatar has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        public function _show_avatar($user_id = 0, $user_name = '', $as_link = 0, $is_middle = 0, $only_img_src = 0, $force_link = '')
    Severity: Minor
    Found in classes/yf_utils.class.php - About 45 mins to fix

      Function _init_cur_user_info has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          public function _init_cur_user_info(&$obj)
          {
              $this->PROFILING && $this->_timing[] = [microtime(true), __CLASS__, __FUNCTION__, $this->trace_string(), []];
              if (MAIN_TYPE_ADMIN) {
                  $obj->USER_ID = $_GET['user_id'];
      Severity: Minor
      Found in classes/yf_main.class.php - About 45 mins 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 _index has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          public function _index($mode, $post_id, &$message, &$subject, $poster_id, $forum_id)
      Severity: Minor
      Found in plugins/search/admin_modules/yf_manage_sphinx.class.php - About 45 mins to fix

        Function edit has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            public function edit()
            {
                $ds = $this->_get_dashboard_data($_GET['id']);
                if ( ! $ds['id']) {
                    return _e('No such record');
        Severity: Minor
        Found in plugins/dashboards/admin_modules/yf_manage_dashboards.class.php - About 45 mins 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 truncate_utf8 has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            public function truncate_utf8($string, $len, $wordsafe = false, $dots = false)
            {
                if ($this->strlen($string) <= $len) {
                    return $string;
                }
        Severity: Minor
        Found in classes/yf_utf8.class.php - About 45 mins 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_error has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            public function check_error($name, $dir, $check_file, $error_reason = 'git url or command is wrong') {
                $libs_root = $this->libs_root;
                $error_reasons = [];
                if (!file_exists($check_file)) {
                    if (!is_writable($dir)) {
        Severity: Minor
        Found in services/_yf_autoloader.php - About 45 mins 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 test_dump has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            public function test_dump()
            {
                if ($this->_need_skip_test(__FUNCTION__)) {
                    return;
                }
        Severity: Minor
        Found in .dev/tests/functional/db/class_db_real_migrator_mysql.Test__off__.php - About 45 mins 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 _resize has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        function _resize($f = '', $s = '')
        {
            global $max_x, $max_y, $method;
            if (!$f || (!is_array($f) && !$s)) {
                return false;
        Severity: Minor
        Found in .dev/scripts/create_missing_small_images.php - About 45 mins 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 xml_parser_create has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            public function xml_parser_create(&$data)
            {
                // Default XML encoding
                $encoding = 'utf-8';
                $bom = false;
        Severity: Minor
        Found in classes/yf_utf8.class.php - About 45 mins 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 _cleanup_columns_info has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function _cleanup_columns_info($a)
            {
                $skip_info = ['primary', 'unique', 'type_raw', 'collate', 'row_format'];
                foreach ((array) $a as $col => $info) {
                    foreach ((array) $info as $k => $v) {
        Severity: Minor
        Found in .dev/tests/functional/db/class_db_real_utils_mysql_test.Test.php - About 45 mins 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 test_apply has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            public function test_apply()
            {
                if ($this->_need_skip_test(__FUNCTION__)) {
                    return;
                }
        Severity: Minor
        Found in .dev/tests/functional/db/class_db_real_migrator_mysql.Test__off__.php - About 45 mins 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

        Avoid deeply nested control flow statements.
        Open

                        if (is_string($tokens[$j]) && $tokens[$j] == '[') {
                            ++$openBracketsCount;
                        } elseif (is_string($tokens[$j]) && $tokens[$j] == ']') {
                            --$openBracketsCount;
                            if ($openBracketsCount == 0) {
        Severity: Major
        Found in .dev/useful/php-short-array-syntax-converter/revert.php - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                          if (is_string($tokens[$j]) && $tokens[$j] == '(') {
                              ++$openBracketsCount;
                          } elseif (is_string($tokens[$j]) && $tokens[$j] == ')') {
                              --$openBracketsCount;
          
          
          Severity: Major
          Found in .dev/useful/php-short-array-syntax-converter/convert.php - About 45 mins to fix

            Function array_set has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                function array_set(&$array, $key, $value)
                {
                    if ($key === null) {
                        return $array = $value;
                    }
            Severity: Minor
            Found in functions/yf_array_funcs.php - About 45 mins 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 _attr_class_clean has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                function _attr_class_clean($class = '')
                {
                    if ( ! strlen($class) || strpos($class, ' ') === false) {
                        return $class;
                    }
            Severity: Minor
            Found in functions/yf_common_funcs.php - About 45 mins 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