fisharebest/webtrees

View on GitHub

Showing 1,727 of 2,400 total issues

Function isRelated has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
Open

    private static function isRelated(Individual $target, int $distance): bool
    {
        static $cache = null;

        $user_individual = Registry::individualFactory()->make($target->tree->getUserPreference(Auth::user(), UserInterface::PREF_TREE_ACCOUNT_XREF), $target->tree);
Severity: Minor
Found in app/Individual.php - About 1 day 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 getAnniversaryEvents has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
Open

    public function getAnniversaryEvents(int $jd, string $facts, Tree $tree, string $filterof = '', string $filtersx = ''): array
    {
        $found_facts = [];

        $anniversaries = [
Severity: Minor
Found in app/Services/CalendarService.php - About 1 day 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 55 (exceeds 5 allowed). Consider refactoring.
Open

    public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        $ua      = Validator::serverParams($request)->string('HTTP_USER_AGENT', '');
        $ip      = Validator::attributes($request)->string('client-ip');
        $address = IPFactory::parseAddressString($ip);
Severity: Minor
Found in app/Http/Middleware/BadBotBlocker.php - About 1 day 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

File CountryService.php has 520 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * webtrees: online genealogy
 * Copyright (C) 2023 webtrees development team
Severity: Major
Found in app/Statistics/Service/CountryService.php - About 1 day to fix

    Method handle has 207 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function handle(ServerRequestInterface $request): ResponseInterface
        {
            $this->layout = 'layouts/administration';
    
            $tree    = Validator::attributes($request)->tree();
    Severity: Major
    Found in app/Http/RequestHandlers/CheckTree.php - About 1 day to fix

      File RelationshipsChartModule.php has 496 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      
      /**
       * webtrees: online genealogy
       * Copyright (C) 2023 webtrees development team
      Severity: Minor
      Found in app/Module/RelationshipsChartModule.php - About 7 hrs to fix

        Method tags has 197 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function tags(): array
            {
                return [
                    'FAM:*:ADDR:_NAME'                => new CustomElement(I18N::translate('Name of addressee')),
                    // I18N: https://gov.genealogy.net
        Severity: Major
        Found in app/CustomTags/GedcomL.php - About 7 hrs to fix

          ReportParserGenerate has 54 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class ReportParserGenerate extends ReportParserBase
          {
              /** Are we collecting data from <Footnote> elements */
              private bool $process_footnote = true;
          
          
          Severity: Major
          Found in app/Report/ReportParserGenerate.php - About 7 hrs to fix

            File Fact.php has 478 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            
            /**
             * webtrees: online genealogy
             * Copyright (C) 2023 webtrees development team
            Severity: Minor
            Found in app/Fact.php - About 7 hrs to fix

              File AbstractCalendarDate.php has 474 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              <?php
              
              /**
               * webtrees: online genealogy
               * Copyright (C) 2023 webtrees development team
              Severity: Minor
              Found in app/Date/AbstractCalendarDate.php - About 7 hrs to fix

                File RenumberTreeAction.php has 474 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                <?php
                
                /**
                 * webtrees: online genealogy
                 * Copyright (C) 2023 webtrees development team
                Severity: Minor
                Found in app/Http/RequestHandlers/RenumberTreeAction.php - About 7 hrs to fix

                  Function repeatTagStartHandler has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
                  Open

                      protected function repeatTagStartHandler(array $attrs): void
                      {
                          $this->process_repeats++;
                          if ($this->process_repeats > 1) {
                              return;
                  Severity: Minor
                  Found in app/Report/ReportParserGenerate.php - About 7 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 handle has 180 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function handle(ServerRequestInterface $request): ResponseInterface
                      {
                          $tree1_name = Validator::parsedBody($request)->string('tree1_name');
                          $tree2_name = Validator::parsedBody($request)->string('tree2_name');
                  
                  
                  Severity: Major
                  Found in app/Http/RequestHandlers/MergeTreesAction.php - About 7 hrs to fix

                    Method render has 180 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function render($renderer): void
                        {
                            // checkFootnote
                            $newelements      = [];
                            $lastelement      = [];
                    Severity: Major
                    Found in app/Report/ReportHtmlTextbox.php - About 7 hrs to fix

                      Function getWidth has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function getWidth($renderer): array
                          {
                              // Setup the style name
                              $renderer->setCurrentStyle('footnotenum');
                      
                      
                      Severity: Minor
                      Found in app/Report/ReportHtmlFootnote.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 getWidth has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function getWidth($renderer): array
                          {
                              // Setup the style name, a font must be selected to calculate the width
                              $renderer->setCurrentStyle('footnotenum');
                      
                      
                      Severity: Minor
                      Found in app/Report/ReportPdfFootnote.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 getWidth has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function getWidth($renderer): array
                          {
                              // Setup the style name, a font must be selected to calculate the width
                              if ($renderer->getCurrentStyle() !== $this->styleName) {
                                  $renderer->setCurrentStyle($this->styleName);
                      Severity: Minor
                      Found in app/Report/ReportPdfText.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 getWidth has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function getWidth($renderer): array
                          {
                              // Setup the style name, a font must be selected to calculate the width
                              if ($renderer->getCurrentStyle() !== $this->styleName) {
                                  $renderer->setCurrentStyle($this->styleName);
                      Severity: Minor
                      Found in app/Report/ReportHtmlText.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 chart has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
                      Open

                          protected function chart(Individual $individual, int $style, int $width, int $generations): ResponseInterface
                          {
                              $ancestors = $this->chart_service->sosaStradonitzAncestors($individual, $generations);
                      
                              $width = intdiv(self::CHART_WIDTH_PIXELS * $width, 100);
                      Severity: Minor
                      Found in app/Module/FanChartModule.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

                      GedcomRecord has 48 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      class GedcomRecord
                      {
                          public const RECORD_TYPE = 'UNKNOWN';
                      
                          protected const ROUTE_NAME = GedcomRecordPage::class;
                      Severity: Minor
                      Found in app/GedcomRecord.php - About 6 hrs to fix
                        Severity
                        Category
                        Status
                        Source
                        Language