xoopscube/altsys

View on GitHub

Showing 242 of 242 total issues

Function _tool_TranslateWinPath has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  public function _tool_TranslateWinPath($p_path, $p_remove_disk_letter=true)
  {
      if (mb_stristr(php_uname(), 'windows')) {
      // ----- Look for potential disk letter
      if (($p_remove_disk_letter)
Severity: Minor
Found in xoops_trust_path/libs/altsys/include/Archive_Zip.php - About 35 mins 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 errorName has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function errorName($p_with_code=false)
    {
        $v_const_list = get_defined_constants();

          // ----- Extract error constants from all const.
Severity: Minor
Found in xoops_trust_path/libs/altsys/include/Archive_Zip.php - About 35 mins 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 altsys_clear_templates_c has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

function altsys_clear_templates_c() {
    $dh = opendir( XOOPS_COMPILE_PATH );
    while ( $file = readdir( $dh ) ) {

        if ( '.' == substr( $file, 0, 1 ) ) {
Severity: Minor
Found in xoops_trust_path/libs/altsys/include/altsys_functions.php - About 35 mins 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 duplicate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function duplicate($p_archive)
    {
        $this->_errorReset();

        // ----- Look if the $p_archive is a Archive_Zip object
Severity: Minor
Found in xoops_trust_path/libs/altsys/include/Archive_Zip.php - About 35 mins 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 _readFileHeader has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  public function _readFileHeader(&$p_header)
  {
      $v_result=1;

    // ----- Read the 4 bytes signature
Severity: Minor
Found in xoops_trust_path/libs/altsys/include/Archive_Zip.php - About 35 mins 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 _check has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function _check( $from_lines, $to_lines ) {
        if ( serialize( $from_lines ) != serialize( $this->getOriginal() ) ) {
            trigger_error( "Reconstructed original doesn't match", E_USER_ERROR );
        }
        if ( serialize( $to_lines ) != serialize( $this->getFinal() ) ) {
Severity: Minor
Found in xoops_trust_path/libs/altsys/include/Text_Diff.php - About 35 mins 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 altsys_message_append_oninstall has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

        function altsys_message_append_oninstall( &$module_obj, &$log ) {
            if ( is_array( @$GLOBALS['ret'] ) ) {
                foreach ( $GLOBALS['ret'] as $message ) {
                    $log->add( strip_tags( $message ) );
                }
Severity: Minor
Found in xoops_trust_path/libs/altsys/oninstall.php - About 35 mins 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 init has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function init( $xoopsModule ) {
        // altsys "module" MODE

        if ( 'altsys' == $xoopsModule->getVar( 'dirname' ) ) {
            // set target_module if specified by $_GET['dirname']
Severity: Minor
Found in xoops_trust_path/libs/altsys/class/MyBlocksAdmin.class.php - About 35 mins 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 do_edit has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function do_edit( $bid ) {
        $bid = (int) $bid;

        if ( $bid <= 0 ) {
            // new custom block
Severity: Minor
Found in xoops_trust_path/libs/altsys/class/MyBlocksAdmin.class.php - About 35 mins 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 list_blocks has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function list_blocks() {
        global $xoopsGTicket;

        // main query
        $sql       = 'SELECT * FROM ' . $this->db->prefix( 'newblocks' ) . " WHERE mid='$this->target_mid' ORDER BY visible DESC,side,weight";
Severity: Minor
Found in xoops_trust_path/libs/altsys/class/MyBlocksAdmin.class.php - About 35 mins 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 isInstalledXclHtmleditor has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public static function isInstalledXclHtmleditor(): bool
    {
        if (defined('LEGACY_BASE_VERSION') && version_compare(LEGACY_BASE_VERSION, '2.2', '>=')) {
            $cNames = self::getDelegateCallbackClassNames('Site.TextareaEditor.HTML.Show');
            if ($cNames) {
Severity: Minor
Found in xoops_trust_path/libs/altsys/class/altsysUtils.class.php - About 35 mins 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

if ( ! empty( $_POST['as_dw_extension_zip'] ) ) {
    require_once XOOPS_ROOT_PATH . '/class/zipdownloader.php';
    $downloader  = new XoopsZipDownloader();
    $do_download = true;
} elseif ( ! empty( $_POST['as_dw_extension_tgz'] ) ) {
Severity: Minor
Found in xoops_trust_path/libs/altsys/get_tplsvarsinfo.php and 1 other location - About 30 mins to fix
xoops_trust_path/libs/altsys/get_templates.php on lines 28..36

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

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 ( ! empty( $_POST['download_zip'] ) ) {
    require_once XOOPS_ROOT_PATH . '/class/zipdownloader.php';
    $downloader  = new XoopsZipDownloader();
    $do_download = true;
} elseif ( ! empty( $_POST['download_tgz'] ) ) {
Severity: Minor
Found in xoops_trust_path/libs/altsys/get_templates.php and 1 other location - About 30 mins to fix
xoops_trust_path/libs/altsys/get_tplsvarsinfo.php on lines 181..189

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

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

    foreach ( explode( "\n", $diff_str ) as $line ) {
        if ( 0x2d == ord( $line ) ) {
            $diff_from_file4disp .= "<span style='color:var(--color-red);'>" . $line . "</span>\n";
        } elseif ( 0x2b == ord( $line ) ) {
            $diff_from_file4disp .= "<span style='color:var(--color-green);'>" . $line . "</span>\n";
Severity: Minor
Found in xoops_trust_path/libs/altsys/mytplsform.php and 1 other location - About 30 mins to fix
xoops_trust_path/libs/altsys/mytplsform.php on lines 232..240

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

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

    foreach ( explode( "\n", $diff_str ) as $line ) {
        if ( 0x2d == ord( $line ) ) {
            $diff_from_default4disp .= "<span style='color:var(--color-red);'>" . $line . "</span>\n";
        } elseif ( 0x2b == ord( $line ) ) {
            $diff_from_default4disp .= "<span style='color:var(--color-blue);'>" . $line . "</span>\n";
Severity: Minor
Found in xoops_trust_path/libs/altsys/mytplsform.php and 1 other location - About 30 mins to fix
xoops_trust_path/libs/altsys/mytplsform.php on lines 211..219

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

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

Avoid too many return statements within this method.
Open

    return $v_result;
Severity: Major
Found in xoops_trust_path/libs/altsys/include/Archive_Zip.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

        return $v_result;
    Severity: Major
    Found in xoops_trust_path/libs/altsys/include/Archive_Zip.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                  return $v_result;
      Severity: Major
      Found in xoops_trust_path/libs/altsys/include/Archive_Zip.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                      return $v_result;
        Severity: Major
        Found in xoops_trust_path/libs/altsys/include/Archive_Zip.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                      return;
          Severity: Major
          Found in xoops_trust_path/libs/altsys/get_tplsvarsinfo.php - About 30 mins to fix
            Severity
            Category
            Status
            Source
            Language