xoopscube/altsys

View on GitHub

Showing 242 of 242 total issues

Function altsys_oninstall_base has a Cognitive Complexity of 63 (exceeds 5 allowed). Consider refactoring.
Open

        function altsys_oninstall_base( $module, $mydirname ) {
            // transactions on module install

            global $ret; // TODO :-D

Severity: Minor
Found in xoops_trust_path/libs/altsys/oninstall.php - About 1 day 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 4 locations. Consider refactoring.
Open

<?php

define( '_MYLANGADMIN_H3_MODULE' , '言語定数操作対象モジュール');
define( '_MYLANGADMIN_CACHEUPDATED' , '言語キャッシュを更新しました');
define( '_MYLANGADMIN_BTN_UPDATE' , '更新');
xoops_trust_path/libs/altsys/language/english/mylangadmin.php on lines 1..27
xoops_trust_path/libs/altsys/language/fr_utf8/mylangadmin.php on lines 1..27
xoops_trust_path/libs/altsys/language/pt_utf8/mylangadmin.php on lines 1..23

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

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

<?php

define( '_MYLANGADMIN_H3_MODULE' , 'Target module');
define( '_MYLANGADMIN_CACHEUPDATED' , 'The cache file has been updated');
define( '_MYLANGADMIN_BTN_UPDATE' , 'Update');
xoops_trust_path/libs/altsys/language/fr_utf8/mylangadmin.php on lines 1..27
xoops_trust_path/libs/altsys/language/ja_utf8/mylangadmin.php on lines 1..27
xoops_trust_path/libs/altsys/language/pt_utf8/mylangadmin.php on lines 1..23

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

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

<?php

define( '_MYLANGADMIN_H3_MODULE' , 'Module cible');
define( '_MYLANGADMIN_CACHEUPDATED' , 'Le fichier de cache a été mis à jour');
define( '_MYLANGADMIN_BTN_UPDATE' , 'Mise à jour');
xoops_trust_path/libs/altsys/language/english/mylangadmin.php on lines 1..27
xoops_trust_path/libs/altsys/language/ja_utf8/mylangadmin.php on lines 1..27
xoops_trust_path/libs/altsys/language/pt_utf8/mylangadmin.php on lines 1..23

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

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

<?php
// $Id: mylangadmin.php 1040 2011-11-06 05:24:00Z mikhail $
// License http://creativecommons.org/licenses/by/2.5/br/
define( '_MYLANGADMIN_BTN_RESET' , "Redefinir");
define( '_MYLANGADMIN_BTN_UPDATE' , "Atualizar");
xoops_trust_path/libs/altsys/language/english/mylangadmin.php on lines 1..27
xoops_trust_path/libs/altsys/language/fr_utf8/mylangadmin.php on lines 1..27
xoops_trust_path/libs/altsys/language/ja_utf8/mylangadmin.php on lines 1..27

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

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

  public function _extractFile(&$p_entry, $p_path, $p_remove_path, $p_remove_all_path, &$p_params)
  {
      $v_result=1;

    // ----- Read the file header
Severity: Minor
Found in xoops_trust_path/libs/altsys/include/Archive_Zip.php - About 1 day 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 _addFile has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring.
Open

  public function _addFile($p_filename, &$p_header, $p_add_dir, $p_remove_dir, $p_remove_all_dir, &$p_params)
  {
      $v_result=1;

      if ('' == $p_filename) {
Severity: Minor
Found in xoops_trust_path/libs/altsys/include/Archive_Zip.php - About 1 day 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

    if ( $handler = @opendir( $tplsadmin_autoupdate_path . '/' ) ) {
        while ( false !== ( $file = readdir( $handler ) ) ) {
            $file_path = $tplsadmin_autoupdate_path . '/' . $file;
            /**
             * Import CSS
xoops_trust_path/libs/altsys/include/autoupdate_from_module.inc.php on lines 50..62
xoops_trust_path/libs/altsys/include/autoupdate_from_theme.inc.php on lines 19..35

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

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

    if ( $handler = @opendir( $tplsadmin_autoupdate_path . '/blocks/' ) ) {
        while ( false !== ( $file = readdir( $handler ) ) ) {
            $file_path = $tplsadmin_autoupdate_path . '/blocks/' . $file;
            if ( is_file( $file_path ) && '.html' == substr( $file, - 5 ) ) {
                $mtime = (int) @filemtime( $file_path );
xoops_trust_path/libs/altsys/include/autoupdate_from_module.inc.php on lines 30..47
xoops_trust_path/libs/altsys/include/autoupdate_from_theme.inc.php on lines 19..35

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

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

if ( $handler = @opendir( $tplsadmin_autoupdate_path . '/' ) ) {
    while ( false !== ( $file = readdir( $handler ) ) ) {
        $file_path = $tplsadmin_autoupdate_path . '/' . $file;

        if ( is_file( $file_path ) && '.tpl' == substr( $file, - 5 ) ) {
xoops_trust_path/libs/altsys/include/autoupdate_from_module.inc.php on lines 30..47
xoops_trust_path/libs/altsys/include/autoupdate_from_module.inc.php on lines 50..62

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

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

File Text_Diff.php has 456 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 *  @brief XCL/PHP7 @gigamaster replace 'each' (deprecated) with foreach
 *
 * Text_Diff
Severity: Minor
Found in xoops_trust_path/libs/altsys/include/Text_Diff.php - About 6 hrs to fix

    Function check has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
    Open

            public function check(bool $post = true, string $area = '', bool $allow_repost = true ) {
                global $xoopsModule;
    
                $this->_errors = [];
    
    
    Severity: Minor
    Found in xoops_trust_path/libs/altsys/include/gtickets.php - About 6 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

    Method _deleteByRule has 161 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      public function _deleteByRule(&$p_result_list, &$p_params)
      {
          $v_result=1;
          $v_list_detail = [];
    
    
    Severity: Major
    Found in xoops_trust_path/libs/altsys/include/Archive_Zip.php - About 6 hrs to fix

      Function _shiftBoundaries has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
      Open

          public function _shiftBoundaries( $lines, &$changed, $other_changed ) {
              $i = 0;
              $j = 0;
      
              assert( count( $lines ) == count( $changed ) );
      Severity: Minor
      Found in xoops_trust_path/libs/altsys/include/Text_Diff.php - About 6 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

      Archive_Zip has 43 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class Archive_Zip
      {
          /**
          * The filename of the zip archive.
          *
      Severity: Minor
      Found in xoops_trust_path/libs/altsys/include/Archive_Zip.php - About 5 hrs to fix

        Function _diag has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
        Open

            public function _diag( $xoff, $xlim, $yoff, $ylim, $nchunks ) {
                $flip = false;
        
                if ( $xlim - $xoff > $ylim - $yoff ) {
                    /* Things seems faster (I'm not sure I understand why) when the
        Severity: Minor
        Found in xoops_trust_path/libs/altsys/include/Text_Diff.php - About 5 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 diff has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
        Open

            public function diff( $from_lines, $to_lines ) {
                $n_from = count( $from_lines );
                $n_to   = count( $to_lines );
        
                $this->xchanged = $this->ychanged = [];
        Severity: Minor
        Found in xoops_trust_path/libs/altsys/include/Text_Diff.php - About 5 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 2 locations. Consider refactoring.
        Open

              elseif ((isset($p_params[ARCHIVE_ZIP_PARAM_BY_INDEX]))
                       && (0 != $p_params[ARCHIVE_ZIP_PARAM_BY_INDEX])) {
        
                  // ----- Look if the index is in the list
                  for ($j=$j_start; ($j < count($p_params[ARCHIVE_ZIP_PARAM_BY_INDEX])) && (!$v_extract); $j++) {
        Severity: Major
        Found in xoops_trust_path/libs/altsys/include/Archive_Zip.php and 1 other location - About 5 hrs to fix
        xoops_trust_path/libs/altsys/include/Archive_Zip.php on lines 2750..2770

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

        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

              elseif ((isset($p_params[ARCHIVE_ZIP_PARAM_BY_INDEX]))
                       && (0 != $p_params[ARCHIVE_ZIP_PARAM_BY_INDEX])) {
        
                  // ----- Look if the index is in the list
                  for ($j=$j_start;
        Severity: Major
        Found in xoops_trust_path/libs/altsys/include/Archive_Zip.php and 1 other location - About 5 hrs to fix
        xoops_trust_path/libs/altsys/include/Archive_Zip.php on lines 1895..1911

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

        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 ($p_header['mdate'] && $p_header['mtime']) {
                // ----- Extract time
              $v_hour = ($p_header['mtime'] & 0xF800) >> 11;
                $v_minute = ($p_header['mtime'] & 0x07E0) >> 5;
                $v_seconde = ($p_header['mtime'] & 0x001F)*2;
        Severity: Major
        Found in xoops_trust_path/libs/altsys/include/Archive_Zip.php and 1 other location - About 4 hrs to fix
        xoops_trust_path/libs/altsys/include/Archive_Zip.php on lines 2355..2370

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

        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