fisharebest/webtrees

View on GitHub
app/Module/FanChartModule.php

Summary

Maintainability
D
2 days
Test Coverage

Function chart has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
Open

    protected function chart(Individual $individual, int $style, int $width, int $generations): ResponseInterface
    {
        $ancestors = $this->chart_service->sosaStradonitzAncestors($individual, $generations);

        $width = intdiv(self::CHART_WIDTH_PIXELS * $width, 100);
Severity: Minor
Found in app/Module/FanChartModule.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

Method chart has 163 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function chart(Individual $individual, int $style, int $width, int $generations): ResponseInterface
    {
        $ancestors = $this->chart_service->sosaStradonitzAncestors($individual, $generations);

        $width = intdiv(self::CHART_WIDTH_PIXELS * $width, 100);
Severity: Major
Found in app/Module/FanChartModule.php - About 6 hrs to fix

    File FanChartModule.php has 354 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    /**
     * webtrees: online genealogy
     * Copyright (C) 2022 webtrees development team
    Severity: Minor
    Found in app/Module/FanChartModule.php - About 4 hrs to fix

      Method handle has 43 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();
              $xref        = Validator::attributes($request)->isXref()->string('xref');
      Severity: Minor
      Found in app/Module/FanChartModule.php - About 1 hr to fix

        There are no issues that match your filters.

        Category
        Status