jon48/webtrees-lib

View on GitHub

Showing 758 of 758 total issues

Avoid excessively long variable names like $ancestors_distinct_count. Keep variable name length under 20.
Open

        $ancestors_distinct_count = $sosa_stats_service->totalDistinctAncestors();

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

Avoid excessively long variable names like $max_system_generations. Keep variable name length under 20.
Open

    private ?int $max_system_generations = null;

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

Avoid excessively long variable names like $missing_ancestors_by_gen. Keep variable name length under 20.
Open

        $missing_ancestors_by_gen = DB::table('maj_sosa AS sosa')

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

Avoid excessively long variable names like $known_ancestors_contributions. Keep variable name length under 20.
Open

        $known_ancestors_contributions = DB::table('maj_sosa AS sosa')

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

Avoid excessively long variable names like $consolidated_ancestors_branches. Keep variable name length under 20.
Open

        $consolidated_ancestors_branches = DB::table('maj_sosa')

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

Avoid excessively long variable names like $map_definition_service. Keep variable name length under 20.
Open

    private MapDefinitionsService $map_definition_service;

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

Avoid excessively long variable names like $fab_welcome_block_view. Keep variable name length under 20.
Open

        $fab_welcome_block_view = app(\Fisharebest\Webtrees\Module\WelcomeBlockModule::class)

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

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

    public function linkedFamilies(Certificate $certificate): Collection
    {
        $tree = $certificate->tree();
        return DB::table('families')
            ->where('f_file', '=', $tree->id())
app/Module/Certificates/Services/CertificateDataService.php on lines 40..50
app/Module/Certificates/Services/CertificateDataService.php on lines 82..92

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 114.

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

    public function linkedIndividuals(Certificate $certificate): Collection
    {
        $tree = $certificate->tree();
        return DB::table('individuals')
            ->where('i_file', '=', $tree->id())
app/Module/Certificates/Services/CertificateDataService.php on lines 61..71
app/Module/Certificates/Services/CertificateDataService.php on lines 82..92

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 114.

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

    public function linkedMedias(Certificate $certificate): Collection
    {
        $tree = $certificate->tree();
        return DB::table('media')
            ->where('m_file', '=', $tree->id())
app/Module/Certificates/Services/CertificateDataService.php on lines 40..50
app/Module/Certificates/Services/CertificateDataService.php on lines 61..71

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 114.

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 individualColumns has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function individualColumns(iterable $records): array
    {
        $records = collect($records);
        return [
            'issourced' => [
Severity: Minor
Found in app/Module/IsSourced/Hooks/IsSourcedStatusColumnsHook.php - About 1 hr to fix

    Method sosaMissingColumns has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function sosaMissingColumns(iterable $records): array
        {
            $records = collect($records);
            return [
                'issourced' => [
    Severity: Minor
    Found in app/Module/IsSourced/Hooks/IsSourcedStatusColumnsHook.php - About 1 hr to fix

      Method certificateFileResponse has 40 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function certificateFileResponse(
              Certificate $certificate,
              bool $add_watermark = false,
              Watermark $watermark = null
          ): ResponseInterface {
      Severity: Minor
      Found in app/Module/Certificates/Factories/CertificateImageFactory.php - About 1 hr to fix

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

            public function handle(ServerRequestInterface $request): ResponseInterface
            {
                $tree = Validator::attributes($request)->tree();
        
                if ($this->module === null) {
        Severity: Minor
        Found in app/Module/Certificates/Http/RequestHandlers/AdminConfigAction.php - About 1 hr to fix

          Method statisticsByGenerations has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function statisticsByGenerations(SosaStatisticsService $sosa_stats_service): array
              {
                  $stats_by_gen = $sosa_stats_service->statisticsByGenerations();
          
                  $generation_stats = array();
          Severity: Minor
          Found in app/Module/Sosa/Http/RequestHandlers/SosaStatistics.php - About 1 hr to fix

            Method updateGeneralSettings has 38 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private function updateGeneralSettings(TaskSchedule $task_schedule, ServerRequestInterface $request): bool
                {
                    if ($this->module === null) {
                        return false;
                    }
            Severity: Minor
            Found in app/Module/AdminTasks/Http/RequestHandlers/TaskEditAction.php - About 1 hr to fix

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

                  public function handle(ServerRequestInterface $request): ResponseInterface
                  {
                      $tree = Validator::attributes($request)->tree();
              
                      if ($this->module === null) {

                Method run has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function run(TaskSchedule $task_schedule, $force = false): void
                    {
                        /** @var TaskSchedule $task_schedule */
                        $task_schedule = DB::table('maj_admintasks')
                            ->select()
                Severity: Minor
                Found in app/Module/AdminTasks/Services/TaskScheduleService.php - About 1 hr to fix

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

                                  $router->attach('', '/config/{tree}', static function (Map $router): void {
                  
                                      $router->get(SosaConfig::class, '', SosaConfig::class);
                                      $router->post(SosaConfigAction::class, '', SosaConfigAction::class);
                                      $router->get(SosaComputeModal::class, '/compute/{xref}', SosaComputeModal::class);
                  Severity: Major
                  Found in app/Module/Sosa/SosaModule.php and 1 other location - About 1 hr to fix
                  app/Module/AdminTasks/AdminTasksModule.php on lines 112..118

                  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 110.

                  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

                                      $router->attach('', '/tasks', static function (Map $router): void {
                  
                                          $router->get(TasksList::class, '', TasksList::class);
                                          $router->get(TaskEditPage::class, '/{task}', TaskEditPage::class);
                                          $router->post(TaskEditAction::class, '/{task}', TaskEditAction::class);
                  Severity: Major
                  Found in app/Module/AdminTasks/AdminTasksModule.php and 1 other location - About 1 hr to fix
                  app/Module/Sosa/SosaModule.php on lines 135..141

                  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 110.

                  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