imagecms/ImageCMS

View on GitHub

Showing 1,388 of 1,858 total issues

Function getCollection has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function getCollection() {

        $newData = [];
        $data = $this->data;
        while (!empty($data)) {
Severity: Minor
Found in application/modules/CMSFactory/Tree/TreeCollection.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

Function do_upload has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function do_upload($userID = null) {

        if (!$userID) {
            $userID = $this->dx_auth->get_user_id();
        }
Severity: Minor
Found in application/modules/wishlist/classes/ParentWishlist.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

Function getNewCommentsCount has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function getNewCommentsCount(array $data = []) {

        if (SHOP_INSTALLED) {
            if (count($data)) {
                $waitingForModerationCount = array_shift($data);
Severity: Minor
Found in application/modules/admin_menu/classes/MenuCallbacks.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

Function module has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private function module($url) {

        $moduleSegments = explode('/', $url);

        $moduleName = array_shift($moduleSegments);
Severity: Minor
Found in application/modules/core/src/FrontController.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

Function __call has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function __call($name, $params)
    {
        if (0 === strpos($name, 'get')) {
            $virtualColumn = substr($name, 3);
            if ($this->hasVirtualColumn($virtualColumn)) {
Severity: Minor
Found in application/modules/core/models/Base/Route.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

Function getLanguages has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function getLanguages() {

        if ($this->languages === null) {
            if ($this->cache->contains(self::CACHE_LANG)) {
                $this->languages = $this->cache->fetch(self::CACHE_LANG);
Severity: Minor
Found in application/modules/core/src/CoreModel.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

Function setLastModified has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function setLastModified($LastModified_unix) {

        if ($LastModified_unix < time() - 60 * 60 * 24 * 4 or $LastModified_unix > time()) {
            if (in_array(date('D', time()), ['Mon', 'Tue', 'Wen'])) {
                $LastModified_unix = strtotime('last sunday', time());
Severity: Minor
Found in application/modules/core/core.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

Function update_settings has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function update_settings($locale) {

        $locale = $locale ?: MY_Controller::defaultLocale();

        if ($this->input->post()) {
Severity: Minor
Found in application/modules/cmsemail/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

Function getByPosition has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function getByPosition($pos)
    {
        switch ($pos) {
            case 0:
                return $this->getId();
Severity: Minor
Found in application/modules/core/models/Base/Route.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

Function insertPropertiesData has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function insertPropertiesData($tableName, $data) {

        if (FALSE == (count($data) > 0)) {
            return false;
        }
Severity: Minor
Found in application/modules/exchange/classes/ExchangeBase.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

Function categoryExists2 has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function categoryExists2($externalId, $returnCategoryId = FALSE) {

        if (null === $this->externalIds) {
            $this->externalIds = [];
            foreach ($this->categories as $categoryId => $categoryData) {
Severity: Minor
Found in application/modules/exchange/classes/Categories.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

Function addProductsToUpperCategories has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function addProductsToUpperCategories() {

        $products = $this->db->select('shop_products.id, shop_category.full_path_ids')
            ->join('shop_category', 'shop_category.id = shop_products.category_id')
            ->get('shop_products')
Severity: Minor
Found in application/modules/exchange/classes/Products.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

Function addProductWhenAjaxChangeActive has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public static function addProductWhenAjaxChangeActive($arg) {

        /* @var $model SProducts */
        $models = $arg['model'];

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

Function init has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function init($config = []) {
        foreach ($config as $key => $val) {
            if (isset($this->$key)) {
                $this->$key = $val;
            } else {
Severity: Minor
Found in application/modules/search/search.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

Avoid too many return statements within this function.
Open

                return false;
Severity: Major
Found in application/modules/xbanners/assets/js/cycle.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

        return false;
Severity: Major
Found in application/modules/xbanners/assets/js/cycle.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

                        return;

Avoid too many return statements within this function.
Open

                        return;

Avoid too many return statements within this function.
Open

    return options;
Severity: Major
Found in application/modules/xbanners/assets/js/cycle.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

                    return;
Severity
Category
Status
Source
Language