fisharebest/webtrees

View on GitHub

Showing 1,727 of 2,400 total issues

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

    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

          Function render has a Cognitive Complexity of 102 (exceeds 5 allowed). Consider refactoring.
          Open

              public function render($renderer): void
              {
                  // checkFootnote
                  $newelements      = [];
                  $lastelement      = [];
          Severity: Minor
          Found in app/Report/ReportHtmlTextbox.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 UTF8.php has 817 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/UTF8.php - About 1 day to fix

            Method childFacts has 387 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private function childFacts(Individual $person, Family $family, string $option, string $relation, Date $min_date, Date $max_date): Collection
                {
                    $SHOW_RELATIVES_EVENTS = $person->tree()->getPreference('SHOW_RELATIVES_EVENTS');
            
                    $birth_of_a_child = [
            Severity: Major
            Found in app/Services/IndividualFactsService.php - About 1 day to fix

              Method searchIndividualsAdvanced has 385 lines of code (exceeds 25 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: Major
              Found in app/Services/SearchService.php - About 1 day to fix

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

                  Method load has 363 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function load(Map $router): void
                      {
                          $router->attach('', '', static function (Map $router) {
                              // Admin routes.
                              $router->attach('', '/admin', static function (Map $router) {
                  Severity: Major
                  Found in app/Http/Routes/WebRoutes.php - About 1 day to fix

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

                      Function childFacts has a Cognitive Complexity of 86 (exceeds 5 allowed). Consider refactoring.
                      Open

                          private function childFacts(Individual $person, Family $family, string $option, string $relation, Date $min_date, Date $max_date): Collection
                          {
                              $SHOW_RELATIVES_EVENTS = $person->tree()->getPreference('SHOW_RELATIVES_EVENTS');
                      
                              $birth_of_a_child = [
                      Severity: Minor
                      Found in app/Services/IndividualFactsService.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 webtrees.js has 737 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      /**
                       * webtrees: online genealogy
                       * Copyright (C) 2023 webtrees development team
                       * This program is free software: you can redistribute it and/or modify
                       * it under the terms of the GNU General Public License as published by
                      Severity: Major
                      Found in resources/js/webtrees.js - About 1 day to fix

                        Method listStartHandler has 339 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            protected function listStartHandler(array $attrs): void
                            {
                                $this->process_repeats++;
                                if ($this->process_repeats > 1) {
                                    return;
                        Severity: Major
                        Found in app/Report/ReportParserGenerate.php - About 1 day to fix

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

                              public function handle(ServerRequestInterface $request): ResponseInterface
                              {
                                  $this->layout = 'layouts/administration';
                          
                                  $tree    = Validator::attributes($request)->tree();
                          Severity: Minor
                          Found in app/Http/RequestHandlers/CheckTree.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 spanLtrRtl has 319 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public static function spanLtrRtl(string $inputText): string
                              {
                                  if ($inputText === '') {
                                      // Nothing to do
                                      return '';
                          Severity: Major
                          Found in app/Report/RightToLeftSupport.php - About 1 day to fix

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

                              File WebRoutes.php has 680 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

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

                                Function parentFacts has a Cognitive Complexity of 77 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    private function parentFacts(Individual $person, int $sosa, Date $min_date, Date $max_date): Collection
                                    {
                                        $SHOW_RELATIVES_EVENTS = $person->tree()->getPreference('SHOW_RELATIVES_EVENTS');
                                
                                        $death_of_a_parent = [
                                Severity: Minor
                                Found in app/Services/IndividualFactsService.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 getEstimatedBirthDate has a Cognitive Complexity of 76 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    public function getEstimatedBirthDate(): Date
                                    {
                                        if ($this->estimated_birth_date === null) {
                                            foreach ($this->getAllBirthDates() as $date) {
                                                if ($date->isOK()) {
                                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

                                Severity
                                Category
                                Status
                                Source
                                Language