wikimedia/mediawiki-extensions-VisualEditor

View on GitHub

Showing 436 of 912 total issues

Function initialize has 59 lines of code (exceeds 25 allowed). Consider refactoring.
Open

ve.ui.MWLinkAnnotationInspector.prototype.initialize = function () {
    // Properties
    this.allowProtocolInInternal = false;
    this.internalAnnotationInput = this.createInternalAnnotationInput();
    this.externalAnnotationInput = this.createExternalAnnotationInput();
Severity: Major
Found in modules/ve-mw/ui/inspectors/ve.ui.MWLinkAnnotationInspector.js - About 2 hrs to fix

    Function OoUiOutlineControlsWidget has 59 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    ve.ui.MWTransclusionOutlineControlsWidget = function OoUiOutlineControlsWidget() {
        // Parent constructor
        ve.ui.MWTransclusionOutlineControlsWidget.super.call( this );
    
        // Mixin constructors
    Severity: Major
    Found in modules/ve-mw/ui/widgets/ve.ui.MWTransclusionOutlineControlsWidget.js - About 2 hrs to fix

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

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

        Function escapeParameter has 59 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        ve.dm.MWTransclusionNode.static.escapeParameter = function ( param ) {
            let input = param,
                output = '',
                inNowiki = false,
                bracketStack = 0,
        Severity: Major
        Found in modules/ve-mw/dm/nodes/ve.dm.MWTransclusionNode.js - About 2 hrs to fix

          Method onResourceLoaderGetConfigVars has 59 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function onResourceLoaderGetConfigVars( array &$vars, $skin, Config $config ): void {
                  $coreConfig = RequestContext::getMain()->getConfig();
                  $services = MediaWikiServices::getInstance();
                  $veConfig = $services->getConfigFactory()->makeConfig( 'visualeditor' );
                  $extensionRegistry = ExtensionRegistry::getInstance();
          Severity: Major
          Found in includes/Hooks.php - About 2 hrs to fix

            Consider simplifying this complex logical expression.
            Open

                            if (
                                $isAvailable &&
                                $config->get( 'VisualEditorUseSingleEditTab' ) &&
                                (
                                    $userOptionsLookup->getOption( $user, 'visualeditor-tabs' ) === 'prefer-ve' ||
            Severity: Critical
            Found in includes/Hooks.php - About 2 hrs to fix

              Function saveFail has 58 lines of code (exceeds 25 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: Major
              Found in modules/ve-mw/init/targets/ve.init.mw.ArticleTarget.js - About 2 hrs to fix

                Function VeUiMWWikitextSurface has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                ve.ui.MWWikitextSurface = function VeUiMWWikitextSurface() {
                    // Parent constructor
                    ve.ui.MWWikitextSurface.super.apply( this, arguments );
                
                    // Initialization
                Severity: Major
                Found in modules/ve-mw/ui/ve.ui.MWWikitextSurface.js - About 2 hrs to fix

                  Function restoreEditSection has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  ve.init.mw.ArticleTarget.prototype.restoreEditSection = function () {
                      const section = this.section !== null ? this.section : this.visibleSection;
                      const surface = this.getSurface();
                      const mode = surface.getMode();
                  
                  
                  Severity: Major
                  Found in modules/ve-mw/init/targets/ve.init.mw.ArticleTarget.js - About 2 hrs to fix

                    Function wrapLine has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                    Open

                    ve.ui.MWWikitextAction.prototype.wrapLine = function ( before, after, placeholder, unwrapOffsetsCallback ) {
                        let originalFragment = this.surface.getModel().getFragment( null, false, true /* excludeInsertions */ );
                        const selectedNodes = originalFragment.getLeafNodes();
                    
                        let unwrapped = false;
                    Severity: Minor
                    Found in modules/ve-mw/ui/actions/ve.ui.MWWikitextAction.js - About 2 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 swapPanel has a Cognitive Complexity of 17 (exceeds 5 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: Minor
                    Found in modules/ve-mw/ui/dialogs/ve.ui.MWSaveDialog.js - About 2 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 VeUiMWTemplatePage has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                    Open

                    ve.ui.MWTemplatePage = function VeUiMWTemplatePage( template, name, config ) {
                        const link = template.getTemplateDataQueryTitle();
                    
                        // Configuration initialization
                        config = ve.extendObject( {
                    Severity: Minor
                    Found in modules/ve-mw/ui/pages/ve.ui.MWTemplatePage.js - About 2 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 onSkinEditSectionLinks has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function onSkinEditSectionLinks( $skin, $title, $section,
                            $tooltip, &$result, $lang
                        ) {
                            $services = MediaWikiServices::getInstance();
                            $userOptionsLookup = $services->getUserOptionsLookup();
                    Severity: Minor
                    Found in includes/Hooks.php - About 2 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 build has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    ve.ui.MWTocWidget.prototype.build = function () {
                        const $newTocList = $( '<ul>' ),
                            nodes = this.doc.getNodesByType( 'mwHeading', true ),
                            surfaceView = this.surface.getView(),
                            documentView = surfaceView.getDocument(),
                    Severity: Major
                    Found in modules/ve-mw/ui/widgets/ve.ui.MWTocWidget.js - About 2 hrs to fix

                      Function prepareCacheKey has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      ve.init.mw.ArticleTarget.prototype.prepareCacheKey = function ( doc ) {
                          const start = ve.now();
                      
                          if ( this.getSurface().getMode() === 'source' ) {
                              return;
                      Severity: Major
                      Found in modules/ve-mw/init/targets/ve.init.mw.ArticleTarget.js - About 2 hrs to fix

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

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

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

                          /*!
                           * VisualEditor MediaWiki Initialization MobileArticleTarget 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.MobileArticleTarget.js - About 2 hrs to fix

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

                            ve.ui.MWTemplateDialog.prototype.getSetupProcess = function ( data ) {
                                data = data || {};
                                return ve.ui.MWTemplateDialog.super.prototype.getSetupProcess.call( this, data )
                                    .next( () => {
                                        let promise;
                            Severity: Major
                            Found in modules/ve-mw/ui/dialogs/ve.ui.MWTemplateDialog.js - About 2 hrs to fix

                              Function VeUiMWMediaInfoFieldWidget has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              ve.ui.MWMediaInfoFieldWidget = function VeUiMWMediaInfoFieldWidget( content, config ) {
                                  // Configuration initialization
                                  config = config || {};
                              
                                  // Parent constructor
                              Severity: Major
                              Found in modules/ve-mw/ui/widgets/ve.ui.MWMediaInfoFieldWidget.js - About 2 hrs to fix

                                Function onReviewModeButtonSelectSelect has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    function onReviewModeButtonSelectSelect( item ) {
                                        let oldPageName, newPageName;
                                        if ( mw.config.get( 'wgCanonicalSpecialPageName' ) !== 'ComparePages' ) {
                                            oldPageName = newPageName = mw.config.get( 'wgRelevantPageName' );
                                        } else {
                                Severity: Major
                                Found in modules/ve-mw/preinit/ve.init.mw.DiffPage.init.js - About 2 hrs to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language