imagecms/ImageCMS

View on GitHub

Showing 1,858 of 1,858 total issues

Function add has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
Open

    public function add() {

        ($hook = get_hook('comments_on_add')) ? eval($hook) : NULL;

        // Load comments model
Severity: Minor
Found in application/modules/comments/comments.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

Function renameLocaleFolders has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
Open

    private function renameLocaleFolders($from_locale, $to_locale) {

        if ($from_locale && $to_locale) {
            $templates_dir = './templates';
            $main_dir = './application/language/main';
Severity: Minor
Found in application/modules/admin/languages.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

Function _sanitize_globals has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
Open

    public function _sanitize_globals() {
        // It would be "wrong" to unset any of these GLOBALS.
        $protected = ['_SERVER', '_GET', '_POST', '_FILES', '_REQUEST',
            '_SESSION', '_ENV', 'GLOBALS', 'HTTP_RAW_POST_DATA',
            'system_folder', 'application_folder', 'BM', 'EXT',
Severity: Minor
Found in application/core/MY_Input.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

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

    removeDotsCheck: function (curEl) {
        var arrows = $(curEl).closest('.control-group').next('div').find('input');

        $(arrows).removeAttr('checked');

Severity: Major
Found in application/modules/xbanners/assets/js/script.js and 1 other location - About 5 hrs to fix
application/modules/xbanners/assets/js/script.js on lines 237..246

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 143.

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

    removeArrowsCheck: function (curEl) {
        var arrows = $(curEl).closest('.control-group').prev('div').find('input');

        $(arrows).removeAttr('checked');

Severity: Major
Found in application/modules/xbanners/assets/js/script.js and 1 other location - About 5 hrs to fix
application/modules/xbanners/assets/js/script.js on lines 227..236

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 143.

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 2 locations. Consider refactoring.
Open

    public static function addInstanceToPool($obj, $key = null)
    {
        if (Propel::isInstancePoolingEnabled()) {
            if (null === $key) {
                $key = serialize([(null === $obj->getId() || is_scalar($obj->getId()) || is_callable([$obj->getId(), '__toString']) ? (string) $obj->getId() : $obj->getId()), (null === $obj->getLocale() || is_scalar($obj->getLocale()) || is_callable([$obj->getLocale(), '__toString']) ? (string) $obj->getLocale() : $obj->getLocale())]);
application/modules/xbanners/models/Map/BannerImageI18nTableMap.php on lines 187..195

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 191.

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 2 locations. Consider refactoring.
Open

    public static function addInstanceToPool($obj, $key = null)
    {
        if (Propel::isInstancePoolingEnabled()) {
            if (null === $key) {
                $key = serialize([(null === $obj->getId() || is_scalar($obj->getId()) || is_callable([$obj->getId(), '__toString']) ? (string) $obj->getId() : $obj->getId()), (null === $obj->getLocale() || is_scalar($obj->getLocale()) || is_callable([$obj->getLocale(), '__toString']) ? (string) $obj->getLocale() : $obj->getLocale())]);
application/modules/xbanners/models/Map/BannersI18nTableMap.php on lines 169..177

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 191.

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 5 locations. Consider refactoring.
Open

    public function countBannerImages(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
    {
        $partial = $this->collBannerImagesPartial && !$this->isNew();
        if (null === $this->collBannerImages || null !== $criteria || $partial) {
            if ($this->isNew() && null === $this->collBannerImages) {
Severity: Major
Found in application/modules/xbanners/models/Base/Banners.php and 4 other locations - About 5 hrs to fix
application/modules/core/models/Base/Route.php on lines 1469..1492
application/modules/core/models/Base/Route.php on lines 1719..1742
application/modules/xbanners/models/Base/BannerImage.php on lines 1801..1824
application/modules/xbanners/models/Base/Banners.php on lines 1751..1774

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 190.

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 5 locations. Consider refactoring.
Open

    public function countSProductss(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
    {
        $partial = $this->collSProductssPartial && !$this->isNew();
        if (null === $this->collSProductss || null !== $criteria || $partial) {
            if ($this->isNew() && null === $this->collSProductss) {
Severity: Major
Found in application/modules/core/models/Base/Route.php and 4 other locations - About 5 hrs to fix
application/modules/core/models/Base/Route.php on lines 1469..1492
application/modules/xbanners/models/Base/BannerImage.php on lines 1801..1824
application/modules/xbanners/models/Base/Banners.php on lines 1523..1546
application/modules/xbanners/models/Base/Banners.php on lines 1751..1774

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 190.

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 5 locations. Consider refactoring.
Open

    public function countBannerImageI18ns(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
    {
        $partial = $this->collBannerImageI18nsPartial && !$this->isNew();
        if (null === $this->collBannerImageI18ns || null !== $criteria || $partial) {
            if ($this->isNew() && null === $this->collBannerImageI18ns) {
Severity: Major
Found in application/modules/xbanners/models/Base/BannerImage.php and 4 other locations - About 5 hrs to fix
application/modules/core/models/Base/Route.php on lines 1469..1492
application/modules/core/models/Base/Route.php on lines 1719..1742
application/modules/xbanners/models/Base/Banners.php on lines 1523..1546
application/modules/xbanners/models/Base/Banners.php on lines 1751..1774

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 190.

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 5 locations. Consider refactoring.
Open

    public function countBannersI18ns(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
    {
        $partial = $this->collBannersI18nsPartial && !$this->isNew();
        if (null === $this->collBannersI18ns || null !== $criteria || $partial) {
            if ($this->isNew() && null === $this->collBannersI18ns) {
Severity: Major
Found in application/modules/xbanners/models/Base/Banners.php and 4 other locations - About 5 hrs to fix
application/modules/core/models/Base/Route.php on lines 1469..1492
application/modules/core/models/Base/Route.php on lines 1719..1742
application/modules/xbanners/models/Base/BannerImage.php on lines 1801..1824
application/modules/xbanners/models/Base/Banners.php on lines 1523..1546

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 190.

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 5 locations. Consider refactoring.
Open

    public function countSCategories(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
    {
        $partial = $this->collSCategoriesPartial && !$this->isNew();
        if (null === $this->collSCategories || null !== $criteria || $partial) {
            if ($this->isNew() && null === $this->collSCategories) {
Severity: Major
Found in application/modules/core/models/Base/Route.php and 4 other locations - About 5 hrs to fix
application/modules/core/models/Base/Route.php on lines 1719..1742
application/modules/xbanners/models/Base/BannerImage.php on lines 1801..1824
application/modules/xbanners/models/Base/Banners.php on lines 1523..1546
application/modules/xbanners/models/Base/Banners.php on lines 1751..1774

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 190.

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 create_item has 133 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function create_item($id = null) {

        if (!$this->input->post()) {
            $parents = $this->db
                ->where('menu_id', $id)
Severity: Major
Found in application/modules/menu/admin.php - About 5 hrs to fix

File BaseImport.php has 387 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace import_export\classes;

use CI_DB_active_record;
Severity: Minor
Found in application/modules/import_export/classes/BaseImport.php - About 5 hrs to fix

Method processProducts1 has 132 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function processProducts1() {

        $propertiesDataUpdate = [];
        $productPropDTDel = [];

Severity: Major
Found in application/modules/exchange/classes/Products.php - About 5 hrs to fix

Function getMoFilePath has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
Open

    function getMoFilePath($domain) {

        if ($domain) {
            if (!defined('CUR_LOCALE')) {
                $CI = &get_instance();
Severity: Minor
Found in application/helpers/language_helper.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

Function runProductUpdateQuery has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
Open

    public function runProductUpdateQuery($productId, $arg, $EmptyFields) {
        $insertData = [];

        if ($arg['url'] != '') {
            $arg['url'] = $this->urlCheck($arg['url'], $productId);
Severity: Minor
Found in application/modules/import_export/classes/ProductsImport.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

Function step_1 has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
Open

    public function step_1() {
        $result = TRUE;

        // Check folders permissions
        $dir_array = [
Severity: Minor
Found in application/modules/install/install.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

Function pass1Helper_getPropertiesData has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
Open

    protected function pass1Helper_getPropertiesData(SimpleXMLElement $product, $categoryId) {

        $brandIdentif = Properties::getInstance()->getBrandIdentif();
        $brandId = '';

Severity: Minor
Found in application/modules/exchange/classes/Products.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

Function initBanners has 131 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function initBanners() {


    $(".frame_label:has(.niceCheck)").die('click').live('click', function () {
        var $this = $(this);
Severity: Major
Found in application/modules/xbanners/assets/js/script.js - About 5 hrs to fix
Severity
Category
Status
Source
Language