fisharebest/webtrees

View on GitHub

Showing 1,702 of 2,311 total issues

File Soundex.php has 3548 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * webtrees: online genealogy
 * Copyright (C) 2021 webtrees development team
Severity: Major
Found in app/Soundex.php - About 1 wk to fix

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

        public function legacyNameAlgorithm(string $path, Individual $person1 = null, Individual $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 1504 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function legacyNameAlgorithm(string $path, Individual $person1 = null, Individual $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 288 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 2025 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

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

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

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

            Function spanLtrRtl has a Cognitive Complexity of 232 (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 1348 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            
            /**
             * webtrees: online genealogy
             * Copyright (C) 2021 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 = app(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 139 (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 FamilyRepository.php has 1011 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

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

                File IndividualRepository.php has 986 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

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

                  Method gedcom551 has 471 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

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

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

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

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

                          public function searchIndividualsAdvanced(array $trees, array $fields, array $modifiers): Collection
                          {
                              $fields = array_filter($fields);
                      
                              $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

                      Function createResponse has a Cognitive Complexity of 109 (exceeds 5 allowed). Consider refactoring.
                      Open

                          protected function createResponse(Tree $tree, UserInterface $user, array $params, bool $families): ResponseInterface
                          {
                              ob_start();
                      
                              // We show three different lists: initials, surnames and individuals
                      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

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

                          public function handle(ServerRequestInterface $request): ResponseInterface
                          {
                              $tree = $request->getAttribute('tree');
                              assert($tree instanceof Tree);
                      
                      
                      Severity: Major
                      Found in app/Http/RequestHandlers/RenumberTreeAction.php - About 2 days to fix

                        IndividualRepository has 113 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
                          Severity
                          Category
                          Status
                          Source
                          Language