ImpressCMS/impresscms

View on GitHub

Showing 47,251 of 47,256 total issues

Function synchronize has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

function synchronize($id, $type) {
    switch($type) {
        case 'user':
            // Array of tables from which to count 'posts'
            $tables = array();
Severity: Minor
Found in htdocs/modules/system/admin/users/users.php - About 2 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 exec has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function exec() {
        if (!$this->getVar('sat_enabled')) return FALSE;
        if (((int) $this->getVar('sat_lastruntime') + (int) $this->getVar('sat_interval') * 60) > time()) return FALSE;
        $code = $this->getVar('sat_code');
        ignore_user_abort(TRUE);
Severity: Minor
Found in htdocs/modules/system/admin/autotasks/class/autotasks.php - About 2 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 ip_match has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    function ip_match($ips) {
        foreach ($ips as $ip => $info) {
            if ($ip) {
                switch (substr($ip, -1)) {
                    case '.':

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

Method redirect_header has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function redirect_header($url, $time = 3, $message = '', $addredirect = true, $allowExternalLink = false)
{
    global $icmsConfig, $icmsConfigPersona;
    if(preg_match("/[\\0-\\31]|about:|script:/i", $url))
    {
Severity: Major
Found in htdocs/include/functions.php - About 2 hrs to fix

    Method check has 51 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            function check($post = true, $area = '', $allow_repost = true) {
                global $xoopsModule;
    
                $this->_errors = array ();
    
    

      Function clonePosition has 50 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function clonePosition(element, source, options) {
              options = Object.extend({
                  setLeft:    true,
                  setTop:     true,
                  setWidth:   true,
      Severity: Minor
      Found in htdocs/install/prototype.js - About 2 hrs to fix

        Method separateStringsInSQL has 50 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function separateStringsInSQL($sql) {
                $sql = trim($sql);
                $sql_len = strlen($sql);
                $char = '';
                $string_start = '';

          Method b_system_comments_show has 50 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function b_system_comments_show($options) {
              $block = array();
              include_once ICMS_ROOT_PATH . '/include/comment_constants.php';
              $comment_handler = icms::handler('icms_data_comment');
              $criteria = new icms_db_criteria_Compo(new icms_db_criteria_Item('com_status', XOOPS_COMMENT_ACTIVE));
          Severity: Minor
          Found in htdocs/modules/system/blocks/system_blocks.php - About 2 hrs to fix

            Function Str has 49 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function Str(key, holder, stack) {
                    var value = holder[key];
                    if (Type(value) === OBJECT_TYPE && typeof value.toJSON === 'function') {
                        value = value.toJSON(key);
                    }
            Severity: Minor
            Found in htdocs/install/prototype.js - About 1 hr to fix

              Method apply_config has 49 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  function apply_config()
                  {
                      $xoopsDB = $GLOBALS['xoopsDB'];
              
                      $result = true;
              Severity: Minor
              Found in upgrade/cnt-2.2.x-to-2.0.x/index.php - About 1 hr to fix

                Method imanager_clone has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function imanager_clone() {
                    global $target, $type;
                
                    if (!icms::$security->check()) {
                        redirect_header('browser.php?op=list&target=' . $target . '&type=' . $type, 3, implode('<br />', icms::$security->getErrors()));
                Severity: Minor
                Found in htdocs/modules/system/admin/images/browser.php - About 1 hr to fix

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

                              'margin-box-height': function(element) {
                                  var bHeight = this.get('border-box-height'),
                                      mTop = this.get('margin-top'),
                                      mBottom = this.get('margin-bottom');
                  
                  
                  Severity: Major
                  Found in htdocs/install/prototype.js and 1 other location - About 1 hr to fix
                  htdocs/install/prototype.js on lines 3859..3867

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

                  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

                              'margin-box-width': function(element) {
                                  var bWidth = this.get('border-box-width'),
                                      mLeft = this.get('margin-left'),
                                      mRight = this.get('margin-right');
                  
                  
                  Severity: Major
                  Found in htdocs/install/prototype.js and 1 other location - About 1 hr to fix
                  htdocs/install/prototype.js on lines 3849..3857

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

                  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

                      $dbm->insert('config', " VALUES (" . ++$i . ",0,$c,'from','_MD_AM_MAILFROM','','_MD_AM_MAILFROMDESC','textbox','text', " . $p++ . ")"
                          . ", (" . ++$i . ",0,$c,'fromname','_MD_AM_MAILFROMNAME','','_MD_AM_MAILFROMNAMEDESC','textbox','text', " . $p++ . ")"
                      // RMV-NOTIFY... Need to specify which user is sender of notification PM
                          . ", (" . ++$i . ",0,$c,'fromuid','_MD_AM_MAILFROMUID','1','_MD_AM_MAILFROMUIDDESC','user','int', " . $p++ . ")"
                          . ", (" . ++$i . ",0,$c,'mailmethod','_MD_AM_MAILERMETHOD','mail','_MD_AM_MAILERMETHODDESC','select','text', " . $p++ . ")");
                  Severity: Major
                  Found in htdocs/install/makedata.php and 1 other location - About 1 hr to fix
                  htdocs/install/makedata.php on lines 451..454

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

                  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

                      $dbm->insert('config', " VALUES (" . ++$i . ",0,$c,'smtphost','_MD_AM_SMTPHOST','a:1:{i:0;s:0:\"\";}', '_MD_AM_SMTPHOSTDESC','textsarea','array', " . $p++ . ")"
                          . ", (" . ++$i . ",0,$c,'smtpuser','_MD_AM_SMTPUSER','','_MD_AM_SMTPUSERDESC','textbox','text', " . $p++ . ")"
                          . ", (" . ++$i . ",0,$c,'smtppass','_MD_AM_SMTPPASS','','_MD_AM_SMTPPASSDESC','password','text', " . $p++ . ")"
                          . ", (" . ++$i . ",0,$c,'smtpsecure','_MD_AM_SMTPSECURE','ssl','_MD_AM_SMTPSECUREDESC','select','text', " . $p++ . ")");
                  Severity: Major
                  Found in htdocs/install/makedata.php and 1 other location - About 1 hr to fix
                  htdocs/install/makedata.php on lines 440..444

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

                  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 (count($tplfile) == 0) {
                                                      $tplfile_new =& $tplfile_handler->create();
                                                      $tplfile_new->setVar('tpl_module', $dirname);
                                                      $tplfile_new->setVar('tpl_refid', (int) ($fblock['bid']));
                                                      $tplfile_new->setVar('tpl_tplset', 'default');
                  Severity: Major
                  Found in htdocs/install/modulesadmin.php and 1 other location - About 1 hr to fix
                  htdocs/modules/system/admin/modulesadmin/modulesadmin.php on lines 1076..1085

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

                  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 (count($tplfile) == 0) {
                                                      $tplfile_new = &$tplfile_handler->create();
                                                      $tplfile_new->setVar('tpl_module', $dirname);
                                                      $tplfile_new->setVar('tpl_refid', (int) $fblock['bid']);
                                                      $tplfile_new->setVar('tpl_tplset', 'default');
                  Severity: Major
                  Found in htdocs/modules/system/admin/modulesadmin/modulesadmin.php and 1 other location - About 1 hr to fix
                  htdocs/install/modulesadmin.php on lines 591..601

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

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

                  function imanager_clone() {
                      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 1 hr to fix

                    Function request has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                    Open

                        request: function(url) {
                            this.url = url;
                            this.method = this.options.method;
                            var params = Object.isString(this.options.parameters) ?
                                this.options.parameters :
                    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 setRequestHeaders has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                    Open

                        setRequestHeaders: function() {
                            var headers = {
                                'X-Requested-With': 'XMLHttpRequest',
                                'X-Prototype-Version': Prototype.Version,
                                'Accept': 'text/javascript, text/html, application/xml, text/xml, */*'
                    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

                    Severity
                    Category
                    Status
                    Source
                    Language