wikimedia/mediawiki-extensions-VisualEditor

View on GitHub

Showing 436 of 912 total issues

Function updateRedirectInterface has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

ve.init.mw.ArticleTarget.prototype.updateRedirectInterface = function ( $sub, $msg ) {
    // For the subtitle, replace the real one with ours.
    // This is more complicated than it should be because we have to fiddle with the <br>.
    const $currentSub = $( '#redirectsub' );
    if ( $currentSub.length ) {
Severity: Minor
Found in modules/ve-mw/init/targets/ve.init.mw.ArticleTarget.js - About 1 hr to fix

    Function initialize has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    ve.ui.MWLanguageVariantFilterInspector.prototype.initialize = function () {
        ve.ui.MWLanguageVariantFilterInspector.super.prototype.initialize.call( this );
        this.textTarget = this.createTextTarget( OO.ui.msg(
            'visualeditor-mwlanguagevariantinspector-filter-text-placeholder'
        ) );
    Severity: Minor
    Found in modules/ve-mw/ui/inspectors/ve.ui.MWLanguageVariantInspector.js - About 1 hr to fix

      Function getActionProcess has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      ve.ui.MWTransclusionDialog.prototype.getActionProcess = function ( action ) {
          const willLoseProgress = this.getMode() === 'insert' ?
              // A new template with no parameters is not considered valuable.
              this.transclusionModel.containsValuableData() :
              // The user has changed a parameter, and is not on the template search page.
      Severity: Minor
      Found in modules/ve-mw/ui/dialogs/ve.ui.MWTransclusionDialog.js - About 1 hr to fix

        Function VeUiMWTransclusionOutlinePartWidget has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        ve.ui.MWTransclusionOutlinePartWidget = function VeUiMWTransclusionOutlinePartWidget( part, config ) {
            this.part = part;
        
            // Parent constructor
            ve.ui.MWTransclusionOutlinePartWidget.super.call( this, ve.extendObject( config, {
        Severity: Minor
        Found in modules/ve-mw/ui/widgets/ve.ui.MWTransclusionOutlinePartWidget.js - About 1 hr to fix

          Function VeUiMWCategoryWidget has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          ve.ui.MWCategoryWidget = function VeUiMWCategoryWidget( config ) {
              // Config initialization
              config = config || {};
          
              // Parent constructor
          Severity: Minor
          Found in modules/ve-mw/ui/widgets/ve.ui.MWCategoryWidget.js - About 1 hr to fix

            Function getUpdatedAttributes has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            ve.dm.MWImageModel.prototype.getUpdatedAttributes = function () {
                const origAttrs = this.getOriginalImageAttributes();
            
                let currentDimensions;
                // Adjust default dimensions if size is set to default
            Severity: Minor
            Found in modules/ve-mw/dm/models/ve.dm.MWImageModel.js - About 1 hr to fix

              Function setEditorPreference has 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  function setEditorPreference( editor ) {
                      // If visual mode isn't available, don't set the editor preference as the
                      // user has expressed no choice by opening this editor. (T246259)
                      // Strictly speaking the same thing should happen if visual mode is
                      // available but source mode isn't, but that is never the case.
              Severity: Minor
              Found in modules/ve-mw/preinit/ve.init.mw.DesktopArticleTarget.init.js - About 1 hr to fix

                Function getPreviewHtml has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                ve.dm.MWLanguageVariantNode.static.getPreviewHtml = function ( variantInfo, opts ) {
                    if ( variantInfo.disabled ) {
                        return variantInfo.disabled.t;
                    } else if ( variantInfo.name ) {
                        return ve.init.platform.getLanguageName( variantInfo.name.t.toLowerCase() );
                Severity: Minor
                Found in modules/ve-mw/dm/nodes/ve.dm.MWLanguageVariantNode.js - About 1 hr to fix

                  Function reduplicateStyles has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  mw.libs.ve.reduplicateStyles = function ( element ) {
                      Array.prototype.forEach.call( element.querySelectorAll( 'link[rel~="mw-deduplicated-inline-style"]' ), ( link ) => {
                          const href = link.getAttribute( 'href' );
                          if ( !href || href.slice( 0, 'mw-data:'.length ) !== 'mw-data:' ) {
                              return;
                  Severity: Minor
                  Found in modules/ve-mw/preinit/ve.utils.parsoid.js - About 1 hr to fix

                    Function getSetupProcess has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                    ve.ui.MWMediaDialog.prototype.getSetupProcess = function ( data ) {
                        return ve.ui.MWMediaDialog.super.prototype.getSetupProcess.call( this, data )
                            .next( () => {
                                const isReadOnly = this.isReadOnly();
                    
                    
                    Severity: Minor
                    Found in modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js - About 1 hr to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    Function VeUiMWWikitextSurface has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                    ve.ui.MWWikitextSurface = function VeUiMWWikitextSurface() {
                        // Parent constructor
                        ve.ui.MWWikitextSurface.super.apply( this, arguments );
                    
                        // Initialization
                    Severity: Minor
                    Found in modules/ve-mw/ui/ve.ui.MWWikitextSurface.js - About 1 hr to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    Function teardown has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                    ve.init.mw.DesktopArticleTarget.prototype.teardown = function ( trackMechanism ) {
                        // Event tracking
                        let abortType, abortedMode;
                        if ( trackMechanism ) {
                            if ( this.activating ) {
                    Severity: Minor
                    Found in modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js - About 1 hr to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    Function surfaceReady has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                    ve.init.mw.ArticleTarget.prototype.surfaceReady = function () {
                        const accessKeyPrefix = $.fn.updateTooltipAccessKeys.getAccessKeyPrefix().replace( /-/g, '+' ),
                            accessKeyModifiers = new ve.ui.Trigger( accessKeyPrefix + '-' ).modifiers,
                            surfaceModel = this.getSurface().getModel();
                    
                    
                    Severity: Minor
                    Found in modules/ve-mw/init/targets/ve.init.mw.ArticleTarget.js - About 1 hr to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    Function insertImageNode has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                    ve.dm.MWImageModel.prototype.insertImageNode = function ( fragment ) {
                        const nodeType = this.getImageNodeType(),
                            surfaceModel = fragment.getSurface();
                    
                        if ( !( fragment.getSelection() instanceof ve.dm.LinearSelection ) ) {
                    Severity: Minor
                    Found in modules/ve-mw/dm/models/ve.dm.MWImageModel.js - About 1 hr to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    Function changeImageSource has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                    ve.dm.MWImageModel.prototype.changeImageSource = function ( attrs, APIinfo ) {
                        this.changedImageSource = true;
                    
                        if ( attrs.mediaType ) {
                            this.setMediaType( attrs.mediaType );
                    Severity: Minor
                    Found in modules/ve-mw/dm/models/ve.dm.MWImageModel.js - About 1 hr to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    Function getPartsList has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                    ve.dm.MWTransclusionNode.prototype.getPartsList = function () {
                        if ( !this.partsList ) {
                            this.partsList = [];
                            const content = this.getAttribute( 'mw' );
                            for ( let i = 0; i < content.parts.length; i++ ) {
                    Severity: Minor
                    Found in modules/ve-mw/dm/nodes/ve.dm.MWTransclusionNode.js - About 1 hr to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    Function wrapLine has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

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

                      Function export has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      ve.ui.MWExportWikitextDialog.prototype.export = function () {
                          const wikitext = this.wikitextLayout.textInput.getValue(),
                              title = this.titleInput.getMWTitle(),
                              importTitle = ve.init.target.getImportTitle();
                      
                      
                      Severity: Minor
                      Found in modules/ve-mw-collab/ve.ui.MWExportWikitextDialog.js - About 1 hr to fix

                        Function switchPanels has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        ve.ui.MWMediaDialog.prototype.switchPanels = function ( panel, noFocus ) {
                            switch ( panel ) {
                                case 'edit':
                                    this.setSize( this.constructor.static.size );
                                    // Set the edit panel
                        Severity: Minor
                        Found in modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js - About 1 hr to fix

                          Function getTeardownProcess has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          ve.ui.MWGalleryDialog.prototype.getTeardownProcess = function ( data ) {
                              return ve.ui.MWGalleryDialog.super.prototype.getTeardownProcess.call( this, data )
                                  .first( () => {
                                      // Layouts
                                      this.indexLayout.setTabPanel( 'images' );
                          Severity: Minor
                          Found in modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language