bcit-ci/CodeIgniter

View on GitHub

Showing 865 of 865 total issues

Function DB has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
Open

function &DB($params = '')
{
    // Load the DB config file if a DSN string wasn't passed
    if (is_string($params) && strpos($params, '://') === FALSE)
    {
Severity: Minor
Found in system/database/DB.php - About 6 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 create_links has 168 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function create_links()
    {
        // If our item count or per-page total is zero there is no need to continue.
        // Note: DO NOT change the operator to === here!
        if ($this->total_rows == 0 OR $this->per_page == 0)
Severity: Major
Found in system/libraries/Pagination.php - About 6 hrs to fix

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

        protected function _alter_table($alter_type, $table, $field)
        {
            if (in_array($alter_type, array('DROP', 'ADD'), TRUE))
            {
                return parent::_alter_table($alter_type, $table, $field);
    Severity: Major
    Found in system/database/drivers/cubrid/cubrid_forge.php and 1 other location - About 6 hrs to fix
    system/database/drivers/pdo/subdrivers/pdo_cubrid_forge.php on lines 106..129

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

    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 _alter_table($alter_type, $table, $field)
        {
            if (in_array($alter_type, array('DROP', 'ADD'), TRUE))
            {
                return parent::_alter_table($alter_type, $table, $field);
    Severity: Major
    Found in system/database/drivers/pdo/subdrivers/pdo_cubrid_forge.php and 1 other location - About 6 hrs to fix
    system/database/drivers/cubrid/cubrid_forge.php on lines 106..129

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

    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 generate has a Cognitive Complexity of 43 (exceeds 5 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: Minor
    Found in system/libraries/Table.php - About 6 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 41 (exceeds 5 allowed). Consider refactoring.
    Open

        public function initialize($props = array())
        {
            // Convert array elements into class variables
            if (count($props) > 0)
            {
    Severity: Minor
    Found in system/libraries/Image_lib.php - About 6 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 do_upload has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
    Open

        public function do_upload($field = 'userfile')
        {
            // Is $_FILES[$field] set? If not, no reason to continue.
            if (isset($_FILES[$field]))
            {
    Severity: Minor
    Found in system/libraries/Upload.php - About 6 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 2 locations. Consider refactoring.
    Open

    if ( ! function_exists('set_radio'))
    {
        /**
         * Set Radio
         *
    Severity: Major
    Found in system/helpers/form_helper.php and 1 other location - About 6 hrs to fix
    system/helpers/form_helper.php on lines 755..803

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

    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

    if ( ! function_exists('set_checkbox'))
    {
        /**
         * Set Checkbox
         *
    Severity: Major
    Found in system/helpers/form_helper.php and 1 other location - About 6 hrs to fix
    system/helpers/form_helper.php on lines 807..855

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

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

        protected function _execute($row, $rules, $postdata = NULL, $cycles = 0)
        {
            $allow_arrays = in_array('is_array', $rules, TRUE);
    
            // If the $_POST data is an array we will run a recursive call
    Severity: Major
    Found in system/libraries/Form_validation.php - About 6 hrs to fix

      Function _file_mime_type has a Cognitive Complexity of 39 (exceeds 5 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: Minor
      Found in system/libraries/Upload.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 safe_mailto has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
      Open

          function safe_mailto($email, $title = '', $attributes = '')
          {
              $title = (string) $title;
      
              if ($title === '')
      Severity: Minor
      Found in system/helpers/url_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

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

          public function drop_database($db_name)
          {
              // In SQLite, a database is dropped when we delete a file
              if (file_exists($this->db->database))
              {
      Severity: Major
      Found in system/database/drivers/pdo/subdrivers/pdo_sqlite_forge.php and 1 other location - About 5 hrs to fix
      system/database/drivers/sqlite3/sqlite3_forge.php on lines 106..130

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

      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 decode_message($param)
          {
              $kind = $param->kindOf();
      
              if ($kind === 'scalar')
      Severity: Major
      Found in system/libraries/Xmlrpc.php and 1 other location - About 5 hrs to fix
      system/libraries/Xmlrpc.php on lines 970..1002

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

      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 xmlrpc_decoder($xmlrpc_val)
          {
              $kind = $xmlrpc_val->kindOf();
      
              if ($kind === 'scalar')
      Severity: Major
      Found in system/libraries/Xmlrpc.php and 1 other location - About 5 hrs to fix
      system/libraries/Xmlrpc.php on lines 1609..1642

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

      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)
          {
              // In SQLite, a database is dropped when we delete a file
              if (file_exists($this->db->database))
              {
      Severity: Major
      Found in system/database/drivers/sqlite3/sqlite3_forge.php and 1 other location - About 5 hrs to fix
      system/database/drivers/pdo/subdrivers/pdo_sqlite_forge.php on lines 120..144

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

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

          function password_hash($password, $algo, array $options = array())
          {
              static $func_overload;
              isset($func_overload) OR $func_overload = (extension_loaded('mbstring') && ini_get('mbstring.func_overload'));
      
      
      Severity: Minor
      Found in system/core/compat/password.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 model has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
      Open

          public function model($model, $name = '', $db_conn = FALSE)
          {
              if (empty($model))
              {
                  return $this;
      Severity: Minor
      Found in system/core/Loader.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 force_download has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
      Open

          function force_download($filename = '', $data = '', $set_mime = FALSE)
          {
              if ($filename === '' OR $data === '')
              {
                  return;
      Severity: Minor
      Found in system/helpers/download_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

      Method do_upload has 138 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function do_upload($field = 'userfile')
          {
              // Is $_FILES[$field] set? If not, no reason to continue.
              if (isset($_FILES[$field]))
              {
      Severity: Major
      Found in system/libraries/Upload.php - About 5 hrs to fix
        Severity
        Category
        Status
        Source
        Language