fisharebest/webtrees

View on GitHub

Showing 2,400 of 2,400 total issues

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

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

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

          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 483.

          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) 2023 webtrees development team
          Severity: Major
          Found in app/Census/CensusOfUnitedStates1930.php and 1 other location - About 2 days to fix
          app/Census/CensusOfRhodeIsland1905.php on lines 1..75

          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 483.

          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

          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

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

            <?php
            
            /**
             * webtrees: online genealogy
             * Copyright (C) 2023 webtrees development team
            Severity: Major
            Found in app/SurnameTradition/SpanishSurnameTradition.php and 1 other location - About 2 days to fix
            app/SurnameTradition/PortugueseSurnameTradition.php on lines 1..146

            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 467.

            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) 2023 webtrees development team
            Severity: Major
            Found in app/SurnameTradition/PortugueseSurnameTradition.php and 1 other location - About 2 days to fix
            app/SurnameTradition/SpanishSurnameTradition.php on lines 1..146

            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 467.

            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

            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

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

                  public function handle(ServerRequestInterface $request): ResponseInterface
                  {
                      $tree  = Validator::attributes($request)->tree();
                      $xrefs = $this->admin_service->duplicateXrefs($tree);
              
              
              Severity: Major
              Found in app/Http/RequestHandlers/RenumberTreeAction.php - About 2 days to fix

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

                    public function columns(): array
                    {
                        return [
                            new CensusColumnNull($this, 'Lfd.Nr.', 'Laufende Nummer'),
                            new CensusColumnGivenNames($this, 'Vorname', 'Vorname'),
                Severity: Major
                Found in app/Census/CensusOfDeutschland1900.php and 1 other location - About 2 days to fix
                app/Census/CensusOfSlovakia1930.php on lines 42..73

                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 440.

                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

                    public function columns(): array
                    {
                        return [
                            new CensusColumnNull($this, 'Č. b.', 'Radové číslo bytu'),
                            new CensusColumnNull($this, 'Č. os.', 'Radové číslo osôb v dome'),
                Severity: Major
                Found in app/Census/CensusOfSlovakia1930.php and 1 other location - About 2 days to fix
                app/Census/CensusOfDeutschland1900.php on lines 52..83

                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 440.

                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

                File RightToLeftSupport.php has 884 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/RightToLeftSupport.php - About 2 days to fix

                  Method finishCurrentSpan has 424 lines of code (exceeds 25 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: Major
                  Found in app/Report/RightToLeftSupport.php - About 2 days to fix

                    File SearchService.php has 867 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/SearchService.php - About 2 days to fix

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

                      <?php
                      
                      /**
                       * webtrees: online genealogy
                       * Copyright (C) 2023 webtrees development team
                      Severity: Major
                      Found in app/Factories/NoteFactory.php and 1 other location - About 2 days to fix
                      app/Factories/SharedNoteFactory.php on lines 1..101

                      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 420.

                      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

                      Severity
                      Category
                      Status
                      Source
                      Language