fisharebest/webtrees

View on GitHub

Showing 2,400 of 2,400 total issues

Similar blocks of code found in 3 locations. Consider refactoring.
Open

<?php

/**
 * webtrees: online genealogy
 * Copyright (C) 2023 webtrees development team
Severity: Major
Found in app/Http/RequestHandlers/ReorderMediaAction.php and 2 other locations - About 1 day to fix
app/Http/RequestHandlers/ReorderMediaFilesAction.php on lines 1..78
app/Http/RequestHandlers/ReorderNamesAction.php on lines 1..78

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 348.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

<?php

/**
 * webtrees: online genealogy
 * Copyright (C) 2023 webtrees development team
Severity: Major
Found in app/Http/RequestHandlers/UserPageUpdate.php and 1 other location - About 1 day to fix
app/Http/RequestHandlers/TreePageUpdate.php on lines 1..76

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 348.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    public function chartAge(): string
    {
        $out = [];
        foreach ($this->queryRecords() as $record) {
            $out[$record->century][$record->sex] = $record->age;
Severity: Major
Found in app/Statistics/Google/ChartAge.php and 1 other location - About 1 day to fix
app/Statistics/Google/ChartMarriageAge.php on lines 121..176

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 348.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

<?php

/**
 * webtrees: online genealogy
 * Copyright (C) 2023 webtrees development team
Severity: Major
Found in app/Http/RequestHandlers/ReorderMediaFilesAction.php and 2 other locations - About 1 day to fix
app/Http/RequestHandlers/ReorderMediaAction.php on lines 1..78
app/Http/RequestHandlers/ReorderNamesAction.php on lines 1..78

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 348.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    public function chartMarriageAge(): string
    {
        $out = [];

        foreach ($this->queryRecords() as $record) {
Severity: Major
Found in app/Statistics/Google/ChartMarriageAge.php and 1 other location - About 1 day to fix
app/Statistics/Google/ChartAge.php on lines 99..153

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 348.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Method spanLtrRtl has 319 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function spanLtrRtl(string $inputText): string
    {
        if ($inputText === '') {
            // Nothing to do
            return '';
Severity: Major
Found in app/Report/RightToLeftSupport.php - About 1 day to fix

    File ModuleService.php has 689 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    /**
     * webtrees: online genealogy
     * Copyright (C) 2023 webtrees development team
    Severity: Major
    Found in app/Services/ModuleService.php - About 1 day to fix

      File WebRoutes.php has 680 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      
      /**
       * webtrees: online genealogy
       * Copyright (C) 2023 webtrees development team
      Severity: Major
      Found in app/Http/Routes/WebRoutes.php - About 1 day to fix

        Function parentFacts has a Cognitive Complexity of 77 (exceeds 5 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: Minor
        Found in app/Services/IndividualFactsService.php - About 1 day 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 getEstimatedBirthDate has a Cognitive Complexity of 76 (exceeds 5 allowed). Consider refactoring.
        Open

            public function getEstimatedBirthDate(): Date
            {
                if ($this->estimated_birth_date === null) {
                    foreach ($this->getAllBirthDates() as $date) {
                        if ($date->isOK()) {
        Severity: Minor
        Found in app/Individual.php - About 1 day 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 IndividualFactsService.php has 670 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        
        /**
         * webtrees: online genealogy
         * Copyright (C) 2023 webtrees development team
        Severity: Major
        Found in app/Services/IndividualFactsService.php - About 1 day to fix

          FamilyRepository has 80 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class FamilyRepository
          {
              private CenturyService $century_service;
          
              private ColorService $color_service;
          Severity: Major
          Found in app/Statistics/Repository/FamilyRepository.php - About 1 day to fix

            Method upgrade has 298 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function upgrade(): void
                {
                    DB::schema()->create('gedcom', static function (Blueprint $table): void {
                        $table->integer('gedcom_id', true);
                        $table->string('gedcom_name', 255);
            Severity: Major
            Found in app/Schema/Migration0.php - About 1 day to fix

              File Soundex.php has 662 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              <?php
              
              /**
               * webtrees: online genealogy
               * Copyright (C) 2023 webtrees development team
              Severity: Major
              Found in app/Soundex.php - About 1 day to fix

                File Individual.php has 661 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                <?php
                
                /**
                 * webtrees: online genealogy
                 * Copyright (C) 2023 webtrees development team
                Severity: Major
                Found in app/Individual.php - About 1 day to fix

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                  <?php
                  
                  /**
                   * webtrees: online genealogy
                   * Copyright (C) 2023 webtrees development team
                  Severity: Major
                  Found in app/Module/LanguageKazhak.php and 1 other location - About 1 day to fix
                  app/Module/LanguageUkranian.php on lines 1..99

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 325.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                  <?php
                  
                  /**
                   * webtrees: online genealogy
                   * Copyright (C) 2023 webtrees development team
                  Severity: Major
                  Found in app/Module/LanguageUkranian.php and 1 other location - About 1 day to fix
                  app/Module/LanguageKazhak.php on lines 1..99

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 325.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

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

                      public function handle(ServerRequestInterface $request): ResponseInterface
                      {
                          $tree = Validator::attributes($request)->tree();
                          $user = Validator::attributes($request)->user();
                  
                  
                  Severity: Major
                  Found in app/Module/IndividualListModule.php - About 1 day to fix

                    Similar blocks of code found in 4 locations. Consider refactoring.
                    Open

                    <?php
                    
                    /**
                     * webtrees: online genealogy
                     * Copyright (C) 2023 webtrees development team
                    Severity: Major
                    Found in app/Census/CensusOfScotland1911.php and 3 other locations - About 1 day to fix
                    app/Census/CensusOfCanadaPraries1926.php on lines 1..65
                    app/Census/CensusOfDenmark1930.php on lines 1..65
                    app/Census/CensusOfUnitedStates1870.php on lines 1..65

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 323.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 4 locations. Consider refactoring.
                    Open

                    <?php
                    
                    /**
                     * webtrees: online genealogy
                     * Copyright (C) 2023 webtrees development team
                    Severity: Major
                    Found in app/Census/CensusOfUnitedStates1870.php and 3 other locations - About 1 day to fix
                    app/Census/CensusOfCanadaPraries1926.php on lines 1..65
                    app/Census/CensusOfDenmark1930.php on lines 1..65
                    app/Census/CensusOfScotland1911.php on lines 1..65

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 323.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Severity
                    Category
                    Status
                    Source
                    Language