wikimedia/mediawiki-extensions-VisualEditor

View on GitHub

Showing 438 of 907 total issues

File ve.dm.MWTransclusionModel.js has 330 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*!
 * VisualEditor DataModel MWTransclusionModel class.
 *
 * @copyright See AUTHORS.txt
 * @license The MIT License (MIT); see LICENSE.txt
Severity: Minor
Found in modules/ve-mw/dm/models/ve.dm.MWTransclusionModel.js - About 3 hrs to fix

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

    module.exports = function () {
        const veDone = arguments[ arguments.length - 1 ];
    
        window.seleniumUtils = {
            getBoundingRect: function ( elements ) {
    Severity: Major
    Found in build/screenshots-client/utils.js - About 3 hrs to fix

      Function VeUiMWAdvancedSettingsPage has 97 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

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

        exports has 31 functions (exceeds 20 allowed). Consider refactoring.
        Open

        module.exports = {
            toolbar: function () {
                const done = arguments[ arguments.length - 1 ];
                // HACK: The test page is on the help namespace, so overwrite the
                // read tab with the nstab-main message.
        Severity: Minor
        Found in build/screenshots-client/userGuide.js - About 3 hrs to fix

          Function VeUiMWParameterPage has 95 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          ve.ui.MWParameterPage = function VeUiMWParameterPage( parameter, config ) {
              const paramName = parameter.getName();
          
              // Configuration initialization
              config = ve.extendObject( {
          Severity: Major
          Found in modules/ve-mw/ui/pages/ve.ui.MWParameterPage.js - About 3 hrs to fix

            Function processQueue has a Cognitive Complexity of 26 (exceeds 5 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 3 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 a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
            Open

            ve.dm.MWGalleryImageNode.static.toDomElements = function ( data, doc, converter ) {
                // ImageNode:
                //   <li> li (gallerybox)
                //     <div> thumbDiv
                //       <span> container
            Severity: Minor
            Found in modules/ve-mw/dm/nodes/ve.dm.MWGalleryImageNode.js - About 3 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 a Cognitive Complexity of 26 (exceeds 5 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: Minor
            Found in modules/ve-mw/dm/nodes/ve.dm.MWInlineImageNode.js - About 3 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.MWLinkAnnotationInspector.js has 316 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            /*!
             * VisualEditor UserInterface LinkAnnotationInspector class.
             *
             * @copyright See AUTHORS.txt
             * @license The MIT License (MIT); see LICENSE.txt
            Severity: Minor
            Found in modules/ve-mw/ui/inspectors/ve.ui.MWLinkAnnotationInspector.js - About 3 hrs to fix

              Function saveFail has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
              Open

              ve.init.mw.ArticleTarget.prototype.saveFail = function ( doc, saveData, code, data ) {
                  this.pageDeletedWarning = false;
              
                  let handled = false;
                  // Handle empty response
              Severity: Minor
              Found in modules/ve-mw/init/targets/ve.init.mw.ArticleTarget.js - About 3 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 a Cognitive Complexity of 25 (exceeds 5 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: Minor
              Found in modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js - About 3 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 postContent has 88 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      postContent: function ( data, options ) {
                          options = options || {};
                          const api = options.api || new mw.Api();
              
                          let start;
              Severity: Major
              Found in modules/ve-mw/preinit/ve.init.mw.ArticleTargetSaver.js - About 3 hrs to fix

                Function swapPanel has 86 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                ve.ui.MWSaveDialog.prototype.swapPanel = function ( panel, noFocus ) {
                    if ( ( [ 'save', 'review', 'preview', 'conflict' ].indexOf( panel ) ) === -1 ) {
                        throw new Error( 'Unknown saveDialog panel: ' + panel );
                    }
                
                
                Severity: Major
                Found in modules/ve-mw/ui/dialogs/ve.ui.MWSaveDialog.js - About 3 hrs to fix

                  Function escapeParameter has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                  Open

                  ve.dm.MWTransclusionNode.static.escapeParameter = function ( param ) {
                      let input = param,
                          output = '',
                          inNowiki = false,
                          bracketStack = 0,
                  Severity: Minor
                  Found in modules/ve-mw/dm/nodes/ve.dm.MWTransclusionNode.js - About 3 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 getLookupMenuOptionsFromData has 85 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  ve.ui.MWCategoryInputWidget.prototype.getLookupMenuOptionsFromData = function ( data ) {
                      const itemWidgets = [],
                          existingCategoryItems = [],
                          matchingCategoryItems = [],
                          hiddenCategoryItems = [],
                  Severity: Major
                  Found in modules/ve-mw/ui/widgets/ve.ui.MWCategoryInputWidget.js - About 3 hrs to fix

                    File ve.dm.MWTransclusionNode.js has 307 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    /*!
                     * VisualEditor DataModel MWTransclusionNode class.
                     *
                     * @copyright See AUTHORS.txt
                     * @license The MIT License (MIT); see LICENSE.txt
                    Severity: Minor
                    Found in modules/ve-mw/dm/nodes/ve.dm.MWTransclusionNode.js - About 3 hrs to fix

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

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

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

                        ve.ui.MWWikitextLinkAnnotationInspector.prototype.getSetupProcess = function ( data ) {
                            // Annotation inspector stages the annotation, so call its parent
                            // Call grand-parent
                            return ve.ui.AnnotationInspector.super.prototype.getSetupProcess.call( this, data )
                                .next( () => {

                          Function activateTarget has 83 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              function activateTarget( mode, section, tPromise, modified ) {
                                  let dataPromise;
                          
                                  updateTabs( true, mode, section === 'new' );
                          
                          
                          Severity: Major
                          Found in modules/ve-mw/preinit/ve.init.mw.DesktopArticleTarget.init.js - About 3 hrs to fix

                            Function createScreenshotEnvironment has 82 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            function createScreenshotEnvironment( test ) {
                                let clientSize, driver;
                            
                                test.beforeEach( function () {
                                    const lang = this.currentTest.parent.lang || 'en';
                            Severity: Major
                            Found in build/screenshots.js - About 3 hrs to fix
                              Severity
                              Category
                              Status
                              Source
                              Language