jon48/webtrees-lib

View on GitHub

Showing 758 of 758 total issues

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

                    $router->attach('', '/analysis-views/{tree}', static function (Map $router): void {
                        $router->tokens(['view_id' => '\d+', 'enable' => '[01]']);
                        $router->extras([
                            'middleware' => [
                                AuthManager::class,
Severity: Major
Found in app/Module/GeoDispersion/GeoDispersionModule.php and 1 other location - About 6 hrs to fix
app/Module/GeoDispersion/GeoDispersionModule.php on lines 154..171

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

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('', '/map-adapters/{tree}', static function (Map $router): void {
                        $router->tokens(['adapter_id' => '\d+', 'view_id' => '\d+']);
                        $router->extras([
                            'middleware' => [
                                AuthManager::class,
Severity: Major
Found in app/Module/GeoDispersion/GeoDispersionModule.php and 1 other location - About 6 hrs to fix
app/Module/GeoDispersion/GeoDispersionModule.php on lines 135..152

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

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

Function buildLineage has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
Open

    private function buildLineage(LineageNode $node): LineageNode
    {
        $indi_surname = '';

        $indi_node = $node->individual();
Severity: Minor
Found in app/Module/PatronymicLineage/Model/LineageBuilder.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

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

                'birth' => [
                    'position' => 7,
                    'column_def' => [ 'class' => 'text-center' ],
                    'th' => view($this->module()->name() . '::components/column-th-issourced', [
                        'title' => I18N::translate('%s sourced', Registry::elementFactory()->make('INDI:BIRT')->label())
Severity: Major
Found in app/Module/IsSourced/Hooks/IsSourcedStatusColumnsHook.php and 2 other locations - About 4 hrs to fix
app/Module/IsSourced/Hooks/IsSourcedStatusColumnsHook.php on lines 173..190
app/Module/IsSourced/Hooks/IsSourcedStatusColumnsHook.php on lines 191..208

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

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

                'indi' => [
                    'position' => 3,
                    'column_def' => [ 'class' => 'text-center' ],
                    'th' => view($this->module()->name() . '::components/column-th-issourced', [
                        'title' => I18N::translate('%s sourced', Registry::elementFactory()->make('INDI')->label())
Severity: Major
Found in app/Module/IsSourced/Hooks/IsSourcedStatusColumnsHook.php and 2 other locations - About 4 hrs to fix
app/Module/IsSourced/Hooks/IsSourcedStatusColumnsHook.php on lines 72..89
app/Module/IsSourced/Hooks/IsSourcedStatusColumnsHook.php on lines 191..208

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

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

                'birth' => [
                    'position' => 7,
                    'column_def' => [ 'class' => 'text-center' ],
                    'th' => view($this->module()->name() . '::components/column-th-issourced', [
                        'title' => I18N::translate('%s sourced', Registry::elementFactory()->make('INDI:BIRT')->label())
Severity: Major
Found in app/Module/IsSourced/Hooks/IsSourcedStatusColumnsHook.php and 2 other locations - About 4 hrs to fix
app/Module/IsSourced/Hooks/IsSourcedStatusColumnsHook.php on lines 72..89
app/Module/IsSourced/Hooks/IsSourcedStatusColumnsHook.php on lines 173..190

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

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

File SosaStatisticsService.php has 358 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * webtrees-lib: MyArtJaub library for webtrees
 *
Severity: Minor
Found in app/Module/Sosa/Services/SosaStatisticsService.php - About 4 hrs to fix

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

    <?php
    
    /**
     * webtrees-lib: MyArtJaub library for webtrees
     *
    Severity: Major
    Found in app/Module/GeoDispersion/Services/GeoAnalysisService.php and 1 other location - About 4 hrs to fix
    app/Module/GeoDispersion/Services/PlaceMapperService.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 171.

    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-lib: MyArtJaub library for webtrees
     *
    Severity: Major
    Found in app/Module/GeoDispersion/Services/PlaceMapperService.php and 1 other location - About 4 hrs to fix
    app/Module/GeoDispersion/Services/GeoAnalysisService.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 171.

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

        public function pedigreeCollapseByGenerationData(): array
        {
            if (!$this->isPdoSupported()) {
                return [];
            }
    Severity: Major
    Found in app/Module/Sosa/Services/SosaStatisticsService.php - About 4 hrs to fix

      The class FactSourceStatus has 11 public methods. Consider refactoring FactSourceStatus to keep number of public methods under 10.
      Open

      class FactSourceStatus extends SourceStatus
      {
          /**
           * @var boolean $has_date
           */

      TooManyPublicMethods

      Since: 0.1

      A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

      By default it ignores methods starting with 'get' or 'set'.

      Example

      Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

      The class GeoAnalysisResult has 16 public methods. Consider refactoring GeoAnalysisResult to keep number of public methods under 10.
      Open

      class GeoAnalysisResult
      {
          private string $description;
          private int $order;
          private int $unknown_count;

      TooManyPublicMethods

      Since: 0.1

      A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

      By default it ignores methods starting with 'get' or 'set'.

      Example

      Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

      The class TaskSchedule has 13 public methods. Consider refactoring TaskSchedule to keep number of public methods under 10.
      Open

      class TaskSchedule
      {
          private int $id;
          private bool $enabled;
          private string $task_id;
      Severity: Minor
      Found in app/Common/Tasks/TaskSchedule.php by phpmd

      TooManyPublicMethods

      Since: 0.1

      A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

      By default it ignores methods starting with 'get' or 'set'.

      Example

      Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

      The class AbstractGeoAnalysisView has 13 public methods. Consider refactoring AbstractGeoAnalysisView to keep number of public methods under 10.
      Open

      abstract class AbstractGeoAnalysisView
      {
          private int $id;
          private Tree $tree;
          private bool $enabled;

      TooManyPublicMethods

      Since: 0.1

      A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

      By default it ignores methods starting with 'get' or 'set'.

      Example

      Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

      The class TaskScheduleService has 11 public methods. Consider refactoring TaskScheduleService to keep number of public methods under 10.
      Open

      class TaskScheduleService
      {
          /**
           * Time-out after which the task will be considered not running any more.
           * In seconds, default 5 mins.

      TooManyPublicMethods

      Since: 0.1

      A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

      By default it ignores methods starting with 'get' or 'set'.

      Example

      Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

      The class Certificate has 13 public methods. Consider refactoring Certificate to keep number of public methods under 10.
      Open

      class Certificate
      {
          /**
           * Pattern to extract information from a file name.
           * Specific to the author's workflow.

      TooManyPublicMethods

      Since: 0.1

      A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

      By default it ignores methods starting with 'get' or 'set'.

      Example

      Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

      The class SosaStatisticsService has 13 public methods. Consider refactoring SosaStatisticsService to keep number of public methods under 10.
      Open

      class SosaStatisticsService
      {
          private UserInterface $user;
          private Tree $tree;
      
      

      TooManyPublicMethods

      Since: 0.1

      A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

      By default it ignores methods starting with 'get' or 'set'.

      Example

      Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

      The class SosaRecordsService has 11 public methods. Consider refactoring SosaRecordsService to keep number of public methods under 10.
      Open

      class SosaRecordsService
      {
          private ?int $max_system_generations = null;
      
          /**

      TooManyPublicMethods

      Since: 0.1

      A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

      By default it ignores methods starting with 'get' or 'set'.

      Example

      Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

      The class SosaModule has 12 public methods. Consider refactoring SosaModule to keep number of public methods under 10.
      Open

      class SosaModule extends AbstractModule implements
          ModuleMyArtJaubInterface,
          ModuleGlobalInterface,
          ModuleMenuInterface,
          ModuleSidebarInterface,
      Severity: Minor
      Found in app/Module/Sosa/SosaModule.php by phpmd

      TooManyPublicMethods

      Since: 0.1

      A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

      By default it ignores methods starting with 'get' or 'set'.

      Example

      Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

      Function oneLinkedSource has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

          public function oneLinkedSource(Certificate $certificate): ?Source
          {
              $regex_query = preg_quote($certificate->gedcomPath(), '/');
              $regex_pattern = '/[1-9] SOUR @(' . Gedcom::REGEX_XREF . ')@(?:\n[2-9]\s(?:(?!SOUR)\w+)\s.*)*\n[2-9] _ACT ' . $regex_query . '/i'; //phpcs:ignore Generic.Files.LineLength.TooLong
      
      
      Severity: Minor
      Found in app/Module/Certificates/Services/CertificateDataService.php - About 3 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

      Severity
      Category
      Status
      Source
      Language