wikimedia/mediawiki-extensions-VisualEditor

View on GitHub

Showing 912 of 912 total issues

Function submit has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

ve.init.mw.ArticleTarget.prototype.submit = function ( wikitext, fields ) {
    // Prevent duplicate requests
    if ( this.submitting ) {
        return false;
    }
Severity: Minor
Found in modules/ve-mw/init/targets/ve.init.mw.ArticleTarget.js - About 1 hr to fix

    Function toggleWrapSelection has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    ve.ui.MWWikitextAction.prototype.toggleWrapSelection = function ( before, after, placeholder, expandOffsetsCallback, unwrapOffsetsCallback ) {
        const originalFragment = this.surface.getModel().getFragment( null, false, true /* excludeInsertions */ );
    
        let fragment = originalFragment;
        let textBefore, textAfter;
    Severity: Minor
    Found in modules/ve-mw/ui/actions/ve.ui.MWWikitextAction.js - About 1 hr to fix

      Function processChangeQueue has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          ve.dm.MWTransclusionModel.prototype.processChangeQueue = function () {
              const templateNamespaceId = mw.config.get( 'wgNamespaceIds' ).template,
                  titles = [];
      
              if ( !this.changeQueue.length ) {
      Severity: Minor
      Found in modules/ve-mw/dm/models/ve.dm.MWTransclusionModel.js - About 1 hr to fix

        Function createImageNode has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        ve.dm.MWImageModel.static.createImageNode = function ( attributes, imageType ) {
            const defaultThumbSize = mw.config.get( 'wgVisualEditorConfig' )
                .thumbLimits[ mw.user.options.get( 'thumbsize' ) ];
        
            const attrs = ve.extendObject( {
        Severity: Minor
        Found in modules/ve-mw/dm/models/ve.dm.MWImageModel.js - About 1 hr to fix

          Function showPreview has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          ve.ui.MWSaveDialog.prototype.showPreview = function ( response ) {
              if ( response instanceof $ ) {
                  this.$previewViewer.empty().append(
                      // eslint-disable-next-line no-jquery/no-append-html
                      $( '<em>' ).append( response )
          Severity: Minor
          Found in modules/ve-mw/ui/dialogs/ve.ui.MWSaveDialog.js - About 1 hr to fix

            Function getValidationErrors has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            ve.ui.MWAddParameterPage.prototype.getValidationErrors = function ( name ) {
                if ( !name ) {
                    return [];
                }
            
            
            Severity: Minor
            Found in modules/ve-mw/ui/pages/ve.ui.MWAddParameterPage.js - About 1 hr to fix

              Function load has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  ve.dm.MWTransclusionModel.prototype.load = function ( data ) {
                      const promises = [];
              
                      // Convert single part format to multi-part format
                      // Parsoid doesn't use this format any more, but we accept it for backwards compatibility
              Severity: Minor
              Found in modules/ve-mw/dm/models/ve.dm.MWTransclusionModel.js - About 1 hr to fix

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

                ve.init.mw.CollabTarget.static.importRules = ve.copy( ve.init.mw.CollabTarget.static.importRules );
                Severity: Major
                Found in modules/ve-mw-collab/ve.init.mw.CollabTarget.js and 2 other locations - About 1 hr to fix
                modules/ve-mw-collab/ve.init.mw.CollabTarget.js on lines 60..60
                modules/ve-mw/init/targets/ve.init.mw.Target.js on lines 110..110

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

                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

                    toolbarInsert: function () {
                        seleniumUtils.runMenuTask( arguments[ arguments.length - 1 ], ve.init.target.toolbar.tools.media, true );
                    },
                Severity: Major
                Found in build/screenshots-client/userGuide.js and 1 other location - About 1 hr to fix
                build/screenshots-client/userGuide.js on lines 73..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 55.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

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

                        if (
                            converter.doesModeNeedRendering() &&
                            // Use getHashObjectForRendering to get the rendering from the store
                            ( value = store.value( store.hashOfValue( null, OO.getHash( [ this.getHashObjectForRendering( dataElement ), undefined ] ) ) ) )
                        ) {
                Severity: Major
                Found in modules/ve-mw/dm/nodes/ve.dm.MWTransclusionNode.js and 1 other location - About 1 hr to fix
                modules/ve-mw/dm/nodes/ve.dm.MWExtensionNode.js on lines 113..126

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

                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

                    toolbarFormatting: function () {
                        seleniumUtils.runMenuTask( arguments[ arguments.length - 1 ], ve.init.target.toolbar.tools.bold, true );
                    },
                Severity: Major
                Found in build/screenshots-client/userGuide.js and 1 other location - About 1 hr to fix
                build/screenshots-client/userGuide.js on lines 79..81

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

                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 positionFieldset = new OO.ui.FieldsetLayout( {
                        $overlay: this.$overlay,
                        label: ve.msg( 'visualeditor-dialog-media-position-section' ),
                        help: ve.msg( 'visualeditor-dialog-media-position-section-help' )
                    } );
                Severity: Major
                Found in modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js and 1 other location - About 1 hr to fix
                modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js on lines 243..247

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

                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

                ve.init.mw.Target.static.importRules = ve.copy( ve.init.mw.Target.static.importRules );
                Severity: Major
                Found in modules/ve-mw/init/targets/ve.init.mw.Target.js and 2 other locations - About 1 hr to fix
                modules/ve-mw-collab/ve.init.mw.CollabTarget.js on lines 60..60
                modules/ve-mw-collab/ve.init.mw.CollabTarget.js on lines 96..96

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

                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 altTextFieldset = new OO.ui.FieldsetLayout( {
                        $overlay: this.$overlay,
                        label: ve.msg( 'visualeditor-dialog-media-alttext-section' ),
                        help: ve.msg( 'visualeditor-dialog-media-alttext-section-help' )
                    } );
                Severity: Major
                Found in modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js and 1 other location - About 1 hr to fix
                modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js on lines 264..268

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

                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

                ve.init.mw.CollabTarget.static.toolbarGroups = ve.copy( ve.init.mw.CollabTarget.static.toolbarGroups );
                Severity: Major
                Found in modules/ve-mw-collab/ve.init.mw.CollabTarget.js and 2 other locations - About 1 hr to fix
                modules/ve-mw-collab/ve.init.mw.CollabTarget.js on lines 96..96
                modules/ve-mw/init/targets/ve.init.mw.Target.js on lines 110..110

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

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

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

                        if (
                            converter.doesModeNeedRendering() &&
                            // Use getHashObjectForRendering to get the rendering from the store
                            ( value = store.value( store.hashOfValue( null, OO.getHash( [ this.getHashObjectForRendering( dataElement ), undefined ] ) ) ) )
                        ) {
                Severity: Major
                Found in modules/ve-mw/dm/nodes/ve.dm.MWExtensionNode.js and 1 other location - About 1 hr to fix
                modules/ve-mw/dm/nodes/ve.dm.MWTransclusionNode.js on lines 163..178

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

                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

                                            case 'serialize':
                                                if ( typeof responseData.content !== 'string' ) {
                                                    error = {
                                                        code: 'invalidcontent',
                                                        html: mw.message( 'api-clientside-error-invalidresponse' ).parse()
                Severity: Major
                Found in modules/ve-mw/preinit/ve.init.mw.ArticleTargetSaver.js and 1 other location - About 1 hr to fix
                modules/ve-mw/preinit/ve.init.mw.ArticleTargetSaver.js on lines 286..293

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

                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

                                            case 'diff':
                                                if ( typeof responseData.diff !== 'string' ) {
                                                    error = {
                                                        code: 'invalidcontent',
                                                        html: mw.message( 'api-clientside-error-invalidresponse' ).parse()
                Severity: Major
                Found in modules/ve-mw/preinit/ve.init.mw.ArticleTargetSaver.js and 1 other location - About 1 hr to fix
                modules/ve-mw/preinit/ve.init.mw.ArticleTargetSaver.js on lines 278..285

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

                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

                ve.ui.MWLinkAction = function VeUiMWLinkAction( surface ) {
                    // Parent constructor
                    ve.ui.MWLinkAction.super.call( this, surface );
                };
                Severity: Major
                Found in modules/ve-mw/ui/actions/ve.ui.MWLinkAction.js and 8 other locations - About 55 mins to fix
                modules/ve-mw/ce/nodes/ve.ce.MWTransclusionBlockNode.js on lines 16..19
                modules/ve-mw/ce/nodes/ve.ce.MWTransclusionInlineNode.js on lines 16..19
                modules/ve-mw/ui/dialogs/ve.ui.MWCommandHelpDialog.js on lines 17..20
                modules/ve-mw/ui/dialogs/ve.ui.MWMetaDialog.js on lines 17..20
                modules/ve-mw/ui/dialogs/ve.ui.MWRequiredParamBlankConfirmDialog.js on lines 17..20
                modules/ve-mw/ui/dialogs/ve.ui.MWTableDialog.js on lines 16..19
                modules/ve-mw/ui/inspectors/ve.ui.MWWikitextLinkAnnotationInspector.js on lines 17..20
                modules/ve-mw/ui/widgets/ve.ui.MWPreTextInputWidget.js on lines 16..19

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

                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

                ve.ui.MWCommandHelpDialog = function VeUiMWCommandHelpDialog( config ) {
                    // Parent constructor
                    ve.ui.MWCommandHelpDialog.super.call( this, config );
                };
                Severity: Major
                Found in modules/ve-mw/ui/dialogs/ve.ui.MWCommandHelpDialog.js and 8 other locations - About 55 mins to fix
                modules/ve-mw/ce/nodes/ve.ce.MWTransclusionBlockNode.js on lines 16..19
                modules/ve-mw/ce/nodes/ve.ce.MWTransclusionInlineNode.js on lines 16..19
                modules/ve-mw/ui/actions/ve.ui.MWLinkAction.js on lines 17..20
                modules/ve-mw/ui/dialogs/ve.ui.MWMetaDialog.js on lines 17..20
                modules/ve-mw/ui/dialogs/ve.ui.MWRequiredParamBlankConfirmDialog.js on lines 17..20
                modules/ve-mw/ui/dialogs/ve.ui.MWTableDialog.js on lines 16..19
                modules/ve-mw/ui/inspectors/ve.ui.MWWikitextLinkAnnotationInspector.js on lines 17..20
                modules/ve-mw/ui/widgets/ve.ui.MWPreTextInputWidget.js on lines 16..19

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

                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