fisharebest/webtrees

View on GitHub

Showing 2,311 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

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

              <?php
              
              /**
               * webtrees: online genealogy
               * Copyright (C) 2021 webtrees development team
              Severity: Major
              Found in app/Census/CensusOfCanada1921.php and 1 other location - About 2 days to fix
              app/Census/CensusOfUnitedStates1820.php on lines 1..80

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 547.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

              <?php
              
              /**
               * webtrees: online genealogy
               * Copyright (C) 2021 webtrees development team
              Severity: Major
              Found in app/Census/CensusOfUnitedStates1820.php and 1 other location - About 2 days to fix
              app/Census/CensusOfCanada1921.php on lines 1..80

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 547.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              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

                      Severity
                      Category
                      Status
                      Source
                      Language