bcit-ci/CodeIgniter

View on GitHub

Showing 865 of 865 total issues

Method version has 91 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function version($target_version)
    {
        // Note: We use strings, so that timestamp versions work on 32-bit systems
        $current_version = $this->_get_version();

Severity: Major
Found in system/libraries/Migration.php - About 3 hrs to fix

    CI_Loader has 29 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class CI_Loader {
    
        // All these are set automatically. Don't mess with them.
        /**
         * Nesting level of the output buffering mechanism
    Severity: Minor
    Found in system/core/Loader.php - About 3 hrs to fix

      Method generate has 87 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function generate($table_data = NULL)
          {
              // The table data can optionally be passed to this function
              // either as a database result object or an array
              if ( ! empty($table_data))
      Severity: Major
      Found in system/libraries/Table.php - About 3 hrs to fix

        File text_helper.php has 310 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        /**
         * CodeIgniter
         *
         * An open source application development framework for PHP
        Severity: Minor
        Found in system/helpers/text_helper.php - About 3 hrs to fix

          Function parseResponse has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
          Open

              public function parseResponse($fp)
              {
                  $data = '';
          
                  while ($datum = fread($fp, 4096))
          Severity: Minor
          Found in system/libraries/Xmlrpc.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 closing_tag has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
          Open

              public function closing_tag($the_parser, $name)
              {
                  $the_parser = (string) $the_parser;
          
                  if ($this->xh[$the_parser]['isf'] > 1) return;
          Severity: Minor
          Found in system/libraries/Xmlrpc.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 load has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
          Open

              public function load($langfile, $idiom = '', $return = FALSE, $add_suffix = TRUE, $alt_path = '')
              {
                  if (is_array($langfile))
                  {
                      foreach ($langfile as $value)
          Severity: Minor
          Found in system/core/Lang.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

          Method query has 85 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function query($sql, $binds = FALSE, $return_object = NULL)
              {
                  if ($sql === '')
                  {
                      log_message('error', 'Invalid query: '.$sql);
          Severity: Major
          Found in system/database/DB_driver.php - About 3 hrs to fix

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

                public function drop_database($db_name)
                {
                    if ( ! ibase_drop_db($this->conn_id))
                    {
                        return ($this->db->db_debug) ? $this->db->display_error('db_unable_to_drop') : FALSE;
            system/database/drivers/ibase/ibase_forge.php on lines 115..131

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

            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 drop_database($db_name)
                {
                    if ( ! ibase_drop_db($this->conn_id))
                    {
                        return ($this->db->db_debug) ? $this->db->display_error('db_unable_to_drop') : FALSE;
            Severity: Major
            Found in system/database/drivers/ibase/ibase_forge.php and 1 other location - About 3 hrs to fix
            system/database/drivers/pdo/subdrivers/pdo_firebird_forge.php on lines 101..117

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

            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

            CI_Upload has 28 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class CI_Upload {
            
                /**
                 * Maximum file size
                 *
            Severity: Minor
            Found in system/libraries/Upload.php - About 3 hrs to fix

              CI_Session has 28 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class CI_Session {
              
                  /**
                   * Userdata array
                   *
              Severity: Minor
              Found in system/libraries/Session/Session.php - About 3 hrs to fix

                File Ftp.php has 305 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                <?php
                /**
                 * CodeIgniter
                 *
                 * An open source application development framework for PHP
                Severity: Minor
                Found in system/libraries/Ftp.php - About 3 hrs to fix

                  Method _backup has 83 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      protected function _backup($params = array())
                      {
                          if (count($params) === 0)
                          {
                              return FALSE;
                  Severity: Major
                  Found in system/database/drivers/mysql/mysql_utility.php - About 3 hrs to fix

                    Function db_connect has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function db_connect($persistent = FALSE)
                        {
                            // PHP 8.1 changes default error handling mode from silent to exceptions - reverse that
                            if (is_php('8.1'))
                            {
                    Severity: Minor
                    Found in system/database/drivers/mysqli/mysqli_driver.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 form_open has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                    Open

                        function form_open($action = '', $attributes = array(), $hidden = array())
                        {
                            $CI =& get_instance();
                    
                            // If no action is provided then set to the current url
                    Severity: Minor
                    Found in system/helpers/form_helper.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 _display has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function _display($output = NULL)
                        {
                            // Note:  We use load_class() because we can't use $CI =& get_instance()
                            // since this function is sometimes called by the caching mechanism,
                            // which happens before the CI super object is available.
                    Severity: Minor
                    Found in system/core/Output.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 load has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function load($file = '', $use_sections = FALSE, $fail_gracefully = FALSE)
                        {
                            $file = ($file === '') ? 'config' : str_replace('.php', '', $file);
                            $loaded = FALSE;
                    
                    
                    Severity: Minor
                    Found in system/core/Config.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 helper has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function helper($helpers = array())
                        {
                            is_array($helpers) OR $helpers = array($helpers);
                            foreach ($helpers as &$helper)
                            {
                    Severity: Minor
                    Found in system/core/Loader.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

                    Method _backup has 81 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        protected function _backup($params = array())
                        {
                            if (count($params) === 0)
                            {
                                return FALSE;
                    Severity: Major
                    Found in system/database/drivers/mysqli/mysqli_utility.php - About 3 hrs to fix
                      Severity
                      Category
                      Status
                      Source
                      Language