piotrpolak/pepiscms

View on GitHub

Showing 482 of 487 total issues

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

    private function toValue($obj)
    {
        if ($obj->is_serialized) {
            return json_decode($obj->value);
        } elseif ($obj->is_boolean) {
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 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 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 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 mergeLanguageTranslationPairs has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function mergeLanguageTranslationPairs($translation_file_path, $language_pairs)
    {
        // Merging existing translations with the new pairs
        if (file_exists($translation_file_path)) {
            $existing_language_pairs = $this->languagehelper->getLanguageByPath($translation_file_path);
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 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 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 getUpdatedAtFieldName has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function getUpdatedAtFieldName($available_field_names, $definition)
    {
        foreach ($available_field_names as $available_field_name) {
            if (strpos($available_field_name, 'update') !== 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 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 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 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

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

    public function _menu_item_name_check($str)
    {
        if ($this->formbuilder->getId()) {
            $item = $this->Menu_model->getById($this->formbuilder->getId(), 'item_name, parent_item_id');

Severity: Minor
Found in pepiscms/modules/pages/controllers/PagesAdmin.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