Showing 4,217 of 4,217 total issues

Method _view_widget_items has 69 lines of code (exceeds 25 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: Major
Found in plugins/common/classes/common/yf_dashboards.class.php - About 2 hrs to fix

    Function connect has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

        public function connect($params = [])
        {
            $this->_connected_ok = false;
    
            $ext_old_allowed = $this->FORCE_EXT ? in_array($this->FORCE_EXT, ['old', 'memcache']) : true;
    Severity: Minor
    Found in plugins/memcached/classes/yf_wrapper_memcached.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 _load_lang_get_vars_from_files has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

        public function _load_lang_get_vars_from_files($lang)
        {
            $files = [];
            // Auto-find shared language vars. They will be connected in order of file system
            // Names can be any, but better to include lang name into file name. Examples:
    Severity: Minor
    Found in plugins/locale/classes/yf_i18n.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 menu has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

        public function menu($data = [], $extra = [])
        {
            $extra['id'] = $extra['id'] ?: __FUNCTION__ . '_' . ++$this->_ids[__FUNCTION__];
            if ($data) {
                $data = $this->_recursive_sort_items($data);
    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 view has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

        public function view()
        {
            // check operation
            $operation = $this->_operation();
            // import options
    Severity: Minor
    Found in plugins/payment/admin_modules/yf_manage_payout.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_daily_stats has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

        public function _get_daily_stats($type = 'sum', $days = null)
        {
            $time = time();
            $days = $days ?: 60;
            $min_time = $time - $days * 86400;
    Severity: Minor
    Found in plugins/payment/admin_modules/yf_manage_payment.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_dir_contents has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

        public function _get_dir_contents($abs_dir_name)
        {
            $contents = [
                'dirs' => [],
                'files' => [],
    Severity: Minor
    Found in plugins/sys/admin_modules/yf_file_manager.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 _validate_prepare has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

        public function _validate_prepare($validate_rules = [], $extra = [])
        {
            $form_global_validate = isset($this->_params['validate']) ? $this->_params['validate'] : (isset($this->_replace['validate']) ? $this->_replace['validate'] : []);
            foreach ((array) $form_global_validate as $name => $rules) {
                $this->_validate_rules[$name] = $rules;
    Severity: Minor
    Found in plugins/form2/classes/yf_form2.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 send has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

        public function send(array $params = [], &$error_message = '')
        {
            require_php_lib('phpmailer');
    
            $mail = new PHPMailer(true); // defaults to using php 'mail()'
    Severity: Minor
    Found in plugins/email/classes/mail/yf_mail_driver_phpmailer.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 _split_by_comma has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

        public function _split_by_comma(array $items)
        {
            // Pre-split items by comma
            foreach ($items as $k => $v) {
                if (is_string($v)) {
    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 btn has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

        public function btn($name, $link, $extra = [])
        {
            if (is_array($link)) {
                $extra = $link;
                $link = '';
    Severity: Minor
    Found in plugins/table2/classes/yf_table2.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 _load_oauth_providers has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

        public function _load_oauth_providers()
        {
            $config = $this->_load_oauth_config();
            if (isset($this->_providers_loaded)) {
                return $this->_providers;
    Severity: Minor
    Found in plugins/oauth/classes/yf_oauth.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 diff_config has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

        public function diff_config($options = [])
        {
            if ( ! $options || ! is_array($options)) {
                return  null;
            }
    Severity: Minor
    Found in plugins/redis/classes/yf_wrapper_redis.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 read_file has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

        public function read_file($server_info = [], $remote_file = '', $local_file = '')
        {
            $local_file = trim($local_file);
            $remote_file = _class('ssh')->_prepare_path($remote_file);
            if ( ! _class('ssh')->_INIT_OK || ! $server_info || ! strlen($remote_file)) {
    Severity: Minor
    Found in plugins/ssh/classes/ssh/yf_ssh_files.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_paths has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

    function get_paths()
    {
        $paths = [
            'called_path' => rtrim(getcwd(), '/') . '/',
            'yf_path' => dirname(dirname(__DIR__)) . '/',
    Severity: Minor
    Found in .dev/console/yf.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 show_html has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

        public function show_html($page = 'form', $vars = [], $errors = [])
        {
            if (php_sapi_name() == 'cli' || ! $_SERVER['PHP_SELF']) {
                return print '__CONSOLE_INSTALL__' . PHP_EOL;
            }
    Severity: Minor
    Found in .dev/install/install.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

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

        public function _get_conf($name, $default = null, array $params = [])
        {
            if (isset($params[$name])) {
                return $params[$name];
            }
    plugins/queue/classes/queue/yf_queue_driver_redis.class.php on lines 12..30
    plugins/redis/classes/yf_wrapper_redlock.class.php on lines 149..167

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

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

        public function payment($options)
        {
            if ( ! $this->ENABLE) {
                return  null;
            }
    plugins/payment/classes/yf_payment_api__provider_bitcoin.class.php on lines 350..371
    plugins/payment/classes/yf_payment_api__provider_remote_test.class.php on lines 117..138

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

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

        public function payment($options)
        {
            if ( ! $this->ENABLE) {
                return  null;
            }
    plugins/payment/classes/yf_payment_api__provider_bitcoin.class.php on lines 350..371
    plugins/payment/classes/yf_payment_api__provider_bitpay.class.php on lines 549..570

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

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

        private function _get_conf($name, $default = null, array $params = [])
        {
            if (isset($params[$name])) {
                return $params[$name];
            }
    Severity: Major
    Found in plugins/redis/classes/yf_wrapper_redlock.class.php and 2 other locations - About 2 hrs to fix
    plugins/pubsub/classes/pubsub/yf_pubsub_driver_redis.class.php on lines 14..32
    plugins/queue/classes/queue/yf_queue_driver_redis.class.php on lines 12..30

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

    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