fisharebest/webtrees

View on GitHub

Showing 1,726 of 2,403 total issues

Avoid deeply nested control flow statements.
Open

                                if ($first === 'sis' && $sex1 === 'M') {
                                    return I18N::translateContext('(a man’s) sister’s great ×(%s-1) granddaughter', 'great ×%s niece', I18N::number($down - 1));
                                }
Severity: Major
Found in app/Services/RelationshipService.php - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                                    switch ($event->tag()) {
                                        case 'FAM:ANUL':
                                        case 'FAM:DIV':
                                            return I18N::translate('ex-spouse');
                                        case 'FAM:MARR':
    Severity: Major
    Found in app/Services/RelationshipService.php - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                                      if ($first === 'sis' && $sex1 === 'M') {
                                          return I18N::translateContext('(a man’s) sister’s great ×(%s-1) granddaughter', 'great ×%s niece', I18N::number($down - 3));
                                      }
      Severity: Major
      Found in app/Services/RelationshipService.php - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                        if ($first === 'sis' && $sex1 === 'M') {
                                            return I18N::translateContext('(a man’s) sister’s great ×(%s-1) granddaughter', 'great ×%s niece', I18N::number($down - 3));
                                        }
        Severity: Major
        Found in app/Services/RelationshipService.php - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                          if ($first === 'sis' && $sex1 === 'M') {
                                              return I18N::translateContext('(a man’s) sister’s great ×(%s-1) grandson', 'great ×%s nephew', I18N::number($down - 1));
                                          }
          Severity: Major
          Found in app/Services/RelationshipService.php - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                            if ($first === 'bro' && $sex1 === 'M') {
                                                return I18N::translateContext('(a man’s) brother’s great ×(%s-1) grandson', 'great ×%s nephew', I18N::number($down - 1));
                                            }
            Severity: Major
            Found in app/Services/RelationshipService.php - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                              if ($bef_last === 'fat') {
                                                  return I18N::translateContext('great ×(%s-1) grandfather’s brother', 'great ×%s uncle', I18N::number($up - 2));
                                              }
              Severity: Major
              Found in app/Services/RelationshipService.php - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                                if ($first === 'bro' && $sex1 === 'M') {
                                                    return I18N::translateContext('(a man’s) brother’s great ×(%s-1) granddaughter', 'great ×%s niece', I18N::number($down - 3));
                                                }
                Severity: Major
                Found in app/Services/RelationshipService.php - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                                  if ($first === 'bro' && $sex1 === 'M') {
                                                      return I18N::translateContext('(a man’s) brother’s great ×(%s-1) grandson', 'great ×%s nephew', I18N::number($down - 0));
                                                  }
                  Severity: Major
                  Found in app/Services/RelationshipService.php - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                                    if ($first === 'sis' && $sex1 === 'M') {
                                                        return I18N::translateContext('(a man’s) sister’s great ×(%s-1) grandson', 'great ×%s nephew', I18N::number($down - 0));
                                                    }
                    Severity: Major
                    Found in app/Services/RelationshipService.php - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                                      switch ($event->tag()) {
                                                          case 'FAM:ANUL':
                                                          case 'FAM:DIV':
                                                              return I18N::translate('ex-wife');
                                                          case 'FAM:MARR':
                      Severity: Major
                      Found in app/Services/RelationshipService.php - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                                        if ($first === 'bro' && $sex1 === 'M') {
                                                            return I18N::translateContext('(a man’s) brother’s great ×(%s-1) grandson', 'great ×%s nephew', I18N::number($down - 3));
                                                        }
                        Severity: Major
                        Found in app/Services/RelationshipService.php - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                                          if ($first === 'sis' && $sex1 === 'M') {
                                                              return I18N::translateContext('(a man’s) sister’s great ×(%s-1) grandson', 'great ×%s nephew', I18N::number($down - 3));
                                                          }
                          Severity: Major
                          Found in app/Services/RelationshipService.php - About 45 mins to fix

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

                                private function importTNGPlac(string $gedcom): void
                                {
                                    if (preg_match('/^0 _PLAC (.+)/', $gedcom, $match)) {
                                        $place_name = $match[1];
                                    } else {
                            Severity: Minor
                            Found in app/Services/GedcomImportService.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

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

                                public function handle(ServerRequestInterface $request): ResponseInterface
                                {
                                    $tree = Validator::attributes($request)->tree();
                            
                                    // For backwards compatibility with webtrees 1.x we store the two calendar formats in one variable
                            Severity: Minor
                            Found in app/Http/RequestHandlers/TreePreferencesAction.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

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

                                    ServerRequestInterface $request,
                                    string $username,
                                    string $email,
                                    string $realname,
                                    string $comments,
                            Severity: Minor
                            Found in app/Http/RequestHandlers/RegisterAction.php - About 45 mins to fix

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

                                  public function deliverMessage(UserInterface $sender, UserInterface $recipient, string $subject, string $body, string $url, string $ip): bool
                              Severity: Minor
                              Found in app/Services/MessageService.php - About 45 mins to fix

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

                                    public function getEventsList(int $jd1, int $jd2, string $events, bool $only_living, string $sort_by, Tree $tree): Collection
                                Severity: Minor
                                Found in app/Services/CalendarService.php - About 45 mins to fix

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

                                      public function handle(ServerRequestInterface $request): ResponseInterface
                                      {
                                          $tree       = Validator::attributes($request)->tree();
                                          $ip         = Validator::attributes($request)->string('client-ip');
                                          $base_url   = Validator::attributes($request)->string('base_url');
                                  Severity: Minor
                                  Found in app/Http/RequestHandlers/ContactAction.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

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

                                      public function handle(ServerRequestInterface $request): ResponseInterface
                                      {
                                          $tree   = Validator::attributes($request)->tree();
                                          $xref   = Validator::attributes($request)->isXref()->string('xref');
                                          $family = Registry::familyFactory()->make($xref, $tree);
                                  Severity: Minor
                                  Found in app/Http/RequestHandlers/AddSpouseToFamilyAction.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

                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language