chertokdmitry/project-lvl2-s277

View on GitHub

Showing 16 of 16 total issues

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

function dataOut($data, $action, $tree, $parent)
{
    static $counter;
    $counter++;
    $value = "";
Severity: Minor
Found in src/Viewjson.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 dataOut has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

function dataOut($data, $action, $tree, $parent)
{
    static $counter;
    $counter++;
    $result = '';
Severity: Minor
Found in src/Viewpretty.php - About 4 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 dataOut has 68 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function dataOut($data, $action, $tree, $parent)
{
    static $counter;
    $counter++;
    $value = "";
Severity: Major
Found in src/Viewjson.php - About 2 hrs to fix

    Function getChildren has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

    function getChildren($data, $file)
    {
        $func = function ($carry, $item) {
    
            if (is_array($item)) {
    Severity: Minor
    Found in src/Viewplain.php - About 2 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 diffAst has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

    function diffAst($beforeData, $afterData)
    {
        $ast = [];
        $depthOfData = setGetDepth($beforeData, $afterData, 'set');
        $before = $depthOfData[0];
    Severity: Minor
    Found in src/Differast.php - About 2 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 dataOut has 55 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function dataOut($data, $action, $tree, $parent)
    {
        static $counter;
        $counter++;
        $result = '';
    Severity: Major
    Found in src/Viewpretty.php - About 2 hrs to fix

      Function viewDiff has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

      function viewDiff($data, $file)
      {
          $func = function ($carry, $item) use ($file) {
              if (is_array($item)) {
                  $ak = array_keys($item);
      Severity: Minor
      Found in src/Viewplain.php - About 2 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 diffAst has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function diffAst($beforeData, $afterData)
      {
          $ast = [];
          $depthOfData = setGetDepth($beforeData, $afterData, 'set');
          $before = $depthOfData[0];
      Severity: Minor
      Found in src/Differast.php - About 1 hr to fix

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

        function viewDiff($data, $format)
        {
            if ($format == "pretty") {
                $dataOut = "Diff\Viewpretty\dataOut";
            }
        Severity: Minor
        Found in src/Mainview.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

        Function getChildren has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

        function getChildren($data, $dataOut, $parent)
        {
            $func = function ($carry, $item) use ($dataOut, $parent) {
        
                if (is_array($item)) {
        Severity: Minor
        Found in src/Mainview.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

        Function dataOut has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

        function dataOut($data, $action, $tree, $parent)
        {
            $result = '';
            $path = '';
            foreach ($parent as $value) {
        Severity: Minor
        Found in src/Viewcli.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 viewDiff has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function viewDiff($data, $format)
        {
            if ($format == "pretty") {
                $dataOut = "Diff\Viewpretty\dataOut";
            }
        Severity: Minor
        Found in src/Mainview.php - About 1 hr to fix

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

          function diff($files)
          {
              $before = $files[0];
              $after = $files[1];
              $union = Funct\Collection\union(array_keys($before), array_keys($after));
          Severity: Minor
          Found in src/Differ.php - About 1 hr to fix

            Method newNodeAst has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            function newNodeAst($key, $status, $beforeVal, $afterVal, $tree, $children)
            Severity: Minor
            Found in src/Differast.php - About 45 mins to fix

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

              function diff($files)
              {
                  $before = $files[0];
                  $after = $files[1];
                  $union = Funct\Collection\union(array_keys($before), array_keys($after));
              Severity: Minor
              Found in src/Differ.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 objToArray has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              function objToArray($obj)
              {
                  if (is_object($obj)) {
                      $obj = (array) $obj;
                  }
              Severity: Minor
              Found in src/Parser.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

              Severity
              Category
              Status
              Source
              Language