jon48/webtrees-lib

View on GitHub

Showing 96 of 758 total issues

Function buildLineage has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
Open

    private function buildLineage(LineageNode $node): LineageNode
    {
        $indi_surname = '';

        $indi_node = $node->individual();
Severity: Minor
Found in app/Module/PatronymicLineage/Model/LineageBuilder.php - About 6 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 SosaStatisticsService.php has 358 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * webtrees-lib: MyArtJaub library for webtrees
 *
Severity: Minor
Found in app/Module/Sosa/Services/SosaStatisticsService.php - About 4 hrs to fix

    Method pedigreeCollapseByGenerationData has 110 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function pedigreeCollapseByGenerationData(): array
        {
            if (!$this->isPdoSupported()) {
                return [];
            }
    Severity: Major
    Found in app/Module/Sosa/Services/SosaStatisticsService.php - About 4 hrs to fix

      Function oneLinkedSource has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

          public function oneLinkedSource(Certificate $certificate): ?Source
          {
              $regex_query = preg_quote($certificate->gedcomPath(), '/');
              $regex_pattern = '/[1-9] SOUR @(' . Gedcom::REGEX_XREF . ')@(?:\n[2-9]\s(?:(?!SOUR)\w+)\s.*)*\n[2-9] _ACT ' . $regex_query . '/i'; //phpcs:ignore Generic.Files.LineLength.TooLong
      
      
      Severity: Minor
      Found in app/Module/Certificates/Services/CertificateDataService.php - About 3 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 buildLineages has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

          public function buildLineages(): ?Collection
          {
              $indis = $this->patrolineage_module->individuals(
                  $this->tree,
                  $this->surname,
      Severity: Minor
      Found in app/Module/PatronymicLineage/Model/LineageBuilder.php - About 2 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 handle has 62 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function handle(ServerRequestInterface $request): ResponseInterface
          {
              if ($this->module === null) {
                  throw new HttpNotFoundException(I18N::translate('The attached module could not be found.'));
              }
      Severity: Major
      Found in app/Module/AdminTasks/Http/RequestHandlers/TasksList.php - About 2 hrs to fix

        Method buildLineage has 61 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function buildLineage(LineageNode $node): LineageNode
            {
                $indi_surname = '';
        
                $indi_node = $node->individual();
        Severity: Major
        Found in app/Module/PatronymicLineage/Model/LineageBuilder.php - About 2 hrs to fix

          Function getLineageRootIndividual has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
          Open

              private function getLineageRootIndividual(Individual $indi): ?Individual
              {
                  $child_families = $indi->childFamilies();
                  if ($this->used_indis->get($indi->xref(), false) !== false) {
                      return null;
          Severity: Minor
          Found in app/Module/PatronymicLineage/Model/LineageBuilder.php - About 2 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 handle has 50 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function handle(ServerRequestInterface $request): ResponseInterface
              {
                  $tree = Validator::attributes($request)->tree();
          
                  if ($this->module === null) {

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

                public function handle(ServerRequestInterface $request): ResponseInterface
                {
                    $tree = Validator::attributes($request)->tree();
            
                    if ($this->module === null) {
            Severity: Minor
            Found in app/Module/GeoDispersion/Http/RequestHandlers/MapAdapterAddAction.php - About 2 hrs to fix

              Method insertOrUpdate has 49 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function insertOrUpdate(Tree $tree, UserInterface $user, array $sosa_records): void
                  {
                      $mass_update = DB::connection()->getDriverName() === 'mysql';
              
                      $bindings_placeholders = $bindings_values = [];
              Severity: Minor
              Found in app/Module/Sosa/Services/SosaRecordsService.php - About 1 hr to fix

                Function label has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function label(string $context): string
                    {
                        $context_label = Registry::elementFactory()->make($context)->label();
                
                        if ($this->factHasPreciseDate()) {
                Severity: Minor
                Found in app/Module/IsSourced/Data/FactSourceStatus.php - About 1 hr 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 run has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function run(TaskSchedule $task_schedule, $force = false): void
                    {
                        /** @var TaskSchedule $task_schedule */
                        $task_schedule = DB::table('maj_admintasks')
                            ->select()
                Severity: Minor
                Found in app/Module/AdminTasks/Services/TaskScheduleService.php - About 1 hr 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 featuresIndex has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    protected function featuresIndex(): ?array
                    {
                        $cacheKey = $this->cacheKey();
                        if ($cacheKey === null) {
                            return null;
                Severity: Minor
                Found in app/Module/GeoDispersion/PlaceMappers/CoordinatesPlaceMapper.php - About 1 hr to fix

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

                      public function handle(ServerRequestInterface $request): ResponseInterface
                      {
                          $tree = Validator::attributes($request)->tree();
                  
                          if ($this->module === null) {

                    Method getMenu has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function getMenu(Tree $tree): ?Menu
                        {
                            $menu = new Menu(I18N::translate('Sosa Statistics'));
                            $menu->setClass('menu-maj-sosa');
                            $menu->setSubmenus([
                    Severity: Minor
                    Found in app/Module/Sosa/SosaModule.php - About 1 hr to fix

                      Method run has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function run(TaskSchedule $task_schedule): bool
                          {
                              if ($this->module === null) {
                                  return false;
                              }
                      Severity: Minor
                      Found in app/Module/AdminTasks/Tasks/HealthCheckEmailTask.php - About 1 hr to fix

                        Method loadRoutes has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function loadRoutes(Map $router): void
                            {
                                $router->attach('', '', static function (Map $router): void {
                        
                                    $router->attach('', '/module-maj/geodispersion', static function (Map $router): void {
                        Severity: Minor
                        Found in app/Module/GeoDispersion/GeoDispersionModule.php - About 1 hr to fix

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

                              public function handle(ServerRequestInterface $request): ResponseInterface
                              {
                                  if ($this->module === null) {
                                      throw new HttpNotFoundException(I18N::translate('The attached module could not be found.'));
                                  }

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

                                public function handle(ServerRequestInterface $request): ResponseInterface
                                {
                                    $tree = Validator::attributes($request)->tree();
                            
                                    if ($this->module === null) {
                              Severity
                              Category
                              Status
                              Source
                              Language