piotrpolak/pepiscms

View on GitHub

Showing 485 of 486 total issues

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

    public function update($module_name, $is_displayed_in_menu = false, $is_displayed_in_utilities = true, $parent_module_id = false)
    {
        // Reading module info
        $module_info = $this->getInfoByName($module_name);

Severity: Minor
Found in pepiscms/application/models/Module_model.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 describeSystemControllers has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function describeSystemControllers()
    {
        $controllers = array();

        $path = APPPATH . 'controllers/admin/';
Severity: Minor
Found in pepiscms/application/libraries/SecurityPolicy.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 sessionCounter has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    sessionCounter: function (sessionTimeoutUTC, serverOffsetSec) {

        var today = new Date();
        var todaySecsUTC = Math.floor(today.getTime() / 1000 + (today.getTimezoneOffset() * 60));

Severity: Minor
Found in pepiscms/js/jquery.frontend.js - 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 getAvailableThemes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function getAvailableThemes()
    {
        $theme_path = $this->config->item('theme_path');
        $dir = opendir($theme_path);

Severity: Minor
Found in pepiscms/application/models/Siteconfig_model.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 saveById has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function saveById($id, $data)
    {
        if (!$id) {
            if (!isset($data['language_code']) || !$data['language_code']) {
                $data['language_code'] = 'en';
Severity: Minor
Found in pepiscms/application/models/Menu_model.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 setMappedFilterFields has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function setMappedFilterFields($fields_array)
    {
        if (!$fields_array || count($fields_array) == 0) {
            $this->mapped_filter_fields = array();
            return true;
Severity: Minor
Found in pepiscms/application/models/Generic_model.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 resetPasswordByUserId has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function resetPasswordByUserId($user_id)
    {
        // Reading user info
        $user = $this->getById($user_id, 'user_email, display_name');
        if (!$user) {
Severity: Minor
Found in pepiscms/application/models/User_model.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 handleForeignKeys has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function handleForeignKeys()
    {
        foreach ($this->fields as &$field) {
            if ($field['foreign_key_table']) {
                if ($this->getId()) {
Severity: Minor
Found in pepiscms/application/libraries/FormBuilder.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 configure has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function configure()
    {
        $module = $this->input->getParam('module');

        $render_as_module = $this->input->getParam('render_as_module');
Severity: Minor
Found in pepiscms/application/controllers/admin/Module.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 generateForeignKeyManyToManyDoInsert has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function generateForeignKeyManyToManyDoInsert($save_id_values, $field, $where_conditions)
    {
        foreach ($save_id_values as $right_id) {
            // There is no value specified, skip the cycle
            if (!$right_id) {
Severity: Minor
Found in pepiscms/application/libraries/FormBuilder.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 niceuri has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    function niceuri($name)
    {
        //form_prep
        if (strlen($name) == 0) {
            return '';
Severity: Minor
Found in pepiscms/application/helpers/PEPISCMS_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 getOrderFieldName has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function getOrderFieldName($available_field_names, $definition)
    {
        $possible_order_field_names = array('item_order', 'position', 'pos');

        foreach ($possible_order_field_names as $possible_order_field_name) {
Severity: Minor
Found in pepiscms/modules/development/libraries/ModuleGenerator.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 edit has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function edit($display_view = true)
    {
        $id = $this->input->getParam('id');

        if ($id && !$this->isEditable()) {
Severity: Minor
Found in pepiscms/modules/crud/libraries/AdminCRUDController.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 getImageFieldNameBestMatch has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function getImageFieldNameBestMatch($available_field_names, $possible_image_field_names)
    {
        foreach ($available_field_names as $available_field_name) {
            foreach ($possible_image_field_names as $possible_image_field_name) {
                if (strpos($available_field_name, $possible_image_field_name) !== false) {
Severity: Minor
Found in pepiscms/modules/development/libraries/ModuleGenerator.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 getCompiledDescription has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function getCompiledDescription($content, $line)
    {
        if (!$this->meta_description_pattern && !$this->meta_description_pattern_callback) {
            return '';
        }
Severity: Minor
Found in pepiscms/modules/crud/libraries/AdminCRUDController.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 getCreatedAtFieldName has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function getCreatedAtFieldName($available_field_names, $definition)
    {
        foreach ($available_field_names as $available_field_name) {
            if (strpos($available_field_name, 'create') !== false) {
                // Input type check
Severity: Minor
Found in pepiscms/modules/development/libraries/ModuleGenerator.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 computeGetParamsOnFirstUse has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function computeGetParamsOnFirstUse()
    {
        if ($this->get_parameters == -1) {
            $CI = get_instance();
            $this->get_parameters = array();
Severity: Minor
Found in pepiscms/application/core/PEPISCMS_Input.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 import has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function import()
    {
        if (!$this->isImportable()) {
            show_404();
        }
Severity: Minor
Found in pepiscms/modules/crud/libraries/AdminCRUDController.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 moduleLanguage has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function moduleLanguage($module_name = false, $langfile = false, $idiom = false)
    {
        if (!$idiom) {
            if (class_exists('Dispatcher') && ($d_lang = Dispatcher::getSiteLanguage())) {
                $idiom = $d_lang->ci_language;
Severity: Minor
Found in pepiscms/application/core/PEPISCMS_Loader.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 display has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function display($view = false, $display_header = true, $display_footer = true, $return = false)
    {
        $this->benchmark->mark('display_start');

        if ($this->already_displayed) {
Severity: Minor
Found in pepiscms/application/classes/ModuleController.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