bcit-ci/CodeIgniter

View on GitHub

Showing 865 of 865 total issues

Function drop_database has a Cognitive Complexity of 7 (exceeds 5 allowed). 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: Minor
Found in system/database/drivers/sqlite3/sqlite3_forge.php - About 35 mins 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 drop_database has a Cognitive Complexity of 7 (exceeds 5 allowed). 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: Minor
Found in system/database/drivers/pdo/subdrivers/pdo_sqlite_forge.php - About 35 mins 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 _update_batch has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function _update_batch($table, $values, $index)
    {
        $ids = array();
        foreach ($values as $key => $val)
        {
Severity: Minor
Found in system/database/drivers/postgre/postgre_driver.php - About 35 mins 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 __construct has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function __construct()
    {
        $config =& get_config();

        isset(self::$func_overload) OR self::$func_overload = ( ! is_php('8.0') && extension_loaded('mbstring') && @ini_get('mbstring.func_overload'));
Severity: Minor
Found in system/core/Log.php - About 35 mins 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 _drop_table has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function _drop_table($table, $if_exists)
    {
        $sql = 'DROP TABLE';

        if ($if_exists)
Severity: Minor
Found in system/database/DB_forge.php - About 35 mins 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 _create_table_attr has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function _create_table_attr($attributes)
    {
        $sql = '';

        foreach (array_keys($attributes) as $key)
Severity: Minor
Found in system/database/drivers/pdo/subdrivers/pdo_mysql_forge.php - About 35 mins 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 __construct has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function __construct($params)
    {
        parent::__construct($params);

        if (empty($this->dsn))
Severity: Minor
Found in system/database/drivers/pdo/subdrivers/pdo_oci_driver.php - About 35 mins 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 _update_batch has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function _update_batch($table, $values, $index)
    {
        $ids = array();
        foreach ($values as $key => $val)
        {
Severity: Minor
Found in system/database/drivers/pdo/subdrivers/pdo_pgsql_driver.php - About 35 mins 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 insert_id has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function insert_id()
    {
        $v = $this->version();

        $table    = (func_num_args() > 0) ? func_get_arg(0) : NULL;
Severity: Minor
Found in system/database/drivers/postgre/postgre_driver.php - About 35 mins 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 _create_table_attr has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function _create_table_attr($attributes)
    {
        $sql = '';

        foreach (array_keys($attributes) as $key)
Severity: Minor
Found in system/database/drivers/mysql/mysql_forge.php - About 35 mins 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 __construct has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function __construct($params)
    {
        parent::__construct($params);

        if (empty($this->dsn))
Severity: Minor
Found in system/database/drivers/pdo/subdrivers/pdo_dblib_driver.php - About 35 mins 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 show_php_error has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function show_php_error($severity, $message, $filepath, $line)
    {
        $templates_path = config_item('error_views_path');
        if (empty($templates_path))
        {
Severity: Minor
Found in system/core/Exceptions.php - About 35 mins 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_content_type has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function set_content_type($mime_type, $charset = NULL)
    {
        if (strpos($mime_type, '/') === FALSE)
        {
            $extension = ltrim($mime_type, '.');
Severity: Minor
Found in system/core/Output.php - About 35 mins 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 entity_decode has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function entity_decode($str, $charset = NULL)
    {
        if (strpos($str, '&') === FALSE)
        {
            return $str;
Severity: Minor
Found in system/core/Security.php - About 35 mins 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 __construct has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function __construct(CI_Config $config)
    {
        $this->config = $config;

        // If it's a CLI request, ignore the configuration
Severity: Minor
Found in system/core/URI.php - About 35 mins 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

    public function field_data($table)
    {
        $sql = 'SELECT "syscolumns"."colname" AS "name",
                CASE "syscolumns"."coltype"
                    WHEN 0 THEN \'CHAR\'
Severity: Minor
Found in system/database/drivers/pdo/subdrivers/pdo_informix_driver.php and 1 other location - About 30 mins to fix
system/database/drivers/pdo/subdrivers/pdo_ibm_driver.php on lines 178..190

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

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 field_data($table)
    {
        $sql = 'SELECT "colname" AS "name", "typename" AS "type", "default" AS "default", "length" AS "max_length",
                CASE "keyseq" WHEN NULL THEN 0 ELSE 1 END AS "primary_key"
            FROM "syscat"."columns"
Severity: Minor
Found in system/database/drivers/pdo/subdrivers/pdo_ibm_driver.php and 1 other location - About 30 mins to fix
system/database/drivers/pdo/subdrivers/pdo_informix_driver.php on lines 191..240

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

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

Avoid too many return statements within this method.
Open

                return FALSE;
Severity: Major
Found in system/libraries/Image_lib.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

            return call_user_func($this->methods[$methName]['function'], $m);
    Severity: Major
    Found in system/libraries/Xmlrpcs.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                  return $this->multicall_error('noparams');
      Severity: Major
      Found in system/libraries/Xmlrpcs.php - About 30 mins to fix
        Severity
        Category
        Status
        Source
        Language