xoopscube/altsys

View on GitHub
xoops_trust_path/libs/altsys/include/Text_Diff.php

Summary

Maintainability
F
4 days
Test Coverage

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 _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

    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

    Method diff has 75 lines of code (exceeds 25 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: Major
    Found in xoops_trust_path/libs/altsys/include/Text_Diff.php - About 3 hrs to fix

      Method _shiftBoundaries has 65 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function _shiftBoundaries( $lines, &$changed, $other_changed ) {
              $i = 0;
              $j = 0;
      
              assert( count( $lines ) == count( $changed ) );
      Severity: Major
      Found in xoops_trust_path/libs/altsys/include/Text_Diff.php - About 2 hrs to fix

        Method _diag has 63 lines of code (exceeds 25 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: Major
        Found in xoops_trust_path/libs/altsys/include/Text_Diff.php - About 2 hrs to fix

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

              public function _compareseq( $xoff, $xlim, $yoff, $ylim ) {
                  /* Slide down the bottom initial diagonal. */
                  while ( $xoff < $xlim && $yoff < $ylim
                          && $this->xv[ $xoff ] == $this->yv[ $yoff ] ) {
                      ++ $xoff;
          Severity: Minor
          Found in xoops_trust_path/libs/altsys/include/Text_Diff.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

          Method _compareseq has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function _compareseq( $xoff, $xlim, $yoff, $ylim ) {
                  /* Slide down the bottom initial diagonal. */
                  while ( $xoff < $xlim && $yoff < $ylim
                          && $this->xv[ $xoff ] == $this->yv[ $yoff ] ) {
                      ++ $xoff;
          Severity: Minor
          Found in xoops_trust_path/libs/altsys/include/Text_Diff.php - About 1 hr to fix

            Method _diag has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                public function _diag( $xoff, $xlim, $yoff, $ylim, $nchunks ) {
            Severity: Minor
            Found in xoops_trust_path/libs/altsys/include/Text_Diff.php - About 35 mins to fix

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

                  public function _lcsPos( $ypos ) {
                      $end = $this->lcs;
                      if ( 0 == $end || $ypos > $this->seq[ $end ] ) {
                          $this->seq[ ++ $this->lcs ] = $ypos;
                          $this->in_seq[ $ypos ]      = 1;
              Severity: Minor
              Found in xoops_trust_path/libs/altsys/include/Text_Diff.php - About 25 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

              There are no issues that match your filters.

              Category
              Status