jon48/webtrees-lib

View on GitHub

Showing 758 of 758 total issues

Function results has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function results(Tree $tree, int $depth): GeoAnalysisResults
    {
        $results = new GeoAnalysisResults();

        foreach ($this->geoanalysis_data_service->individualsAndFamilies($tree) as $record) {
Severity: Minor
Found in app/Module/GeoDispersion/GeoAnalyses/AllEventsByTypeGeoAnalysis.php - About 35 mins 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 significantPlaces has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function significantPlaces(Individual $individual): Generator
    {
        yield $individual->getBirthPlace();

        /** @var \Fisharebest\Webtrees\Fact $fact */
Severity: Minor
Found in app/Module/Sosa/GeoAnalyses/SosaByGenerationGeoAnalysis.php - About 35 mins 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

Avoid too many return statements within this method.
Open

            return $target_format;
Severity: Major
Found in app/Module/GeoDispersion/Services/PlacesReferenceTableService.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

            return $indi;
    Severity: Major
    Found in app/Module/PatronymicLineage/Model/LineageBuilder.php - About 30 mins to fix

      The method sortedKnownPlaces has a boolean flag argument $exclude_other, which is a certain sign of a Single Responsibility Principle violation.
      Open

          public function sortedKnownPlaces(bool $exclude_other = false): Collection

      BooleanArgumentFlag

      Since: 1.4.0

      A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

      Example

      class Foo {
          public function bar($flag = true) {
          }
      }

      Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

      The method with has a boolean flag argument $use_flags, which is a certain sign of a Single Responsibility Principle violation.
      Open

              bool $use_flags = false

      BooleanArgumentFlag

      Since: 1.4.0

      A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

      Example

      class Foo {
          public function bar($flag = true) {
          }
      }

      Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

      The method knownPlaces has a boolean flag argument $exclude_other, which is a certain sign of a Single Responsibility Principle violation.
      Open

          public function knownPlaces(bool $exclude_other = false): Collection

      BooleanArgumentFlag

      Since: 1.4.0

      A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

      Example

      class Foo {
          public function bar($flag = true) {
          }
      }

      Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

      Avoid too many return statements within this method.
      Open

                  return $this->replacementImageResponse((string) StatusCodeInterface::STATUS_INTERNAL_SERVER_ERROR)
                  ->withHeader('X-Image-Exception', $ex->getMessage());
      Severity: Major
      Found in app/Module/Certificates/Factories/CertificateImageFactory.php - About 30 mins to fix

        The method all has a boolean flag argument $include_disabled, which is a certain sign of a Single Responsibility Principle violation.
        Open

            public function all(bool $include_disabled = false): Collection

        BooleanArgumentFlag

        Since: 1.4.0

        A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

        Example

        class Foo {
            public function bar($flag = true) {
            }
        }

        Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

        The method find has a boolean flag argument $include_disabled, which is a certain sign of a Single Responsibility Principle violation.
        Open

            public function find(Tree $tree, int $id, bool $include_disabled = false): ?AbstractGeoAnalysisView

        BooleanArgumentFlag

        Since: 1.4.0

        A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

        Example

        class Foo {
            public function bar($flag = true) {
            }
        }

        Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

        Avoid too many return statements within this method.
        Open

                    return I18N::translate('%s not precise', $context_label);
        Severity: Major
        Found in app/Module/IsSourced/Data/FactSourceStatus.php - About 30 mins to fix

          The method certificateFileResponse has a boolean flag argument $add_watermark, which is a certain sign of a Single Responsibility Principle violation.
          Open

                  bool $add_watermark = false,

          BooleanArgumentFlag

          Since: 1.4.0

          A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

          Example

          class Foo {
              public function bar($flag = true) {
              }
          }

          Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

          The method exclude has a boolean flag argument $exclude, which is a certain sign of a Single Responsibility Principle violation.
          Open

              public function exclude(bool $exclude = true): self

          BooleanArgumentFlag

          Since: 1.4.0

          A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

          Example

          class Foo {
              public function bar($flag = true) {
              }
          }

          Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

          The method find has a boolean flag argument $include_disabled, which is a certain sign of a Single Responsibility Principle violation.
          Open

              public function find(string $hook_name, bool $include_disabled = false): ?HookCollectorInterface

          BooleanArgumentFlag

          Since: 1.4.0

          A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

          Example

          class Foo {
              public function bar($flag = true) {
              }
          }

          Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

          The method all has a boolean flag argument $include_disabled, which is a certain sign of a Single Responsibility Principle violation.
          Open

              public function all(bool $include_disabled = false): Collection

          BooleanArgumentFlag

          Since: 1.4.0

          A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

          Example

          class Foo {
              public function bar($flag = true) {
              }
          }

          Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

          The method all has a boolean flag argument $include_disabled, which is a certain sign of a Single Responsibility Principle violation.
          Open

              public function all(bool $include_disabled = false): Collection

          BooleanArgumentFlag

          Since: 1.4.0

          A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

          Example

          class Foo {
              public function bar($flag = true) {
              }
          }

          Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

          The method run has a boolean flag argument $force, which is a certain sign of a Single Responsibility Principle violation.
          Open

              public function run(TaskSchedule $task_schedule, $force = false): void

          BooleanArgumentFlag

          Since: 1.4.0

          A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

          Example

          class Foo {
              public function bar($flag = true) {
              }
          }

          Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

          The method all has a boolean flag argument $sync_available, which is a certain sign of a Single Responsibility Principle violation.
          Open

              public function all(bool $sync_available = false, bool $include_disabled = true): Collection

          BooleanArgumentFlag

          Since: 1.4.0

          A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

          Example

          class Foo {
              public function bar($flag = true) {
              }
          }

          Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

          Avoid too many return statements within this method.
          Open

                  return I18N::translate('%s not found', $context_label);
          Severity: Major
          Found in app/Module/IsSourced/Data/FactSourceStatus.php - About 30 mins to fix

            The method allForView has a boolean flag argument $show_invalid, which is a certain sign of a Single Responsibility Principle violation.
            Open

                public function allForView(GeoAnalysisMap $map_view, bool $show_invalid = false): Collection

            BooleanArgumentFlag

            Since: 1.4.0

            A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

            Example

            class Foo {
                public function bar($flag = true) {
                }
            }

            Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

            Severity
            Category
            Status
            Source
            Language