wikimedia/mediawiki-extensions-VisualEditor

View on GitHub

Showing 436 of 912 total issues

Function toDomElements has 66 lines of code (exceeds 25 allowed). Consider refactoring.
Open

ve.dm.MWGalleryImageNode.static.toDomElements = function ( data, doc, converter ) {
    // ImageNode:
    //   <li> li (gallerybox)
    //     <div> thumbDiv
    //       <span> container
Severity: Major
Found in modules/ve-mw/dm/nodes/ve.dm.MWGalleryImageNode.js - About 2 hrs to fix

    Function renderCategories has 65 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    ve.init.mw.ArticleTarget.prototype.renderCategories = function ( categoryItems ) {
        const promises = [],
            categories = { hidden: {}, normal: {} };
        categoryItems.forEach( ( categoryItem, index ) => {
            const attributes = ve.copy( ve.getProp( categoryItem, 'element', 'attributes' ) );
    Severity: Major
    Found in modules/ve-mw/init/targets/ve.init.mw.ArticleTarget.js - About 2 hrs to fix

      Function showSaveDialog has 65 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      ve.init.mw.ArticleTarget.prototype.showSaveDialog = function ( action, checkboxName ) {
          let firstLoad = false;
      
          if ( !this.isSaveable() || this.saveDialogIsOpening ) {
              return;
      Severity: Major
      Found in modules/ve-mw/init/targets/ve.init.mw.ArticleTarget.js - About 2 hrs to fix

        Function teardown has 65 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        ve.ui.MWSettingsPage.prototype.teardown = function ( data ) {
            // Data initialisation
            data = data || {};
            if ( data.action !== 'done' ) {
                return;
        Severity: Major
        Found in modules/ve-mw/ui/pages/ve.ui.MWSettingsPage.js - About 2 hrs to fix

          Function toDomElements has 65 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          ve.dm.MWTransclusionNode.static.toDomElements = function ( dataElement, doc, converter ) {
              const store = converter.getStore(),
                  originalMw = dataElement.attributes.originalMw,
                  originalDomElements = store.value( dataElement.originalDomElementsHash );
          
          
          Severity: Major
          Found in modules/ve-mw/dm/nodes/ve.dm.MWTransclusionNode.js - About 2 hrs to fix

            Function toDomElements has 65 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            ve.dm.MWInlineImageNode.static.toDomElements = function ( dataElement, doc, converter ) {
                const attributes = dataElement.attributes,
                    container = doc.createElement( 'span' ),
                    imgWrapper = doc.createElement( attributes.href ? 'a' : 'span' ),
                    img = doc.createElement( attributes.isError ? 'span' : attributes.mediaTag ),
            Severity: Major
            Found in modules/ve-mw/dm/nodes/ve.dm.MWInlineImageNode.js - About 2 hrs to fix

              Function restoreEditSection has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
              Open

              ve.init.mw.ArticleTarget.prototype.restoreEditSection = function () {
                  const section = this.section !== null ? this.section : this.visibleSection;
                  const surface = this.getSurface();
                  const mode = surface.getMode();
              
              
              Severity: Minor
              Found in modules/ve-mw/init/targets/ve.init.mw.ArticleTarget.js - About 2 hrs 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 buildMediaInfoPanel has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
              Open

              ve.ui.MWMediaDialog.prototype.buildMediaInfoPanel = function ( imageinfo ) {
                  const contentDirection = this.getFragment().getDocument().getDir(),
                      imageTitleText = imageinfo.title || imageinfo.canonicaltitle,
                      imageTitle = new OO.ui.LabelWidget( {
                          label: mw.Title.newFromText( imageTitleText ).getNameText()
              Severity: Minor
              Found in modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js - About 2 hrs 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 VeUiMWMediaInfoFieldWidget has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
              Open

              ve.ui.MWMediaInfoFieldWidget = function VeUiMWMediaInfoFieldWidget( content, config ) {
                  // Configuration initialization
                  config = config || {};
              
                  // Parent constructor
              Severity: Minor
              Found in modules/ve-mw/ui/widgets/ve.ui.MWMediaInfoFieldWidget.js - About 2 hrs 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 toDataElement has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
              Open

              ve.dm.MWInlineImageNode.static.toDataElement = function ( domElements, converter ) {
                  const container = domElements[ 0 ]; // <span>
                  if ( !container.children.length ) {
                      // Malformed image, alienate (T267282)
                      return null;
              Severity: Minor
              Found in modules/ve-mw/dm/nodes/ve.dm.MWInlineImageNode.js - About 2 hrs 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 toDomElements has 64 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              ve.dm.MWBlockImageNode.static.toDomElements = function ( data, doc, converter ) {
                  const dataElement = data[ 0 ],
                      attributes = dataElement.attributes,
                      figure = doc.createElement( 'figure' ),
                      imgWrapper = doc.createElement( attributes.href ? 'a' : 'span' ),
              Severity: Major
              Found in modules/ve-mw/dm/nodes/ve.dm.MWBlockImageNode.js - About 2 hrs to fix

                File init.js has 272 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                mw.editcheck = {
                    config: require( './config.json' ),
                    ecenable: !!( new URL( location.href ).searchParams.get( 'ecenable' ) || window.MWVE_FORCE_EDIT_CHECK_ENABLED )
                };
                
                
                Severity: Minor
                Found in editcheck/modules/init.js - About 2 hrs to fix

                  Function changeImageSource has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

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

                    Function VeCeMWGalleryImageNode has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    ve.ce.MWGalleryImageNode = function VeCeMWGalleryImageNode( model ) {
                        // Parent constructor
                        ve.ce.MWGalleryImageNode.super.apply( this, arguments );
                    
                        // DOM hierarchy for MWGalleryImageNode:
                    Severity: Major
                    Found in modules/ve-mw/ce/nodes/ve.ce.MWGalleryImageNode.js - About 2 hrs to fix

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

                      ve.ui.MWWikitextLinkAnnotationInspector.prototype.getTeardownProcess = function ( data ) {
                          data = data || {};
                          // Call grand-parent
                          return ve.ui.FragmentInspector.prototype.getTeardownProcess.call( this, data )
                              .first( () => {

                        Method onGetPreferences has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function onGetPreferences( $user, &$preferences ) {
                                $services = MediaWikiServices::getInstance();
                                $userOptionsLookup = $services->getUserOptionsLookup();
                                $veConfig = $services->getConfigFactory()->makeConfig( 'visualeditor' );
                                $isBeta = $veConfig->get( 'VisualEditorEnableBetaFeature' );
                        Severity: Major
                        Found in includes/Hooks.php - About 2 hrs to fix

                          File ve.ui.MWSettingsPage.js has 268 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          /*!
                           * VisualEditor user interface MWSettingsPage class.
                           *
                           * @copyright See AUTHORS.txt
                           * @license The MIT License (MIT); see LICENSE.txt
                          Severity: Minor
                          Found in modules/ve-mw/ui/pages/ve.ui.MWSettingsPage.js - About 2 hrs to fix

                            Function save has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                            Open

                            ve.init.mw.ArticleTarget.prototype.save = function ( doc, options ) {
                                // Prevent duplicate requests
                                if ( this.saving ) {
                                    return this.saving;
                                }
                            Severity: Minor
                            Found in modules/ve-mw/init/targets/ve.init.mw.ArticleTarget.js - About 2 hrs 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 18 (exceeds 5 allowed). Consider refactoring.
                            Open

                            ve.ui.MWCategoriesPage.prototype.teardown = function ( data ) {
                                const currentDefaultSortKeyItem = this.getDefaultSortKeyItem(),
                                    newDefaultSortKey = this.defaultSortInput.getValue();
                            
                                if ( data && data.action === 'done' ) {
                            Severity: Minor
                            Found in modules/ve-mw/ui/pages/ve.ui.MWCategoriesPage.js - About 2 hrs 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 59 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            ve.init.mw.DesktopArticleTarget.prototype.teardown = function ( trackMechanism ) {
                                // Event tracking
                                let abortType, abortedMode;
                                if ( trackMechanism ) {
                                    if ( this.activating ) {
                            Severity: Major
                            Found in modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js - About 2 hrs to fix
                              Severity
                              Category
                              Status
                              Source
                              Language