wikimedia/mediawiki-extensions-VisualEditor

View on GitHub

Showing 436 of 912 total issues

Function checkRequiredParameters has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

ve.ui.MWTemplateDialog.prototype.checkRequiredParameters = function () {
    const blankRequired = [],
        deferred = ve.createDeferred();

    this.bookletLayout.stackLayout.getItems().forEach( ( page ) => {
Severity: Minor
Found in modules/ve-mw/ui/dialogs/ve.ui.MWTemplateDialog.js - About 1 hr to fix

    Function createItem has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    ve.ui.MWLanguageVariantTwoWayInspector.prototype.createItem = function ( lang, content ) {
        const languageInput = new ve.ui.LanguageInputWidget( {
            dialogManager: this.manager.getSurface().getDialogs(),
            dirInput: 'none'
        } );
    Severity: Minor
    Found in modules/ve-mw/ui/inspectors/ve.ui.MWLanguageVariantInspector.js - About 1 hr to fix

      Function onSaveDialogPreview has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      ve.init.mw.ArticleTarget.prototype.onSaveDialogPreview = function () {
          const api = this.getContentApi();
      
          if ( !this.saveDialog.$previewViewer.children().length ) {
              this.emit( 'savePreview' );
      Severity: Minor
      Found in modules/ve-mw/init/targets/ve.init.mw.ArticleTarget.js - About 1 hr to fix

        Function teardown has 35 lines of code (exceeds 25 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 1 hr to fix

          Method getAllowedParams has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function getAllowedParams() {
                  return [
                      'page' => [
                          ParamValidator::PARAM_REQUIRED => true,
                      ],
          Severity: Minor
          Found in includes/ApiVisualEditor.php - About 1 hr to fix

            Function surfaceReady has 34 lines of code (exceeds 25 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

              Function toggleSidebar has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              ve.ui.MWTransclusionDialog.prototype.toggleSidebar = function ( expandSidebar ) {
                  if ( this.isSidebarExpanded === expandSidebar ) {
                      return;
                  }
              
              
              Severity: Minor
              Found in modules/ve-mw/ui/dialogs/ve.ui.MWTransclusionDialog.js - About 1 hr to fix

                Function process has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                ve.ui.MWWikitextStringTransferHandler.prototype.process = function () {
                    const wikitext = this.item.getAsString();
                
                    // We already know how to handle wikitext magic links, no need for the API call
                    if ( ve.dm.MWMagicLinkNode.static.validateContent( wikitext.trim() ) ) {

                  Function scrollToSection has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      function scrollToSection( section ) {
                          if ( section === '0' || section === 'new' ) {
                              return;
                          }
                  
                  
                  Severity: Minor
                  Found in modules/ve-mw/preinit/ve.init.mw.DesktopArticleTarget.init.js - About 1 hr to fix

                    Consider simplifying this complex logical expression.
                    Open

                            if (
                                pageCanLoadEditor &&
                                showWikitextWelcome &&
                                // At least one editor is available (T201928)
                                ( init.isVisualAvailable || init.isWikitextAvailable || $( '#wpTextbox1' ).length ) &&
                    Severity: Critical
                    Found in modules/ve-mw/preinit/ve.init.mw.DesktopArticleTarget.init.js - About 1 hr to fix

                      Function onWindowPopState has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      ve.init.mw.DesktopArticleTarget.prototype.onWindowPopState = function ( e ) {
                          if ( !this.verifyPopState( e.state ) ) {
                              // Ignore popstate events fired for states not created by us
                              // This also filters out the initial fire in Chrome (T59901).
                              return;
                      Severity: Minor
                      Found in modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js - About 1 hr to fix

                        Function preparedCacheKeyPromise has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                .then( ( deflatedHtml ) => {
                                    if ( aborted ) {
                                        return ve.createDeferred().reject();
                                    }
                                    xhr = this.getContentApi().postWithToken( 'csrf',
                        Severity: Minor
                        Found in modules/ve-mw/init/targets/ve.init.mw.ArticleTarget.js - About 1 hr to fix

                          Function parseDocument has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          ve.init.mw.Target.static.parseDocument = function ( documentString, mode, section, onlySection ) {
                              let doc;
                              if ( mode === 'source' ) {
                                  // Parent method
                                  doc = ve.init.mw.Target.super.static.parseDocument.call( this, documentString, mode );
                          Severity: Minor
                          Found in modules/ve-mw/init/targets/ve.init.mw.Target.js - About 1 hr to fix

                            Function onHighlightItem has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            ve.ui.MWGalleryDialog.prototype.onHighlightItem = function ( item ) {
                                // Unhighlight previous item
                                if ( this.highlightedItem ) {
                                    this.highlightedItem.toggleHighlighted( false );
                                }
                            Severity: Minor
                            Found in modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js - About 1 hr to fix

                              Function updateImageNode has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              ve.dm.MWImageModel.prototype.updateImageNode = function ( node, surfaceModel ) {
                                  const doc = surfaceModel.getDocument();
                              
                                  // Update the caption
                                  if ( node.getType() === 'mwBlockImage' ) {
                              Severity: Minor
                              Found in modules/ve-mw/dm/models/ve.dm.MWImageModel.js - About 1 hr to fix

                                Function VeUiMWGalleryItemWidget has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                ve.ui.MWGalleryItemWidget = function VeUiMWGalleryItemWidget( imageInfo, config ) {
                                    this.resource = imageInfo.resource;
                                    this.altText = imageInfo.altText || '';
                                    this.altTextSame = imageInfo.altTextSame;
                                    this.href = imageInfo.href;
                                Severity: Minor
                                Found in modules/ve-mw/ui/widgets/ve.ui.MWGalleryItemWidget.js - About 1 hr to fix

                                  Function onCopy has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  ve.ce.MWWikitextSurface.prototype.onCopy = function ( e ) {
                                      const clipboardData = e.originalEvent.clipboardData,
                                          text = this.getModel().getFragment().getText( true ).replace( /\n\n/g, '\n' );
                                  
                                      if ( !text ) {
                                  Severity: Minor
                                  Found in modules/ve-mw/ce/ve.ce.MWWikitextSurface.js - About 1 hr to fix

                                    Function VeCeMWInlineImageNode has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    ve.ce.MWInlineImageNode = function VeCeMWInlineImageNode( model, config ) {
                                        let $image;
                                        let hasHref = false;
                                    
                                        if ( model.getAttribute( 'isError' ) ) {
                                    Severity: Minor
                                    Found in modules/ve-mw/ce/nodes/ve.ce.MWInlineImageNode.js - About 1 hr to fix

                                      Method onCustomEditor has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                          public function onCustomEditor( $article, $user ) {
                                              $req = $article->getContext()->getRequest();
                                              $services = MediaWikiServices::getInstance();
                                              $urlUtils = $services->getUrlUtils();
                                              $veConfig = $services->getConfigFactory()->makeConfig( 'visualeditor' );
                                      Severity: Minor
                                      Found in includes/Hooks.php - About 1 hr to fix

                                        Function getSetupProcess has 32 lines of code (exceeds 25 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
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language