bcit-ci/CodeIgniter

View on GitHub

Showing 728 of 865 total issues

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

    function _parse_form_attributes($attributes, $default)
    {
        if (is_array($attributes))
        {
            foreach ($default as $key => $val)
Severity: Minor
Found in system/helpers/form_helper.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 _run_hook has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    protected function _run_hook($data)
    {
        // Closures/lambda functions and array($object, 'method') callables
        if (is_callable($data))
        {
Severity: Minor
Found in system/core/Hooks.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

File DB_result.php has 281 lines of code (exceeds 250 allowed). Consider refactoring.
Open

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

    Method _file_mime_type has 68 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function _file_mime_type($file)
        {
            // We'll need this to validate the MIME info string (e.g. text/plain; charset=us-ascii)
            $regexp = '/^([a-z\-]+\/[a-z0-9\-\.\+]+)(;\s.+)?$/';
    
    
    Severity: Major
    Found in system/libraries/Upload.php - About 2 hrs to fix

      Method overlay_watermark has 67 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function overlay_watermark()
          {
              if ( ! function_exists('imagecolortransparent'))
              {
                  $this->set_error('imglib_gd_required');
      Severity: Major
      Found in system/libraries/Image_lib.php - About 2 hrs to fix

        Method _run_hook has 67 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function _run_hook($data)
            {
                // Closures/lambda functions and array($object, 'method') callables
                if (is_callable($data))
                {
        Severity: Major
        Found in system/core/Hooks.php - About 2 hrs to fix

          Method _write_cache has 66 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function _write_cache($output)
              {
                  $CI =& get_instance();
                  $path = $CI->config->item('cache_path');
                  $cache_path = ($path === '') ? APPPATH.'cache'.DIRECTORY_SEPARATOR : rtrim($path, '/\\').DIRECTORY_SEPARATOR;
          Severity: Major
          Found in system/core/Output.php - About 2 hrs to fix

            Function initialize has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
            Open

                public function initialize()
                {
                    /* If an established connection is available, then there's
                     * no need to connect and select the database.
                     *
            Severity: Minor
            Found in system/database/DB_driver.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 ascii_to_entities has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
            Open

                function ascii_to_entities($str)
                {
                    $out = '';
                    $length = defined('MB_OVERLOAD_STRING')
                        ? mb_strlen($str, '8bit') - 1
            Severity: Minor
            Found in system/helpers/text_helper.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 set_cookie has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
            Open

                public function set_cookie($name, $value = '', $expire = 0, $domain = '', $path = '/', $prefix = '', $secure = NULL, $httponly = NULL, $samesite = NULL)
                {
                    if (is_array($name))
                    {
                        // always leave 'name' in last place, as the loop will break otherwise, due to $$item
            Severity: Minor
            Found in system/core/Input.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_class has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
            Open

                function &load_class($class, $directory = 'libraries', $param = NULL)
                {
                    static $_classes = array();
            
                    // Does the class exist? If so, we're done...
            Severity: Minor
            Found in system/core/Common.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

            Method image_process_netpbm has 64 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function image_process_netpbm($action = 'resize')
                {
                    if ($this->library_path === '')
                    {
                        $this->set_error('imglib_libpath_invalid');
            Severity: Major
            Found in system/libraries/Image_lib.php - About 2 hrs to fix

              Method _get_params has 64 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function _get_params($params)
                  {
                      if (empty($params))
                      {
                          return isset($this->_cipher, $this->_mode, $this->_key, $this->_handle)
              Severity: Major
              Found in system/libraries/Encryption.php - About 2 hrs to fix

                File Pagination.php has 273 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/Pagination.php - About 2 hrs to fix

                  Method _execute has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      protected function _execute($m)
                      {
                          $methName = $m->method_name;
                  
                          // Check to see if it is a system call
                  Severity: Major
                  Found in system/libraries/Xmlrpcs.php - About 2 hrs to fix

                    Method form_dropdown has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        function form_dropdown($data = '', $options = array(), $selected = array(), $extra = '')
                        {
                            $defaults = array();
                    
                            if (is_array($data))
                    Severity: Major
                    Found in system/helpers/form_helper.php - About 2 hrs to fix

                      Method timespan has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          function timespan($seconds = 1, $time = '', $units = 7)
                          {
                              $CI =& get_instance();
                              $CI->lang->load('date');
                      
                      
                      Severity: Major
                      Found in system/helpers/date_helper.php - About 2 hrs to fix

                        Method _ci_init_library has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            protected function _ci_init_library($class, $prefix, $config = FALSE, $object_name = NULL)
                            {
                                // Is there an associated config file for this class? Note: these should always be lowercase
                                if ($config === NULL)
                                {
                        Severity: Major
                        Found in system/core/Loader.php - About 2 hrs to fix

                          CI_DB_result has 23 functions (exceeds 20 allowed). Consider refactoring.
                          Open

                          class CI_DB_result {
                          
                              /**
                               * Connection ID
                               *
                          Severity: Minor
                          Found in system/database/DB_result.php - About 2 hrs to fix

                            CI_DB_postgre_driver has 23 functions (exceeds 20 allowed). Consider refactoring.
                            Open

                            class CI_DB_postgre_driver extends CI_DB {
                            
                                /**
                                 * Database driver
                                 *
                            Severity: Minor
                            Found in system/database/drivers/postgre/postgre_driver.php - About 2 hrs to fix
                              Severity
                              Category
                              Status
                              Source
                              Language