bcit-ci/CodeIgniter

View on GitHub

Showing 865 of 865 total issues

Function unmark_temp has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function unmark_temp($key)
    {
        if (empty($_SESSION['__ci_vars']))
        {
            return;
Severity: Minor
Found in system/libraries/Session/Session.php - About 25 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_realpath has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    function set_realpath($path, $check_existance = FALSE)
    {
        // Security check to make sure the path is NOT a URL. No remote file inclusion!
        if (preg_match('#^(http:\/\/|https:\/\/|www\.|ftp|php:\/\/)#i', $path) OR filter_var($path, FILTER_VALIDATE_IP) === $path)
        {
Severity: Minor
Found in system/helpers/path_helper.php - About 25 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 byte_format has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    function byte_format($num, $precision = 1)
    {
        $CI =& get_instance();
        $CI->lang->load('number');

Severity: Minor
Found in system/helpers/number_helper.php - About 25 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 random_string has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    function random_string($type = 'alnum', $len = 8)
    {
        switch ($type)
        {
            case 'basic':
Severity: Minor
Found in system/helpers/string_helper.php - About 25 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 xml_from_result has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function xml_from_result(CI_DB_result $query, $params = array())
    {
        // Set our default values
        foreach (array('root' => 'root', 'element' => 'element', 'newline' => "\n", 'tab' => "\t") as $key => $val)
        {
Severity: Minor
Found in system/database/DB_utility.php - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function drop_table($table_name, $if_exists = FALSE)
    {
        if ($table_name === '')
        {
            return ($this->db->db_debug) ? $this->db->display_error('db_table_name_required') : FALSE;
Severity: Minor
Found in system/database/DB_forge.php - About 25 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 db_connect has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function db_connect($persistent = FALSE)
    {
        empty($this->dsn) && $this->_build_dsn();
        $this->conn_id = ($persistent === TRUE)
            ? pg_pconnect($this->dsn)
Severity: Minor
Found in system/database/drivers/postgre/postgre_driver.php - About 25 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 result_object has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function result_object()
    {
        if (count($this->result_object) > 0)
        {
            return $this->result_object;
Severity: Minor
Found in system/database/DB_result.php - About 25 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 db_connect has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function db_connect($persistent = FALSE)
    {
        if ($persistent === TRUE)
        {
            $this->options[PDO::ATTR_PERSISTENT] = TRUE;
Severity: Minor
Found in system/database/drivers/pdo/pdo_driver.php - About 25 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 order_by has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function order_by($orderby, $direction = '', $escape = NULL)
    {
        $direction = strtoupper(trim($direction));
        if ($direction === 'RANDOM')
        {
Severity: Minor
Found in system/database/drivers/postgre/postgre_driver.php - About 25 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 order_by has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function order_by($orderby, $direction = '', $escape = NULL)
    {
        $direction = strtoupper(trim($direction));
        if ($direction === 'RANDOM')
        {
Severity: Minor
Found in system/database/drivers/pdo/subdrivers/pdo_pgsql_driver.php - About 25 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_exception has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function show_exception($exception)
    {
        $templates_path = config_item('error_views_path');
        if (empty($templates_path))
        {
Severity: Minor
Found in system/core/Exceptions.php - About 25 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 add_key has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function add_key($key, $primary = FALSE)
    {
        // DO NOT change this! This condition is only applicable
        // for PRIMARY keys because you can only have one such,
        // and therefore all fields you add to it will be included
Severity: Minor
Found in system/database/DB_forge.php - About 25 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 rename_table has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function rename_table($table_name, $new_table_name)
    {
        if ($table_name === '' OR $new_table_name === '')
        {
            show_error('A table name is required for that operation.');
Severity: Minor
Found in system/database/DB_forge.php - About 25 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 modify_column has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function modify_column($table, $field)
    {
        // Work-around for literal column definitions
        is_array($field) OR $field = array($field);

Severity: Minor
Found in system/database/DB_forge.php - About 25 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 result_array has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function result_array()
    {
        if (count($this->result_array) > 0)
        {
            return $this->result_array;
Severity: Minor
Found in system/database/DB_result.php - About 25 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_row has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function set_row($key, $value = NULL)
    {
        // We cache the row data for subsequent uses
        if ( ! is_array($this->row_data))
        {
Severity: Minor
Found in system/database/DB_result.php - About 25 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 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function _create_table($table, $if_not_exists, $attributes)
    {
        if ($if_not_exists === TRUE && $this->_create_table_if === FALSE)
        {
            if ($this->db->table_exists($table))
Severity: Minor
Found in system/database/DB_forge.php - About 25 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 6 (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_firebird_driver.php - About 25 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_request has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function _set_request($segments = array())
    {
        $segments = $this->_validate_request($segments);
        // If we don't have any segments left - try the default controller;
        // WARNING: Directories get shifted out of the segments array!
Severity: Minor
Found in system/core/Router.php - About 25 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

Severity
Category
Status
Source
Language