fisharebest/webtrees

View on GitHub

Showing 1,726 of 2,403 total issues

Function TreeViewHandler has 90 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function TreeViewHandler (treeview_instance, ged) {
  var tv = this; // Store "this" for usage within jQuery functions where "this" is not this ;-)

  this.treeview = $('#' + treeview_instance + '_in');
  this.loadingImage = $('#' + treeview_instance + '_loading');
Severity: Major
Found in resources/js/treeview.js - About 3 hrs to fix

    Method getBlock has 90 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function getBlock(Tree $tree, int $block_id, string $context, array $config = []): string
        {
            $statistics = Registry::container()->get(Statistics::class);
    
            $show_last_update     = $this->getBlockSetting($block_id, 'show_last_update', '1');
    Severity: Major
    Found in app/Module/FamilyTreeStatisticsModule.php - About 3 hrs to fix

      Method getBlock has 90 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function getBlock(Tree $tree, int $block_id, string $context, array $config = []): string
          {
              $PEDIGREE_ROOT_ID = $tree->getPreference('PEDIGREE_ROOT_ID');
              $gedcomid         = $tree->getUserPreference(Auth::user(), UserInterface::PREF_TREE_ACCOUNT_XREF);
              $default_xref     = $gedcomid ?: $PEDIGREE_ROOT_ID;
      Severity: Major
      Found in app/Module/ChartsBlockModule.php - About 3 hrs to fix

        File GedcomExportService.php has 316 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/GedcomExportService.php - About 3 hrs to fix

          Function postDownloadAction has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
          Open

              public function postDownloadAction(ServerRequestInterface $request): ResponseInterface
              {
                  $tree = Validator::attributes($request)->tree();
          
                  if (Auth::isAdmin()) {
          Severity: Minor
          Found in app/Module/ClippingsCartModule.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 handle has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
          Open

              public function handle(ServerRequestInterface $request): ResponseInterface
              {
                  $tree    = Validator::attributes($request)->tree();
                  $xref    = Validator::attributes($request)->isXref()->string('xref');
                  $fact_id = Validator::attributes($request)->string('fact_id');
          Severity: Minor
          Found in app/Http/RequestHandlers/EditFactAction.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 canShowByType has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function canShowByType(int $access_level): bool
              {
                  // Dead people...
                  if ((int) $this->tree->getPreference('SHOW_DEAD_PEOPLE') >= $access_level && $this->isDead()) {
                      $keep_alive             = false;
          Severity: Minor
          Found in app/Individual.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 reformatDate has 88 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            webtrees.reformatDate = function (datefield, dmy) {
              const months = ['JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN', 'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC'];
              const hijri_months = ['MUHAR', 'SAFAR', 'RABIA', 'RABIT', 'JUMAA', 'JUMAT', 'RAJAB', 'SHAAB', 'RAMAD', 'SHAWW', 'DHUAQ', 'DHUAH'];
              const hebrew_months = ['TSH', 'CSH', 'KSL', 'TVT', 'SHV', 'ADR', 'ADS', 'NSN', 'IYR', 'SVN', 'TMZ', 'AAV', 'ELL'];
              const french_months = ['VEND', 'BRUM', 'FRIM', 'NIVO', 'PLUV', 'VENT', 'GERM', 'FLOR', 'PRAI', 'MESS', 'THER', 'FRUC', 'COMP'];
          Severity: Major
          Found in resources/js/webtrees.js - About 3 hrs to fix

            Method getBlock has 88 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function getBlock(Tree $tree, int $block_id, string $context, array $config = []): string
                {
                    $request       = Registry::container()->get(ServerRequestInterface::class);
                    $default_start = (bool) $this->getBlockSetting($block_id, 'start');
                    $filter_links  = $this->getBlockSetting($block_id, 'filter', self::LINK_ALL);
            Severity: Major
            Found in app/Module/SlideShowModule.php - About 3 hrs to fix

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

                  public function tags(): array
                  {
                      return [
                          'FAM:CHIL:_FREL'              => new CustomElement(I18N::translate('Relationship to father')),
                          'FAM:CHIL:_MREL'              => new CustomElement(I18N::translate('Relationship to mother')),
              Severity: Major
              Found in app/CustomTags/FamilyTreeMaker.php - About 3 hrs to fix

                EventRepository has 29 functions (exceeds 20 allowed). Consider refactoring.
                Open

                class EventRepository implements EventRepositoryInterface
                {
                    /**
                     * Sorting directions.
                     */
                Severity: Minor
                Found in app/Statistics/Repository/EventRepository.php - About 3 hrs to fix

                  Method getBlock has 87 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function getBlock(Tree $tree, int $block_id, string $context, array $config = []): string
                      {
                          $num        = (int) $this->getBlockSetting($block_id, 'num', self::DEFAULT_NUMBER);
                          $info_style = $this->getBlockSetting($block_id, 'infoStyle', self::DEFAULT_STYLE);
                  
                  
                  Severity: Major
                  Found in app/Module/TopSurnamesModule.php - About 3 hrs to fix

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

                        public function handle(ServerRequestInterface $request): ResponseInterface
                        {
                            $topic = $request->getAttribute('topic');
                    
                            $dmy = I18N::language()->dateOrder();
                    Severity: Major
                    Found in app/Http/RequestHandlers/HelpText.php - About 3 hrs to fix

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

                          public function historicEventsAll(): Collection
                          {
                              switch (I18N::languageTag()) {
                                  case 'en-AU':
                                  case 'en-GB':
                      Severity: Major
                      Found in app/Module/BritishPrimeMinisters.php - About 3 hrs to fix

                        Function associateFacts has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function associateFacts(Individual $individual): Collection
                            {
                                $facts = [];
                        
                                $asso1 = $this->linked_record_service->linkedIndividuals($individual, 'ASSO');
                        Severity: Minor
                        Found in app/Services/IndividualFactsService.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 handle has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function handle(ServerRequestInterface $request): ResponseInterface
                            {
                                $data_filesystem = Registry::filesystem()->data();
                                $all_folders     = $this->media_file_service->allMediaFolders($data_filesystem);
                        
                        
                        Severity: Minor
                        Found in app/Http/RequestHandlers/UploadMediaAction.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 relativesEndHandler has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                        Open

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

                        File Migration0.php has 309 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

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

                          Registry has 28 functions (exceeds 20 allowed). Consider refactoring.
                          Open

                          class Registry
                          {
                              private static CacheFactoryInterface $cache_factory;
                          
                              private static CalendarDateFactoryInterface $calendar_date_factory;
                          Severity: Minor
                          Found in app/Registry.php - About 3 hrs to fix

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

                                public function handle(ServerRequestInterface $request): ResponseInterface
                                {
                                    $source  = Validator::parsedBody($request)->isInArray(['client', 'server'])->string('source');
                                    $options = Validator::parsedBody($request)->isInArray(['add', 'addupdate', 'update'])->string('options');
                            
                            
                            Severity: Major
                            Found in app/Http/RequestHandlers/MapDataImportAction.php - About 3 hrs to fix
                              Severity
                              Category
                              Status
                              Source
                              Language