Showing 1,726 of 2,403 total issues
Method myPlot
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function myPlot(
string $chart_title,
array $x_axis,
string $x_axis_title,
array $ydata,
Method getCloseRelationship
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getCloseRelationship(Individual $individual1, Individual $individual2, int $maxlength = 4): array
{
if ($individual1 === $individual2) {
return [$individual1];
}
Method handle
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handle(ServerRequestInterface $request): ResponseInterface
{
$user = Validator::attributes($request)->user();
$user_id = Validator::parsedBody($request)->integer('user_id');
$username = Validator::parsedBody($request)->string('username');
Method handle
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handle(ServerRequestInterface $request): ResponseInterface
{
$user = Validator::attributes($request)->user();
$languages = $this->module_service->findByInterface(ModuleLanguageInterface::class, true)
File Relationship.php
has 285 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* webtrees: online genealogy
* Copyright (C) 2023 webtrees development team
Method getDescendantsHtml
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getDescendantsHtml(Tree $tree, array $individuals, array $ancestors, string $surname, bool $soundex_dm, bool $soundex_std, Individual $individual, Family|null $parents = null): string
{
$module = $this->module_service
->findByComponent(ModuleChartInterface::class, $tree, Auth::user())
->first(static fn (ModuleInterface $module) => $module instanceof RelationshipsChartModule);
File treeview.js
has 282 lines of code (exceeds 250 allowed). Consider refactoring. Open
/**
* webtrees: online genealogy
* Copyright (C) 2023 webtrees development team
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Method handle
has 69 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();
$scale = Validator::attributes($request)->isBetween(self::MINIMUM_SCALE, self::MAXIMUM_SCALE)->integer('scale');
Function getBlock
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
public function getBlock(Tree $tree, int $block_id, string $context, array $config = []): string
{
$PEDIGREE_ROOT_ID = $tree->getPreference('PEDIGREE_ROOT_ID');
$gedcomid = $tree->getUserPreference(Auth::user(), UserInterface::PREF_TREE_ACCOUNT_XREF);
$default_xref = $gedcomid ?: $PEDIGREE_ROOT_ID;
- Read upRead up
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 insertMissingLevels
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
protected function insertMissingLevels(Tree $tree, string $tag, string $gedcom, bool $include_hidden): string
{
$next_level = substr_count($tag, ':') + 1;
$factory = Registry::elementFactory();
$subtags = $factory->make($tag)->subtags();
- Read upRead up
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 lineStartHandler
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
protected function lineStartHandler(array $attrs): void
{
// Start horizontal position, current position (default)
$x1 = ReportBaseElement::CURRENT_POSITION;
if (isset($attrs['x1'])) {
- Read upRead up
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 repeatTagEndHandler
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
protected function repeatTagEndHandler(): void
{
$this->process_repeats--;
if ($this->process_repeats > 0) {
return;
- Read upRead up
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 leafletJsTileLayers
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function leafletJsTileLayers(): array
{
$api_key = $this->getPreference('api_key');
return [
Function calGenerateSelectorContent
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
function calGenerateSelectorContent (dateFieldId, dateDivId, date) {
let i, j;
let content = '<table border="1"><tr>';
content += '<td><select class="form-select" id="' + dateFieldId + '_daySelect" onchange="return webtrees.calUpdateCalendar(\'' + dateFieldId + '\', \'' + dateDivId + '\');">';
for (i = 1; i < 32; i++) {
Method handle
has 68 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();
$xrefs = Validator::queryParams($request)->string('xrefs', '');
Method handle
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handle(ServerRequestInterface $request): ResponseInterface
{
$tree = Validator::attributes($request)->tree();
$view = Validator::attributes($request)->isInArray(['day', 'month', 'year'])->string('view');
$cal = Validator::queryParams($request)->string('cal', '');
Method run
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function run(): void
{
// Setting up the styles
echo '<style>';
echo '#bodydiv { font: 10px sans-serif;}';
Method relativesEndHandler
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function relativesEndHandler(): void
{
$this->process_repeats--;
if ($this->process_repeats > 0) {
return;
Method isDead
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function isDead(): bool
{
$MAX_ALIVE_AGE = (int) $this->tree->getPreference('MAX_ALIVE_AGE');
$today_jd = Registry::timestampFactory()->now()->julianDay();
Method getWidth
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getWidth($renderer): array
{
// Setup the style name
$renderer->setCurrentStyle('footnotenum');