Tazya/php-project-lvl2

View on GitHub

Showing 10 of 10 total issues

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

function makeAst($firstProperties, $secondProperties)
{
    $allKeys = array_unique(
        array_merge(
            array_keys($firstProperties),
Severity: Minor
Found in src/differ.php - About 1 hr to fix

    Method renderPrettyDiff has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function renderPrettyDiff($ast)
    {
        $iter = function ($ast, $depth = 1) use (&$iter) {
            $diffs = array_map(function ($elem) use (&$iter, $depth) {
                $name = $elem['name'];
    Severity: Minor
    Found in src/Formatters/pretty.php - About 1 hr to fix

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

      function renderPlainDiff($ast)
      {
          $iter = function ($ast, $parents = []) use (&$iter) {
              $filteredAst = array_filter($ast, fn($elem) => $elem['type'] !== "unchanged");
      
      
      Severity: Minor
      Found in src/Formatters/plain.php - About 1 hr to fix

        Avoid too many return statements within this method.
        Open

                            return "$indentStr+ $name: $newValue\n$indentStr- $name: $oldValue";
        Severity: Major
        Found in src/Formatters/pretty.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                  return implode("\n", $diffs);
          Severity: Major
          Found in src/Formatters/plain.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                return array_values($ast);
            Severity: Major
            Found in src/differ.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                  return $diff;
              Severity: Major
              Found in src/Formatters/plain.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                    return $diff;
                Severity: Major
                Found in src/Formatters/pretty.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                          return "{\n" . implode("\n", $diffs) . "\n$shortIndentStr}";
                  Severity: Major
                  Found in src/Formatters/pretty.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                return [
                                    'name' => $key,
                                    'type' => 'changed',
                                    'newValue' => $secondProperty,
                                    'oldValue' => $firstProperty
                    Severity: Major
                    Found in src/differ.php - About 30 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language