fisharebest/webtrees

View on GitHub

Showing 1,726 of 2,403 total issues

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

    public function fromUtf8(string $text): string
    {
        $out = '';
        $len = strlen($text);

Severity: Minor
Found in app/Encodings/AbstractUTF16Encoding.php - About 1 hr to fix

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

        public function columns(): array
        {
            return [
                new CensusColumnFullName($this, 'Name', 'Name'),
                new CensusColumnRelationToHeadEnglish($this, 'Relation', 'Relationship of each person to the head of the family'),
    Severity: Minor
    Found in app/Census/CensusOfUnitedStates1900.php - About 1 hr to fix

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

          private function parseFacts(): array
          {
              // Split the record into facts
              if ($this->gedcom !== '') {
                  $gedcom_facts = preg_split('/\n(?=1)/', $this->gedcom);
      Severity: Minor
      Found in app/GedcomRecord.php - About 1 hr to fix

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

            private function topTenOldestAliveQuery(string $sex, int $total): array
            {
                $query = DB::table('dates')
                    ->join('individuals', static function (JoinClause $join): void {
                        $join
        Severity: Minor
        Found in app/Statistics/Repository/IndividualRepository.php - About 1 hr to fix

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

              private function topSurnames(int $number_of_surnames, int $threshold): array
              {
                  // Use the count of base surnames.
                  $top_surnames = DB::table('name')
                      ->where('n_file', '=', $this->tree->id())
          Severity: Minor
          Found in app/Statistics/Repository/IndividualRepository.php - About 1 hr to fix

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

                private function ageBetweenSiblingsList(int $total, bool $one): array
                {
                    $rows  = $this->ageBetweenSiblingsQuery($total);
                    $top10 = [];
                    $dist  = [];
            Severity: Minor
            Found in app/Statistics/Repository/FamilyRepository.php - About 1 hr to fix

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

                  protected function highlightedImageStartHandler(array $attrs): void
                  {
                      $id = '';
                      if (preg_match('/0 @(.+)@/', $this->gedrec, $match)) {
                          $id = $match[1];
              Severity: Minor
              Found in app/Report/ReportParserGenerate.php - About 1 hr to fix

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

                    public static function sortFacts(Collection $unsorted): Collection
                    {
                        $dated    = [];
                        $nondated = [];
                        $sorted   = [];
                Severity: Minor
                Found in app/Fact.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 handle has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function handle(ServerRequestInterface $request): ResponseInterface
                    {
                        $tree     = Validator::attributes($request)->tree();
                        $user     = Validator::attributes($request)->user();
                        $place_id = Validator::attributes($request)->integer('place_id', 0);
                Severity: Minor
                Found in app/Module/PlaceHierarchyListModule.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 myPlot has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function myPlot(
                        string $chart_title,
                        array $x_axis,
                        string $x_axis_title,
                        array $ydata,
                Severity: Minor
                Found in app/Module/StatisticsChartModule.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 getFactsWithNotes has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function getFactsWithNotes(Individual $individual): Collection
                    {
                        if ($this->facts === null) {
                            $facts = $individual->facts();
                
                
                Severity: Minor
                Found in app/Module/NotesTabModule.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 getMapData has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected function getMapData(ServerRequestInterface $request): array
                    {
                        $facts = $this->getPedigreeMapFacts($request, $this->chart_service);
                
                        $geojson = [
                Severity: Minor
                Found in app/Module/PedigreeMapModule.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 getBlock has a Cognitive Complexity of 10 (exceeds 5 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: Minor
                Found in app/Module/TopSurnamesModule.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 handle has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

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

                    public function postAddIndividualAction(ServerRequestInterface $request): ResponseInterface
                    {
                        $tree   = Validator::attributes($request)->tree();
                        $xref   = Validator::parsedBody($request)->isXref()->string('xref');
                        $option = Validator::parsedBody($request)->string('option');
                Severity: Minor
                Found in app/Module/ClippingsCartModule.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 getBlock has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function getBlock(Tree $tree, int $block_id, string $context, array $config = []): string
                    {
                        $days      = (int) $this->getBlockSetting($block_id, 'days', self::DEFAULT_DAYS);
                        $infoStyle = $this->getBlockSetting($block_id, 'infoStyle', self::DEFAULT_INFO_STYLE);
                        $sortStyle = $this->getBlockSetting($block_id, 'sortStyle', self::DEFAULT_SORT_STYLE);
                Severity: Minor
                Found in app/Module/RecentChangesModule.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 closeFamily has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected function closeFamily(Individual $individual): array
                    {
                        $xrefs = [];
                
                        foreach ($individual->spouseFamilies() as $family) {
                Severity: Minor
                Found in app/Module/LifespansChartModule.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 matchRelationships has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected function matchRelationships(array $nodes, array $pattern, array $relationships): array
                    {
                        $count = count($pattern);
                
                        // Look for the longest matchable series of components
                Severity: Minor
                Found in app/Services/RelationshipService.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 descendants has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function descendants(Individual $individual, int $generations): Collection
                    {
                        $descendants = new Collection([$individual->xref() => $individual]);
                
                        if ($generations > 0) {
                Severity: Minor
                Found in app/Services/ChartService.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 checkDefaultTreeBlocksExist has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function checkDefaultTreeBlocksExist(): void
                    {
                        $has_blocks = DB::table('block')
                            ->where('gedcom_id', '=', -1)
                            ->exists();
                Severity: Minor
                Found in app/Services/HomePageService.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

                Severity
                Category
                Status
                Source
                Language