wikimedia/mediawiki-extensions-VisualEditor

View on GitHub

Showing 436 of 912 total issues

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

        onEditTabClick: function ( mode, e ) {
            if ( !init.isUnmodifiedLeftClick( e ) ) {
                return;
            }
            if ( !active && mode === 'source' && !init.isWikitextAvailable ) {
Severity: Minor
Found in modules/ve-mw/preinit/ve.init.mw.DesktopArticleTarget.init.js - About 1 hr to fix

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

    ve.dm.MWImageNode.static.syncScalableToType = function ( type, mediaType, scalable ) {
        const defaultThumbSize = mw.config.get( 'wgVisualEditorConfig' )
            .thumbLimits[ mw.user.options.get( 'thumbsize' ) ];
    
        const originalDimensions = scalable.getOriginalDimensions();
    Severity: Minor
    Found in modules/ve-mw/dm/nodes/ve.dm.MWImageNode.js - About 1 hr to fix

      Function onLoadLanguageData has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      ve.ui.MWLanguagesPage.prototype.onLoadLanguageData = function ( languages ) {
          const $languagesTable = $( '<table>' ),
              languageslength = languages.length;
      
          $languagesTable
      Severity: Minor
      Found in modules/ve-mw/ui/pages/ve.ui.MWLanguagesPage.js - About 1 hr to fix

        Function setupEditLinks has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                setupEditLinks: function () {
                    // NWE
                    if ( init.isWikitextAvailable && !isOnlyTabVE() ) {
                        $(
                            // Edit section links, except VE ones when both editors visible
        Severity: Minor
        Found in modules/ve-mw/preinit/ve.init.mw.DesktopArticleTarget.init.js - About 1 hr to fix

          Method saveWikitext has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function saveWikitext( Title $title, $wikitext, $params ) {
                  $apiParams = [
                      'action' => 'edit',
                      'title' => $title->getPrefixedDBkey(),
                      'text' => $wikitext,
          Severity: Minor
          Found in includes/ApiVisualEditorEdit.php - About 1 hr to fix

            Function setActive has 36 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            ve.ui.MWHelpListToolGroup.prototype.setActive = function () {
                // Parent method
                ve.ui.MWHelpListToolGroup.super.prototype.setActive.apply( this, arguments );
            
                if ( this.active && !this.versionPromise ) {
            Severity: Minor
            Found in modules/ve-mw/ui/toolgroups/ve.ui.MWHelpListToolGroup.js - About 1 hr to fix

              Function loadSuccess has 36 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              ve.init.mw.ArticleTarget.prototype.loadSuccess = function ( response ) {
                  const data = response ? ( response.visualeditor || response.visualeditoredit ) : null;
              
                  if ( !data || typeof data.content !== 'string' ) {
                      this.loadFail( 've-api', { errors: [ {
              Severity: Minor
              Found in modules/ve-mw/init/targets/ve.init.mw.ArticleTarget.js - About 1 hr to fix

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

                ve.ui.MWMetaDialog.prototype.getSetupProcess = function ( data ) {
                    data = data || {};
                    return ve.ui.MWMetaDialog.super.prototype.getSetupProcess.call( this, data )
                        .next( () => {
                            const surfaceModel = this.getFragment().getSurface(),
                Severity: Minor
                Found in modules/ve-mw/ui/dialogs/ve.ui.MWMetaDialog.js - About 1 hr to fix

                  Function onDocumentKeyDown has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

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

                    Function fixFragmentLinks has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    mw.libs.ve.fixFragmentLinks = function ( container, docTitle, prefix ) {
                        const docTitleText = docTitle.getPrefixedText();
                        prefix = prefix || '';
                        Array.prototype.forEach.call( container.querySelectorAll( 'a[href*="#"]' ), ( el ) => {
                            let fragment = null;
                    Severity: Minor
                    Found in modules/ve-mw/preinit/ve.utils.parsoid.js - About 1 hr to fix

                      Function getSaveFields has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                      Open

                      ve.init.mw.ArticleTarget.prototype.getSaveFields = function () {
                          const fields = {};
                      
                          if ( this.section === 'new' ) {
                              // MediaWiki action=edit UI doesn't have separate parameters for edit summary and new section
                      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 parseDocument has a Cognitive Complexity of 12 (exceeds 5 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

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

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

                      ve.init.mw.ArticleTarget.prototype.parseMetadata = function ( response ) {
                          const data = response ? ( response.visualeditor || response.visualeditoredit ) : null;
                      
                          if ( !data ) {
                              this.loadFail( 've-api', { errors: [ {
                      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 loadSuccess has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                      Open

                      ve.init.mw.ArticleTarget.prototype.loadSuccess = function ( response ) {
                          const data = response ? ( response.visualeditor || response.visualeditoredit ) : null;
                      
                          if ( !data || typeof data.content !== 'string' ) {
                              this.loadFail( 've-api', { errors: [ {
                      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 getAllParametersOrdered has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                      Open

                      ve.dm.MWTemplateModel.prototype.getAllParametersOrdered = function () {
                          const spec = this.spec,
                              usedAliases = {};
                      
                          let primaryName;
                      Severity: Minor
                      Found in modules/ve-mw/dm/models/ve.dm.MWTemplateModel.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 setTemplateData has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                      Open

                      ve.dm.MWTemplateSpecModel.prototype.setTemplateData = function ( data ) {
                          if ( !data || !ve.isPlainObject( data ) ) {
                              return;
                          }
                      
                      
                      Severity: Minor
                      Found in modules/ve-mw/dm/models/ve.dm.MWTemplateSpecModel.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 insertOrUpdateNode has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                      Open

                      ve.ui.MWGalleryDialog.prototype.insertOrUpdateNode = function () {
                          const surfaceModel = this.getFragment().getSurface(),
                              surfaceModelDocument = surfaceModel.getDocument(),
                              items = this.galleryGroup.items,
                              data = [];
                      Severity: Minor
                      Found in modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.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 VeCeMWGalleryImageNode has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                      Open

                      ve.ce.MWGalleryImageNode = function VeCeMWGalleryImageNode( model ) {
                          // Parent constructor
                          ve.ce.MWGalleryImageNode.super.apply( this, arguments );
                      
                          // DOM hierarchy for MWGalleryImageNode:
                      Severity: Minor
                      Found in modules/ve-mw/ce/nodes/ve.ce.MWGalleryImageNode.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 findAddedContent has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                      Open

                      mw.editcheck.AddReferenceEditCheck.prototype.findAddedContent = function ( documentModel, includeReferencedContent ) {
                          // Broken out so a helper for tagging can call it
                          const ranges = this.getModifiedContentRanges( documentModel ).filter( ( range ) => {
                              if ( !includeReferencedContent ) {
                                  // 4. Exclude any ranges that already contain references
                      Severity: Minor
                      Found in editcheck/modules/AddReferenceEditCheck.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

                      Severity
                      Category
                      Status
                      Source
                      Language