fisharebest/webtrees

View on GitHub

Showing 1,727 of 2,400 total issues

File phpstan-baseline.php has 6439 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

declare(strict_types=1);

$ignoreErrors = [];
Severity: Major
Found in phpstan-baseline.php - About 2 wks to fix

    Function legacyNameAlgorithm has a Cognitive Complexity of 486 (exceeds 5 allowed). Consider refactoring.
    Open

        public function legacyNameAlgorithm(string $path, Individual|null $person1 = null, Individual|null $person2 = null): string
        {
            // The path does not include the starting person. In some languages, the
            // translation for a man’s (relative) is different from a woman’s (relative),
            // due to inflection.
    Severity: Minor
    Found in app/Services/RelationshipService.php - About 1 wk 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 legacyNameAlgorithm has 1554 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function legacyNameAlgorithm(string $path, Individual|null $person1 = null, Individual|null $person2 = null): string
        {
            // The path does not include the starting person. In some languages, the
            // translation for a man’s (relative) is different from a woman’s (relative),
            // due to inflection.
    Severity: Major
    Found in app/Services/RelationshipService.php - About 1 wk to fix

      Function finishCurrentSpan has a Cognitive Complexity of 342 (exceeds 5 allowed). Consider refactoring.
      Open

          private static function finishCurrentSpan(string &$result, bool $theEnd = false): void
          {
              $textSpan = substr($result, self::$posSpanStart);
              $result   = substr($result, 0, self::$posSpanStart);
      
      
      Severity: Minor
      Found in app/Report/RightToLeftSupport.php - About 1 wk 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

      Statistics has 289 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class Statistics implements
          GedcomRepositoryInterface,
          IndividualRepositoryInterface,
          EventRepositoryInterface,
          MediaRepositoryInterface,
      Severity: Major
      Found in app/Statistics.php - About 5 days to fix

        File ReportParserGenerate.php has 2059 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        
        /**
         * webtrees: online genealogy
         * Copyright (C) 2023 webtrees development team
        Severity: Major
        Found in app/Report/ReportParserGenerate.php - About 5 days to fix

          File RelationshipService.php has 1907 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          
          /**
           * webtrees: online genealogy
           * Copyright (C) 2023 webtrees development team
          Severity: Major
          Found in app/Services/RelationshipService.php - About 5 days to fix

            Function spanLtrRtl has a Cognitive Complexity of 223 (exceeds 5 allowed). Consider refactoring.
            Open

                public static function spanLtrRtl(string $inputText): string
                {
                    if ($inputText === '') {
                        // Nothing to do
                        return '';
            Severity: Minor
            Found in app/Report/RightToLeftSupport.php - About 4 days 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 listStartHandler has a Cognitive Complexity of 221 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function listStartHandler(array $attrs): void
                {
                    $this->process_repeats++;
                    if ($this->process_repeats > 1) {
                        return;
            Severity: Minor
            Found in app/Report/ReportParserGenerate.php - About 4 days 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 Statistics.php has 1346 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.php - About 3 days to fix

              Function postCustomChartAction has a Cognitive Complexity of 144 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function postCustomChartAction(ServerRequestInterface $request): ResponseInterface
                  {
                      $statistics = Registry::container()->get(Statistics::class);
                      assert($statistics instanceof Statistics);
              
              
              Severity: Minor
              Found in app/Module/StatisticsChartModule.php - About 2 days 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 render has a Cognitive Complexity of 131 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function render($renderer): void
                  {
                      $newelements      = [];
                      $lastelement      = '';
                      $footnote_element = [];
              Severity: Minor
              Found in app/Report/ReportPdfTextBox.php - About 2 days 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 Gedcom.php has 1052 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              <?php
              
              /**
               * webtrees: online genealogy
               * Copyright (C) 2023 webtrees development team
              Severity: Major
              Found in app/Gedcom.php - About 2 days to fix

                File FamilyRepository.php has 1009 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/Repository/FamilyRepository.php - About 2 days to fix

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

                      public function handle(ServerRequestInterface $request): ResponseInterface
                      {
                          $tree = Validator::attributes($request)->tree();
                          $user = Validator::attributes($request)->user();
                  
                  
                  Severity: Minor
                  Found in app/Module/IndividualListModule.php - About 2 days 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 IndividualRepository.php has 1002 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/Repository/IndividualRepository.php - About 2 days to fix

                    Method gedcom551Tags has 489 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        private function gedcom551Tags(): array
                        {
                            return [
                                'FAM'                        => new FamilyRecord(I18N::translate('Family')),
                                'FAM:*:ADDR'                 => new AddressLine(I18N::translate('Address')),
                    Severity: Major
                    Found in app/Gedcom.php - About 2 days to fix

                      Method postCustomChartAction has 469 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function postCustomChartAction(ServerRequestInterface $request): ResponseInterface
                          {
                              $statistics = Registry::container()->get(Statistics::class);
                              assert($statistics instanceof Statistics);
                      
                      
                      Severity: Major
                      Found in app/Module/StatisticsChartModule.php - About 2 days to fix

                        IndividualRepository has 116 functions (exceeds 20 allowed). Consider refactoring.
                        Open

                        class IndividualRepository implements IndividualRepositoryInterface
                        {
                            private CenturyService $century_service;
                        
                            private ColorService $color_service;
                        Severity: Major
                        Found in app/Statistics/Repository/IndividualRepository.php - About 2 days to fix

                          Function searchIndividualsAdvanced has a Cognitive Complexity of 111 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function searchIndividualsAdvanced(Tree $tree, array $fields, array $modifiers): Collection
                              {
                                  $fields = array_filter($fields, static fn (string $x): bool => $x !== '');
                          
                                  $query = DB::table('individuals')
                          Severity: Minor
                          Found in app/Services/SearchService.php - About 2 days 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