ImpressCMS/impresscms

View on GitHub

Showing 47,251 of 47,256 total issues

Function xoopsCodeUrl has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

function xoopsCodeUrl(id, enterUrlPhrase, enterWebsitePhrase){
    if (enterUrlPhrase == null) {
        enterUrlPhrase = "Enter the URL of the link you want to add:";
    }
    var text = prompt(enterUrlPhrase, "");
Severity: Minor
Found in htdocs/include/xoops.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 lastday has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

function lastday ($month,$day,$year) {
    $lastdayen=date('d',mktime(0,0,0,$month+1,0,$year));
    list( $jyear, $jmonth, $jday ) = gregorian_to_jalali($year, $month, $day);
    $lastdatep=$jday;
    while ($jday!='1')
Severity: Minor
Found in htdocs/include/jalali.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 showNav has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

function showNav($id = null, $separador = '/', $style="style='font-weight:bold'")
{
    $url = ICMS_URL.'/content.php';
    if($id == false) {return false;}
    else
Severity: Minor
Found in htdocs/include/functions.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 draw_repost_form has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

        function draw_repost_form($area = '') {
            // Notify which file is broken
            if (headers_sent()) {
                restore_error_handler();
                set_error_handler(array (

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

function editblock($bid = 0, $clone = FALSE) {
    global $icms_block_handler, $icmsAdminTpl;

    $blockObj = $icms_block_handler->get($bid);

Severity: Minor
Found in htdocs/modules/system/admin/blocksadmin/main.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

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

    this.hide = document.layers ? 
        function (div) { this.divs[div].visibility = 'hide' } :
        function (div) { this.divs[div].visibility = 'hidden' };
Severity: Major
Found in htdocs/include/color-picker.js and 1 other location - About 1 hr to fix
htdocs/include/color-picker.js on lines 130..132

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

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

function b_system_admin_cp_new_show() {
    global $icmsTpl, $icmsConfig;

    $block['lang_cp'] = _CPHOME;

Severity: Minor
Found in htdocs/modules/system/blocks/system_admin_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

Function b_system_admin_cp_show has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

function b_system_admin_cp_show() {
    global $icmsTpl, $icmsConfig;

    $block['lang_cp'] = _CPHOME;
    $block['lang_insmodules'] = _AD_INSTALLEDMODULES;
Severity: Minor
Found in htdocs/modules/system/blocks/system_admin_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

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

    this.show = document.layers ? 
        function (div) { this.divs[div].visibility = 'show' } :
        function (div) { this.divs[div].visibility = 'visible' };
Severity: Major
Found in htdocs/include/color-picker.js and 1 other location - About 1 hr to fix
htdocs/include/color-picker.js on lines 133..135

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

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

        _begin: function() {
            if (this._isPrepared()) return;

            var element = this.element;
            if (isDisplayed(element)) {
Severity: Minor
Found in htdocs/install/prototype.js - About 1 hr to fix

    Method disable_features has 43 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function disable_features() {
    
            // disable "Notice: Undefined index: ..."
            $error_reporting_level = error_reporting(0);
    
    

      Method convert_table has 42 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function convert_table($tables, $charset, $collation) {
              // Initialize vars.
              $string_querys = array();
              $binary_querys = array();
              $gen_index_querys = array();
      Severity: Minor
      Found in upgrade/upd-icms-1.0-to-1.1/index.php - About 1 hr to fix

        Method icms_wordwrap has 42 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function icms_wordwrap($str, $width, $break = '/n', $cut = false)
        {
            if(strtolower(_CHARSET) !== 'utf-8')
            {
                $str = wordwrap($str, $width, $break, $cut);
        Severity: Minor
        Found in htdocs/include/functions.php - About 1 hr to fix

          Method editform has 42 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function editform() {
                  $ret =
                      "<table width='100%' class='outer' cellspacing='5'>
                          <tr>
                              <th colspan='2'></th>
          Severity: Minor
          Found in htdocs/install/class/settingmanager.php - About 1 hr to fix

            Consider simplifying this complex logical expression.
            Open

                if ( text != null && text != "" ) {
                    if (enterImgPosPhrase == null) {
                        enterImgPosPhrase = "Now, enter the position of the image.";
                    }
                    if (imgPosRorLPhrase == null) {
            Severity: Critical
            Found in htdocs/include/xoops.js - About 1 hr to fix

              Avoid excessively long variable names like $passwordmeter_installed. Keep variable name length under 20.
              Open

                      $passwordmeter_installed = false;
              Severity: Minor
              Found in upgrade/upd-icms-1.0-to-1.1/index.php by phpmd

              LongVariable

              Since: 0.2

              Detects when a field, formal or local variable is declared with a long name.

              Example

              class Something {
                  protected $reallyLongIntName = -3; // VIOLATION - Field
                  public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                      $otherReallyLongName = -5; // VIOLATION - Local
                      for ($interestingIntIndex = 0; // VIOLATION - For
                           $interestingIntIndex < 10;
                           $interestingIntIndex++ ) {
                      }
                  }
              }

              Source https://phpmd.org/rules/naming.html#longvariable

              Avoid excessively long variable names like $decimal_section_original. Keep variable name length under 20.
              Open

                  $decimal_section_original = strstr($ret, '.');
              Severity: Minor
              Found in htdocs/include/functions.php by phpmd

              LongVariable

              Since: 0.2

              Detects when a field, formal or local variable is declared with a long name.

              Example

              class Something {
                  protected $reallyLongIntName = -3; // VIOLATION - Field
                  public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                      $otherReallyLongName = -5; // VIOLATION - Local
                      for ($interestingIntIndex = 0; // VIOLATION - For
                           $interestingIntIndex < 10;
                           $interestingIntIndex++ ) {
                      }
                  }
              }

              Source https://phpmd.org/rules/naming.html#longvariable

              Avoid excessively long variable names like $reversed_module_admin_menu. Keep variable name length under 20.
              Open

                                      $reversed_module_admin_menu[] = $m['subs'][$i];
              Severity: Minor
              Found in htdocs/include/cp_functions.php by phpmd

              LongVariable

              Since: 0.2

              Detects when a field, formal or local variable is declared with a long name.

              Example

              class Something {
                  protected $reallyLongIntName = -3; // VIOLATION - Field
                  public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                      $otherReallyLongName = -5; // VIOLATION - Local
                      for ($interestingIntIndex = 0; // VIOLATION - For
                           $interestingIntIndex < 10;
                           $interestingIntIndex++ ) {
                      }
                  }
              }

              Source https://phpmd.org/rules/naming.html#longvariable

              Avoid excessively long variable names like $icms_customtag_handler. Keep variable name length under 20.
              Open

                  $icms_customtag_handler = icms_getModuleHandler("customtag", "system");
              Severity: Minor
              Found in htdocs/include/functions.php by phpmd

              LongVariable

              Since: 0.2

              Detects when a field, formal or local variable is declared with a long name.

              Example

              class Something {
                  protected $reallyLongIntName = -3; // VIOLATION - Field
                  public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                      $otherReallyLongName = -5; // VIOLATION - Local
                      for ($interestingIntIndex = 0; // VIOLATION - For
                           $interestingIntIndex < 10;
                           $interestingIntIndex++ ) {
                      }
                  }
              }

              Source https://phpmd.org/rules/naming.html#longvariable

              Avoid excessively long variable names like $welcome_webmaster_filename. Keep variable name length under 20.
              Open

                  $welcome_webmaster_filename = 'language/' . $language . '/welcome_webmaster.tpl';
              Severity: Minor
              Found in htdocs/install/makedata.php by phpmd

              LongVariable

              Since: 0.2

              Detects when a field, formal or local variable is declared with a long name.

              Example

              class Something {
                  protected $reallyLongIntName = -3; // VIOLATION - Field
                  public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                      $otherReallyLongName = -5; // VIOLATION - Local
                      for ($interestingIntIndex = 0; // VIOLATION - For
                           $interestingIntIndex < 10;
                           $interestingIntIndex++ ) {
                      }
                  }
              }

              Source https://phpmd.org/rules/naming.html#longvariable

              Severity
              Category
              Status
              Source
              Language