TryGhost/Ghost

View on GitHub
apps/admin-x-settings/src/components/settings/general/TitleAndDescription.tsx

Summary

Maintainability
B
4 hrs
Test Coverage

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

    return (
        <TopLevelGroup
            description='The details used to identify your publication around the web'
            isEditing={isEditing}
            keywords={keywords}
apps/admin-x-settings/src/components/settings/email/DefaultRecipients.tsx on lines 152..167
apps/admin-x-settings/src/components/settings/general/LockSite.tsx on lines 102..117
apps/admin-x-settings/src/components/settings/general/PublicationLanguage.tsx on lines 69..84
apps/admin-x-settings/src/components/settings/general/TimeZone.tsx on lines 88..103
apps/admin-x-settings/src/components/settings/growth/TipsOrDonations.tsx on lines 118..133
apps/admin-x-settings/src/components/settings/membership/Access.tsx on lines 177..192

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 86.

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 5 locations. Consider refactoring.
Open

    const {
        localSettings,
        isEditing,
        saveState,
        focusRef,
apps/admin-x-settings/src/components/settings/general/Facebook.tsx on lines 12..21
apps/admin-x-settings/src/components/settings/general/SocialAccounts.tsx on lines 9..18
apps/admin-x-settings/src/components/settings/general/Twitter.tsx on lines 12..21
apps/comments-ui/src/components/content/Content.tsx on lines 11..11

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 51.

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 11 locations. Consider refactoring.
Open

    const handleTitleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
        updateSetting('title', e.target.value);
    };
apps/admin-x-settings/src/components/settings/general/Facebook.tsx on lines 34..36
apps/admin-x-settings/src/components/settings/general/Facebook.tsx on lines 38..40
apps/admin-x-settings/src/components/settings/general/LockSite.tsx on lines 34..36
apps/admin-x-settings/src/components/settings/general/LockSite.tsx on lines 38..40
apps/admin-x-settings/src/components/settings/general/Metadata.tsx on lines 73..75
apps/admin-x-settings/src/components/settings/general/Metadata.tsx on lines 77..79
apps/admin-x-settings/src/components/settings/general/PublicationLanguage.tsx on lines 33..35
apps/admin-x-settings/src/components/settings/general/TitleAndDescription.tsx on lines 25..27
apps/admin-x-settings/src/components/settings/general/Twitter.tsx on lines 32..34
apps/admin-x-settings/src/components/settings/general/Twitter.tsx on lines 36..38

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 45.

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 11 locations. Consider refactoring.
Open

    const handleDescriptionChange = (e: React.ChangeEvent<HTMLInputElement>) => {
        updateSetting('description', e.target.value);
    };
apps/admin-x-settings/src/components/settings/general/Facebook.tsx on lines 34..36
apps/admin-x-settings/src/components/settings/general/Facebook.tsx on lines 38..40
apps/admin-x-settings/src/components/settings/general/LockSite.tsx on lines 34..36
apps/admin-x-settings/src/components/settings/general/LockSite.tsx on lines 38..40
apps/admin-x-settings/src/components/settings/general/Metadata.tsx on lines 73..75
apps/admin-x-settings/src/components/settings/general/Metadata.tsx on lines 77..79
apps/admin-x-settings/src/components/settings/general/PublicationLanguage.tsx on lines 33..35
apps/admin-x-settings/src/components/settings/general/TitleAndDescription.tsx on lines 21..23
apps/admin-x-settings/src/components/settings/general/Twitter.tsx on lines 32..34
apps/admin-x-settings/src/components/settings/general/Twitter.tsx on lines 36..38

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 45.

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

There are no issues that match your filters.

Category
Status