fisharebest/webtrees

View on GitHub

Showing 1,726 of 2,403 total issues

Method tags has 112 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function tags(): array
    {
        $tags = [
            'FAM:NO'                     => new FamilyNonEvent(I18N::translate('Event did not occur')),
            'INDI:NO'                    => new IndividualNonEvent(I18N::translate('Event did not occur')),
Severity: Major
Found in app/CustomTags/Gedcom7.php - About 4 hrs to fix

    Method handle has 112 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/Http/RequestHandlers/ReportSetupPage.php - About 4 hrs to fix

      Method display has 111 lines of code (exceeds 25 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: Major
      Found in app/Date.php - About 4 hrs to fix

        File CalendarService.php has 351 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        
        /**
         * webtrees: online genealogy
         * Copyright (C) 2023 webtrees development team
        Severity: Minor
        Found in app/Services/CalendarService.php - About 4 hrs to fix

          Function getBlock has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
          Open

              public function getBlock(Tree $tree, int $block_id, string $context, array $config = []): string
              {
                  $calendar_service = new CalendarService();
          
                  $days      = (int) $this->getBlockSetting($block_id, 'days', self::DEFAULT_DAYS);
          Severity: Minor
          Found in app/Module/YahrzeitModule.php - About 4 hrs 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 format has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
          Open

              public function format(string $format, string $qualifier = ''): string
              {
                  // Dates can include additional punctuation and symbols. e.g.
                  // %F %j, %Y
                  // %Y. %F %d.
          Severity: Minor
          Found in app/Date/AbstractCalendarDate.php - About 4 hrs 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 gedcomStartHandler has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function gedcomStartHandler(array $attrs): void
              {
                  if ($this->process_gedcoms > 0) {
                      $this->process_gedcoms++;
          
          
          Severity: Minor
          Found in app/Report/ReportParserGenerate.php - About 4 hrs 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 HtmlRenderer.php has 350 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          
          /**
           * webtrees: online genealogy
           * Copyright (C) 2023 webtrees development team
          Severity: Minor
          Found in app/Report/HtmlRenderer.php - About 4 hrs to fix

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

                public function handle(ServerRequestInterface $request): ResponseInterface
                {
                    $tree = Validator::attributes($request)->tree();
            
                    $query = Validator::queryParams($request)->string('query', '');
            Severity: Major
            Found in app/Http/RequestHandlers/SearchGeneralPage.php - About 4 hrs to fix

              Individual has 34 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class Individual extends GedcomRecord
              {
                  public const RECORD_TYPE = 'INDI';
              
                  // Placeholders to indicate unknown names
              Severity: Minor
              Found in app/Individual.php - About 4 hrs to fix

                Function nameAtCensusDate has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected function nameAtCensusDate(Individual $individual): array
                    {
                        $names  = $individual->getAllNames();
                        $name   = $names[0];
                        $family = $this->spouseFamily($individual);
                Severity: Minor
                Found in app/Census/AbstractCensusColumn.php - About 4 hrs 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 relationships has 106 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function relationships(): array
                    {
                        // Genitive forms in English are simple/regular, as no relationship name ends in "s".
                        $genitive = static fn (string $s): array => [$s, $s . '’s %s'];
                
                
                Severity: Major
                Found in app/Module/LanguageEnglishUnitedStates.php - About 4 hrs to fix

                  Method legacyCousinName has 106 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private static function legacyCousinName(int $n, string $sex): string
                      {
                          if ($sex === 'M') {
                              switch ($n) {
                                  case 1:
                  Severity: Major
                  Found in app/Services/RelationshipService.php - About 4 hrs to fix

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

                        public function handle(ServerRequestInterface $request): ResponseInterface
                        {
                            $tree = Validator::attributes($request)->tree();
                    
                            // For backwards compatibility with webtrees 1.x we store the two calendar formats in one variable
                    Severity: Major
                    Found in app/Http/RequestHandlers/TreePreferencesAction.php - About 4 hrs to fix

                      Method historicEventsAll has 105 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function historicEventsAll(): Collection
                          {
                              switch (I18N::languageTag()) {
                                  case 'cs':
                                      return new Collection([
                      Severity: Major
                      Found in app/Module/CzechMonarchsAndPresidents.php - About 4 hrs to fix

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

                            public function render($renderer): void
                            {
                                if (str_contains($this->text, '{{:ptp:}}')) {
                                    return;
                                }
                        Severity: Major
                        Found in app/Report/ReportHtmlCell.php - About 4 hrs to fix

                          Method reformatRecord has 104 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              private function reformatRecord(string $rec, Tree $tree): string
                              {
                                  $gedcom_service = Registry::container()->get(GedcomService::class);
                          
                                  // Strip out mac/msdos line endings
                          Severity: Major
                          Found in app/Services/GedcomImportService.php - About 4 hrs to fix

                            Method tags has 103 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function tags(): array
                                {
                                    return [
                                        'FAM:*:ADDR:_PRIV'             => new CustomElement(I18N::translate('Private')),
                                        'FAM:*:PLAC:_VERI'             => new CustomElement(I18N::translate('Verified')),
                            Severity: Major
                            Found in app/CustomTags/Legacy.php - About 4 hrs to fix

                              Function calculateRelationships has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  private function calculateRelationships(
                                      Individual $individual1,
                                      Individual $individual2,
                                      int $recursion,
                                      bool $ancestor = false
                              Severity: Minor
                              Found in app/Module/RelationshipsChartModule.php - About 4 hrs 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 factsEndHandler has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  protected function factsEndHandler(): void
                                  {
                                      $this->process_repeats--;
                                      if ($this->process_repeats > 0) {
                                          return;
                              Severity: Minor
                              Found in app/Report/ReportParserGenerate.php - About 4 hrs 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