wikimedia/mediawiki-extensions-VisualEditor

View on GitHub

Showing 436 of 912 total issues

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

ve.ui.MWLanguageVariantOneWayInspector.prototype.createItem = function ( from, lang, to ) {
    const fromTextTarget = this.createTextTarget( OO.ui.msg(
        'visualeditor-mwlanguagevariantinspector-oneway-from-text-placeholder'
    ) );
    const languageInput = new ve.ui.LanguageInputWidget( {
Severity: Minor
Found in modules/ve-mw/ui/inspectors/ve.ui.MWLanguageVariantInspector.js - About 1 hr to fix

    Function processQueue has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    ve.init.mw.ApiResponseCache.prototype.processQueue = function () {
        const rejectSubqueue = ( rejectQueue ) => {
            for ( let i = 0, len = rejectQueue.length; i < len; i++ ) {
                this.deferreds[ rejectQueue[ i ] ].reject();
            }
    Severity: Minor
    Found in modules/ve-mw/init/apiresponsecache/ve.init.mw.ApiResponseCache.js - About 1 hr to fix

      Function VeUiMwEducationPopup has 41 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      ve.ui.MWEducationPopupWidget = function VeUiMwEducationPopup( $target, config ) {
          config = config || {};
      
          // HACK: Do not display on platforms other than desktop
          if ( !( ve.init.mw.DesktopArticleTarget && ve.init.target instanceof ve.init.mw.DesktopArticleTarget ) ) {
      Severity: Minor
      Found in modules/ve-mw/ui/widgets/ve.ui.MWEducationPopupWidget.js - About 1 hr to fix

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

          Function switchToFallbackWikitextEditor has 40 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          ve.init.mw.DesktopArticleTarget.prototype.switchToFallbackWikitextEditor = function ( modified ) {
              const oldId = mw.config.get( 'wgRevisionId' ) || $( 'input[name=parentRevId]' ).val();
              const prefPromise = mw.libs.ve.setEditorPreference( 'wikitext' );
          
              if ( !modified ) {
          Severity: Minor
          Found in modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js - About 1 hr to fix

            Method onBeforePageDisplay has 40 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function onBeforePageDisplay( $output, $skin ): void {
                    $services = MediaWikiServices::getInstance();
                    $hookRunner = new VisualEditorHookRunner( $services->getHookContainer() );
                    if ( !$hookRunner->onVisualEditorBeforeEditor( $output, $skin ) ) {
                        $output->addJsConfigVars( 'wgVisualEditorDisabledByHook', true );
            Severity: Minor
            Found in includes/Hooks.php - About 1 hr to fix

              Function initAutosave has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

              ve.init.mw.Target.prototype.initAutosave = function ( config ) {
                  // Old function signature
                  // TODO: Remove after fixed downstream
                  if ( typeof config === 'boolean' ) {
                      config = { suppressNotification: config };
              Severity: Minor
              Found in modules/ve-mw/init/targets/ve.init.mw.Target.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 updateRedirectInterface has a Cognitive Complexity of 13 (exceeds 5 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

              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 onSelect has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

              ve.ui.MWFeedbackDialogTool.prototype.onSelect = function () {
                  this.setActive( false );
              
                  if ( !this.feedbackPromise ) {
                      this.feedbackPromise = mw.loader.using( 'mediawiki.feedback' ).then( () => {
              Severity: Minor
              Found in modules/ve-mw/ui/toolgroups/ve.ui.MWHelpListToolGroup.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 getSetupProcess has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

              ve.ui.MWSaveDialog.prototype.getSetupProcess = function ( data ) {
                  return ve.ui.MWSaveDialog.super.prototype.getSetupProcess.call( this, data )
                      .next( () => {
                          const surfaceMode = ve.init.target.getSurface().getMode();
              
              
              Severity: Minor
              Found in modules/ve-mw/ui/dialogs/ve.ui.MWSaveDialog.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 onDocumentKeyDown has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

              ve.ui.MWTransclusionOutlineParameterSelectWidget.prototype.onDocumentKeyDown = function ( e ) {
                  let item;
              
                  switch ( e.keyCode ) {
                      case OO.ui.Keys.HOME:

              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 getPreviewHtml has a Cognitive Complexity of 13 (exceeds 5 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

              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 getTeardownProcess has 39 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              ve.ui.MWMagicLinkNodeInspector.prototype.getTeardownProcess = function ( data ) {
                  data = data || {};
                  return ve.ui.MWMagicLinkNodeInspector.super.prototype.getTeardownProcess.call( this, data )
                      .first( () => {
                          const surfaceView = this.manager.getSurface().getView(),
              Severity: Minor
              Found in modules/ve-mw/ui/inspectors/ve.ui.MWMagicLinkNodeInspector.js - About 1 hr to fix

                Function getVisualDiffGeneratorPromise has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                ve.init.mw.ArticleTarget.prototype.getVisualDiffGeneratorPromise = function () {
                    return mw.loader.using( 'ext.visualEditor.diffLoader' ).then( () => {
                        const mode = this.getSurface().getMode();
                
                        if ( !this.originalDmDocPromise ) {
                Severity: Minor
                Found in modules/ve-mw/init/targets/ve.init.mw.ArticleTarget.js - About 1 hr to fix

                  Function VeUiMWCategoryPopupWidget has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  ve.ui.MWCategoryPopupWidget = function VeUiMWCategoryPopupWidget( config ) {
                      // Configuration initialization
                      config = ve.extendObject( { autoClose: true }, config );
                  
                      // Parent constructor
                  Severity: Minor
                  Found in modules/ve-mw/ui/widgets/ve.ui.MWCategoryPopupWidget.js - About 1 hr to fix

                    Function getSetupProcess has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

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

                      Function describeChanges has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      ve.dm.MWImageNode.static.describeChanges = function ( attributeChanges, attributes ) {
                          const customKeys = [ 'width', 'height', 'defaultSize', 'src', 'href' ],
                              descriptions = [];
                      
                          function describeSize( width, height ) {
                      Severity: Minor
                      Found in modules/ve-mw/dm/nodes/ve.dm.MWImageNode.js - About 1 hr to fix

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

                        ve.ui.MWTemplateDialog.prototype.getActionProcess = function ( action ) {
                            if ( action === 'done' ) {
                                return new OO.ui.Process( () => {
                                    const deferred = ve.createDeferred();
                                    this.checkRequiredParameters().done( () => {
                        Severity: Minor
                        Found in modules/ve-mw/ui/dialogs/ve.ui.MWTemplateDialog.js - About 1 hr to fix

                          Function onContainerScroll has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          ve.init.mw.MobileArticleTarget.prototype.onContainerScroll = function () {
                              // Editor may not have loaded yet, in which case `this.surface` is undefined
                              const surfaceView = this.surface && this.surface.getView(),
                                  isActiveWithKeyboard = surfaceView && surfaceView.isFocused() && !surfaceView.isDeactivated();
                          
                          
                          Severity: Minor
                          Found in modules/ve-mw/init/targets/ve.init.mw.MobileArticleTarget.js - About 1 hr to fix

                            Method diffWikitext has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                protected function diffWikitext( Title $title, ?int $fromId, $wikitext, $section = null ) {
                                    $apiParams = [
                                        'action' => 'compare',
                                        'prop' => 'diff',
                                        // Because we're just providing wikitext, we only care about the main slot
                            Severity: Minor
                            Found in includes/ApiVisualEditorEdit.php - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language