bcit-ci/CodeIgniter

View on GitHub

Showing 865 of 865 total issues

File date_helper.php has 356 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/date_helper.php - About 4 hrs to fix

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

        public function set_radio($field = '', $value = '', $default = FALSE)
        {
            if ( ! isset($this->_field_data[$field], $this->_field_data[$field]['postdata']))
            {
                return ($default === TRUE && count($this->_field_data) === 0) ? ' checked="checked"' : '';
    Severity: Major
    Found in system/libraries/Form_validation.php and 1 other location - About 4 hrs to fix
    system/libraries/Form_validation.php on lines 957..985

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

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

        public function set_select($field = '', $value = '', $default = FALSE)
        {
            if ( ! isset($this->_field_data[$field], $this->_field_data[$field]['postdata']))
            {
                return ($default === TRUE && count($this->_field_data) === 0) ? ' selected="selected"' : '';
    Severity: Major
    Found in system/libraries/Form_validation.php and 1 other location - About 4 hrs to fix
    system/libraries/Form_validation.php on lines 1000..1028

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

    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

    Method hash_pbkdf2 has 112 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function hash_pbkdf2($algo, $password, $salt, $iterations, $length = 0, $raw_output = FALSE)
        {
            if ( ! in_array(strtolower($algo), hash_algos(), TRUE))
            {
                trigger_error('hash_pbkdf2(): Unknown hashing algorithm: '.$algo, E_USER_WARNING);
    Severity: Major
    Found in system/core/compat/hash.php - About 4 hrs to fix

      File Input.php has 353 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

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

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

            public function __construct($params)
            {
                parent::__construct($params);
        
                if (empty($this->dsn))
        Severity: Major
        Found in system/database/drivers/pdo/subdrivers/pdo_4d_driver.php and 1 other location - About 4 hrs to fix
        system/database/drivers/pdo/subdrivers/pdo_mysql_driver.php on lines 98..114

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

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

            public function __construct($params)
            {
                parent::__construct($params);
        
                if (empty($this->dsn))
        Severity: Major
        Found in system/database/drivers/pdo/subdrivers/pdo_mysql_driver.php and 1 other location - About 4 hrs to fix
        system/database/drivers/pdo/subdrivers/pdo_4d_driver.php on lines 80..96

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

        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

        Function _compile_queries has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function _compile_queries()
            {
                $dbs = array();
        
                // Let's determine which databases are currently connected to
        Severity: Minor
        Found in system/libraries/Profiler.php - About 4 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 word_wrap has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
        Open

            function word_wrap($str, $charlim = 76)
            {
                // Set the character limit
                is_numeric($charlim) OR $charlim = 76;
        
        
        Severity: Minor
        Found in system/helpers/text_helper.php - About 4 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 generate has 109 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function generate($year = '', $month = '', $data = array())
            {
                $local_time = time();
        
                // Set and validate the supplied month/year
        Severity: Major
        Found in system/libraries/Calendar.php - About 4 hrs to fix

          Function query has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
          Open

              public function query($sql, $binds = FALSE, $return_object = NULL)
              {
                  if ($sql === '')
                  {
                      log_message('error', 'Invalid query: '.$sql);
          Severity: Minor
          Found in system/database/DB_driver.php - About 4 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 link_tag has a Cognitive Complexity of 29 (exceeds 5 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 4 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 text_watermark has 106 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

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

            Method protect_identifiers has 106 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function protect_identifiers($item, $prefix_single = FALSE, $protect_identifiers = NULL, $field_exists = TRUE)
                {
                    if ( ! is_bool($protect_identifiers))
                    {
                        $protect_identifiers = $this->_protect_identifiers;
            Severity: Major
            Found in system/database/DB_driver.php - About 4 hrs to fix

              Function generate has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function generate($year = '', $month = '', $data = array())
                  {
                      $local_time = time();
              
                      // Set and validate the supplied month/year
              Severity: Minor
              Found in system/libraries/Calendar.php - About 4 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 auto_typography has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function auto_typography($str, $reduce_linebreaks = FALSE)
                  {
                      if ($str === '')
                      {
                          return '';
              Severity: Minor
              Found in system/libraries/Typography.php - About 4 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 initialize has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function initialize(array $config = array(), $reset = TRUE)
                  {
                      $reflection = new ReflectionClass($this);
              
                      if ($reset === TRUE)
              Severity: Minor
              Found in system/libraries/Upload.php - About 4 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_driver has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function load_driver($child)
                  {
                      // Get CodeIgniter instance and subclass prefix
                      $prefix = config_item('subclass_prefix');
              
              
              Severity: Minor
              Found in system/libraries/Driver.php - About 4 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 array_column has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
              Open

                  function array_column(array $array, $column_key, $index_key = NULL)
                  {
                      if ( ! in_array($type = gettype($column_key), array('integer', 'string', 'NULL'), TRUE))
                      {
                          if ($type === 'double')
              Severity: Minor
              Found in system/core/compat/standard.php - About 4 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 _ci_init_library has a Cognitive Complexity of 28 (exceeds 5 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: Minor
              Found in system/core/Loader.php - About 4 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

              Severity
              Category
              Status
              Source
              Language