bcit-ci/CodeIgniter

View on GitHub

Showing 865 of 865 total issues

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

    protected function _process_column($field)
    {
        $extra_clause = isset($field['after'])
            ? ' AFTER '.$this->db->escape_identifiers($field['after']) : '';

Severity: Major
Found in system/database/drivers/pdo/subdrivers/pdo_cubrid_forge.php and 1 other location - About 5 hrs to fix
system/database/drivers/cubrid/cubrid_forge.php on lines 139..158

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

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

    protected function _process_column($field)
    {
        $extra_clause = isset($field['after'])
            ? ' AFTER '.$this->db->escape_identifiers($field['after']) : '';

Severity: Major
Found in system/database/drivers/cubrid/cubrid_forge.php and 1 other location - About 5 hrs to fix
system/database/drivers/pdo/subdrivers/pdo_cubrid_forge.php on lines 139..158

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

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

File Output.php has 394 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/Output.php - About 5 hrs to fix

    Function form_dropdown has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
    Open

        function form_dropdown($data = '', $options = array(), $selected = array(), $extra = '')
        {
            $defaults = array();
    
            if (is_array($data))
    Severity: Minor
    Found in system/helpers/form_helper.php - About 5 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 _backup has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function _backup($params = array())
        {
            if (count($params) === 0)
            {
                return FALSE;
    Severity: Minor
    Found in system/database/drivers/mysql/mysql_utility.php - About 5 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 _backup has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function _backup($params = array())
        {
            if (count($params) === 0)
            {
                return FALSE;
    Severity: Minor
    Found in system/database/drivers/mysqli/mysqli_utility.php - About 5 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 hash_pbkdf2 has a Cognitive Complexity of 35 (exceeds 5 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: Minor
    Found in system/core/compat/hash.php - About 5 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 _build_message has 126 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function _build_message()
        {
            if ($this->wordwrap === TRUE && $this->mailtype !== 'html')
            {
                $this->_body = $this->word_wrap($this->_body);
    Severity: Major
    Found in system/libraries/Email.php - About 5 hrs to fix

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

              if ($c = preg_match_all("/'[^']*'|\"[^\"]*\"/i", $sql, $matches))
              {
                  $c = preg_match_all('/'.preg_quote($this->bind_marker, '/').'/i',
                      str_replace($matches[0],
                          str_replace($this->bind_marker, str_repeat(' ', $ml), $matches[0]),
      Severity: Major
      Found in system/database/DB_driver.php and 1 other location - About 5 hrs to fix
      system/database/drivers/odbc/odbc_driver.php on lines 176..193

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

      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

              if ($c = preg_match_all("/'[^']*'|\"[^\"]*\"/i", $sql, $matches))
              {
                  $c = preg_match_all('/'.preg_quote($this->bind_marker, '/').'/i',
                      str_replace($matches[0],
                          str_replace($this->bind_marker, str_repeat(' ', $ml), $matches[0]),
      Severity: Major
      Found in system/database/drivers/odbc/odbc_driver.php and 1 other location - About 5 hrs to fix
      system/database/DB_driver.php on lines 955..972

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

      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 initialize has 123 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function initialize($props = array())
          {
              // Convert array elements into class variables
              if (count($props) > 0)
              {
      Severity: Major
      Found in system/libraries/Image_lib.php - About 4 hrs to fix

        Function version has a Cognitive Complexity of 33 (exceeds 5 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: Minor
        Found in system/libraries/Migration.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

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

                    foreach ($_POST as $key => $val)
                    {
                        is_int($key) OR $key = "'".htmlspecialchars($key, ENT_QUOTES, config_item('charset'))."'";
                        $val = (is_array($val) OR is_object($val))
                            ? '<pre>'.htmlspecialchars(print_r($val, TRUE), ENT_QUOTES, config_item('charset')).'</pre>'
        Severity: Major
        Found in system/libraries/Profiler.php and 2 other locations - About 4 hrs to fix
        system/libraries/Profiler.php on lines 316..326
        system/libraries/Profiler.php on lines 368..378

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

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

                    foreach ($_FILES as $key => $val)
                    {
                        is_int($key) OR $key = "'".htmlspecialchars($key, ENT_QUOTES, config_item('charset'))."'";
                        $val = (is_array($val) OR is_object($val))
                            ? '<pre>'.htmlspecialchars(print_r($val, TRUE), ENT_QUOTES, config_item('charset')).'</pre>'
        Severity: Major
        Found in system/libraries/Profiler.php and 2 other locations - About 4 hrs to fix
        system/libraries/Profiler.php on lines 316..326
        system/libraries/Profiler.php on lines 356..366

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

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

                    foreach ($_GET as $key => $val)
                    {
                        is_int($key) OR $key = "'".htmlspecialchars($key, ENT_QUOTES, config_item('charset'))."'";
                        $val = (is_array($val) OR is_object($val))
                            ? '<pre>'.htmlspecialchars(print_r($val, TRUE), ENT_QUOTES, config_item('charset')).'</pre>'
        Severity: Major
        Found in system/libraries/Profiler.php and 2 other locations - About 4 hrs to fix
        system/libraries/Profiler.php on lines 356..366
        system/libraries/Profiler.php on lines 368..378

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

        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 order_by($orderby, $direction = '', $escape = NULL)
            {
                $direction = strtoupper(trim($direction));
                if ($direction === 'RANDOM')
                {
        Severity: Major
        Found in system/database/drivers/pdo/subdrivers/pdo_pgsql_driver.php and 1 other location - About 4 hrs to fix
        system/database/drivers/postgre/postgre_driver.php on lines 478..501

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

        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 order_by($orderby, $direction = '', $escape = NULL)
            {
                $direction = strtoupper(trim($direction));
                if ($direction === 'RANDOM')
                {
        Severity: Major
        Found in system/database/drivers/postgre/postgre_driver.php and 1 other location - About 4 hrs to fix
        system/database/drivers/pdo/subdrivers/pdo_pgsql_driver.php on lines 196..219

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

        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 field_data()
            {
                $retval = array();
        
                for ($i = 0, $c = $this->num_fields(); $i < $c; $i++)
        Severity: Major
        Found in system/database/drivers/cubrid/cubrid_result.php and 1 other location - About 4 hrs to fix
        system/database/drivers/mysql/mysql_result.php on lines 121..134

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

        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 field_data()
            {
                $retval = array();
                for ($i = 0, $c = $this->num_fields(); $i < $c; $i++)
                {
        Severity: Major
        Found in system/database/drivers/mysql/mysql_result.php and 1 other location - About 4 hrs to fix
        system/database/drivers/cubrid/cubrid_result.php on lines 99..113

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

        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 timespan has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
        Open

            function timespan($seconds = 1, $time = '', $units = 7)
            {
                $CI =& get_instance();
                $CI->lang->load('date');
        
        
        Severity: Minor
        Found in system/helpers/date_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

        Severity
        Category
        Status
        Source
        Language