imagecms/ImageCMS

View on GitHub

Showing 1,858 of 1,858 total issues

File PoFileManager.php has 541 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace translator\classes;

use Gettext\Translations;
Severity: Major
Found in application/modules/translator/classes/PoFileManager.php - About 1 day to fix

File commentsapi.php has 526 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

use core\models\Route;
use core\src\CoreFactory;
use CMSFactory\Events;
Severity: Major
Found in application/modules/comments/commentsapi.php - About 1 day to fix

Function execute has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
Open

    public function execute($where = [], $offset = 0) {
        $collect_ids = FALSE;

        if ($this->table == '') {
            $error = lang('Error. Select or specify the table for search', 'search');
Severity: Minor
Found in application/modules/search/search.php - About 1 day 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 wishlist_model.php has 524 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
use cmsemail\email;
use CMSFactory\ModuleSettings;
use core\models\Route;

Severity: Major
Found in application/modules/wishlist/models/wishlist_model.php - About 1 day to fix

Function initDiscounts has 214 lines of code (exceeds 25 allowed). Consider refactoring.
Open

            function initDiscounts() {

                var isGift = $('#gift_checkbox').attr('checked') == 'checked';
                if (isGift) {
                    giftCheckboxCallback();
Severity: Major
Found in application/modules/mod_discount/assets/js/adminScripts.js - About 1 day to fix

File comments.php has 521 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

use CMSFactory\assetManager;

if (!defined('BASEPATH')) {
Severity: Major
Found in application/modules/comments/comments.php - About 1 day to fix

File menu.php has 521 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

if (!defined('BASEPATH')) {
    exit('No direct script access allowed');
}
Severity: Major
Found in application/modules/menu/menu.php - About 1 day to fix

Identical blocks of code found in 5 locations. Consider refactoring.
Open

    public function __call($name, $params)
    {
        if (0 === strpos($name, 'get')) {
            $virtualColumn = substr($name, 3);
            if ($this->hasVirtualColumn($virtualColumn)) {
Severity: Major
Found in application/modules/xbanners/models/Base/BannersI18n.php and 4 other locations - About 1 day to fix
application/modules/core/models/Base/Route.php on lines 2013..2041
application/modules/xbanners/models/Base/BannerImage.php on lines 2250..2278
application/modules/xbanners/models/Base/BannerImageI18n.php on lines 1497..1525
application/modules/xbanners/models/Base/Banners.php on lines 2126..2154

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 251.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 5 locations. Consider refactoring.
Open

    public function __call($name, $params)
    {
        if (0 === strpos($name, 'get')) {
            $virtualColumn = substr($name, 3);
            if ($this->hasVirtualColumn($virtualColumn)) {
application/modules/core/models/Base/Route.php on lines 2013..2041
application/modules/xbanners/models/Base/BannerImage.php on lines 2250..2278
application/modules/xbanners/models/Base/Banners.php on lines 2126..2154
application/modules/xbanners/models/Base/BannersI18n.php on lines 1314..1342

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 251.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 5 locations. Consider refactoring.
Open

    public function __call($name, $params)
    {
        if (0 === strpos($name, 'get')) {
            $virtualColumn = substr($name, 3);
            if ($this->hasVirtualColumn($virtualColumn)) {
Severity: Major
Found in application/modules/xbanners/models/Base/Banners.php and 4 other locations - About 1 day to fix
application/modules/core/models/Base/Route.php on lines 2013..2041
application/modules/xbanners/models/Base/BannerImage.php on lines 2250..2278
application/modules/xbanners/models/Base/BannerImageI18n.php on lines 1497..1525
application/modules/xbanners/models/Base/BannersI18n.php on lines 1314..1342

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 251.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 5 locations. Consider refactoring.
Open

    public function __call($name, $params)
    {
        if (0 === strpos($name, 'get')) {
            $virtualColumn = substr($name, 3);
            if ($this->hasVirtualColumn($virtualColumn)) {
Severity: Major
Found in application/modules/xbanners/models/Base/BannerImage.php and 4 other locations - About 1 day to fix
application/modules/core/models/Base/Route.php on lines 2013..2041
application/modules/xbanners/models/Base/BannerImageI18n.php on lines 1497..1525
application/modules/xbanners/models/Base/Banners.php on lines 2126..2154
application/modules/xbanners/models/Base/BannersI18n.php on lines 1314..1342

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 251.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 5 locations. Consider refactoring.
Open

    public function __call($name, $params)
    {
        if (0 === strpos($name, 'get')) {
            $virtualColumn = substr($name, 3);
            if ($this->hasVirtualColumn($virtualColumn)) {
Severity: Major
Found in application/modules/core/models/Base/Route.php and 4 other locations - About 1 day to fix
application/modules/xbanners/models/Base/BannerImage.php on lines 2250..2278
application/modules/xbanners/models/Base/BannerImageI18n.php on lines 1497..1525
application/modules/xbanners/models/Base/Banners.php on lines 2126..2154
application/modules/xbanners/models/Base/BannersI18n.php on lines 1314..1342

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 251.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    function changeEmtyActive() {
        $('.prod-on_off.emptyMetaSeo').die('click');
        $('.prod-on_off.emptyMetaSeo').live('click', function () {
            var $this = $(this);
            if (!$this.hasClass('disabled')) {
Severity: Major
Found in application/modules/mod_seo/assets/js/scripts.js and 1 other location - About 1 day to fix
application/modules/mod_seo/assets/js/scripts.js on lines 133..155

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 197.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    function changeActive() {
        $('.prod-on_off.categorySeo').die('click');
        $('.prod-on_off.categorySeo').live('click', function () {
            var $this = $(this);
            if (!$this.hasClass('disabled')) {
Severity: Major
Found in application/modules/mod_seo/assets/js/scripts.js and 1 other location - About 1 day to fix
application/modules/mod_seo/assets/js/scripts.js on lines 108..130

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 197.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME)
    {
        $keys = BannersTableMap::getFieldNames($keyType);

        if (array_key_exists($keys[0], $arr)) {
Severity: Major
Found in application/modules/xbanners/models/Base/Banners.php and 1 other location - About 1 day to fix
application/modules/xbanners/models/Base/BannerImageI18n.php on lines 1073..1095

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 247.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME)
    {
        $keys = BannerImageI18nTableMap::getFieldNames($keyType);

        if (array_key_exists($keys[0], $arr)) {
Severity: Major
Found in application/modules/xbanners/models/Base/BannerImageI18n.php and 1 other location - About 1 day to fix
application/modules/xbanners/models/Base/Banners.php on lines 1138..1160

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 247.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

$.fn.cycle.transitions.blindX = function($cont, $slides, opts) {
    var w = $cont.css('overflow','hidden').width();
    opts.before.push(function(curr, next, opts) {
        $.fn.cycle.commonReset(curr,next,opts);
        opts.animIn.width = next.cycleW;
Severity: Major
Found in application/modules/xbanners/assets/js/cycle.js and 1 other location - About 1 day to fix
application/modules/xbanners/assets/js/cycle.js on lines 1060..1070

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 196.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

$.fn.cycle.transitions.blindY = function($cont, $slides, opts) {
    var h = $cont.css('overflow','hidden').height();
    opts.before.push(function(curr, next, opts) {
        $.fn.cycle.commonReset(curr,next,opts);
        opts.animIn.height = next.cycleH;
Severity: Major
Found in application/modules/xbanners/assets/js/cycle.js and 1 other location - About 1 day to fix
application/modules/xbanners/assets/js/cycle.js on lines 1048..1058

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 196.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Method widget_navigation has 200 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function widget_navigation($widget = []) {
        $this->load->module('core');

        $segmentGallery = $this->pathGallery();
        if ($this->core->core_data['data_type'] === '404' || !$this->core->core_data['data_type'] || $segmentGallery === 'gallery') {
Severity: Major
Found in application/modules/navigation/navigation_widgets.php - About 1 day to fix

Function runProperties has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
Open

    public function runProperties() {
        if (ImportBootstrap::hasErrors()) {
            return FALSE;
        }
        $properties = $this->db->query('SELECT `id`, `csv_name` FROM `shop_product_properties`')->result();
Severity: Minor
Found in application/modules/import_export/classes/BaseImport.php - About 7 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

Severity
Category
Status
Source
Language