jon48/webtrees-lib

View on GitHub

Showing 96 of 758 total issues

Method visits has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function visits(WelcomeBlockModule $module, int $block_id, string $period): ?int
    {
        $settings = $module->matomoSettings($block_id);

        if (
Severity: Minor
Found in app/Module/WelcomeBlock/Services/MatomoStatsService.php - About 1 hr to fix

    Method targetId has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function targetId(string $source, string $source_format, string $target_format): ?string
        {
            // Extract parts for the WHERE clause
            $source_format = str_replace(['{', '}'], ['{#', '#}'], $source_format);
            $source_parts = preg_split('/[{}]/i', $source_format);
    Severity: Minor
    Found in app/Module/GeoDispersion/Services/PlacesReferenceTableService.php - About 1 hr to fix

      Method all has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function all(bool $include_disabled = false): Collection
          {
              return Registry::cache()->array()->remember('all-hooks', function () use ($include_disabled): Collection {
                  $hooks_info = DB::table('maj_hook_order')
                      ->get()
      Severity: Minor
      Found in app/Module/Hooks/Services/HookService.php - About 1 hr to fix

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

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

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

              public function handle(ServerRequestInterface $request): ResponseInterface
              {
                  $this->layout = 'layouts/ajax';
          
                  if ($this->module === null) {

          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 results has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              public function results(Tree $tree, int $depth): GeoAnalysisResults
              {
                  $results = new GeoAnalysisResults();
          
                  $unique_ancestors = $this->records_service
          Severity: Minor
          Found in app/Module/Sosa/GeoAnalyses/SosaByGenerationGeoAnalysis.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 handle has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function handle(ServerRequestInterface $request): ResponseInterface
              {
                  $this->layout = 'layouts/ajax';
          
                  if ($this->module === null) {

            Method map has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function map(Place $place, string $feature_property): ?string
                {
                    $location = new PlaceLocation($place->gedcomName());
                    $longitude = $location->longitude();
                    $latitude = $location->latitude();
            Severity: Minor
            Found in app/Module/GeoDispersion/PlaceMappers/CoordinatesPlaceMapper.php - About 1 hr to fix

              Method handle has 31 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 loadRoutes has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

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

                  Method ancestorsDispersionForGeneration has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function ancestorsDispersionForGeneration(int $gen): Collection
                      {
                          if (!$this->isPdoSupported()) {
                              return collect();
                          }
                  Severity: Minor
                  Found in app/Module/Sosa/Services/SosaStatisticsService.php - About 1 hr to fix

                    Method topMultipleAncestorsWithNoTies has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function topMultipleAncestorsWithNoTies(int $limit): Collection
                        {
                            $table_prefix = DB::connection()->getTablePrefix();
                            $multiple_ancestors = DB::table('maj_sosa AS sosa')
                                ->select('sosa.majs_i_id AS sosa_i_id')
                    Severity: Minor
                    Found in app/Module/Sosa/Services/SosaStatisticsService.php - About 1 hr to fix

                      Method migrateGeoAnalysisMap has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          private function migrateGeoAnalysisMap(
                              stdClass $old_view,
                              Tree $tree,
                              GeoAnalysisViewDataService $geoview_data_service
                          ): bool {
                      Severity: Minor
                      Found in app/Module/GeoDispersion/Schema/Migration2.php - About 1 hr to fix

                        Method handle has 29 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: Minor
                        Found in app/Module/PatronymicLineage/Http/RequestHandlers/SurnamesList.php - About 1 hr to fix

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

                              public function handle(ServerRequestInterface $request): ResponseInterface
                              {
                                  if ($this->module === null) {
                                      FlashMessages::addMessage(
                                          I18N::translate('The attached module could not be found.'),

                            Function results has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                            Open

                                public function results(Tree $tree, int $depth): GeoAnalysisResults
                                {
                                    $results = new GeoAnalysisResults();
                            
                                    foreach ($this->geoanalysis_data_service->individualsAndFamilies($tree) as $record) {

                            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 getLineageRootIndividual has 27 lines of code (exceeds 25 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 1 hr to fix

                              Method listMissingAncestorsAtGeneration has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public function listMissingAncestorsAtGeneration(Tree $tree, UserInterface $user, int $gen): Collection
                                  {
                                      if ($gen === 1) {
                                          return collect();
                                      }
                              Severity: Minor
                              Found in app/Module/Sosa/Services/SosaRecordsService.php - About 1 hr to fix

                                Method handle has 26 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: Minor
                                Found in app/Module/PatronymicLineage/Http/RequestHandlers/LineagesPage.php - About 1 hr to fix

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

                                      public function handle(ServerRequestInterface $request): ResponseInterface
                                      {
                                          if ($this->module === null) {
                                              FlashMessages::addMessage(
                                                  I18N::translate('The attached module could not be found.'),
                                  Severity: Minor
                                  Found in app/Module/AdminTasks/Http/RequestHandlers/TaskEditAction.php - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language