fisharebest/webtrees

View on GitHub

Showing 1,727 of 2,400 total issues

Method importRecord has 164 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function importRecord(string $gedrec, Tree $tree, bool $update): void
    {
        $tree_id = $tree->id();

        // Escaped @ signs (only if importing from file)
Severity: Major
Found in app/Services/GedcomImportService.php - About 6 hrs to fix

    Method chart has 162 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function chart(Individual $individual, int $style, int $width, int $generations): ResponseInterface
        {
            $ancestors = $this->chart_service->sosaStradonitzAncestors($individual, $generations);
    
            $width = intdiv(self::CHART_WIDTH_PIXELS * $width, 100);
    Severity: Major
    Found in app/Module/FanChartModule.php - About 6 hrs to fix

      ClippingsCartModule has 46 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class ClippingsCartModule extends AbstractModule implements ModuleMenuInterface
      {
          use ModuleMenuTrait;
      
          // What to add to the cart?
      Severity: Minor
      Found in app/Module/ClippingsCartModule.php - About 6 hrs to fix

        AbstractCalendarDate has 46 functions (exceeds 20 allowed). Consider refactoring.
        Open

        abstract class AbstractCalendarDate
        {
            // GEDCOM calendar escape
            public const ESCAPE = '@#DUNKNOWN@';
        
        
        Severity: Minor
        Found in app/Date/AbstractCalendarDate.php - About 6 hrs to fix

          Function relativesStartHandler has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
          Open

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

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

              public function handle(ServerRequestInterface $request): ResponseInterface
              {
                  $tree     = Validator::attributes($request)->tree();
                  $view     = Validator::attributes($request)->isInArray(['day', 'month', 'year'])->string('view');
                  $cal      = Validator::queryParams($request)->string('cal');
          Severity: Major
          Found in app/Http/RequestHandlers/CalendarEvents.php - About 6 hrs to fix

            Function importRecord has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
            Open

                public function importRecord(string $gedrec, Tree $tree, bool $update): void
                {
                    $tree_id = $tree->id();
            
                    // Escaped @ signs (only if importing from file)
            Severity: Minor
            Found in app/Services/GedcomImportService.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

            Function getGedcomValue has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
            Open

                private function getGedcomValue(string $tag, int $level, string $gedrec): string
                {
                    if ($gedrec === '') {
                        return '';
                    }
            Severity: Minor
            Found in app/Report/ReportParserGenerate.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

            Function getDescendantsHtml has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
            Open

                private function getDescendantsHtml(Tree $tree, array $individuals, array $ancestors, string $surname, bool $soundex_dm, bool $soundex_std, Individual $individual, Family|null $parents = null): string
                {
                    $module = $this->module_service
                        ->findByComponent(ModuleChartInterface::class, $tree, Auth::user())
                        ->first(static fn (ModuleInterface $module) => $module instanceof RelationshipsChartModule);
            Severity: Minor
            Found in app/Module/BranchesListModule.php - About 5 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 reformatRecord has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
            Open

                private function reformatRecord(string $rec, Tree $tree): string
                {
                    $gedcom_service = Registry::container()->get(GedcomService::class);
            
                    // Strip out mac/msdos line endings
            Severity: Minor
            Found in app/Services/GedcomImportService.php - About 5 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 gedcomValueStartHandler has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function gedcomValueStartHandler(array $attrs): void
                {
                    $id    = '';
                    $match = [];
                    if (preg_match('/0 @(.+)@/', $this->gedrec, $match)) {
            Severity: Minor
            Found in app/Report/ReportParserGenerate.php - About 5 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 render has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
            Open

                public function render($renderer): void
                {
                    if (str_contains($this->text, '{{:ptp:}}')) {
                        return;
                    }
            Severity: Minor
            Found in app/Report/ReportHtmlCell.php - About 5 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 drawPerson has a Cognitive Complexity of 38 (exceeds 5 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: Minor
            Found in app/Module/InteractiveTree/TreeView.php - About 5 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 addDescendancy has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
            Open

                private function addDescendancy(&$list, $pid, $parents = false, $generations = -1): void
                {
                    $person = Registry::individualFactory()->make($pid, $this->tree);
                    if ($person === null) {
                        return;
            Severity: Minor
            Found in app/Report/ReportParserGenerate.php - About 5 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 relationships has 140 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function relationships(): array
                {
                    // Construct the genitive form in French
                    $genitive = static fn (string $s, string $genitive_link): array => [$s, '%s ' . $genitive_link . $s];
            
            
            Severity: Major
            Found in app/Module/LanguageFrench.php - About 5 hrs to fix

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

                  public function handle(ServerRequestInterface $request): ResponseInterface
                  {
                      $data_filesystem = Registry::filesystem()->data();
              
                      $files = Validator::queryParams($request)->isInArray(['local', 'external', 'unused'])->string('files');
              Severity: Major
              Found in app/Http/RequestHandlers/ManageMediaData.php - About 5 hrs to fix

                Function chart has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function chart(Individual $individual1, Individual $individual2, int $recursion, int $ancestors): ResponseInterface
                    {
                        $tree = $individual1->tree();
                
                        $max_recursion = (int) $tree->getPreference('RELATIONSHIP_RECURSION', static::DEFAULT_RECURSION);
                Severity: Minor
                Found in app/Module/RelationshipsChartModule.php - About 5 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 ageOfMarriageQuery has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function ageOfMarriageQuery(string $type, string $age_dir, int $total): string
                    {
                        $hrows = DB::table('families')
                            ->where('f_file', '=', $this->tree->id())
                            ->join('dates AS married', static function (JoinClause $join): void {
                Severity: Minor
                Found in app/Statistics/Repository/FamilyRepository.php - About 5 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 textBoxStartHandler has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected function textBoxStartHandler(array $attrs): void
                    {
                        // string Background color code
                        $bgcolor = '';
                        if (!empty($attrs['bgcolor'])) {
                Severity: Minor
                Found in app/Report/ReportParserGenerate.php - About 5 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 parentFacts has 139 lines of code (exceeds 25 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: Major
                Found in app/Services/IndividualFactsService.php - About 5 hrs to fix
                  Severity
                  Category
                  Status
                  Source
                  Language