Showing 4,217 of 4,217 total issues

Function _load_tables_sql_php_from_files has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function _load_tables_sql_php_from_files($params = [])
    {
        $existing_files_sql_php = [];
        $existing_sql_php = [];
        // Preload db installer PHP array of CREATE TABLE DDL statements
Severity: Minor
Found in plugins/db/classes/db/yf_db_migrator.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 _render_table_td has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function _render_table_td($info, $row, $params, $row_id)
    {
        $name = $info['name'];
        if ( ! array_key_exists($name, $row)) {
            return false;
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 add_get_vars has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function add_get_vars($add_skip = [])
    {
        // Cache it
        if (isset($this->_get_vars_cache)) {
            return $this->_get_vars_cache;
Severity: Minor
Found in plugins/common/classes/yf_common.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 edit has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function edit()
    {
        if (is_post() && isset($_POST['mass_delete']) && $_POST['id']) {
            $_GET['action'] = 'delete';
            return $this->delete();
Severity: Minor
Found in plugins/redis/admin_modules/yf_manage_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 exec has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function exec($server_info = [], $cmd = '')
    {
        if ( ! $this->_INIT_OK || ! $cmd || ! $server_info) {
            return false;
        }
Severity: Minor
Found in plugins/ssh/classes/yf_ssh.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 move_dir has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function move_dir($path1, $path2, $pattern_include = '', $pattern_exclude = '')
    {
        if ( ! $path1 || ! file_exists($path1)) {
            return false;
        }
Severity: Minor
Found in classes/yf_dir.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 _debug_DEBUG_YF has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function _debug_DEBUG_YF(&$params = [])
    {
        if ( ! $this->SHOW_SETTINGS) {
            return '';
        }
Severity: Minor
Found in classes/yf_debug.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 _account_info has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function _account_info($account_id)
    {
        $cached_account_info = &main()->_cached_account_info;
        if (is_numeric($account_id)) {
            $account_id = (int) $account_id;
Severity: Minor
Found in classes/yf_utils.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 execute has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        global $yf_paths;
        require_once $yf_paths['db_setup_path'];
        init_yf();
Severity: Minor
Found in .dev/console/commands/yf_console_db_utils.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 require_php_lib has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function require_php_lib($name, $params = [])
    {
        if (isset($this->php_libs[$name])) {
            return $this->php_libs[$name];
        }
Severity: Minor
Found in classes/yf_services.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 payin has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        payin: function( options ) {
            var $this = this;
            $scope.block_wait     = true;
            $scope.is_submitted   = true;
            $scope.status         = false;
Severity: Major
Found in plugins/content/templates/user/js/ng/payment/balance-recharge.js - About 2 hrs to fix

    Method load__nbu_html has 52 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function load__nbu_html($options = null)
        {
            // import options
            is_array($options) && extract($options, EXTR_PREFIX_ALL | EXTR_REFS, '');
            // var
    Severity: Major
    Found in plugins/payment/classes/yf_payment_api__currency.class.php - About 2 hrs to fix

      Method load__nbu has 52 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function load__nbu($options = null)
          {
              // import options
              is_array($options) && extract($options, EXTR_PREFIX_ALL | EXTR_REFS, '');
              // var
      Severity: Major
      Found in plugins/payment/classes/yf_payment_api__currency.class.php - About 2 hrs to fix

        Method compare has 52 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function compare($params = [])
            {
                $installer = $this->db->installer();
                $utils = $this->db->utils();
                $db_prefix = $this->db->DB_PREFIX;
        Severity: Major
        Found in plugins/db/classes/db/yf_db_migrator.class.php - About 2 hrs to fix

          Method having has 52 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function having()
              {
                  $sql = '';
                  $where = func_get_args();
                  if ( ! count((array) $where)) {
          Severity: Major
          Found in plugins/db/classes/db/yf_db_query_builder_driver.class.php - About 2 hrs to fix

            Method go has 52 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function go()
                {
                    if ( ! $this->allow()) {
                        return false;
                    }
            Severity: Major
            Found in plugins/logs/classes/logs/yf_logs_exec_user.class.php - About 2 hrs to fix

              Method save_locale_var has 52 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function save_locale_var()
                  {
                      no_graphics(true);
                      if ( ! DEBUG_MODE && ! $_SESSION['locale_vars_edit']) {
                          return print 'Access denied';
              Severity: Major
              Found in plugins/dynamic/modules/dynamic/yf_dynamic_edit.class.php - About 2 hrs to fix

                Method _show_auto_table has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function _show_auto_table($items = [], $params = [], $name = '')
                    {
                        if ( ! is_array($items)) {
                            $items = [];
                        }
                Severity: Major
                Found in classes/yf_debug.class.php - About 2 hrs to fix

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

                          foreach (_class('encryption')->_avail_ciphers as $cipher) {
                              $encrypted = _class('encryption')->_safe_encrypt_with_base64(self::$to_encode, self::$secret, $cipher);
                              $this->assertRegexp('/^[a-z0-9\=+\*\|]+$/i', $encrypted);
                              $this->assertNotEquals($prev_encrypted, $encrypted);
                              $prev_encrypted = $encrypted;
                  Severity: Major
                  Found in .dev/tests/unit/class_encryption_test.php and 1 other location - About 2 hrs to fix
                  .dev/tests/unit/class_encryption_test.php on lines 155..163

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

                  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

                      public function test_complex_foreach2()
                      {
                          $data = [
                              'test_array' => [
                                  'One' => ['name' => 'First'],
                  Severity: Major
                  Found in .dev/tests/unit/tpl/tpl_driver_yf_foreach_test.Test.php and 1 other location - About 2 hrs to fix
                  .dev/tests/unit/tpl/tpl_driver_yf_core_test.Test.php on lines 313..327

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

                  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