imagecms/ImageCMS

View on GitHub

Showing 1,388 of 1,858 total issues

Consider simplifying this complex logical expression.
Open

        if (($this->agent->browser() === 'Firefox' && $this->agent->version() < 16.0) || $this->agent->browser() === 'IE' || ($this->agent->browser() === 'Chrome' && $this->agent->version() < 17) || ($this->agent->browser() === 'Opera' && $this->agent->version() < 12.11)) {
            $this->template->display('old_browser');
        } else {
            $this->do_login();
        }
Severity: Major
Found in application/modules/admin/login.php - About 1 hr to fix

Function createBackup has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function createBackup($ext, $prefix = NULL, $fullName = FALSE, $params = []) {
        if (is_really_writable($this->directory)) {
            if ($prefix == null) {
                $prefix = 'sql';
            }
Severity: Minor
Found in application/libraries/Backup.php - About 55 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 renderPopup has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

function renderPopup(varId, wlBtn) {
    if (!$('#' + varId).hasClass('inWL')) {
        var popupTemplate = '';
        $.ajax(
            {
Severity: Minor
Found in application/modules/wishlist/assets/js/wishlist.js - About 55 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 privilegeCreate has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function privilegeCreate() {

        if ($this->input->post()) {

            $this->form_validation->set_rules('Name', 'Name', 'required');
Severity: Minor
Found in application/libraries/Permitions.php - About 55 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 unsorted has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function unsorted() {
        if ($this->unsorted != FALSE) {
            return $this->unsorted_arr;
        }

Severity: Minor
Found in application/libraries/lib_category.php - About 55 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 getOnline has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function getOnline() {
        $locale = MY_Controller::getCurrentLocale();
        $query = "
            SELECT 
                `mod_stats_attendance`.`id_user`,
Severity: Minor
Found in application/modules/mod_stats/models/attendance_model.php - About 55 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 getAbbreviation has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    protected function getAbbreviation($field = NULL) {
        $abbreviationsArray = [
                               'name'    => '`shop_products_i18n`.`name` as product_name', //
                               'url'     => '`route`.`url` as url', //
                               'oldprc'  => 'old_price', //
Severity: Minor
Found in application/modules/import_export/classes/Export.php - About 55 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 recent_comments_configure has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function recent_comments_configure($action = 'show_settings', array $widget_data = []) {
        if ($this->dx_auth->is_admin() == FALSE) {
            exit; // Only admin access
        }
        switch ($action) {
Severity: Minor
Found in application/modules/comments/comments_widgets.php - About 55 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 change_password has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function change_password() {
        $this->load->library('Form_validation');

        // Check if user logged in or not
        if ($this->dx_auth->is_logged_in()) {
Severity: Minor
Found in application/modules/auth/auth.php - About 55 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 prepareDataForStaticChart has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public static function prepareDataForStaticChart($array = null) {
        $chartData = [];
        foreach ($array as $item) {
            // Make for all keys the same length
            if (mb_strlen($item['name']) > 35) {
Severity: Minor
Found in application/modules/mod_stats/classes/ControllerBase.php - About 55 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 reset_password has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function reset_password() {

        if ($this->dx_auth->is_logged_in()) {
            redirect(site_url('/'));
        }
Severity: Minor
Found in application/modules/auth/auth.php - About 55 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 recent_product_comments_configure has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function recent_product_comments_configure($action = 'show_settings', array $widget_data = []) {
        if ($this->dx_auth->is_admin() == FALSE) {
            exit; // Only admin access
        }
        switch ($action) {
Severity: Minor
Found in application/modules/comments/comments_widgets.php - About 55 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 getExport has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function getExport() {
        $postData = $this->input->post();
        $export = new Export(
            [
             'attributes'   => $postData['attribute'],
Severity: Minor
Found in application/modules/import_export/admin.php - About 55 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 change_password has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function change_password() {
        /** Preprate Variables */
        $jsonResponse = [];

        /** Check if user logged in or not */
Severity: Minor
Found in application/modules/auth/authapi.php - About 55 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 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function import($filePath) {
        $ext = strtolower(pathinfo($filePath, PATHINFO_EXTENSION));
        if ($ext != 'php' && $ext != '') {
            return;
        }
Severity: Minor
Found in application/modules/mod_stats/controllers/UsersController.php - About 55 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 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function import($filePath) {
        $ext = strtolower(pathinfo($filePath, PATHINFO_EXTENSION));
        if ($ext != 'php' && $ext != '') {
            return;
        }
Severity: Minor
Found in application/modules/mod_stats/mod_stats.php - About 55 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 runProductVariantInsertQuery has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    private function runProductVariantInsertQuery(&$arg, &$productId) {
        if (isset($arg['prc'])) {
            $arg['prc'] = str_replace(',', '.', $arg['prc']);
        } else {
            $arg['prc'] = 0;
Severity: Minor
Found in application/modules/import_export/classes/ProductsImport.php - About 55 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 validateFile has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function validateFile($offers, $limit) {

        if (substr(sprintf('%o', fileperms(ImportBootstrap::getUploadDir())), -4) != '0777') {
            ImportBootstrap::addMessage(Factor::ErrorFolderPermission);
            return FALSE;
Severity: Minor
Found in application/modules/import_export/classes/BaseImport.php - About 55 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 delete has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function delete() {

        //cp_check_perm('lang_delete');
        //$id = $this->input->post('lang_id');
        $id = $this->input->post('ids');
Severity: Minor
Found in application/modules/admin/languages.php - About 55 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 save has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function save() {
        //cp_check_perm('cp_site_settings');

        $this->form_validation->set_rules('siteinfo_adminemail', lang('Admin email', 'admin'), 'trim|valid_email');
        if (!$this->form_validation->run($this)) {
Severity: Minor
Found in application/modules/admin/settings.php - About 55 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