fisharebest/webtrees

View on GitHub

Showing 677 of 2,403 total issues

Similar blocks of code found in 4 locations. Consider refactoring.
Open

    protected function sourcesToFixQuery(Tree $tree, array $params): Builder
    {
        $query = DB::table('sources')
            ->where('s_file', '=', $tree->id());

Severity: Major
Found in app/Module/ModuleDataFixTrait.php and 3 other locations - About 40 mins to fix
app/Module/ModuleDataFixTrait.php on lines 169..179
app/Module/ModuleDataFixTrait.php on lines 200..210
app/Module/ModuleDataFixTrait.php on lines 263..273

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 93.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

<?php

/**
 * webtrees: online genealogy
 * Copyright (C) 2023 webtrees development team
Severity: Minor
Found in app/Header.php and 1 other location - About 40 mins to fix
app/Submission.php on lines 1..49

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 93.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

                                $table[$x + 1][$y + 1] = '<div style="background:url(' . $diagonal1 . '); background-position: top right; width: 64px; height: 64px; text-align: center;"><div style="height: 32px; text-align: start;">' . $this->relationship_service->legacyNameAlgorithm($relationships[$n], Registry::individualFactory()->make($path[$n - 1], $tree), Registry::individualFactory()->make($path[$n + 1], $tree)) . '</div><div style="height: 32px; text-align: end;">' . view('icons/arrow-down') . '</div></div>';
Severity: Minor
Found in app/Module/RelationshipsChartModule.php and 1 other location - About 40 mins to fix
app/Module/RelationshipsChartModule.php on lines 363..363

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 93.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

<?php

/**
 * webtrees: online genealogy
 * Copyright (C) 2023 webtrees development team
Severity: Minor
Found in app/Submission.php and 1 other location - About 40 mins to fix
app/Header.php on lines 1..47

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 93.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

                                $table[$x + 1][$y - 1] = '<div style="background:url(' . $diagonal2 . '); width: 64px; height: 64px; text-align: center;"><div style="height: 32px; text-align: end;">' . $this->relationship_service->legacyNameAlgorithm($relationships[$n], Registry::individualFactory()->make($path[$n - 1], $tree), Registry::individualFactory()->make($path[$n + 1], $tree)) . '</div><div style="height: 32px; text-align: start;">' . view('icons/arrow-down') . '</div></div>';
Severity: Minor
Found in app/Module/RelationshipsChartModule.php and 1 other location - About 40 mins to fix
app/Module/RelationshipsChartModule.php on lines 374..374

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 93.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 7 locations. Consider refactoring.
Open

        return response([
            'value' => '@' . $record->xref() . '@',
            'text'  => view('selects/submission', ['submission' => $record]),
            'html'  => view('modals/record-created', [
                'title' => I18N::translate('The submission has been created'),
Severity: Major
Found in app/Http/RequestHandlers/CreateSubmissionAction.php and 6 other locations - About 35 mins to fix
app/Http/RequestHandlers/CreateLocationAction.php on lines 52..60
app/Http/RequestHandlers/CreateMediaObjectAction.php on lines 104..112
app/Http/RequestHandlers/CreateNoteAction.php on lines 58..66
app/Http/RequestHandlers/CreateRepositoryAction.php on lines 73..81
app/Http/RequestHandlers/CreateSourceAction.php on lines 94..102
app/Http/RequestHandlers/CreateSubmitterAction.php on lines 76..84

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 92.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 7 locations. Consider refactoring.
Open

        return response([
            'value' => '@' . $record->xref() . '@',
            'text'  => view('selects/repository', ['repository' => $record]),
            'html'  => view('modals/record-created', [
                'title' => I18N::translate('The repository has been created'),
Severity: Major
Found in app/Http/RequestHandlers/CreateRepositoryAction.php and 6 other locations - About 35 mins to fix
app/Http/RequestHandlers/CreateLocationAction.php on lines 52..60
app/Http/RequestHandlers/CreateMediaObjectAction.php on lines 104..112
app/Http/RequestHandlers/CreateNoteAction.php on lines 58..66
app/Http/RequestHandlers/CreateSourceAction.php on lines 94..102
app/Http/RequestHandlers/CreateSubmissionAction.php on lines 52..60
app/Http/RequestHandlers/CreateSubmitterAction.php on lines 76..84

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 92.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 7 locations. Consider refactoring.
Open

        return response([
            'value' => '@' . $record->xref() . '@',
            'text'  => view('selects/location', ['location' => $record]),
            'html'  => view('modals/record-created', [
                'title' => I18N::translate('The location has been created'),
Severity: Major
Found in app/Http/RequestHandlers/CreateLocationAction.php and 6 other locations - About 35 mins to fix
app/Http/RequestHandlers/CreateMediaObjectAction.php on lines 104..112
app/Http/RequestHandlers/CreateNoteAction.php on lines 58..66
app/Http/RequestHandlers/CreateRepositoryAction.php on lines 73..81
app/Http/RequestHandlers/CreateSourceAction.php on lines 94..102
app/Http/RequestHandlers/CreateSubmissionAction.php on lines 52..60
app/Http/RequestHandlers/CreateSubmitterAction.php on lines 76..84

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 92.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 7 locations. Consider refactoring.
Open

        return response([
            'value' => '@' . $record->xref() . '@',
            'text'  => view('selects/note', ['note' => $record]),
            'html'  => view('modals/record-created', [
                'title' => I18N::translate('The note has been created'),
Severity: Major
Found in app/Http/RequestHandlers/CreateNoteAction.php and 6 other locations - About 35 mins to fix
app/Http/RequestHandlers/CreateLocationAction.php on lines 52..60
app/Http/RequestHandlers/CreateMediaObjectAction.php on lines 104..112
app/Http/RequestHandlers/CreateRepositoryAction.php on lines 73..81
app/Http/RequestHandlers/CreateSourceAction.php on lines 94..102
app/Http/RequestHandlers/CreateSubmissionAction.php on lines 52..60
app/Http/RequestHandlers/CreateSubmitterAction.php on lines 76..84

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 92.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

        return $this->viewResponse('modules/edit-block-config', [
            'block'      => $block,
            'block_id'   => $block_id,
            'cancel_url' => route(TreePage::class, ['tree' => $tree->name()]),
            'save_url'   => route(TreePageBlockUpdate::class, ['tree' => $tree->name(), 'block_id' => $block_id]),
Severity: Minor
Found in app/Http/RequestHandlers/TreePageBlockEdit.php and 1 other location - About 35 mins to fix
app/Http/RequestHandlers/UserPageBlockEdit.php on lines 63..70

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 92.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 7 locations. Consider refactoring.
Open

        return response([
            'value' => '@' . $record->xref() . '@',
            'text'  => view('selects/media', ['media' => $record]),
            'html'  => view('modals/record-created', [
                'title' => I18N::translate('The media object has been created'),
Severity: Major
Found in app/Http/RequestHandlers/CreateMediaObjectAction.php and 6 other locations - About 35 mins to fix
app/Http/RequestHandlers/CreateLocationAction.php on lines 52..60
app/Http/RequestHandlers/CreateNoteAction.php on lines 58..66
app/Http/RequestHandlers/CreateRepositoryAction.php on lines 73..81
app/Http/RequestHandlers/CreateSourceAction.php on lines 94..102
app/Http/RequestHandlers/CreateSubmissionAction.php on lines 52..60
app/Http/RequestHandlers/CreateSubmitterAction.php on lines 76..84

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 92.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

                        default:
                            if ($sex2 === 'M') {
                                // I18N: if you need a different number for %s, contact the developers, as a code-change is required
                                return I18N::translate('great ×%s nephew', I18N::number($down - 2));
                            }
Severity: Major
Found in app/Services/RelationshipService.php and 3 other locations - About 35 mins to fix
app/Services/RelationshipService.php on lines 1503..1513
app/Services/RelationshipService.php on lines 1951..1963
app/Services/RelationshipService.php on lines 2085..2097

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 92.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 7 locations. Consider refactoring.
Open

        return response([
            'value' => '@' . $record->xref() . '@',
            'text'  => view('selects/submitter', ['submitter' => $record]),
            'html'  => view('modals/record-created', [
                'title' => I18N::translate('The submitter has been created'),
Severity: Major
Found in app/Http/RequestHandlers/CreateSubmitterAction.php and 6 other locations - About 35 mins to fix
app/Http/RequestHandlers/CreateLocationAction.php on lines 52..60
app/Http/RequestHandlers/CreateMediaObjectAction.php on lines 104..112
app/Http/RequestHandlers/CreateNoteAction.php on lines 58..66
app/Http/RequestHandlers/CreateRepositoryAction.php on lines 73..81
app/Http/RequestHandlers/CreateSourceAction.php on lines 94..102
app/Http/RequestHandlers/CreateSubmissionAction.php on lines 52..60

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 92.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 7 locations. Consider refactoring.
Open

        return response([
            'value' => '@' . $record->xref() . '@',
            'text'  => view('selects/source', ['source' => $record]),
            'html'  => view('modals/record-created', [
                'title' => I18N::translate('The source has been created'),
Severity: Major
Found in app/Http/RequestHandlers/CreateSourceAction.php and 6 other locations - About 35 mins to fix
app/Http/RequestHandlers/CreateLocationAction.php on lines 52..60
app/Http/RequestHandlers/CreateMediaObjectAction.php on lines 104..112
app/Http/RequestHandlers/CreateNoteAction.php on lines 58..66
app/Http/RequestHandlers/CreateRepositoryAction.php on lines 73..81
app/Http/RequestHandlers/CreateSubmissionAction.php on lines 52..60
app/Http/RequestHandlers/CreateSubmitterAction.php on lines 76..84

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 92.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

                        default:
                            if ($sex2 === 'M') {
                                // I18N: if you need a different number for %s, contact the developers, as a code-change is required
                                return I18N::translate('great ×%s grandfather', I18N::number($up - 2));
                            }
Severity: Major
Found in app/Services/RelationshipService.php and 3 other locations - About 35 mins to fix
app/Services/RelationshipService.php on lines 1503..1513
app/Services/RelationshipService.php on lines 1796..1806
app/Services/RelationshipService.php on lines 2085..2097

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 92.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

                        default:
                            if ($sex2 === 'M') {
                                // I18N: if you need a different number for %s, contact the developers, as a code-change is required
                                return I18N::translate('great ×%s grandson', I18N::number($up - 2));
                            }
Severity: Major
Found in app/Services/RelationshipService.php and 3 other locations - About 35 mins to fix
app/Services/RelationshipService.php on lines 1503..1513
app/Services/RelationshipService.php on lines 1796..1806
app/Services/RelationshipService.php on lines 1951..1963

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 92.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        DB::query()->from('gedcom_setting')->insertUsing(
            ['gedcom_id', 'setting_name', 'setting_value'],
            static function (Builder $query) use ($tree_id): void {
                $query
                    ->select([new Expression($tree_id), 'setting_name', 'setting_value'])
Severity: Minor
Found in app/Services/TreeService.php and 1 other location - About 35 mins to fix
app/Services/TreeService.php on lines 198..206

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 92.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        DB::query()->from('default_resn')->insertUsing(
            ['gedcom_id', 'tag_type', 'resn'],
            static function (Builder $query) use ($tree_id): void {
                $query
                    ->select([new Expression($tree_id), 'tag_type', 'resn'])
Severity: Minor
Found in app/Services/TreeService.php and 1 other location - About 35 mins to fix
app/Services/TreeService.php on lines 188..196

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 92.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

        return $this->viewResponse('modules/edit-block-config', [
            'block'      => $block,
            'block_id'   => $block_id,
            'cancel_url' => route(UserPage::class, ['tree' => $tree->name()]),
            'save_url'   => route(UserPageBlockUpdate::class, ['tree' => $tree->name(), 'block_id' => $block_id]),
Severity: Minor
Found in app/Http/RequestHandlers/UserPageBlockEdit.php and 1 other location - About 35 mins to fix
app/Http/RequestHandlers/TreePageBlockEdit.php on lines 62..69

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 92.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

                        default:
                            if ($sex2 === 'M') {
                                // I18N: if you need a different number for %s, contact the developers, as a code-change is required
                                return I18N::translate('great ×%s uncle', I18N::number($up - 1));
                            }
Severity: Major
Found in app/Services/RelationshipService.php and 3 other locations - About 35 mins to fix
app/Services/RelationshipService.php on lines 1796..1806
app/Services/RelationshipService.php on lines 1951..1963
app/Services/RelationshipService.php on lines 2085..2097

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 92.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Severity
Category
Status
Source
Language