modxcms/revolution

View on GitHub
core/xpdo/revision/xpdorevisioncontrol.class.php

Summary

Maintainability
F
3 days
Test Coverage

Function diff has a Cognitive Complexity of 86 (exceeds 5 allowed). Consider refactoring.
Open

    function diff($text1, $text2) {
        $array1= $this->_split($text1);
        $array2= $this->_split($text2);

        /* Build up array with the line as key and a list of line numbers as value */
Severity: Minor
Found in core/xpdo/revision/xpdorevisioncontrol.class.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

Method diff has 117 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function diff($text1, $text2) {
        $array1= $this->_split($text1);
        $array2= $this->_split($text2);

        /* Build up array with the line as key and a list of line numbers as value */
Severity: Major
Found in core/xpdo/revision/xpdorevisioncontrol.class.php - About 4 hrs to fix

    Function patch has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

        function patch($text, $patch) {
            $array= $this->_split($text);
    
            /* Modify patch to an array so that it 
             * is compatible to the modification */
    Severity: Minor
    Found in core/xpdo/revision/xpdorevisioncontrol.class.php - About 3 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 patch has 74 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function patch($text, $patch) {
            $array= $this->_split($text);
    
            /* Modify patch to an array so that it 
             * is compatible to the modification */
    Severity: Major
    Found in core/xpdo/revision/xpdorevisioncontrol.class.php - About 2 hrs to fix

      Function restore has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          function restore($revisions= array (), $restore= 0) {
              reset($revisions);
              $restored= current($revisions);
              if ($restore && next($revisions)) {
                  while (list($k, $v)= each($revisions)) {
      Severity: Minor
      Found in core/xpdo/revision/xpdorevisioncontrol.class.php - About 45 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