fisharebest/webtrees

View on GitHub

Showing 1,726 of 2,403 total issues

Avoid deeply nested control flow statements.
Open

                            while (true) {
                                if ($workingText === '') {
                                    break;
                                }
                                if (str_starts_with($workingText, ' ')) {
Severity: Major
Found in app/Report/RightToLeftSupport.php - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                                if (self::$currentState === 'RTL') {
                                    break;
                                }
    Severity: Major
    Found in app/Report/RightToLeftSupport.php - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                                  if (!empty($openParDirection[$closeParIndex]) && $openParDirection[$closeParIndex] !== '?') {
                                      $newState = $openParDirection[$closeParIndex];
                                  }
      Severity: Major
      Found in app/Report/RightToLeftSupport.php - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                if (str_ends_with($textSpan, ' ')) {
                                    $trailingSeparator = ' ' . $trailingSeparator;
                                    $textSpan          = substr($textSpan, 0, -1);
                                    continue;
                                }
        Severity: Major
        Found in app/Report/RightToLeftSupport.php - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                  if (str_ends_with($textSpan, ' ')) {
                                      $trailingString = ' ' . $trailingString;
                                      $textSpan       = substr($textSpan, 0, -1);
                                      continue;
                                  }
          Severity: Major
          Found in app/Report/RightToLeftSupport.php - About 45 mins to fix

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

                private function ageBetweenSiblingsList(int $total, bool $one): array
                {
                    $rows  = $this->ageBetweenSiblingsQuery($total);
                    $top10 = [];
                    $dist  = [];
            Severity: Minor
            Found in app/Statistics/Repository/FamilyRepository.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

            Avoid deeply nested control flow statements.
            Open

                                        if (self::$currentState === 'RTL') {
                                            $currentLetter = self::UTF8_LRE . $currentLetter;
                                        }
            Severity: Major
            Found in app/Report/RightToLeftSupport.php - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                      if (str_ends_with($textSpan, ' ')) {
                                          $trailingString = ' ' . $trailingString;
                                          $textSpan       = substr($textSpan, 0, -1);
                                          continue;
                                      }
              Severity: Major
              Found in app/Report/RightToLeftSupport.php - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                        if (str_ends_with($textSpan, ' ')) {
                                            $trailingString = ' ' . $trailingString;
                                            $textSpan       = substr($textSpan, 0, -1);
                                            continue;
                                        }
                Severity: Major
                Found in app/Report/RightToLeftSupport.php - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                          if (str_ends_with($textSpan, ' ')) {
                                              $trailingString = ' ' . $trailingString;
                                              $textSpan       = substr($textSpan, 0, -1);
                                              continue;
                                          }
                  Severity: Major
                  Found in app/Report/RightToLeftSupport.php - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                            if (str_ends_with($textSpan, '-')) {
                                                $trailingSeparator = '-' . $trailingSeparator;
                                                $textSpan          = substr($textSpan, 0, -1);
                                                continue;
                                            }
                    Severity: Major
                    Found in app/Report/RightToLeftSupport.php - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                                  if (substr($workingText . "\n", $offset, 6) === ' ') {
                                                      $offset += 6; // This could be numeric punctuation
                                                  } elseif (str_contains(self::NUMBER_PUNCTUATION, $charArray['letter'])) {
                                                      $offset += $charArray['length']; // This could be numeric punctuation
                                                  }
                      Severity: Major
                      Found in app/Report/RightToLeftSupport.php - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                                    while ($tempText !== '') {
                                                        $nextCharArray = self::getChar($tempText, 0);
                                                        $nextLetter    = $nextCharArray['letter'];
                                                        $nextLen       = $nextCharArray['length'];
                                                        $tempText      = substr($tempText, $nextLen);
                        Severity: Major
                        Found in app/Report/RightToLeftSupport.php - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                                  if (str_ends_with($textSpan, ' ')) {
                                                      $trailingBlanks = ' ' . $trailingBlanks;
                                                      $textSpan       = substr($textSpan, 0, -1);
                                                      continue;
                                                  }
                          Severity: Major
                          Found in app/Report/RightToLeftSupport.php - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                                        if (empty($subrec)) {
                                                            $level--;
                                                            $subrec = self::getSubRecord($level, "@ $t", $this->gedrec);
                                                            if (empty($subrec)) {
                                                                return;
                            Severity: Major
                            Found in app/Report/ReportParserGenerate.php - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                                                  if (!empty($searchstr)) {
                                                                      $searchstr .= "[^\n]*(\n[2-9][^\n]*)*\n";
                                                                  }
                              Severity: Major
                              Found in app/Report/ReportParserGenerate.php - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                                                if ($match[1] != '') {
                                                                    $names = explode(' ', $match[1]);
                                                                    foreach ($names as $name) {
                                                                        $query->where($attr . '.n_full', 'LIKE', '%' . addcslashes($name, '\\%_') . '%');
                                                                    }
                                Severity: Major
                                Found in app/Report/ReportParserGenerate.php - About 45 mins to fix

                                  Avoid deeply nested control flow statements.
                                  Open

                                                                      if ($t === 'EMAIL' || $t === '_EMAIL') {
                                                                          $t = '_?EMAIL';
                                                                      }
                                  Severity: Major
                                  Found in app/Report/ReportParserGenerate.php - About 45 mins to fix

                                    Avoid deeply nested control flow statements.
                                    Open

                                                                    if ($tag === 'EMAIL' || $tag === '_EMAIL') {
                                                                        $tag = '_?EMAIL';
                                                                    }
                                    Severity: Major
                                    Found in app/Report/ReportParserGenerate.php - About 45 mins to fix

                                      Avoid deeply nested control flow statements.
                                      Open

                                                                  switch ($expr) {
                                                                      case 'CONTAINS':
                                                                          if ($t === 'PLAC') {
                                                                              $searchstr .= "[^\n]*[, ]*" . $val;
                                                                          } else {
                                      Severity: Major
                                      Found in app/Report/ReportParserGenerate.php - About 45 mins to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language