wikimedia/mediawiki-extensions-WikiLove

View on GitHub

Showing 51 of 81 total issues

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

                pie: {
                    fields: [ 'header', 'message' ],
                    option: mw.msg( 'wikilove-food-pie-option' ),
                    descr: mw.msg( 'wikilove-food-pie-desc' ),
                    header: mw.msg( 'wikilove-food-pie-header' ),
Severity: Major
Found in resources/ext.wikiLove.startup/defaultOptions.js and 10 other locations - About 1 hr to fix
resources/ext.wikiLove.startup/defaultOptions.js on lines 265..272
resources/ext.wikiLove.startup/defaultOptions.js on lines 273..280
resources/ext.wikiLove.startup/defaultOptions.js on lines 281..288
resources/ext.wikiLove.startup/defaultOptions.js on lines 289..296
resources/ext.wikiLove.startup/defaultOptions.js on lines 297..304
resources/ext.wikiLove.startup/defaultOptions.js on lines 305..312
resources/ext.wikiLove.startup/defaultOptions.js on lines 313..320
resources/ext.wikiLove.startup/defaultOptions.js on lines 321..328
resources/ext.wikiLove.startup/defaultOptions.js on lines 337..344
resources/ext.wikiLove.startup/defaultOptions.js on lines 345..352

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

                cupcake: {
                    fields: [ 'header', 'message' ],
                    option: mw.msg( 'wikilove-food-cupcake-option' ),
                    descr: mw.msg( 'wikilove-food-cupcake-desc' ),
                    header: mw.msg( 'wikilove-food-cupcake-header' ),
Severity: Major
Found in resources/ext.wikiLove.startup/defaultOptions.js and 10 other locations - About 1 hr to fix
resources/ext.wikiLove.startup/defaultOptions.js on lines 265..272
resources/ext.wikiLove.startup/defaultOptions.js on lines 273..280
resources/ext.wikiLove.startup/defaultOptions.js on lines 281..288
resources/ext.wikiLove.startup/defaultOptions.js on lines 289..296
resources/ext.wikiLove.startup/defaultOptions.js on lines 297..304
resources/ext.wikiLove.startup/defaultOptions.js on lines 305..312
resources/ext.wikiLove.startup/defaultOptions.js on lines 313..320
resources/ext.wikiLove.startup/defaultOptions.js on lines 329..336
resources/ext.wikiLove.startup/defaultOptions.js on lines 337..344
resources/ext.wikiLove.startup/defaultOptions.js on lines 345..352

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

                tea: {
                    fields: [ 'header', 'message' ],
                    option: mw.msg( 'wikilove-food-tea-option' ),
                    descr: mw.msg( 'wikilove-food-tea-desc' ),
                    header: mw.msg( 'wikilove-food-tea-header' ),
Severity: Major
Found in resources/ext.wikiLove.startup/defaultOptions.js and 10 other locations - About 1 hr to fix
resources/ext.wikiLove.startup/defaultOptions.js on lines 265..272
resources/ext.wikiLove.startup/defaultOptions.js on lines 273..280
resources/ext.wikiLove.startup/defaultOptions.js on lines 281..288
resources/ext.wikiLove.startup/defaultOptions.js on lines 289..296
resources/ext.wikiLove.startup/defaultOptions.js on lines 297..304
resources/ext.wikiLove.startup/defaultOptions.js on lines 305..312
resources/ext.wikiLove.startup/defaultOptions.js on lines 321..328
resources/ext.wikiLove.startup/defaultOptions.js on lines 329..336
resources/ext.wikiLove.startup/defaultOptions.js on lines 337..344
resources/ext.wikiLove.startup/defaultOptions.js on lines 345..352

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

                strawberries: {
                    fields: [ 'header', 'message' ],
                    option: mw.msg( 'wikilove-food-strawberries-option' ),
                    descr: mw.msg( 'wikilove-food-strawberries-desc' ),
                    header: mw.msg( 'wikilove-food-strawberries-header' ),
Severity: Major
Found in resources/ext.wikiLove.startup/defaultOptions.js and 10 other locations - About 1 hr to fix
resources/ext.wikiLove.startup/defaultOptions.js on lines 265..272
resources/ext.wikiLove.startup/defaultOptions.js on lines 273..280
resources/ext.wikiLove.startup/defaultOptions.js on lines 281..288
resources/ext.wikiLove.startup/defaultOptions.js on lines 289..296
resources/ext.wikiLove.startup/defaultOptions.js on lines 297..304
resources/ext.wikiLove.startup/defaultOptions.js on lines 305..312
resources/ext.wikiLove.startup/defaultOptions.js on lines 313..320
resources/ext.wikiLove.startup/defaultOptions.js on lines 321..328
resources/ext.wikiLove.startup/defaultOptions.js on lines 329..336
resources/ext.wikiLove.startup/defaultOptions.js on lines 345..352

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

                cookie: {
                    fields: [ 'header', 'message' ],
                    option: mw.msg( 'wikilove-food-cookie-option' ),
                    descr: mw.msg( 'wikilove-food-cookie-desc' ),
                    header: mw.msg( 'wikilove-food-cookie-header' ),
Severity: Major
Found in resources/ext.wikiLove.startup/defaultOptions.js and 10 other locations - About 1 hr to fix
resources/ext.wikiLove.startup/defaultOptions.js on lines 265..272
resources/ext.wikiLove.startup/defaultOptions.js on lines 273..280
resources/ext.wikiLove.startup/defaultOptions.js on lines 281..288
resources/ext.wikiLove.startup/defaultOptions.js on lines 289..296
resources/ext.wikiLove.startup/defaultOptions.js on lines 305..312
resources/ext.wikiLove.startup/defaultOptions.js on lines 313..320
resources/ext.wikiLove.startup/defaultOptions.js on lines 321..328
resources/ext.wikiLove.startup/defaultOptions.js on lines 329..336
resources/ext.wikiLove.startup/defaultOptions.js on lines 337..344
resources/ext.wikiLove.startup/defaultOptions.js on lines 345..352

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

    showPreviewError: function ( errmsg ) {
        // eslint-disable-next-line mediawiki/msg-doc
        $( '#mw-wikilove-preview' ).append( $( '<div>' ).addClass( 'mw-wikilove-error' ).text( mw.msg( errmsg ) ) );
    },
Severity: Major
Found in resources/ext.wikiLove.startup/wikiLove.js and 1 other location - About 1 hr to fix
resources/ext.wikiLove.startup/wikiLove.js on lines 460..463

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

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

    showAddDetailsError: function ( errmsg ) {
        // eslint-disable-next-line mediawiki/msg-doc
        $( '#mw-wikilove-add-details' ).append( $( '<div>' ).addClass( 'mw-wikilove-error' ).text( mw.msg( errmsg ) ) );
    },
Severity: Major
Found in resources/ext.wikiLove.startup/wikiLove.js and 1 other location - About 1 hr to fix
resources/ext.wikiLove.startup/wikiLove.js on lines 465..468

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

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 ( $( '#mw-wikilove-message' ).val().indexOf( '~~~' ) >= 0 ) {
                $.wikiLove.showAddDetailsError( 'wikilove-err-sig' );
                return false;
            }
Severity: Minor
Found in resources/ext.wikiLove.startup/wikiLove.js and 1 other location - About 45 mins to fix
resources/ext.wikiLove.startup/wikiLove.js on lines 390..393

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

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 ( $( '#mw-wikilove-message' ).val().indexOf( '~~~' ) >= 0 ) {
                $.wikiLove.showAddDetailsError( 'wikilove-err-sig' );
                return false;
            }
Severity: Minor
Found in resources/ext.wikiLove.startup/wikiLove.js and 1 other location - About 45 mins to fix
resources/ext.wikiLove.startup/wikiLove.js on lines 586..589

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

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

        const termsLink = mw.html.element( 'a', {
            href: mw.msg( 'wikilove-terms-url' ),
            target: '_blank'
        }, mw.msg( 'wikilove-terms-link' ) );
Severity: Minor
Found in resources/ext.wikiLove.startup/wikiLove.js and 1 other location - About 40 mins to fix
resources/ext.wikiLove.startup/wikiLove.js on lines 68..71

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

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

        const commonsLink = mw.html.element( 'a', {
            href: mw.msg( 'wikilove-commons-url' ),
            target: '_blank'
        }, mw.msg( 'wikilove-commons-link' ) );
Severity: Minor
Found in resources/ext.wikiLove.startup/wikiLove.js and 1 other location - About 40 mins to fix
resources/ext.wikiLove.startup/wikiLove.js on lines 72..75

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

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