wikimedia/mediawiki-extensions-VisualEditor

View on GitHub

Showing 912 of 912 total issues

Function VeUiMWCategoriesPage has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

ve.ui.MWCategoriesPage = function VeUiMWCategoriesPage( name, config ) {
    // Configuration initialization
    config = config || {};

    // Parent constructor
Severity: Minor
Found in modules/ve-mw/ui/pages/ve.ui.MWCategoriesPage.js - About 1 hr to fix

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

    ve.ui.MWPreContextItem = function VeUiMWPreContextItem() {
        // Parent constructor
        ve.ui.MWPreContextItem.super.apply( this, arguments );
    
        // Initialization
    Severity: Major
    Found in modules/ve-mw/ui/contextitems/ve.ui.MWPreContextItem.js and 9 other locations - About 1 hr to fix
    editcheck/modules/EditCheckContextItem.js on lines 18..24
    modules/ve-mw/ce/annotations/ve.ce.MWNowikiAnnotation.js on lines 17..23
    modules/ve-mw/ui/contextitems/ve.ui.MWGalleryContextItem.js on lines 17..23
    modules/ve-mw/ui/contextitems/ve.ui.MWInternalLinkContextItem.js on lines 18..24
    modules/ve-mw/ui/contextitems/ve.ui.MWLanguageVariantNodeContextItem.js on lines 18..24
    modules/ve-mw/ui/contextitems/ve.ui.MWMagicLinkNodeContextItem.js on lines 18..24
    modules/ve-mw/ui/contextitems/ve.ui.MWWikitextPasteContextItem.js on lines 18..24
    modules/ve-mw/ui/dialogs/ve.ui.MWMobileSaveDialog.js on lines 20..26
    modules/ve-mw/ui/elements/ve.ui.MWPreviewElement.js on lines 20..26

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

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

    ve.ui.MWGalleryContextItem = function VeUiMWGalleryContextItem() {
        // Parent constructor
        ve.ui.MWGalleryContextItem.super.apply( this, arguments );
    
        // Initialization
    editcheck/modules/EditCheckContextItem.js on lines 18..24
    modules/ve-mw/ce/annotations/ve.ce.MWNowikiAnnotation.js on lines 17..23
    modules/ve-mw/ui/contextitems/ve.ui.MWInternalLinkContextItem.js on lines 18..24
    modules/ve-mw/ui/contextitems/ve.ui.MWLanguageVariantNodeContextItem.js on lines 18..24
    modules/ve-mw/ui/contextitems/ve.ui.MWMagicLinkNodeContextItem.js on lines 18..24
    modules/ve-mw/ui/contextitems/ve.ui.MWPreContextItem.js on lines 18..24
    modules/ve-mw/ui/contextitems/ve.ui.MWWikitextPasteContextItem.js on lines 18..24
    modules/ve-mw/ui/dialogs/ve.ui.MWMobileSaveDialog.js on lines 20..26
    modules/ve-mw/ui/elements/ve.ui.MWPreviewElement.js on lines 20..26

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

    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

    ve.dm.MWDisplayTitleMetaItem.static.toDataElement = function ( domElements ) {
        const content = domElements[ 0 ].getAttribute( 'content' );
        return {
            type: this.name,
            attributes: {
    Severity: Major
    Found in modules/ve-mw/dm/metaitems/ve.dm.MWDisplayTitleMetaItem.js and 1 other location - About 1 hr to fix
    modules/ve-mw/dm/metaitems/ve.dm.MWLanguageMetaItem.js on lines 33..41

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

    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

                        linkCacheUpdate[ pageInfo.title ] = {
                            missing: Object.prototype.hasOwnProperty.call( pageInfo, 'missing' ),
                            hidden: pageInfo.pageprops &&
                                Object.prototype.hasOwnProperty.call( pageInfo.pageprops, 'hiddencat' )
                        };
    Severity: Major
    Found in modules/ve-mw/ui/widgets/ve.ui.MWCategoryWidget.js and 1 other location - About 1 hr to fix
    modules/ve-mw/ui/widgets/ve.ui.MWCategoryInputWidget.js on lines 92..98

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

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

    ve.ui.MWPreviewElement = function VeUiMwPreviewElement() {
        // Parent constructor
        ve.ui.MWPreviewElement.super.apply( this, arguments );
    
        // Initialize
    Severity: Major
    Found in modules/ve-mw/ui/elements/ve.ui.MWPreviewElement.js and 9 other locations - About 1 hr to fix
    editcheck/modules/EditCheckContextItem.js on lines 18..24
    modules/ve-mw/ce/annotations/ve.ce.MWNowikiAnnotation.js on lines 17..23
    modules/ve-mw/ui/contextitems/ve.ui.MWGalleryContextItem.js on lines 17..23
    modules/ve-mw/ui/contextitems/ve.ui.MWInternalLinkContextItem.js on lines 18..24
    modules/ve-mw/ui/contextitems/ve.ui.MWLanguageVariantNodeContextItem.js on lines 18..24
    modules/ve-mw/ui/contextitems/ve.ui.MWMagicLinkNodeContextItem.js on lines 18..24
    modules/ve-mw/ui/contextitems/ve.ui.MWPreContextItem.js on lines 18..24
    modules/ve-mw/ui/contextitems/ve.ui.MWWikitextPasteContextItem.js on lines 18..24
    modules/ve-mw/ui/dialogs/ve.ui.MWMobileSaveDialog.js on lines 20..26

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

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

    ve.ui.MWWikitextPasteContextItem = function VeUiMWWikitextPasteContextItem() {
        // Parent constructor
        ve.ui.MWWikitextPasteContextItem.super.apply( this, arguments );
    
        // Initialization
    editcheck/modules/EditCheckContextItem.js on lines 18..24
    modules/ve-mw/ce/annotations/ve.ce.MWNowikiAnnotation.js on lines 17..23
    modules/ve-mw/ui/contextitems/ve.ui.MWGalleryContextItem.js on lines 17..23
    modules/ve-mw/ui/contextitems/ve.ui.MWInternalLinkContextItem.js on lines 18..24
    modules/ve-mw/ui/contextitems/ve.ui.MWLanguageVariantNodeContextItem.js on lines 18..24
    modules/ve-mw/ui/contextitems/ve.ui.MWMagicLinkNodeContextItem.js on lines 18..24
    modules/ve-mw/ui/contextitems/ve.ui.MWPreContextItem.js on lines 18..24
    modules/ve-mw/ui/dialogs/ve.ui.MWMobileSaveDialog.js on lines 20..26
    modules/ve-mw/ui/elements/ve.ui.MWPreviewElement.js on lines 20..26

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

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

    ve.ui.MWMobileSaveDialog = function VeUiMwMobileSaveDialog() {
        // Parent constructor
        ve.ui.MWMobileSaveDialog.super.apply( this, arguments );
    
        // Initialization
    Severity: Major
    Found in modules/ve-mw/ui/dialogs/ve.ui.MWMobileSaveDialog.js and 9 other locations - About 1 hr to fix
    editcheck/modules/EditCheckContextItem.js on lines 18..24
    modules/ve-mw/ce/annotations/ve.ce.MWNowikiAnnotation.js on lines 17..23
    modules/ve-mw/ui/contextitems/ve.ui.MWGalleryContextItem.js on lines 17..23
    modules/ve-mw/ui/contextitems/ve.ui.MWInternalLinkContextItem.js on lines 18..24
    modules/ve-mw/ui/contextitems/ve.ui.MWLanguageVariantNodeContextItem.js on lines 18..24
    modules/ve-mw/ui/contextitems/ve.ui.MWMagicLinkNodeContextItem.js on lines 18..24
    modules/ve-mw/ui/contextitems/ve.ui.MWPreContextItem.js on lines 18..24
    modules/ve-mw/ui/contextitems/ve.ui.MWWikitextPasteContextItem.js on lines 18..24
    modules/ve-mw/ui/elements/ve.ui.MWPreviewElement.js on lines 20..26

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

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

    ve.ui.MWMagicLinkNodeContextItem = function VeUiMWMagicLinkNodeContextItem() {
        // Parent constructor
        ve.ui.MWMagicLinkNodeContextItem.super.apply( this, arguments );
    
        // Initialization
    editcheck/modules/EditCheckContextItem.js on lines 18..24
    modules/ve-mw/ce/annotations/ve.ce.MWNowikiAnnotation.js on lines 17..23
    modules/ve-mw/ui/contextitems/ve.ui.MWGalleryContextItem.js on lines 17..23
    modules/ve-mw/ui/contextitems/ve.ui.MWInternalLinkContextItem.js on lines 18..24
    modules/ve-mw/ui/contextitems/ve.ui.MWLanguageVariantNodeContextItem.js on lines 18..24
    modules/ve-mw/ui/contextitems/ve.ui.MWPreContextItem.js on lines 18..24
    modules/ve-mw/ui/contextitems/ve.ui.MWWikitextPasteContextItem.js on lines 18..24
    modules/ve-mw/ui/dialogs/ve.ui.MWMobileSaveDialog.js on lines 20..26
    modules/ve-mw/ui/elements/ve.ui.MWPreviewElement.js on lines 20..26

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

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

    ve.ce.MWNowikiAnnotation = function VeCeMWNowikiAnnotation() {
        // Parent constructor
        ve.ce.MWNowikiAnnotation.super.apply( this, arguments );
    
        // DOM changes
    Severity: Major
    Found in modules/ve-mw/ce/annotations/ve.ce.MWNowikiAnnotation.js and 9 other locations - About 1 hr to fix
    editcheck/modules/EditCheckContextItem.js on lines 18..24
    modules/ve-mw/ui/contextitems/ve.ui.MWGalleryContextItem.js on lines 17..23
    modules/ve-mw/ui/contextitems/ve.ui.MWInternalLinkContextItem.js on lines 18..24
    modules/ve-mw/ui/contextitems/ve.ui.MWLanguageVariantNodeContextItem.js on lines 18..24
    modules/ve-mw/ui/contextitems/ve.ui.MWMagicLinkNodeContextItem.js on lines 18..24
    modules/ve-mw/ui/contextitems/ve.ui.MWPreContextItem.js on lines 18..24
    modules/ve-mw/ui/contextitems/ve.ui.MWWikitextPasteContextItem.js on lines 18..24
    modules/ve-mw/ui/dialogs/ve.ui.MWMobileSaveDialog.js on lines 20..26
    modules/ve-mw/ui/elements/ve.ui.MWPreviewElement.js on lines 20..26

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

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

    ve.ui.MWLanguageVariantNodeContextItem = function VeUiMWLanguageVariantNodeContextItem() {
        // Parent constructor
        ve.ui.MWLanguageVariantNodeContextItem.super.apply( this, arguments );
    
        // Initialization
    editcheck/modules/EditCheckContextItem.js on lines 18..24
    modules/ve-mw/ce/annotations/ve.ce.MWNowikiAnnotation.js on lines 17..23
    modules/ve-mw/ui/contextitems/ve.ui.MWGalleryContextItem.js on lines 17..23
    modules/ve-mw/ui/contextitems/ve.ui.MWInternalLinkContextItem.js on lines 18..24
    modules/ve-mw/ui/contextitems/ve.ui.MWMagicLinkNodeContextItem.js on lines 18..24
    modules/ve-mw/ui/contextitems/ve.ui.MWPreContextItem.js on lines 18..24
    modules/ve-mw/ui/contextitems/ve.ui.MWWikitextPasteContextItem.js on lines 18..24
    modules/ve-mw/ui/dialogs/ve.ui.MWMobileSaveDialog.js on lines 20..26
    modules/ve-mw/ui/elements/ve.ui.MWPreviewElement.js on lines 20..26

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

    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

            linkCacheUpdate[ categoryPage.title ] = {
                missing: Object.prototype.hasOwnProperty.call( categoryPage, 'missing' ),
                hidden: (
                    categoryPage.categoryinfo &&
                    Object.prototype.hasOwnProperty.call( categoryPage.categoryinfo, 'missing' )
    Severity: Major
    Found in modules/ve-mw/ui/widgets/ve.ui.MWCategoryInputWidget.js and 1 other location - About 1 hr to fix
    modules/ve-mw/ui/widgets/ve.ui.MWCategoryWidget.js on lines 335..339

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

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

    ve.ui.MWInternalLinkContextItem = function VeUiMWInternalLinkContextItem() {
        // Parent constructor
        ve.ui.MWInternalLinkContextItem.super.apply( this, arguments );
    
        // Initialization
    editcheck/modules/EditCheckContextItem.js on lines 18..24
    modules/ve-mw/ce/annotations/ve.ce.MWNowikiAnnotation.js on lines 17..23
    modules/ve-mw/ui/contextitems/ve.ui.MWGalleryContextItem.js on lines 17..23
    modules/ve-mw/ui/contextitems/ve.ui.MWLanguageVariantNodeContextItem.js on lines 18..24
    modules/ve-mw/ui/contextitems/ve.ui.MWMagicLinkNodeContextItem.js on lines 18..24
    modules/ve-mw/ui/contextitems/ve.ui.MWPreContextItem.js on lines 18..24
    modules/ve-mw/ui/contextitems/ve.ui.MWWikitextPasteContextItem.js on lines 18..24
    modules/ve-mw/ui/dialogs/ve.ui.MWMobileSaveDialog.js on lines 20..26
    modules/ve-mw/ui/elements/ve.ui.MWPreviewElement.js on lines 20..26

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

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

    ve.ui.EditCheckContextItem = function VeUiEditCheckContextItem() {
        // Parent constructor
        ve.ui.EditCheckContextItem.super.apply( this, arguments );
    
        // Initialization
    Severity: Major
    Found in editcheck/modules/EditCheckContextItem.js and 9 other locations - About 1 hr to fix
    modules/ve-mw/ce/annotations/ve.ce.MWNowikiAnnotation.js on lines 17..23
    modules/ve-mw/ui/contextitems/ve.ui.MWGalleryContextItem.js on lines 17..23
    modules/ve-mw/ui/contextitems/ve.ui.MWInternalLinkContextItem.js on lines 18..24
    modules/ve-mw/ui/contextitems/ve.ui.MWLanguageVariantNodeContextItem.js on lines 18..24
    modules/ve-mw/ui/contextitems/ve.ui.MWMagicLinkNodeContextItem.js on lines 18..24
    modules/ve-mw/ui/contextitems/ve.ui.MWPreContextItem.js on lines 18..24
    modules/ve-mw/ui/contextitems/ve.ui.MWWikitextPasteContextItem.js on lines 18..24
    modules/ve-mw/ui/dialogs/ve.ui.MWMobileSaveDialog.js on lines 20..26
    modules/ve-mw/ui/elements/ve.ui.MWPreviewElement.js on lines 20..26

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

    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

    ve.dm.MWLanguageMetaItem.static.toDataElement = function ( domElements ) {
        const href = domElements[ 0 ].getAttribute( 'href' );
        return {
            type: this.name,
            attributes: {
    Severity: Major
    Found in modules/ve-mw/dm/metaitems/ve.dm.MWLanguageMetaItem.js and 1 other location - About 1 hr to fix
    modules/ve-mw/dm/metaitems/ve.dm.MWDisplayTitleMetaItem.js on lines 35..43

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

    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

    Function addItems has 46 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    ve.ui.MWCategoryWidget.prototype.addItems = function ( items, index ) {
        const categoryItems = [],
            // eslint-disable-next-line no-jquery/no-map-util
            categoryNames = $.map( items, ( item ) => item.name );
    
    
    Severity: Minor
    Found in modules/ve-mw/ui/widgets/ve.ui.MWCategoryWidget.js - About 1 hr to fix

      Function getTargetDataFromHref has 46 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      mw.libs.ve.getTargetDataFromHref = function ( href, doc ) {
          function regexEscape( str ) {
              return str.replace( /([.?*+^$[\]\\(){}|-])/g, '\\$1' );
          }
      
      
      Severity: Minor
      Found in modules/ve-mw/preinit/ve.utils.parsoid.js - About 1 hr to fix

        Function onReplacePart has 45 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        ve.ui.MWTemplateDialog.prototype.onReplacePart = function ( removed, added ) {
            const removePages = [];
        
            if ( removed ) {
                // Remove parameter pages of removed templates
        Severity: Minor
        Found in modules/ve-mw/ui/dialogs/ve.ui.MWTemplateDialog.js - About 1 hr to fix

          Function insertTransclusionNode has 45 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              ve.dm.MWTransclusionModel.prototype.insertTransclusionNode = function ( surfaceFragment, forceType ) {
                  const deferred = ve.createDeferred(),
                      baseNodeClass = ve.dm.MWTransclusionNode;
          
                  const insertNode = ( isInline, generatedContents ) => {
          Severity: Minor
          Found in modules/ve-mw/dm/models/ve.dm.MWTransclusionModel.js - About 1 hr to fix

            Function VeUiMWTemplatePlaceholderPage has 45 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            ve.ui.MWTemplatePlaceholderPage = function VeUiMWTemplatePlaceholderPage( placeholder, name, config ) {
                // Configuration initialization
                config = ve.extendObject( {
                    scrollable: false
                }, config );
            Severity: Minor
            Found in modules/ve-mw/ui/pages/ve.ui.MWTemplatePlaceholderPage.js - About 1 hr to fix
              Severity
              Category
              Status
              Source
              Language