ImpressCMS/impresscms

View on GitHub

Showing 47,251 of 47,256 total issues

The class upgrade_impcms06 has an overall complexity of 125 which is very high. The configured complexity threshold is 50.
Open

class upgrade_impcms06 {

    public $usedFiles = array ();
    private $tasks = array(
        'table1', 'table2', 'table3', 'table4', 'conf',
Severity: Minor
Found in upgrade/upd-icms-1.0-to-1.1/index.php by phpmd

The class TextSanitizer has 27 public methods. Consider refactoring TextSanitizer to keep number of public methods under 10.
Open

class TextSanitizer {

    /*
     * Constructor of this class
     * Gets allowed html tags from admin config settings

TooManyPublicMethods

Since: 0.1

A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

By default it ignores methods starting with 'get' or 'set'.

Example

Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

The class TextSanitizer has 27 non-getter- and setter-methods. Consider refactoring TextSanitizer to keep number of methods under 25.
Open

class TextSanitizer {

    /*
     * Constructor of this class
     * Gets allowed html tags from admin config settings

TooManyMethods

Since: 0.1

A class with too many methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

By default it ignores methods starting with 'get' or 'set'.

The default was changed from 10 to 25 in PHPMD 2.3.

Example

Source https://phpmd.org/rules/codesize.html#toomanymethods

The class Protector has an overall complexity of 267 which is very high. The configured complexity threshold is 50.
Open

class Protector {
    var $mydirname;
    var $_conn = null;
    var $_conf = array();
    var $_conf_serialized = '';

The class XoopsGTicket has an overall complexity of 55 which is very high. The configured complexity threshold is 50.
Open

    class XoopsGTicket {
        var $_errors = array ();
        var $_latest_token = '';
        var $messages = array ();

The class Protector has 30 public methods. Consider refactoring Protector to keep number of public methods under 10.
Open

class Protector {
    var $mydirname;
    var $_conn = null;
    var $_conf = array();
    var $_conf_serialized = '';

TooManyPublicMethods

Since: 0.1

A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

By default it ignores methods starting with 'get' or 'set'.

Example

Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

The class Protector has 30 non-getter- and setter-methods. Consider refactoring Protector to keep number of methods under 25.
Open

class Protector {
    var $mydirname;
    var $_conn = null;
    var $_conf = array();
    var $_conf_serialized = '';

TooManyMethods

Since: 0.1

A class with too many methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

By default it ignores methods starting with 'get' or 'set'.

The default was changed from 10 to 25 in PHPMD 2.3.

Example

Source https://phpmd.org/rules/codesize.html#toomanymethods

The class PathStuffController has 11 public methods. Consider refactoring PathStuffController to keep number of public methods under 10.
Open

class PathStuffController {
    var $xoopsRootPath = '';
    var $xoopsTrustPath = '';
    var $xoopsUrl = '';

Severity: Minor
Found in htdocs/install/page_pathsettings.php by phpmd

TooManyPublicMethods

Since: 0.1

A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

By default it ignores methods starting with 'get' or 'set'.

Example

Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

The class PathStuffController has an overall complexity of 53 which is very high. The configured complexity threshold is 50.
Open

class PathStuffController {
    var $xoopsRootPath = '';
    var $xoopsTrustPath = '';
    var $xoopsUrl = '';

Severity: Minor
Found in htdocs/install/page_pathsettings.php by phpmd

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

        if ($configs !== FALSE) {
            if ($module->getVar('hascomments') != 0) {
                include_once ICMS_INCLUDE_PATH . '/comment_constants.php';
                array_push($configs, array('name' => 'com_rule',
                    'title' => '_CM_COMRULES',
Severity: Major
Found in htdocs/modules/system/admin/modulesadmin/modulesadmin.php and 1 other location - About 3 hrs to fix
htdocs/modules/system/admin/modulesadmin/modulesadmin.php on lines 345..369

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

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

                if ($configs !== FALSE) {
                    if ($module->getVar('hascomments') != 0) {
                        include_once ICMS_INCLUDE_PATH . '/comment_constants.php';
                        $configs[] = array('name' => 'com_rule',
                            'title' => '_CM_COMRULES',
Severity: Major
Found in htdocs/modules/system/admin/modulesadmin/modulesadmin.php and 1 other location - About 3 hrs to fix
htdocs/modules/system/admin/modulesadmin/modulesadmin.php on lines 1217..1241

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

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

function Icms_getMonthNameById($month_id) {
    global $icmsConfig;
    icms_loadLanguageFile('core', 'calendar');
    $month_id = icms_conv_local2nr($month_id);
    if( $icmsConfig['use_ext_date'] == true && defined ('_CALENDAR_TYPE') && _CALENDAR_TYPE == "jalali"){
Severity: Major
Found in htdocs/include/functions.php - About 3 hrs to fix

    Method check_dos_attack has 82 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function check_dos_attack($uid = 0, $can_ban = false) {
            if ($this->_done_dos) return true;
    
            $ip4sql = filter_input(INPUT_SERVER, 'REMOTE_ADDR', FILTER_VALIDATE_IP);
            $uri4sql = filter_input(INPUT_SERVER, 'REQUEST_URI', FILTER_SANITIZE_STRING);

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

          if (!$clone && !$adsenseObj->isNew()) {
              $sform = $adsenseObj->getForm(_CO_ICMS_ADSENSES_EDIT, 'addadsense');
              $sform->assign($icmsAdminTpl);
              $icmsAdminTpl->assign('icms_adsense_title', _CO_ICMS_ADSENSES_EDIT_INFO);
              $icmsAdminTpl->display('db:system_adm_adsense.html');
      Severity: Major
      Found in htdocs/modules/system/admin/adsense/main.php and 1 other location - About 3 hrs to fix
      htdocs/modules/system/admin/customtag/main.php on lines 49..63

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

      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

          if (!$clone && !$customtagObj->isNew()) {
              $sform = $customtagObj->getForm(_CO_ICMS_CUSTOMTAG_EDIT, "addcustomtag");
              $sform->assign($icmsAdminTpl);
              $icmsAdminTpl->assign("icms_custom_tag_title", _CO_ICMS_CUSTOMTAG_EDIT_INFO);
              $icmsAdminTpl->display("db:system_adm_customtag.html");
      Severity: Major
      Found in htdocs/modules/system/admin/customtag/main.php and 1 other location - About 3 hrs to fix
      htdocs/modules/system/admin/adsense/main.php on lines 29..41

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

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

      function xoops_comment_delete($module_id, $item_id)
      {
          if( (int) ($module_id) > 0 && (int) ($item_id) > 0)
          {
              $comment_handler = icms::handler('icms_data_comment');
      Severity: Minor
      Found in htdocs/include/functions.php - About 3 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 imanager_addfile has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

      function imanager_addfile() {
          if (!icms::$security->check()) {
              redirect_header('admin.php?fct=images', 3, implode('<br />', icms::$security->getErrors()));
          }
      
      
      Severity: Minor
      Found in htdocs/modules/system/admin/images/main.php - About 3 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 imanager_addfile has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

      function imanager_addfile() {
          /* because we are using a function, the GET/POST variables are not in scope */
          global $imgcat_id, $image_display, $image_weight, $image_nicename;
      
          if (!icms::$security->check()) {
      Severity: Minor
      Found in htdocs/modules/system/admin/images/browser.php - About 3 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 b_system_info_show has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

      function b_system_info_show($options) {
          global $icmsConfig;
          $block = array();
          if (!empty($options[3])) {
              $block['showgroups'] = TRUE;
      Severity: Minor
      Found in htdocs/modules/system/blocks/system_blocks.php - About 3 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 3 locations. Consider refactoring.
      Open

      <?php
      // $Id: install2.php 9920 2010-03-27 17:46:23Z skenow $
      define("_INSTALL_WEBMASTER","Webmasters");
      define("_INSTALL_WEBMASTERD","Webmasters van deze website");
      define("_INSTALL_REGUSERS","Geregistreerde gebruikers");
      Severity: Major
      Found in htdocs/install/language/nederlands/install2.php and 2 other locations - About 3 hrs to fix
      htdocs/install/language/english/install2.php on lines 1..84
      htdocs/install/language/italiano/install2.php on lines 1..56

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

      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

      Severity
      Category
      Status
      Source
      Language