Showing 1,726 of 2,403 total issues
Function TreeViewHandler
has 90 lines of code (exceeds 25 allowed). Consider refactoring. Open
function TreeViewHandler (treeview_instance, ged) {
var tv = this; // Store "this" for usage within jQuery functions where "this" is not this ;-)
this.treeview = $('#' + treeview_instance + '_in');
this.loadingImage = $('#' + treeview_instance + '_loading');
Method getBlock
has 90 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getBlock(Tree $tree, int $block_id, string $context, array $config = []): string
{
$statistics = Registry::container()->get(Statistics::class);
$show_last_update = $this->getBlockSetting($block_id, 'show_last_update', '1');
Method getBlock
has 90 lines of code (exceeds 25 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;
File GedcomExportService.php
has 316 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* webtrees: online genealogy
* Copyright (C) 2023 webtrees development team
Function postDownloadAction
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
public function postDownloadAction(ServerRequestInterface $request): ResponseInterface
{
$tree = Validator::attributes($request)->tree();
if (Auth::isAdmin()) {
- 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 handle
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
public function handle(ServerRequestInterface $request): ResponseInterface
{
$tree = Validator::attributes($request)->tree();
$xref = Validator::attributes($request)->isXref()->string('xref');
$fact_id = Validator::attributes($request)->string('fact_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 canShowByType
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
protected function canShowByType(int $access_level): bool
{
// Dead people...
if ((int) $this->tree->getPreference('SHOW_DEAD_PEOPLE') >= $access_level && $this->isDead()) {
$keep_alive = false;
- 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 reformatDate
has 88 lines of code (exceeds 25 allowed). Consider refactoring. Open
webtrees.reformatDate = function (datefield, dmy) {
const months = ['JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN', 'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC'];
const hijri_months = ['MUHAR', 'SAFAR', 'RABIA', 'RABIT', 'JUMAA', 'JUMAT', 'RAJAB', 'SHAAB', 'RAMAD', 'SHAWW', 'DHUAQ', 'DHUAH'];
const hebrew_months = ['TSH', 'CSH', 'KSL', 'TVT', 'SHV', 'ADR', 'ADS', 'NSN', 'IYR', 'SVN', 'TMZ', 'AAV', 'ELL'];
const french_months = ['VEND', 'BRUM', 'FRIM', 'NIVO', 'PLUV', 'VENT', 'GERM', 'FLOR', 'PRAI', 'MESS', 'THER', 'FRUC', 'COMP'];
Method getBlock
has 88 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getBlock(Tree $tree, int $block_id, string $context, array $config = []): string
{
$request = Registry::container()->get(ServerRequestInterface::class);
$default_start = (bool) $this->getBlockSetting($block_id, 'start');
$filter_links = $this->getBlockSetting($block_id, 'filter', self::LINK_ALL);
Method tags
has 88 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function tags(): array
{
return [
'FAM:CHIL:_FREL' => new CustomElement(I18N::translate('Relationship to father')),
'FAM:CHIL:_MREL' => new CustomElement(I18N::translate('Relationship to mother')),
EventRepository
has 29 functions (exceeds 20 allowed). Consider refactoring. Open
class EventRepository implements EventRepositoryInterface
{
/**
* Sorting directions.
*/
Method getBlock
has 87 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getBlock(Tree $tree, int $block_id, string $context, array $config = []): string
{
$num = (int) $this->getBlockSetting($block_id, 'num', self::DEFAULT_NUMBER);
$info_style = $this->getBlockSetting($block_id, 'infoStyle', self::DEFAULT_STYLE);
Method handle
has 87 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handle(ServerRequestInterface $request): ResponseInterface
{
$topic = $request->getAttribute('topic');
$dmy = I18N::language()->dateOrder();
Method historicEventsAll
has 86 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function historicEventsAll(): Collection
{
switch (I18N::languageTag()) {
case 'en-AU':
case 'en-GB':
Function associateFacts
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
public function associateFacts(Individual $individual): Collection
{
$facts = [];
$asso1 = $this->linked_record_service->linkedIndividuals($individual, 'ASSO');
- 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 handle
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
public function handle(ServerRequestInterface $request): ResponseInterface
{
$data_filesystem = Registry::filesystem()->data();
$all_folders = $this->media_file_service->allMediaFolders($data_filesystem);
- 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 relativesEndHandler
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
protected function relativesEndHandler(): 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
File Migration0.php
has 309 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* webtrees: online genealogy
* Copyright (C) 2023 webtrees development team
Registry
has 28 functions (exceeds 20 allowed). Consider refactoring. Open
class Registry
{
private static CacheFactoryInterface $cache_factory;
private static CalendarDateFactoryInterface $calendar_date_factory;
Method handle
has 83 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handle(ServerRequestInterface $request): ResponseInterface
{
$source = Validator::parsedBody($request)->isInArray(['client', 'server'])->string('source');
$options = Validator::parsedBody($request)->isInArray(['add', 'addupdate', 'update'])->string('options');