fisharebest/webtrees

View on GitHub

Showing 1,727 of 2,400 total issues

File IndividualFactsService.php has 670 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/IndividualFactsService.php - About 1 day to fix

    FamilyRepository has 80 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class FamilyRepository
    {
        private CenturyService $century_service;
    
        private ColorService $color_service;
    Severity: Major
    Found in app/Statistics/Repository/FamilyRepository.php - About 1 day to fix

      Method upgrade has 298 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function upgrade(): void
          {
              DB::schema()->create('gedcom', static function (Blueprint $table): void {
                  $table->integer('gedcom_id', true);
                  $table->string('gedcom_name', 255);
      Severity: Major
      Found in app/Schema/Migration0.php - About 1 day to fix

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

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

          File Individual.php has 661 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

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

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

                public function handle(ServerRequestInterface $request): ResponseInterface
                {
                    $tree = Validator::attributes($request)->tree();
                    $user = Validator::attributes($request)->user();
            
            
            Severity: Major
            Found in app/Module/IndividualListModule.php - About 1 day to fix

              File GedcomImportService.php has 643 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/GedcomImportService.php - About 1 day to fix

                Method values has 278 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function values(): array
                    {
                        $values = [
                            ''  => '',
                            1   => 'Amt',
                Severity: Major
                Found in app/Elements/GovIdType.php - About 1 day to fix

                  Function getCloseRelationship has a Cognitive Complexity of 70 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private function getCloseRelationship(Individual $individual1, Individual $individual2, int $maxlength = 4): array
                      {
                          if ($individual1 === $individual2) {
                              return [$individual1];
                          }
                  Severity: Minor
                  Found in app/Services/RelationshipService.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 GedcomRecord.php has 628 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

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

                    Function daitchMokotoffWord has a Cognitive Complexity of 68 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private static function daitchMokotoffWord(string $name): array
                        {
                            // Apply special transformation rules to the input string
                            $name = I18N::strtoupper($name);
                            foreach (self::TRANSFORM_NAMES as $transformRule) {
                    Severity: Minor
                    Found in app/Soundex.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

                    Method getAllCountries has 255 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function getAllCountries(): array
                        {
                            return [
                                /* I18N: Name of a country or state */
                                '???' => I18N::translate('Unknown'),
                    Severity: Major
                    Found in app/Statistics/Service/CountryService.php - About 1 day to fix

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

                          public function handle(ServerRequestInterface $request): ResponseInterface
                          {
                              $tree     = Validator::attributes($request)->tree();
                              $view     = Validator::attributes($request)->isInArray(['day', 'month', 'year'])->string('view');
                              $cal      = Validator::queryParams($request)->string('cal');
                      Severity: Minor
                      Found in app/Http/RequestHandlers/CalendarEvents.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 display has a Cognitive Complexity of 63 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function display(Tree|null $tree = null, string|null $date_format = null, bool $convert_calendars = false): string
                          {
                              if ($tree instanceof Tree) {
                                  $CALENDAR_FORMAT = $tree->getPreference('CALENDAR_FORMAT');
                              } else {
                      Severity: Minor
                      Found in app/Date.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 ANSEL.php has 579 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      <?php
                      
                      /**
                       * webtrees: online genealogy
                       * Copyright (C) 2023 webtrees development team
                      Severity: Major
                      Found in app/Encodings/ANSEL.php - About 1 day to fix

                        Method iso3166 has 246 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function iso3166(): array
                            {
                                return [
                                    'GBR' => 'GB', // Must come before ENG, NIR, SCT and WLS
                                    'ABW' => 'AW',
                        Severity: Major
                        Found in app/Statistics/Service/CountryService.php - About 1 day to fix

                          Function isDead has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function isDead(): bool
                              {
                                  $MAX_ALIVE_AGE = (int) $this->tree->getPreference('MAX_ALIVE_AGE');
                                  $today_jd      = Registry::timestampFactory()->now()->julianDay();
                          
                          
                          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 handle has a Cognitive Complexity of 60 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function handle(ServerRequestInterface $request): ResponseInterface
                              {
                                  $tree   = Validator::attributes($request)->tree();
                                  $xref   = Validator::parsedBody($request)->isXref()->string('xref');
                                  $family = Registry::familyFactory()->make($xref, $tree);
                          Severity: Minor
                          Found in app/Http/RequestHandlers/ChangeFamilyMembersAction.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 IndividualListModule.php has 551 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          <?php
                          
                          /**
                           * webtrees: online genealogy
                           * Copyright (C) 2023 webtrees development team
                          Severity: Major
                          Found in app/Module/IndividualListModule.php - About 1 day to fix

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

                                public function render($renderer): void
                                {
                                    $newelements      = [];
                                    $lastelement      = '';
                                    $footnote_element = [];
                            Severity: Major
                            Found in app/Report/ReportPdfTextBox.php - About 1 day to fix
                              Severity
                              Category
                              Status
                              Source
                              Language