fisharebest/webtrees

View on GitHub

Showing 1,727 of 2,400 total issues

Avoid too many return statements within this method.
Open

                return '<a href="' . e($family->url()) . '">' . $family->fullName() . '</a>';
Severity: Major
Found in app/Statistics/Repository/FamilyRepository.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

            return $this->canShowByType($access_level);
    Severity: Major
    Found in app/GedcomRecord.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

              return ltrim($subrec);
      Severity: Major
      Found in app/Report/ReportParserGenerate.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                return '';
        Severity: Major
        Found in app/Report/ReportParserGenerate.php - About 30 mins to fix

          Function getPedigreeMapFacts has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function getPedigreeMapFacts(ServerRequestInterface $request, ChartService $chart_service): array
              {
                  $tree        = Validator::attributes($request)->tree();
                  $generations = Validator::attributes($request)->isBetween(self::MINIMUM_GENERATIONS, self::MAXIMUM_GENERATIONS)->integer('generations');
                  $xref        = Validator::attributes($request)->isXref()->string('xref');
          Severity: Minor
          Found in app/Module/PedigreeMapModule.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

          Function process has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
              {
                  $route = Validator::attributes($request)->route();
                  $tree  = Validator::attributes($request)->treeOptional();
                  $user  = Validator::attributes($request)->user();
          Severity: Minor
          Found in app/Module/HitCountFooterModule.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

          Function process has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
              {
                  if ($this->upgrade_service->isUpgradeAvailable()) {
                      $latest_version       = $this->upgrade_service->latestVersion();
                      $latest_version_email = Site::getPreference('LATEST_WT_VERSION_EMAIL');
          Severity: Minor
          Found in app/Module/CheckForNewVersion.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

          Function allAncestors has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              private function allAncestors(string $xref1, string $xref2, int $tree_id): array
              {
                  $ancestors = [
                      $xref1,
                      $xref2,
          Severity: Minor
          Found in app/Module/RelationshipsChartModule.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

          Function getMedia has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              private function getMedia(Individual $individual): Collection
              {
                  $media = new Collection();
          
                  foreach ($this->getFactsWithMedia($individual) as $fact) {
          Severity: Minor
          Found in app/Module/AlbumModule.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

          Function getMenu has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public function getMenu(Tree $tree): Menu|null
              {
                  $trees = $this->tree_service->all();
          
                  if ($trees->count() === 1 || Site::getPreference('ALLOW_CHANGE_GEDCOM') !== '1') {
          Severity: Minor
          Found in app/Module/TreesMenuModule.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

          Function updateGedcom has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              private function updateGedcom(Fact $fact, array $params): string
              {
                  $gedcom = $fact->gedcom();
          
                  if (preg_match('/\n\d CEME ?(.+)(?:\n\d PLOT ?(.+))?/', $gedcom, $match)) {
          Severity: Minor
          Found in app/Module/FixCemeteryTag.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

          Function drawPersonName has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              private function drawPersonName(Individual $individual, string $dashed): string
              {
                  $family = $individual->childFamilies()->first();
                  if ($family) {
                      $family_name = strip_tags($family->fullName());
          Severity: Minor
          Found in app/Module/InteractiveTree/TreeView.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

          Function updateMediaLinks has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              private function updateMediaLinks(Individual $individual, string $xref, bool $primary): void
              {
                  $facts = $individual->facts([], false, null, true);
          
                  $facts1 = new Collection();
          Severity: Minor
          Found in app/Module/FixPrimaryTag.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

          Function findElementByWildcard has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              private function findElementByWildcard(string $tag): ElementInterface|null
              {
                  foreach ($this->elements as $tags => $element) {
                      if (str_contains($tags, '*')) {
                          $regex = '/^' . strtr($tags, ['*' => '[^:]+']) . '$/';
          Severity: Minor
          Found in app/Factories/ElementFactory.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

          Function descendantFamilies has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public function descendantFamilies(Individual $individual, int $generations): Collection
              {
                  $descendants = new Collection($individual->spouseFamilies());
          
                  if ($generations > 0) {
          Severity: Minor
          Found in app/Services/ChartService.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

          Function spouseFacts has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              private function spouseFacts(Individual $individual, Individual $spouse, Date $min_date, Date $max_date): Collection
              {
                  $SHOW_RELATIVES_EVENTS = $individual->tree()->getPreference('SHOW_RELATIVES_EVENTS');
          
                  $death_of_a_spouse = [
          Severity: Minor
          Found in app/Services/IndividualFactsService.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

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

              public function handle(ServerRequestInterface $request): ResponseInterface
              {
                  $parent_id = $request->getAttribute('parent_id');
          
                  if ($parent_id === null) {
          Severity: Minor
          Found in app/Http/RequestHandlers/MapDataList.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

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

              public function handle(ServerRequestInterface $request): ResponseInterface
              {
                  $this->checkRegistrationAllowed();
          
                  $tree     = Validator::attributes($request)->treeOptional();
          Severity: Minor
          Found in app/Http/RequestHandlers/RegisterAction.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

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

              public function handle(ServerRequestInterface $request): ResponseInterface
              {
                  $recipients = $this->message_service->recipientTypes();
          
                  $user    = Validator::attributes($request)->user();
          Severity: Minor
          Found in app/Http/RequestHandlers/BroadcastAction.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

          Function unhandledExceptionResponse has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              private function unhandledExceptionResponse(ServerRequestInterface $request, Throwable $exception): ResponseInterface
              {
                  $this->layout = 'layouts/default';
          
                  // Create a stack dump for the exception
          Severity: Minor
          Found in app/Http/Middleware/HandleExceptions.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