fisharebest/webtrees

View on GitHub

Showing 1,726 of 2,403 total issues

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

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

    Method drawPerson has 77 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function drawPerson(Individual $person, int $gen, int $state, Family|null $pfamily, string $line, bool $isRoot): string
        {
            if ($gen < 0) {
                return '';
            }
    Severity: Major
    Found in app/Module/InteractiveTree/TreeView.php - About 3 hrs to fix

      Method getEstimatedBirthDate has 77 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function getEstimatedBirthDate(): Date
          {
              if ($this->estimated_birth_date === null) {
                  foreach ($this->getAllBirthDates() as $date) {
                      if ($date->isOK()) {
      Severity: Major
      Found in app/Individual.php - About 3 hrs to fix

        Method factsEndHandler has 77 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function factsEndHandler(): void
            {
                $this->process_repeats--;
                if ($this->process_repeats > 0) {
                    return;
        Severity: Major
        Found in app/Report/ReportParserGenerate.php - About 3 hrs to fix

          File Auth.php has 294 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

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

            Method relationships has 76 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function relationships(): array
                {
                    $pra = static fn (int $n, string $nominative, string $genitive): array => [
                        ($n > 3 ? 'pra ×' . $n . ' ' : str_repeat('pra-', $n)) . $nominative,
                        ($n > 3 ? 'pra ×' . $n . ' ' : str_repeat('pra-', $n)) . $genitive,
            Severity: Major
            Found in app/Module/LanguageSlovakian.php - About 3 hrs to fix

              Method values has 76 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function values(): array
                  {
                      $values = [
                          ''              => '',
                          'AFRIKAANS'     => (new LocaleAf())->endonym(),
              Severity: Major
              Found in app/Elements/LanguageId.php - About 3 hrs to fix

                File ModuleThemeTrait.php has 293 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

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

                  Fact has 26 functions (exceeds 20 allowed). Consider refactoring.
                  Open

                  class Fact
                  {
                      private const FACT_ORDER = [
                          'BIRT',
                          '_HNM',
                  Severity: Minor
                  Found in app/Fact.php - About 3 hrs to fix

                    Method export has 74 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function export(
                            Tree $tree,
                            bool $sort_by_xref = false,
                            string $encoding = UTF8::NAME,
                            int $access_level = Auth::PRIV_HIDE,
                    Severity: Major
                    Found in app/Services/GedcomExportService.php - About 2 hrs to fix

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

                          public function handle(ServerRequestInterface $request): ResponseInterface
                          {
                              $tree = Validator::attributes($request)->tree();
                      
                              $delete_default_resn_id = Validator::parsedBody($request)->array('delete');
                      Severity: Major
                      Found in app/Http/RequestHandlers/TreePrivacyAction.php - About 2 hrs to fix

                        File PlaceHierarchyListModule.php has 289 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

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

                          File GovIdType.php has 289 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

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

                            Method updateRecord has 73 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function updateRecord(string $gedrec, Tree $tree, bool $delete): void
                                {
                                    if (preg_match('/^0 @(' . Gedcom::REGEX_XREF . ')@ (' . Gedcom::REGEX_TAG . ')/', $gedrec, $match)) {
                                        [, $gid, $type] = $match;
                                    } elseif (preg_match('/^0 (HEAD)(?:\n|$)/', $gedrec, $match)) {
                            Severity: Major
                            Found in app/Services/GedcomImportService.php - About 2 hrs to fix

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

                                  public function handle(ServerRequestInterface $request): ResponseInterface
                                  {
                                      $tree   = Validator::attributes($request)->tree();
                                      $xref   = Validator::parsedBody($request)->isXref()->string('xref');
                                      $family = Registry::familyFactory()->make($xref, $tree);
                              Severity: Major
                              Found in app/Http/RequestHandlers/ChangeFamilyMembersAction.php - About 2 hrs to fix

                                Function upgrade has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    public function upgrade(): void
                                    {
                                        // It is simpler to create a new table than to update the existing one.
                                
                                        if (!DB::schema()->hasTable('place_location')) {
                                Severity: Minor
                                Found in app/Schema/Migration44.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

                                Function imageStartHandler has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    protected function imageStartHandler(array $attrs): void
                                    {
                                        // Position the top corner of this box on the page. the default is the current position
                                        $top = (float) ($attrs['top'] ?? ReportBaseElement::CURRENT_POSITION);
                                
                                
                                Severity: Minor
                                Found in app/Report/ReportParserGenerate.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

                                File LifespansChartModule.php has 287 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

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

                                  File FrequentlyAskedQuestionsModule.php has 287 lines of code (exceeds 250 allowed). Consider refactoring.
                                  Open

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

                                    Method listEndHandler has 72 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        protected function listEndHandler(): void
                                        {
                                            $this->process_repeats--;
                                            if ($this->process_repeats > 0) {
                                                return;
                                    Severity: Major
                                    Found in app/Report/ReportParserGenerate.php - About 2 hrs to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language