wikimedia/mediawiki-extensions-VisualEditor

View on GitHub

Showing 438 of 907 total issues

Function exports has 152 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function ( grunt ) {
    const conf = grunt.file.readJSON( 'extension.json' ),
        screenshotOptions = {
            reporter: 'spec',
            // TODO: Work out how to catch this timeout and continue.
Severity: Major
Found in Gruntfile.js - About 6 hrs to fix

    Method onSkinTemplateNavigation__Universal has 151 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function onSkinTemplateNavigation__Universal( $skin, &$links ): void {
            $services = MediaWikiServices::getInstance();
            $userOptionsLookup = $services->getUserOptionsLookup();
            $config = $services->getConfigFactory()
                ->makeConfig( 'visualeditor' );
    Severity: Major
    Found in includes/Hooks.php - About 6 hrs to fix

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

      ve.ui.MWAdvancedSettingsPage.prototype.teardown = function ( data ) {
          // Data initialization
          data = data || {};
          if ( data.action !== 'done' ) {
              return;
      Severity: Minor
      Found in modules/ve-mw/ui/pages/ve.ui.MWAdvancedSettingsPage.js - About 5 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 initialize has 135 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      ve.ui.MWSaveDialog.prototype.initialize = function () {
          const mwString = require( 'mediawiki.String' );
      
          // Parent method
          ve.ui.MWSaveDialog.super.prototype.initialize.call( this );
      Severity: Major
      Found in modules/ve-mw/ui/dialogs/ve.ui.MWSaveDialog.js - About 5 hrs to fix

        Function onReplacePart has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
        Open

        ve.ui.MWTemplateDialog.prototype.onReplacePart = function ( removed, added ) {
            const removePages = [];
        
            if ( removed ) {
                // Remove parameter pages of removed templates
        Severity: Minor
        Found in modules/ve-mw/ui/dialogs/ve.ui.MWTemplateDialog.js - About 5 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

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

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

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

          ve.ui.MWSettingsPage.prototype.teardown = function ( data ) {
              // Data initialisation
              data = data || {};
              if ( data.action !== 'done' ) {
                  return;
          Severity: Minor
          Found in modules/ve-mw/ui/pages/ve.ui.MWSettingsPage.js - About 5 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 showPage has 127 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function showPage( title, importTitle ) {
                  const specialTitle = mw.Title.newFromText( 'Special:CollabPad/' + title.toString() );
          
                  setTitle( mw.msg( 'collabpad-doctitle', title.getPrefixedText() ) );
          
          
          Severity: Major
          Found in modules/ve-mw-collab/ve.init.mw.CollabTarget.init.js - About 5 hrs to fix

            Method execute has 126 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function execute() {
                    $user = $this->getUser();
                    $params = $this->extractRequestParams();
            
                    $result = [];
            Severity: Major
            Found in includes/ApiVisualEditorEdit.php - About 5 hrs to fix

              File ve.init.mw.Target.js has 371 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              /*!
               * VisualEditor MediaWiki Initialization Target class.
               *
               * @copyright See AUTHORS.txt
               * @license The MIT License (MIT); see LICENSE.txt
              Severity: Minor
              Found in modules/ve-mw/init/targets/ve.init.mw.Target.js - About 4 hrs to fix

                Function insertOrUpdateNode has 115 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                ve.ui.MWGalleryDialog.prototype.insertOrUpdateNode = function () {
                    const surfaceModel = this.getFragment().getSurface(),
                        surfaceModelDocument = surfaceModel.getDocument(),
                        items = this.galleryGroup.items;
                
                
                Severity: Major
                Found in modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js - About 4 hrs to fix

                  Function VeUiMWSettingsPage has 113 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  ve.ui.MWSettingsPage = function VeUiMWSettingsPage( name, config ) {
                      // Parent constructor
                      ve.ui.MWSettingsPage.super.apply( this, arguments );
                  
                      // Properties
                  Severity: Major
                  Found in modules/ve-mw/ui/pages/ve.ui.MWSettingsPage.js - About 4 hrs to fix

                    Function toDomElements has a Cognitive Complexity of 30 (exceeds 5 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: Minor
                    Found in modules/ve-mw/dm/nodes/ve.dm.MWBlockImageNode.js - About 4 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 describeChanges has a Cognitive Complexity of 30 (exceeds 5 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 4 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 renderBody has 110 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    ve.ui.MWLanguageVariantNodeContextItem.prototype.renderBody = function () {
                        const $body = this.$body,
                            $table = $( '<table>' ),
                            $header = $( '<tr>' ),
                            variantInfo = this.model.getVariantInfo(),

                      File ve.init.mw.ArticleTargetLoader.js has 348 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      /*!
                       * VisualEditor MediaWiki ArticleTargetLoader.
                       *
                       * @copyright See AUTHORS.txt
                       * @license The MIT License (MIT); see LICENSE.txt
                      Severity: Minor
                      Found in modules/ve-mw/preinit/ve.init.mw.ArticleTargetLoader.js - About 4 hrs to fix

                        Function describeChanges has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                        Open

                        ve.dm.MWTransclusionNode.static.describeChanges = function ( attributeChanges ) {
                            const descriptions = [ ve.msg( 'visualeditor-changedesc-mwtransclusion' ) ];
                        
                            // This method assumes that the behavior of isDiffComparable above remains
                            // the same, so it doesn't have to consider whether the actual template
                        Severity: Minor
                        Found in modules/ve-mw/dm/nodes/ve.dm.MWTransclusionNode.js - About 4 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

                        Hooks has 33 functions (exceeds 20 allowed). Consider refactoring.
                        Open

                        class Hooks implements
                            TextSlotDiffRendererTablePrefixHook,
                            BeforeInitializeHook,
                            BeforePageDisplayHook,
                            ChangeTagsListActiveHook,
                        Severity: Minor
                        Found in includes/Hooks.php - About 4 hrs to fix

                          Function toDataElement has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                          Open

                          ve.dm.MWGalleryImageNode.static.toDataElement = function ( domElements, converter ) {
                              // TODO: Improve handling of missing files. See 'isError' in MWBlockImageNode#toDataElement
                              const li = domElements[ 0 ];
                              const img = li.querySelector( '.mw-file-element' );
                              const imgWrapper = img.parentNode;
                          Severity: Minor
                          Found in modules/ve-mw/dm/nodes/ve.dm.MWGalleryImageNode.js - About 4 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 getSetupProcess has 101 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          ve.ui.MWGalleryDialog.prototype.getSetupProcess = function ( data ) {
                              return ve.ui.MWGalleryDialog.super.prototype.getSetupProcess.call( this, data )
                                  .next( () => {
                                      const namespaceIds = mw.config.get( 'wgNamespaceIds' ),
                                          mwData = this.selectedNode && this.selectedNode.getAttribute( 'mw' ),
                          Severity: Major
                          Found in modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js - About 4 hrs to fix
                            Severity
                            Category
                            Status
                            Source
                            Language