bcit-ci/CodeIgniter

View on GitHub

Showing 728 of 865 total issues

Function _write_cache has a Cognitive Complexity of 16 (exceeds 5 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: Minor
Found in system/core/Output.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 _fetch_from_array has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    protected function _fetch_from_array(&$array, $index = NULL, $xss_clean = FALSE)
    {
        // If $index is NULL, it means that the whole $array is requested
        isset($index) OR $index = array_keys($array);

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

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

    public function word_wrap($str, $charlim = NULL)
    {
        // Set the character limit, if not already present
        if (empty($charlim))
        {
Severity: Major
Found in system/libraries/Email.php - About 2 hrs to fix

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

        protected function _sanitize_naughty_html($matches)
        {
            static $naughty_tags    = array(
                'alert', 'area', 'prompt', 'confirm', 'applet', 'audio', 'basefont', 'base', 'behavior', 'bgsound',
                'blink', 'body', 'embed', 'expression', 'form', 'frameset', 'frame', 'head', 'html', 'ilayer',
    Severity: Major
    Found in system/core/Security.php - About 2 hrs to fix

      File oci8_driver.php has 253 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/drivers/oci8/oci8_driver.php - About 2 hrs to fix

        Method image_mirror_gd has 51 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function image_mirror_gd()
            {
                if ( ! $src_img = $this->image_create_gd())
                {
                    return FALSE;
        Severity: Major
        Found in system/libraries/Image_lib.php - About 2 hrs to fix

          Method _prep_quoted_printable has 51 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function _prep_quoted_printable($str)
              {
                  // ASCII code numbers for "safe" characters that can always be
                  // used literally, without encoding, as described in RFC 2049.
                  // https://www.ietf.org/rfc/rfc2049.txt
          Severity: Major
          Found in system/libraries/Email.php - About 2 hrs to fix

            Method word_wrap has 51 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function word_wrap($str, $charlim = 76)
                {
                    // Set the character limit
                    is_numeric($charlim) OR $charlim = 76;
            
            
            Severity: Major
            Found in system/helpers/text_helper.php - About 2 hrs to fix

              Method write_log has 51 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function write_log($level, $msg)
                  {
                      if ($this->_enabled === FALSE)
                      {
                          return FALSE;
              Severity: Major
              Found in system/core/Log.php - About 2 hrs to fix

                Method _ci_load_library has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    protected function _ci_load_library($class, $params = NULL, $object_name = NULL)
                    {
                        // Get the class name, and while we're at it trim any slashes.
                        // The directory path can be included as part of the class name,
                        // but we don't want a leading slash
                Severity: Major
                Found in system/core/Loader.php - About 2 hrs to fix

                  Method _ci_autoloader has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      protected function _ci_autoloader()
                      {
                          if (file_exists(APPPATH.'config/autoload.php'))
                          {
                              include(APPPATH.'config/autoload.php');
                  Severity: Minor
                  Found in system/core/Loader.php - About 2 hrs to fix

                    Method helper has 49 lines of code (exceeds 25 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 1 hr to fix

                      Method load has 49 lines of code (exceeds 25 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 1 hr to fix

                        Method __construct has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function __construct(&$params)
                            {
                                parent::__construct($params);
                        
                                // Detect the names of some methods in phpRedis instance
                        Severity: Minor
                        Found in system/libraries/Session/drivers/Session_redis_driver.php - About 1 hr to fix

                          Method write has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function write($session_id, $session_data)
                              {
                                  // Prevent previous QB calls from messing with our queries
                                  $this->_db->reset_query();
                          
                          
                          Severity: Minor
                          Found in system/libraries/Session/drivers/Session_database_driver.php - About 1 hr to fix

                            Method link_tag has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                function link_tag($href = '', $rel = 'stylesheet', $type = 'text/css', $title = '', $media = '', $index_page = FALSE)
                                {
                                    $CI =& get_instance();
                                    $link = '<link ';
                            
                            
                            Severity: Minor
                            Found in system/helpers/html_helper.php - About 1 hr to fix

                              Method __construct has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public function __construct($params)
                                  {
                                      parent::__construct($params);
                              
                                      $valid_dsns = array(
                              Severity: Minor
                              Found in system/database/drivers/oci8/oci8_driver.php - About 1 hr to fix

                                Function image_mirror_gd has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    public function image_mirror_gd()
                                    {
                                        if ( ! $src_img = $this->image_create_gd())
                                        {
                                            return FALSE;
                                Severity: Minor
                                Found in system/libraries/Image_lib.php - About 1 hr 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 image_process_gd has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    public function image_process_gd($action = 'resize')
                                    {
                                        $v2_override = FALSE;
                                
                                        // If the target width/height match the source, AND if the new file name is not equal to the old file name
                                Severity: Minor
                                Found in system/libraries/Image_lib.php - About 1 hr 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_with_smtp has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    protected function _send_with_smtp()
                                    {
                                        if ($this->smtp_host === '')
                                        {
                                            $this->_set_error_message('lang:email_no_hostname');
                                Severity: Minor
                                Found in system/libraries/Email.php - About 1 hr 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