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 491 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Text_Diff
 *
 * General API for generating and formatting diffs - the differences between
Severity: Minor
Found in xoops_trust_path/libs/altsys/include/Text_Diff.php - About 7 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;
    
    
    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) {
    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);
    
    
    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 76 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);
    
    
    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;
      
      
      Severity: Major
      Found in xoops_trust_path/libs/altsys/include/Text_Diff.php - About 2 hrs to fix

        Method _diag has 64 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function _diag($xoff, $xlim, $yoff, $ylim, $nchunks)
            {
                $flip = false;
        
                if ($xlim - $xoff > $ylim - $yoff) {
        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]) {
          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 32 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]) {
          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);
                      }
              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 ($end == 0 || $ypos > $this->seq[$end]) {
                          $this->seq[++$this->lcs] = $ypos;
              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