imagecms/ImageCMS

View on GitHub
application/modules/cfcm/admin.php

Summary

Maintainability
F
3 days
Test Coverage

Function create_field has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
Open

    public function create_field() {
        $form = $this->get_form('create_field');
        $form->action = $this->get_url('create_field');
        $form->title = lang('Field creating', 'cfcm');

Severity: Minor
Found in application/modules/cfcm/admin.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

File admin.php has 338 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

if (!defined('BASEPATH')) {
    exit('No direct script access allowed');
}
Severity: Minor
Found in application/modules/cfcm/admin.php - About 4 hrs to fix

Function edit_field has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

    public function edit_field($name = '') {
        $name = urldecode($name);
        $this->db->limit(1);
        $field = $this->db->get_where('content_fields', ['field_name' => (string) $name]);

Severity: Minor
Found in application/modules/cfcm/admin.php - About 3 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 edit_field has 59 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function edit_field($name = '') {
        $name = urldecode($name);
        $this->db->limit(1);
        $field = $this->db->get_where('content_fields', ['field_name' => (string) $name]);

Severity: Major
Found in application/modules/cfcm/admin.php - About 2 hrs to fix

Method create_field has 59 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function create_field() {
        $form = $this->get_form('create_field');
        $form->action = $this->get_url('create_field');
        $form->title = lang('Field creating', 'cfcm');

Severity: Major
Found in application/modules/cfcm/admin.php - About 2 hrs to fix

Function getFormFields has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    public function getFormFields($type = NULL) {
        if ($type) {

            $form = $this->load->module('cfcm/cfcm_forms')->edit_field($type);

Severity: Minor
Found in application/modules/cfcm/admin.php - About 1 hr 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 edit_group has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function edit_group($id) {
        $id = (int) $id;

        $group = $this->db->get_where('content_field_groups', ['id' => $id]);

Severity: Minor
Found in application/modules/cfcm/admin.php - About 1 hr to fix

Method edit_field_data_type has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function edit_field_data_type($field_name) {
        $form = $this->get_form('create_field');
        $form->action = $this->get_url('edit_field_data_type/' . $field_name);
        $form->title = lang('Field editing', 'cfcm');

Severity: Minor
Found in application/modules/cfcm/admin.php - About 1 hr to fix

Method create_group has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function create_group() {
        $form = $this->get_form('create_group_form');
        $form->action = $this->get_url('create_group');
        $form->title = lang('Creating a group', 'cfcm');
        $form->type = 'group';
Severity: Minor
Found in application/modules/cfcm/admin.php - About 1 hr to fix

Function create_group has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function create_group() {
        $form = $this->get_form('create_group_form');
        $form->action = $this->get_url('create_group');
        $form->title = lang('Creating a group', 'cfcm');
        $form->type = 'group';
Severity: Minor
Found in application/modules/cfcm/admin.php - About 1 hr 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_group has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function edit_group($id) {
        $id = (int) $id;

        $group = $this->db->get_where('content_field_groups', ['id' => $id]);

Severity: Minor
Found in application/modules/cfcm/admin.php - About 1 hr 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_field_data_type has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function edit_field_data_type($field_name) {
        $form = $this->get_form('create_field');
        $form->action = $this->get_url('edit_field_data_type/' . $field_name);
        $form->title = lang('Field editing', 'cfcm');

Severity: Minor
Found in application/modules/cfcm/admin.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

There are no issues that match your filters.

Category
Status