TryGhost/Ghost

View on GitHub

Showing 2,185 of 3,998 total issues

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

    @action
    setFacebookDescription() {
        const description = event.target.value;
        this.args.post.ogDescription = description.trim();
        this.args.post.save();
Severity: Major
Found in ghost/admin/app/components/editor/modals/preview/social.js and 1 other location - About 2 hrs to fix
ghost/admin/app/components/editor/modals/preview/social.js on lines 193..199

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

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

        if (!dest) {
            throw new errors.IncorrectUsageError({
                message: tpl(messages.missingConstructorOption.message, {opt: 'dest'}),
                context: tpl(messages.missingConstructorOption.context, {opt: 'dest'}),
                help: tpl(messages.globalHelp)
Severity: Major
Found in ghost/minifier/lib/Minifier.js and 1 other location - About 2 hrs to fix
ghost/minifier/lib/Minifier.js on lines 29..35

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

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

        if (!isSignupAllowed({site})) {
            return (
                <section>
                    <div className='gh-portal-section'>
                        <p
Severity: Major
Found in apps/portal/src/components/pages/SignupPage.js and 1 other location - About 2 hrs to fix
apps/portal/src/components/pages/SigninPage.js on lines 135..148

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

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

        if (!src) {
            throw new errors.IncorrectUsageError({
                message: tpl(messages.missingConstructorOption.message, {opt: 'src'}),
                context: tpl(messages.missingConstructorOption.context, {opt: 'src'}),
                help: tpl(messages.globalHelp)
Severity: Major
Found in ghost/minifier/lib/Minifier.js and 1 other location - About 2 hrs to fix
ghost/minifier/lib/Minifier.js on lines 36..42

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

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

        if (isBlank(email)) {
            model.errors.add('email', 'Please enter an email.');
            this.invalidate();
        } else if (!validator.isEmail(email)) {
            model.errors.add('email', 'Invalid Email.');
Severity: Major
Found in ghost/admin/app/validators/new-user.js and 2 other locations - About 2 hrs to fix
ghost/admin/app/validators/invite-user.js on lines 11..17
ghost/admin/app/validators/member.js on lines 18..24

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

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

module.exports = class StripeLiveEnabledEvent {
    /**
     * @param {StripeLiveEnabledEventData} data
     * @param {Date} timestamp
     */
Severity: Major
Found in ghost/stripe/lib/events/StripeLiveEnabledEvent.js and 15 other locations - About 2 hrs to fix
ghost/core/core/server/services/email-analytics/events/StartEmailAnalyticsJobEvent.js on lines 5..22
ghost/link-redirects/lib/RedirectEvent.js on lines 7..24
ghost/member-events/lib/MemberCreatedEvent.js on lines 9..26
ghost/member-events/lib/MemberEntryViewEvent.js on lines 9..26
ghost/member-events/lib/MemberPaidCancellationEvent.js on lines 10..27
ghost/member-events/lib/MemberPaidConversionEvent.js on lines 10..27
ghost/member-events/lib/MemberSignupEvent.js on lines 8..25
ghost/member-events/lib/MemberSubscribeEvent.js on lines 7..24
ghost/member-events/lib/MemberUnsubscribeEvent.js on lines 9..26
ghost/member-events/lib/SubscriptionActivatedEvent.js on lines 13..30
ghost/member-events/lib/SubscriptionCancelledEvent.js on lines 12..29
ghost/member-events/lib/SubscriptionCreatedEvent.js on lines 14..31
ghost/milestones/lib/MilestoneCreatedEvent.js on lines 5..22
ghost/stripe/lib/events/StripeLiveDisabledEvent.js on lines 6..23
ghost/webmentions/lib/MentionCreatedEvent.js on lines 6..23

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

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

module.exports = class MemberSignupEvent {
    /**
     * @param {MemberSignupEventData} data
     * @param {Date} timestamp
     */
Severity: Major
Found in ghost/member-events/lib/MemberSignupEvent.js and 15 other locations - About 2 hrs to fix
ghost/core/core/server/services/email-analytics/events/StartEmailAnalyticsJobEvent.js on lines 5..22
ghost/link-redirects/lib/RedirectEvent.js on lines 7..24
ghost/member-events/lib/MemberCreatedEvent.js on lines 9..26
ghost/member-events/lib/MemberEntryViewEvent.js on lines 9..26
ghost/member-events/lib/MemberPaidCancellationEvent.js on lines 10..27
ghost/member-events/lib/MemberPaidConversionEvent.js on lines 10..27
ghost/member-events/lib/MemberSubscribeEvent.js on lines 7..24
ghost/member-events/lib/MemberUnsubscribeEvent.js on lines 9..26
ghost/member-events/lib/SubscriptionActivatedEvent.js on lines 13..30
ghost/member-events/lib/SubscriptionCancelledEvent.js on lines 12..29
ghost/member-events/lib/SubscriptionCreatedEvent.js on lines 14..31
ghost/milestones/lib/MilestoneCreatedEvent.js on lines 5..22
ghost/stripe/lib/events/StripeLiveDisabledEvent.js on lines 6..23
ghost/stripe/lib/events/StripeLiveEnabledEvent.js on lines 6..23
ghost/webmentions/lib/MentionCreatedEvent.js on lines 6..23

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

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

module.exports = class MemberEntryViewEvent {
    /**
     * @param {MemberEntryViewEventData} data
     * @param {Date} timestamp
     */
Severity: Major
Found in ghost/member-events/lib/MemberEntryViewEvent.js and 15 other locations - About 2 hrs to fix
ghost/core/core/server/services/email-analytics/events/StartEmailAnalyticsJobEvent.js on lines 5..22
ghost/link-redirects/lib/RedirectEvent.js on lines 7..24
ghost/member-events/lib/MemberCreatedEvent.js on lines 9..26
ghost/member-events/lib/MemberPaidCancellationEvent.js on lines 10..27
ghost/member-events/lib/MemberPaidConversionEvent.js on lines 10..27
ghost/member-events/lib/MemberSignupEvent.js on lines 8..25
ghost/member-events/lib/MemberSubscribeEvent.js on lines 7..24
ghost/member-events/lib/MemberUnsubscribeEvent.js on lines 9..26
ghost/member-events/lib/SubscriptionActivatedEvent.js on lines 13..30
ghost/member-events/lib/SubscriptionCancelledEvent.js on lines 12..29
ghost/member-events/lib/SubscriptionCreatedEvent.js on lines 14..31
ghost/milestones/lib/MilestoneCreatedEvent.js on lines 5..22
ghost/stripe/lib/events/StripeLiveDisabledEvent.js on lines 6..23
ghost/stripe/lib/events/StripeLiveEnabledEvent.js on lines 6..23
ghost/webmentions/lib/MentionCreatedEvent.js on lines 6..23

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

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

module.exports = class MemberCreatedEvent {
    /**
     * @param {MemberCreatedEventData} data
     * @param {Date} timestamp
     */
Severity: Major
Found in ghost/member-events/lib/MemberCreatedEvent.js and 15 other locations - About 2 hrs to fix
ghost/core/core/server/services/email-analytics/events/StartEmailAnalyticsJobEvent.js on lines 5..22
ghost/link-redirects/lib/RedirectEvent.js on lines 7..24
ghost/member-events/lib/MemberEntryViewEvent.js on lines 9..26
ghost/member-events/lib/MemberPaidCancellationEvent.js on lines 10..27
ghost/member-events/lib/MemberPaidConversionEvent.js on lines 10..27
ghost/member-events/lib/MemberSignupEvent.js on lines 8..25
ghost/member-events/lib/MemberSubscribeEvent.js on lines 7..24
ghost/member-events/lib/MemberUnsubscribeEvent.js on lines 9..26
ghost/member-events/lib/SubscriptionActivatedEvent.js on lines 13..30
ghost/member-events/lib/SubscriptionCancelledEvent.js on lines 12..29
ghost/member-events/lib/SubscriptionCreatedEvent.js on lines 14..31
ghost/milestones/lib/MilestoneCreatedEvent.js on lines 5..22
ghost/stripe/lib/events/StripeLiveDisabledEvent.js on lines 6..23
ghost/stripe/lib/events/StripeLiveEnabledEvent.js on lines 6..23
ghost/webmentions/lib/MentionCreatedEvent.js on lines 6..23

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

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

        if (isBlank(email)) {
            model.errors.add('email', 'Please enter an email.');
            this.invalidate();
        } else if (!validator.isEmail(email)) {
            model.errors.add('email', 'Invalid Email.');
Severity: Major
Found in ghost/admin/app/validators/member.js and 2 other locations - About 2 hrs to fix
ghost/admin/app/validators/invite-user.js on lines 11..17
ghost/admin/app/validators/new-user.js on lines 25..31

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

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

module.exports = class MentionCreatedEvent {
    /**
     * @param {MentionCreatedEventData} data
     * @param {Date} timestamp
     */
Severity: Major
Found in ghost/webmentions/lib/MentionCreatedEvent.js and 15 other locations - About 2 hrs to fix
ghost/core/core/server/services/email-analytics/events/StartEmailAnalyticsJobEvent.js on lines 5..22
ghost/link-redirects/lib/RedirectEvent.js on lines 7..24
ghost/member-events/lib/MemberCreatedEvent.js on lines 9..26
ghost/member-events/lib/MemberEntryViewEvent.js on lines 9..26
ghost/member-events/lib/MemberPaidCancellationEvent.js on lines 10..27
ghost/member-events/lib/MemberPaidConversionEvent.js on lines 10..27
ghost/member-events/lib/MemberSignupEvent.js on lines 8..25
ghost/member-events/lib/MemberSubscribeEvent.js on lines 7..24
ghost/member-events/lib/MemberUnsubscribeEvent.js on lines 9..26
ghost/member-events/lib/SubscriptionActivatedEvent.js on lines 13..30
ghost/member-events/lib/SubscriptionCancelledEvent.js on lines 12..29
ghost/member-events/lib/SubscriptionCreatedEvent.js on lines 14..31
ghost/milestones/lib/MilestoneCreatedEvent.js on lines 5..22
ghost/stripe/lib/events/StripeLiveDisabledEvent.js on lines 6..23
ghost/stripe/lib/events/StripeLiveEnabledEvent.js on lines 6..23

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

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

module.exports = class RedirectEvent {
    /**
     * @param {RedirectEventData} data
     * @param {Date} timestamp
     */
Severity: Major
Found in ghost/link-redirects/lib/RedirectEvent.js and 15 other locations - About 2 hrs to fix
ghost/core/core/server/services/email-analytics/events/StartEmailAnalyticsJobEvent.js on lines 5..22
ghost/member-events/lib/MemberCreatedEvent.js on lines 9..26
ghost/member-events/lib/MemberEntryViewEvent.js on lines 9..26
ghost/member-events/lib/MemberPaidCancellationEvent.js on lines 10..27
ghost/member-events/lib/MemberPaidConversionEvent.js on lines 10..27
ghost/member-events/lib/MemberSignupEvent.js on lines 8..25
ghost/member-events/lib/MemberSubscribeEvent.js on lines 7..24
ghost/member-events/lib/MemberUnsubscribeEvent.js on lines 9..26
ghost/member-events/lib/SubscriptionActivatedEvent.js on lines 13..30
ghost/member-events/lib/SubscriptionCancelledEvent.js on lines 12..29
ghost/member-events/lib/SubscriptionCreatedEvent.js on lines 14..31
ghost/milestones/lib/MilestoneCreatedEvent.js on lines 5..22
ghost/stripe/lib/events/StripeLiveDisabledEvent.js on lines 6..23
ghost/stripe/lib/events/StripeLiveEnabledEvent.js on lines 6..23
ghost/webmentions/lib/MentionCreatedEvent.js on lines 6..23

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

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

module.exports = class SubscriptionCreatedEvent {
    /**
     * @param {SubscriptionCreatedEventData} data
     * @param {Date} timestamp
     */
Severity: Major
Found in ghost/member-events/lib/SubscriptionCreatedEvent.js and 15 other locations - About 2 hrs to fix
ghost/core/core/server/services/email-analytics/events/StartEmailAnalyticsJobEvent.js on lines 5..22
ghost/link-redirects/lib/RedirectEvent.js on lines 7..24
ghost/member-events/lib/MemberCreatedEvent.js on lines 9..26
ghost/member-events/lib/MemberEntryViewEvent.js on lines 9..26
ghost/member-events/lib/MemberPaidCancellationEvent.js on lines 10..27
ghost/member-events/lib/MemberPaidConversionEvent.js on lines 10..27
ghost/member-events/lib/MemberSignupEvent.js on lines 8..25
ghost/member-events/lib/MemberSubscribeEvent.js on lines 7..24
ghost/member-events/lib/MemberUnsubscribeEvent.js on lines 9..26
ghost/member-events/lib/SubscriptionActivatedEvent.js on lines 13..30
ghost/member-events/lib/SubscriptionCancelledEvent.js on lines 12..29
ghost/milestones/lib/MilestoneCreatedEvent.js on lines 5..22
ghost/stripe/lib/events/StripeLiveDisabledEvent.js on lines 6..23
ghost/stripe/lib/events/StripeLiveEnabledEvent.js on lines 6..23
ghost/webmentions/lib/MentionCreatedEvent.js on lines 6..23

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

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

module.exports = class MemberUnsubscribeEvent {
    /**
     * @param {MemberUnsubscribeEventData} data
     * @param {Date} timestamp
     */
Severity: Major
Found in ghost/member-events/lib/MemberUnsubscribeEvent.js and 15 other locations - About 2 hrs to fix
ghost/core/core/server/services/email-analytics/events/StartEmailAnalyticsJobEvent.js on lines 5..22
ghost/link-redirects/lib/RedirectEvent.js on lines 7..24
ghost/member-events/lib/MemberCreatedEvent.js on lines 9..26
ghost/member-events/lib/MemberEntryViewEvent.js on lines 9..26
ghost/member-events/lib/MemberPaidCancellationEvent.js on lines 10..27
ghost/member-events/lib/MemberPaidConversionEvent.js on lines 10..27
ghost/member-events/lib/MemberSignupEvent.js on lines 8..25
ghost/member-events/lib/MemberSubscribeEvent.js on lines 7..24
ghost/member-events/lib/SubscriptionActivatedEvent.js on lines 13..30
ghost/member-events/lib/SubscriptionCancelledEvent.js on lines 12..29
ghost/member-events/lib/SubscriptionCreatedEvent.js on lines 14..31
ghost/milestones/lib/MilestoneCreatedEvent.js on lines 5..22
ghost/stripe/lib/events/StripeLiveDisabledEvent.js on lines 6..23
ghost/stripe/lib/events/StripeLiveEnabledEvent.js on lines 6..23
ghost/webmentions/lib/MentionCreatedEvent.js on lines 6..23

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

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

        if (isBlank(email)) {
            model.errors.add('email', 'Please enter an email.');
            this.invalidate();
        } else if (!validator.isEmail(email)) {
            model.errors.add('email', 'Invalid Email.');
Severity: Major
Found in ghost/admin/app/validators/invite-user.js and 2 other locations - About 2 hrs to fix
ghost/admin/app/validators/member.js on lines 18..24
ghost/admin/app/validators/new-user.js on lines 25..31

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

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

module.exports = class MilestoneCreatedEvent {
    /**
     * @param {MilestoneCreatedEventData} data
     * @param {Date} timestamp
     */
Severity: Major
Found in ghost/milestones/lib/MilestoneCreatedEvent.js and 15 other locations - About 2 hrs to fix
ghost/core/core/server/services/email-analytics/events/StartEmailAnalyticsJobEvent.js on lines 5..22
ghost/link-redirects/lib/RedirectEvent.js on lines 7..24
ghost/member-events/lib/MemberCreatedEvent.js on lines 9..26
ghost/member-events/lib/MemberEntryViewEvent.js on lines 9..26
ghost/member-events/lib/MemberPaidCancellationEvent.js on lines 10..27
ghost/member-events/lib/MemberPaidConversionEvent.js on lines 10..27
ghost/member-events/lib/MemberSignupEvent.js on lines 8..25
ghost/member-events/lib/MemberSubscribeEvent.js on lines 7..24
ghost/member-events/lib/MemberUnsubscribeEvent.js on lines 9..26
ghost/member-events/lib/SubscriptionActivatedEvent.js on lines 13..30
ghost/member-events/lib/SubscriptionCancelledEvent.js on lines 12..29
ghost/member-events/lib/SubscriptionCreatedEvent.js on lines 14..31
ghost/stripe/lib/events/StripeLiveDisabledEvent.js on lines 6..23
ghost/stripe/lib/events/StripeLiveEnabledEvent.js on lines 6..23
ghost/webmentions/lib/MentionCreatedEvent.js on lines 6..23

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

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

module.exports = class SubscriptionCancelledEvent {
    /**
     * @param {SubscriptionCancelledEventData} data
     * @param {Date} timestamp
     */
Severity: Major
Found in ghost/member-events/lib/SubscriptionCancelledEvent.js and 15 other locations - About 2 hrs to fix
ghost/core/core/server/services/email-analytics/events/StartEmailAnalyticsJobEvent.js on lines 5..22
ghost/link-redirects/lib/RedirectEvent.js on lines 7..24
ghost/member-events/lib/MemberCreatedEvent.js on lines 9..26
ghost/member-events/lib/MemberEntryViewEvent.js on lines 9..26
ghost/member-events/lib/MemberPaidCancellationEvent.js on lines 10..27
ghost/member-events/lib/MemberPaidConversionEvent.js on lines 10..27
ghost/member-events/lib/MemberSignupEvent.js on lines 8..25
ghost/member-events/lib/MemberSubscribeEvent.js on lines 7..24
ghost/member-events/lib/MemberUnsubscribeEvent.js on lines 9..26
ghost/member-events/lib/SubscriptionActivatedEvent.js on lines 13..30
ghost/member-events/lib/SubscriptionCreatedEvent.js on lines 14..31
ghost/milestones/lib/MilestoneCreatedEvent.js on lines 5..22
ghost/stripe/lib/events/StripeLiveDisabledEvent.js on lines 6..23
ghost/stripe/lib/events/StripeLiveEnabledEvent.js on lines 6..23
ghost/webmentions/lib/MentionCreatedEvent.js on lines 6..23

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

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

module.exports = class SubscriptionActivatedEvent {
    /**
     * @param {SubscriptionActivatedEventData} data
     * @param {Date} timestamp
     */
Severity: Major
Found in ghost/member-events/lib/SubscriptionActivatedEvent.js and 15 other locations - About 2 hrs to fix
ghost/core/core/server/services/email-analytics/events/StartEmailAnalyticsJobEvent.js on lines 5..22
ghost/link-redirects/lib/RedirectEvent.js on lines 7..24
ghost/member-events/lib/MemberCreatedEvent.js on lines 9..26
ghost/member-events/lib/MemberEntryViewEvent.js on lines 9..26
ghost/member-events/lib/MemberPaidCancellationEvent.js on lines 10..27
ghost/member-events/lib/MemberPaidConversionEvent.js on lines 10..27
ghost/member-events/lib/MemberSignupEvent.js on lines 8..25
ghost/member-events/lib/MemberSubscribeEvent.js on lines 7..24
ghost/member-events/lib/MemberUnsubscribeEvent.js on lines 9..26
ghost/member-events/lib/SubscriptionCancelledEvent.js on lines 12..29
ghost/member-events/lib/SubscriptionCreatedEvent.js on lines 14..31
ghost/milestones/lib/MilestoneCreatedEvent.js on lines 5..22
ghost/stripe/lib/events/StripeLiveDisabledEvent.js on lines 6..23
ghost/stripe/lib/events/StripeLiveEnabledEvent.js on lines 6..23
ghost/webmentions/lib/MentionCreatedEvent.js on lines 6..23

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

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

module.exports = class MemberPaidConversionEvent {
    /**
     * @param {MemberPaidConversionEventData} data
     * @param {Date} timestamp
     */
Severity: Major
Found in ghost/member-events/lib/MemberPaidConversionEvent.js and 15 other locations - About 2 hrs to fix
ghost/core/core/server/services/email-analytics/events/StartEmailAnalyticsJobEvent.js on lines 5..22
ghost/link-redirects/lib/RedirectEvent.js on lines 7..24
ghost/member-events/lib/MemberCreatedEvent.js on lines 9..26
ghost/member-events/lib/MemberEntryViewEvent.js on lines 9..26
ghost/member-events/lib/MemberPaidCancellationEvent.js on lines 10..27
ghost/member-events/lib/MemberSignupEvent.js on lines 8..25
ghost/member-events/lib/MemberSubscribeEvent.js on lines 7..24
ghost/member-events/lib/MemberUnsubscribeEvent.js on lines 9..26
ghost/member-events/lib/SubscriptionActivatedEvent.js on lines 13..30
ghost/member-events/lib/SubscriptionCancelledEvent.js on lines 12..29
ghost/member-events/lib/SubscriptionCreatedEvent.js on lines 14..31
ghost/milestones/lib/MilestoneCreatedEvent.js on lines 5..22
ghost/stripe/lib/events/StripeLiveDisabledEvent.js on lines 6..23
ghost/stripe/lib/events/StripeLiveEnabledEvent.js on lines 6..23
ghost/webmentions/lib/MentionCreatedEvent.js on lines 6..23

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

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

module.exports = class StripeLiveDisabledEvent {
    /**
     * @param {StripeLiveDisabledEventData} data
     * @param {Date} timestamp
     */
Severity: Major
Found in ghost/stripe/lib/events/StripeLiveDisabledEvent.js and 15 other locations - About 2 hrs to fix
ghost/core/core/server/services/email-analytics/events/StartEmailAnalyticsJobEvent.js on lines 5..22
ghost/link-redirects/lib/RedirectEvent.js on lines 7..24
ghost/member-events/lib/MemberCreatedEvent.js on lines 9..26
ghost/member-events/lib/MemberEntryViewEvent.js on lines 9..26
ghost/member-events/lib/MemberPaidCancellationEvent.js on lines 10..27
ghost/member-events/lib/MemberPaidConversionEvent.js on lines 10..27
ghost/member-events/lib/MemberSignupEvent.js on lines 8..25
ghost/member-events/lib/MemberSubscribeEvent.js on lines 7..24
ghost/member-events/lib/MemberUnsubscribeEvent.js on lines 9..26
ghost/member-events/lib/SubscriptionActivatedEvent.js on lines 13..30
ghost/member-events/lib/SubscriptionCancelledEvent.js on lines 12..29
ghost/member-events/lib/SubscriptionCreatedEvent.js on lines 14..31
ghost/milestones/lib/MilestoneCreatedEvent.js on lines 5..22
ghost/stripe/lib/events/StripeLiveEnabledEvent.js on lines 6..23
ghost/webmentions/lib/MentionCreatedEvent.js on lines 6..23

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

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