TryGhost/Ghost

View on GitHub

Showing 2,188 of 3,985 total issues

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

            paid_conversions(modelOrCollection) {
                modelOrCollection.query('columns', 'posts.*', (qb) => {
                    qb.count('members_subscription_created_events.id')
                        .from('members_subscription_created_events')
                        .whereRaw('posts.id = members_subscription_created_events.attribution_id')
Severity: Major
Found in ghost/core/core/server/models/post.js and 8 other locations - About 1 hr to fix
ghost/core/core/server/models/comment.js on lines 226..233
ghost/core/core/server/models/comment.js on lines 234..241
ghost/core/core/server/models/email-batch.js on lines 24..31
ghost/core/core/server/models/newsletter.js on lines 140..147
ghost/core/core/server/models/newsletter.js on lines 148..155
ghost/core/core/server/models/post.js on lines 1551..1558
ghost/core/core/server/models/post.js on lines 1604..1611
ghost/core/core/server/models/post.js on lines 1612..1619

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

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

            likes(modelOrCollection) {
                modelOrCollection.query('columns', 'comments.*', (qb) => {
                    qb.count('comment_likes.id')
                        .from('comment_likes')
                        .whereRaw('comment_likes.comment_id = comments.id')
Severity: Major
Found in ghost/core/core/server/models/comment.js and 8 other locations - About 1 hr to fix
ghost/core/core/server/models/comment.js on lines 226..233
ghost/core/core/server/models/email-batch.js on lines 24..31
ghost/core/core/server/models/newsletter.js on lines 140..147
ghost/core/core/server/models/newsletter.js on lines 148..155
ghost/core/core/server/models/post.js on lines 1551..1558
ghost/core/core/server/models/post.js on lines 1559..1566
ghost/core/core/server/models/post.js on lines 1604..1611
ghost/core/core/server/models/post.js on lines 1612..1619

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

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

            posts(modelOrCollection) {
                modelOrCollection.query('columns', 'newsletters.*', (qb) => {
                    qb.count('posts.id')
                        .from('posts')
                        .whereRaw('posts.newsletter_id = newsletters.id')
Severity: Major
Found in ghost/core/core/server/models/newsletter.js and 8 other locations - About 1 hr to fix
ghost/core/core/server/models/comment.js on lines 226..233
ghost/core/core/server/models/comment.js on lines 234..241
ghost/core/core/server/models/email-batch.js on lines 24..31
ghost/core/core/server/models/newsletter.js on lines 148..155
ghost/core/core/server/models/post.js on lines 1551..1558
ghost/core/core/server/models/post.js on lines 1559..1566
ghost/core/core/server/models/post.js on lines 1604..1611
ghost/core/core/server/models/post.js on lines 1612..1619

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

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

            recipients(modelOrCollection) {
                modelOrCollection.query('columns', 'email_batches.*', (qb) => {
                    qb.count('email_recipients.id')
                        .from('email_recipients')
                        .whereRaw('email_batches.id = email_recipients.batch_id')
Severity: Major
Found in ghost/core/core/server/models/email-batch.js and 8 other locations - About 1 hr to fix
ghost/core/core/server/models/comment.js on lines 226..233
ghost/core/core/server/models/comment.js on lines 234..241
ghost/core/core/server/models/newsletter.js on lines 140..147
ghost/core/core/server/models/newsletter.js on lines 148..155
ghost/core/core/server/models/post.js on lines 1551..1558
ghost/core/core/server/models/post.js on lines 1559..1566
ghost/core/core/server/models/post.js on lines 1604..1611
ghost/core/core/server/models/post.js on lines 1612..1619

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

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

            negative_feedback(modelOrCollection) {
                modelOrCollection.query('columns', 'posts.*', (qb) => {
                    qb.count('*')
                        .from('members_feedback')
                        .whereRaw('posts.id = members_feedback.post_id AND members_feedback.score = 0')
Severity: Major
Found in ghost/core/core/server/models/post.js and 8 other locations - About 1 hr to fix
ghost/core/core/server/models/comment.js on lines 226..233
ghost/core/core/server/models/comment.js on lines 234..241
ghost/core/core/server/models/email-batch.js on lines 24..31
ghost/core/core/server/models/newsletter.js on lines 140..147
ghost/core/core/server/models/newsletter.js on lines 148..155
ghost/core/core/server/models/post.js on lines 1551..1558
ghost/core/core/server/models/post.js on lines 1559..1566
ghost/core/core/server/models/post.js on lines 1612..1619

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

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

            members(modelOrCollection) {
                modelOrCollection.query('columns', 'newsletters.*', (qb) => {
                    qb.count('members_newsletters.id')
                        .from('members_newsletters')
                        .whereRaw('members_newsletters.newsletter_id = newsletters.id')
Severity: Major
Found in ghost/core/core/server/models/newsletter.js and 8 other locations - About 1 hr to fix
ghost/core/core/server/models/comment.js on lines 226..233
ghost/core/core/server/models/comment.js on lines 234..241
ghost/core/core/server/models/email-batch.js on lines 24..31
ghost/core/core/server/models/newsletter.js on lines 140..147
ghost/core/core/server/models/post.js on lines 1551..1558
ghost/core/core/server/models/post.js on lines 1559..1566
ghost/core/core/server/models/post.js on lines 1604..1611
ghost/core/core/server/models/post.js on lines 1612..1619

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

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

            replies(modelOrCollection) {
                modelOrCollection.query('columns', 'comments.*', (qb) => {
                    qb.count('replies.id')
                        .from('comments AS replies')
                        .whereRaw('replies.parent_id = comments.id')
Severity: Major
Found in ghost/core/core/server/models/comment.js and 8 other locations - About 1 hr to fix
ghost/core/core/server/models/comment.js on lines 234..241
ghost/core/core/server/models/email-batch.js on lines 24..31
ghost/core/core/server/models/newsletter.js on lines 140..147
ghost/core/core/server/models/newsletter.js on lines 148..155
ghost/core/core/server/models/post.js on lines 1551..1558
ghost/core/core/server/models/post.js on lines 1559..1566
ghost/core/core/server/models/post.js on lines 1604..1611
ghost/core/core/server/models/post.js on lines 1612..1619

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

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

            signups(modelOrCollection) {
                modelOrCollection.query('columns', 'posts.*', (qb) => {
                    qb.count('members_created_events.id')
                        .from('members_created_events')
                        .whereRaw('posts.id = members_created_events.attribution_id')
Severity: Major
Found in ghost/core/core/server/models/post.js and 8 other locations - About 1 hr to fix
ghost/core/core/server/models/comment.js on lines 226..233
ghost/core/core/server/models/comment.js on lines 234..241
ghost/core/core/server/models/email-batch.js on lines 24..31
ghost/core/core/server/models/newsletter.js on lines 140..147
ghost/core/core/server/models/newsletter.js on lines 148..155
ghost/core/core/server/models/post.js on lines 1559..1566
ghost/core/core/server/models/post.js on lines 1604..1611
ghost/core/core/server/models/post.js on lines 1612..1619

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

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

            positive_feedback(modelOrCollection) {
                modelOrCollection.query('columns', 'posts.*', (qb) => {
                    qb.sum('score')
                        .from('members_feedback')
                        .whereRaw('posts.id = members_feedback.post_id')
Severity: Major
Found in ghost/core/core/server/models/post.js and 8 other locations - About 1 hr to fix
ghost/core/core/server/models/comment.js on lines 226..233
ghost/core/core/server/models/comment.js on lines 234..241
ghost/core/core/server/models/email-batch.js on lines 24..31
ghost/core/core/server/models/newsletter.js on lines 140..147
ghost/core/core/server/models/newsletter.js on lines 148..155
ghost/core/core/server/models/post.js on lines 1551..1558
ghost/core/core/server/models/post.js on lines 1559..1566
ghost/core/core/server/models/post.js on lines 1604..1611

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

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

        if (response.meta && response.meta.pagination) {
            response.pagination = response.meta.pagination;
            blockParams.push(response.meta.pagination);
        }
Severity: Major
Found in ghost/core/core/frontend/helpers/collection.js and 1 other location - About 1 hr to fix
ghost/core/core/frontend/helpers/get.js on lines 324..327

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

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

    const topCurrencies = currencies.slice(0, noOfTopCurrencies).map((currency) => {
        return {
            value: currency.isoCode.toLowerCase(),
            label: `${currency.isoCode} - ${currency.name}`,
            isoCode: currency.isoCode
Severity: Major
Found in ghost/admin/app/utils/currency.js and 1 other location - About 1 hr to fix
ghost/admin/app/utils/currency.js on lines 146..152

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

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

    const otherCurrencies = currencies.slice(noOfTopCurrencies, currencies.length).map((currency) => {
        return {
            value: currency.isoCode.toLowerCase(),
            label: `${currency.isoCode} - ${currency.name}`,
            isoCode: currency.isoCode
Severity: Major
Found in ghost/admin/app/utils/currency.js and 1 other location - About 1 hr to fix
ghost/admin/app/utils/currency.js on lines 138..144

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

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

            if (response.meta && response.meta.pagination) {
                response.pagination = response.meta.pagination;
                blockParams.push(response.meta.pagination);
            }
Severity: Major
Found in ghost/core/core/frontend/helpers/get.js and 1 other location - About 1 hr to fix
ghost/core/core/frontend/helpers/collection.js on lines 129..132

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

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

module.exports = function (data) {
    // Be careful when you indent the email, because whitespaces are visible in emails!
    return `
Congratulations!

ghost/staff-service/lib/email-templates/new-free-signup.txt.js on lines 1..13
ghost/staff-service/lib/email-templates/new-paid-cancellation.txt.js on lines 1..13

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

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

module.exports = function (data) {
    // Be careful when you indent the email, because whitespaces are visible in emails!
    return `
Hey there,

ghost/staff-service/lib/email-templates/new-free-signup.txt.js on lines 1..13
ghost/staff-service/lib/email-templates/new-paid-started.txt.js on lines 1..13

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

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

            test('returns expected support address for default noreply value', () => {
                let site = {
                    members_support_address: 'noreply',
                    url: 'https://www.example.com'
                };
Severity: Major
Found in apps/portal/src/utils/helpers.test.js and 2 other locations - About 1 hr to fix
apps/portal/src/utils/helpers.test.js on lines 288..296
apps/portal/src/utils/helpers.test.js on lines 365..373

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

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

        test('otherwise, fallbacks to the calculated default_email_address when available', () => {
            let site = {
                default_email_address: 'default@example.com',
                url: 'https://example.com'
            };
Severity: Major
Found in apps/portal/src/utils/helpers.test.js and 2 other locations - About 1 hr to fix
apps/portal/src/utils/helpers.test.js on lines 288..296
apps/portal/src/utils/helpers.test.js on lines 327..335

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

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

module.exports = function (data) {
    // Be careful when you indent the email, because whitespaces are visible in emails!
    return `
Congratulations!

ghost/staff-service/lib/email-templates/new-paid-cancellation.txt.js on lines 1..13
ghost/staff-service/lib/email-templates/new-paid-started.txt.js on lines 1..13

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

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

            test('returns the calculated support email address, if available', () => {
                let site = {
                    support_email_address: 'support@example.com',
                    members_support_address: 'noreply@example.com'
                };
Severity: Major
Found in apps/portal/src/utils/helpers.test.js and 2 other locations - About 1 hr to fix
apps/portal/src/utils/helpers.test.js on lines 327..335
apps/portal/src/utils/helpers.test.js on lines 365..373

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

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

    } else if (type === 'signup' && status === 'error') {
        return (
            <p>
                {t('Signup error: Invalid link')}<br /><a href={singupPortalLink} target="_parent">{t('Click here to retry')}</a>
            </p>
Severity: Major
Found in apps/portal/src/components/Notification.js and 1 other location - About 1 hr to fix
apps/portal/src/components/Notification.js on lines 76..115

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

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