ImpressCMS/impresscms

View on GitHub

Showing 47,251 of 47,256 total issues

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

        if (is_array($groups) && !empty($groups)) {
            $criteriaTray = new icms_db_criteria_Compo();
            foreach ($groups as $gid) {
                $criteriaTray->add(new icms_db_criteria_Item('gperm_groupid', $gid), 'OR');
            }
Severity: Major
Found in htdocs/modules/system/admin/images/main.php and 9 other locations - About 1 hr to fix
htdocs/modules/system/admin/images/browser.php on lines 170..178
htdocs/modules/system/admin/images/browser.php on lines 234..242
htdocs/modules/system/admin/images/browser.php on lines 250..258
htdocs/modules/system/admin/images/browser.php on lines 392..400
htdocs/modules/system/admin/images/browser.php on lines 409..417
htdocs/modules/system/admin/images/main.php on lines 190..198
htdocs/modules/system/admin/images/main.php on lines 255..263
htdocs/modules/system/admin/images/main.php on lines 420..428
htdocs/modules/system/admin/images/main.php on lines 437..445

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

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

<?php
// $Id: blauer-fisch $
//%%%%%% Avatar Manager %%%%%
define('_MD_AVATARMAN','头像管理');

Severity: Major
Found in htdocs/modules/system/language/schinese/admin/avatars.php and 1 other location - About 1 hr to fix
htdocs/modules/system/language/schinese/admin/comments.php on lines 1..14

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

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

    if (is_array($groups) && !empty($groups)) {
        $criteriaTray = new icms_db_criteria_Compo();
        foreach ($groups as $gid) {
            $criteriaTray->add(new icms_db_criteria_Item('gperm_groupid', $gid), 'OR');
        }
Severity: Major
Found in htdocs/modules/system/admin/images/main.php and 9 other locations - About 1 hr to fix
htdocs/modules/system/admin/images/browser.php on lines 170..178
htdocs/modules/system/admin/images/browser.php on lines 234..242
htdocs/modules/system/admin/images/browser.php on lines 250..258
htdocs/modules/system/admin/images/browser.php on lines 392..400
htdocs/modules/system/admin/images/browser.php on lines 409..417
htdocs/modules/system/admin/images/main.php on lines 255..263
htdocs/modules/system/admin/images/main.php on lines 272..280
htdocs/modules/system/admin/images/main.php on lines 420..428
htdocs/modules/system/admin/images/main.php on lines 437..445

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

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

    if (is_array($groups) && !empty($groups)) {
        $criteriaTray = new icms_db_criteria_Compo();
        foreach ($groups as $gid) {
            $criteriaTray->add(new icms_db_criteria_Item('gperm_groupid', $gid), 'OR');
        }
Severity: Major
Found in htdocs/modules/system/admin/images/main.php and 9 other locations - About 1 hr to fix
htdocs/modules/system/admin/images/browser.php on lines 170..178
htdocs/modules/system/admin/images/browser.php on lines 234..242
htdocs/modules/system/admin/images/browser.php on lines 250..258
htdocs/modules/system/admin/images/browser.php on lines 392..400
htdocs/modules/system/admin/images/browser.php on lines 409..417
htdocs/modules/system/admin/images/main.php on lines 190..198
htdocs/modules/system/admin/images/main.php on lines 255..263
htdocs/modules/system/admin/images/main.php on lines 272..280
htdocs/modules/system/admin/images/main.php on lines 420..428

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

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

    if (is_array($groups) && !empty($groups)) {
        $criteriaTray = new icms_db_criteria_Compo();
        foreach ($groups as $gid) {
            $criteriaTray->add(new icms_db_criteria_Item('gperm_groupid', $gid), 'OR');
        }
Severity: Major
Found in htdocs/modules/system/admin/images/main.php and 9 other locations - About 1 hr to fix
htdocs/modules/system/admin/images/browser.php on lines 170..178
htdocs/modules/system/admin/images/browser.php on lines 234..242
htdocs/modules/system/admin/images/browser.php on lines 250..258
htdocs/modules/system/admin/images/browser.php on lines 392..400
htdocs/modules/system/admin/images/browser.php on lines 409..417
htdocs/modules/system/admin/images/main.php on lines 190..198
htdocs/modules/system/admin/images/main.php on lines 255..263
htdocs/modules/system/admin/images/main.php on lines 272..280
htdocs/modules/system/admin/images/main.php on lines 437..445

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

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

        if (is_array($groups) && !empty($groups)) {
            $criteriaTray = new icms_db_criteria_Compo();
            foreach ($groups as $gid) {
                $criteriaTray->add(new icms_db_criteria_Item('gperm_groupid', $gid), 'OR');
            }
Severity: Major
Found in htdocs/modules/system/admin/images/browser.php and 9 other locations - About 1 hr to fix
htdocs/modules/system/admin/images/browser.php on lines 170..178
htdocs/modules/system/admin/images/browser.php on lines 234..242
htdocs/modules/system/admin/images/browser.php on lines 392..400
htdocs/modules/system/admin/images/browser.php on lines 409..417
htdocs/modules/system/admin/images/main.php on lines 190..198
htdocs/modules/system/admin/images/main.php on lines 255..263
htdocs/modules/system/admin/images/main.php on lines 272..280
htdocs/modules/system/admin/images/main.php on lines 420..428
htdocs/modules/system/admin/images/main.php on lines 437..445

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

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

    if (is_array($groups) && !empty($groups)) {
        $criteriaTray = new icms_db_criteria_Compo();
        foreach ($groups as $gid) {
            $criteriaTray->add(new icms_db_criteria_Item('gperm_groupid', $gid), 'OR');
        }
Severity: Major
Found in htdocs/modules/system/admin/images/browser.php and 9 other locations - About 1 hr to fix
htdocs/modules/system/admin/images/browser.php on lines 170..178
htdocs/modules/system/admin/images/browser.php on lines 234..242
htdocs/modules/system/admin/images/browser.php on lines 250..258
htdocs/modules/system/admin/images/browser.php on lines 392..400
htdocs/modules/system/admin/images/main.php on lines 190..198
htdocs/modules/system/admin/images/main.php on lines 255..263
htdocs/modules/system/admin/images/main.php on lines 272..280
htdocs/modules/system/admin/images/main.php on lines 420..428
htdocs/modules/system/admin/images/main.php on lines 437..445

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

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

        if (is_array($groups) && !empty($groups)) {
            $criteriaTray = new icms_db_criteria_Compo();
            foreach ($groups as $gid) {
                $criteriaTray->add(new icms_db_criteria_Item('gperm_groupid', $gid), 'OR');
            }
Severity: Major
Found in htdocs/modules/system/admin/images/main.php and 9 other locations - About 1 hr to fix
htdocs/modules/system/admin/images/browser.php on lines 170..178
htdocs/modules/system/admin/images/browser.php on lines 234..242
htdocs/modules/system/admin/images/browser.php on lines 250..258
htdocs/modules/system/admin/images/browser.php on lines 392..400
htdocs/modules/system/admin/images/browser.php on lines 409..417
htdocs/modules/system/admin/images/main.php on lines 190..198
htdocs/modules/system/admin/images/main.php on lines 272..280
htdocs/modules/system/admin/images/main.php on lines 420..428
htdocs/modules/system/admin/images/main.php on lines 437..445

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

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

<?php
// $Id: blauer-fisch $
//%%%%%% Comment Manager %%%%%
define('_MD_AM_COMMMAN','留言管理');

Severity: Major
Found in htdocs/modules/system/language/schinese/admin/comments.php and 1 other location - About 1 hr to fix
htdocs/modules/system/language/schinese/admin/avatars.php on lines 1..14

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

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

    if (is_array($groups) && !empty($groups)) {
        $criteriaTray = new icms_db_criteria_Compo();
        foreach ($groups as $gid) {
            $criteriaTray->add(new icms_db_criteria_Item('gperm_groupid', $gid), 'OR');
        }
Severity: Major
Found in htdocs/modules/system/admin/images/browser.php and 9 other locations - About 1 hr to fix
htdocs/modules/system/admin/images/browser.php on lines 234..242
htdocs/modules/system/admin/images/browser.php on lines 250..258
htdocs/modules/system/admin/images/browser.php on lines 392..400
htdocs/modules/system/admin/images/browser.php on lines 409..417
htdocs/modules/system/admin/images/main.php on lines 190..198
htdocs/modules/system/admin/images/main.php on lines 255..263
htdocs/modules/system/admin/images/main.php on lines 272..280
htdocs/modules/system/admin/images/main.php on lines 420..428
htdocs/modules/system/admin/images/main.php on lines 437..445

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

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

        if (is_array($groups) && !empty($groups)) {
            $criteriaTray = new icms_db_criteria_Compo();
            foreach ($groups as $gid) {
                $criteriaTray->add(new icms_db_criteria_Item('gperm_groupid', $gid), 'OR');
            }
Severity: Major
Found in htdocs/modules/system/admin/images/browser.php and 9 other locations - About 1 hr to fix
htdocs/modules/system/admin/images/browser.php on lines 170..178
htdocs/modules/system/admin/images/browser.php on lines 250..258
htdocs/modules/system/admin/images/browser.php on lines 392..400
htdocs/modules/system/admin/images/browser.php on lines 409..417
htdocs/modules/system/admin/images/main.php on lines 190..198
htdocs/modules/system/admin/images/main.php on lines 255..263
htdocs/modules/system/admin/images/main.php on lines 272..280
htdocs/modules/system/admin/images/main.php on lines 420..428
htdocs/modules/system/admin/images/main.php on lines 437..445

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

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

Function respondToReadyState has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    respondToReadyState: function(readyState) {
        var state = Ajax.Request.Events[readyState], response = new Ajax.Response(this);

        if (state == 'Complete') {
            try {
Severity: Minor
Found in htdocs/install/prototype.js - 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 makeWritable has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    function makeWritable( $path, $group = false, $recurse = false) {
        if (!file_exists( $path )) {
            return false;
        }
        $perm = @is_dir( $path ) ? 6 : 7;
Severity: Minor
Found in htdocs/install/page_pathsettings.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 deny_by_htaccess has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    function deny_by_htaccess($ip = null) {
        if (empty($ip)) $ip = filter_input(INPUT_SERVER, 'REMOTE_ADDR', FILTER_VALIDATE_IP);
        if (empty($ip)) return false;
        if (!function_exists('file_get_contents')) return false;

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 execute has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    function execute() {

        if (!function_exists('mb_strlen')) return true;

        // registered users always pass this plugin

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 _spam_check_point_recursive has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    function _spam_check_point_recursive($val) {
        if (is_array($val)) {
            foreach ($val as $subval) {
                $this->_spam_check_point_recursive($subval);
            }

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 _dblayertrap_check_recursive has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    function _dblayertrap_check_recursive($val) {
        if (is_array($val)) {
            foreach ($val as $subval) {
                $this->_dblayertrap_check_recursive($subval);
            }

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 check_manipulation has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    function check_manipulation() {
        if ($_SERVER['SCRIPT_FILENAME'] == ICMS_ROOT_PATH . '/index.php') {
            $root_stat = stat(ICMS_ROOT_PATH);
            $index_stat = stat(ICMS_ROOT_PATH . '/index.php');
            $finger_print = $root_stat['mtime'] . ':' . $index_stat['mtime'] . ':' . $index_stat['ino'];

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 xoInit has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function xoInit(): bool {
        if (!$this->checkAccess()) {
            return false;
        }
        if (@empty($_SERVER['REQUEST_URI'])) {
Severity: Minor
Found in htdocs/install/class/IcmsInstallWizard.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 b_system_topposters_show has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

function b_system_topposters_show($options) {
    global $icmsConfigUser;

    $block = array();
    $criteria = new icms_db_criteria_Compo(new icms_db_criteria_Item('level', 0, '>'));
Severity: Minor
Found in htdocs/modules/system/blocks/system_blocks.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

Severity
Category
Status
Source
Language