jon48/webtrees-lib

View on GitHub

Showing 96 of 758 total issues

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

    Avoid too many return statements within this method.
    Open

            return null;
    Severity: Major
    Found in app/Module/GeoDispersion/PlaceMappers/CoordinatesPlaceMapper.php - About 30 mins to fix

      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

        Avoid too many return statements within this method.
        Open

                return $this->viewResponse($this->module->name() . '::list-missing-page', [
                    'module_name'       =>  $this->module->name(),
                    'title'             =>  I18N::translate('Missing Ancestors'),
                    'tree'              =>  $tree,
                    'root_indi'         =>  $sosa_stats_service->rootIndividual(),
        Severity: Major
        Found in app/Module/Sosa/Http/RequestHandlers/MissingAncestorsList.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                  return str_replace(
                      array_map(fn($tag) => '{' . $tag . '}', $columns_select[1]),
                      array_map(fn($tag) => $mapping[$this->columnName($tag)] ?? '', $columns_select[1]),
                      $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 I18N::translate('%s not precise', $context_label);
            Severity: Major
            Found in app/Module/IsSourced/Data/FactSourceStatus.php - About 30 mins to fix

              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

                  Avoid too many return statements within this method.
                  Open

                              return I18N::translate('%s not sourced', $context_label);
                  Severity: Major
                  Found in app/Module/IsSourced/Data/FactSourceStatus.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

                      Function addNode has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          private function addNode(Individual $indi, int $sosa): void
                          {
                              $birth_year = $indi->getBirthDate()->gregorianYear();
                              $birth_year_est = $birth_year === 0 ? $indi->getEstimatedBirthDate()->gregorianYear() : $birth_year;
                      
                      
                      Severity: Minor
                      Found in app/Module/Sosa/Services/SosaCalculatorService.php - About 25 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 handle has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

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

                      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 handle has a Cognitive Complexity of 6 (exceeds 5 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/GeoDispersion/Http/RequestHandlers/MapAdapterAddAction.php - About 25 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 handle has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function handle(ServerRequestInterface $request): ResponseInterface
                          {
                              $tree = Validator::attributes($request)->tree();
                      
                              $user_id = Validator::parsedBody($request)->integer('sosa-userid', -1);
                      Severity: Minor
                      Found in app/Module/Sosa/Http/RequestHandlers/SosaConfigAction.php - About 25 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 process has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
                          {
                              $tree = Validator::attributes($request)->tree();
                              $route = Validator::attributes($request)->route();
                              $user = Validator::attributes($request)->user();
                      Severity: Minor
                      Found in app/Http/Middleware/AuthTreePreference.php - About 25 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 watermarkText has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          private function watermarkText(ServerRequestInterface $request, Certificate $certificate): string
                          {
                              $sid = Validator::queryParams($request)->isXref()->string('sid', '');
                              if ($sid !== '') {
                                  $source = Registry::sourceFactory()->make($sid, $certificate->tree());
                      Severity: Minor
                      Found in app/Module/Certificates/Http/RequestHandlers/CertificateImage.php - About 25 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

                      Severity
                      Category
                      Status
                      Source
                      Language