wikimedia/mediawiki-extensions-VisualEditor

View on GitHub

Showing 436 of 912 total issues

Function onEditSectionLinkClick has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        onEditSectionLinkClick: function ( mode, e, section ) {
            const link = $( e.target ).closest( 'a' )[ 0 ];
            if ( !link || !link.href ) {
                // Not a real link, probably added by a gadget or another extension (T328094)
                return;
Severity: Minor
Found in modules/ve-mw/preinit/ve.init.mw.DesktopArticleTarget.init.js - About 1 hr to fix

    Function filterRendering has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    ve.ce.MWTransclusionNode.static.filterRendering = function ( contentNodes ) {
        if ( !contentNodes.length ) {
            return [];
        }
    
    
    Severity: Minor
    Found in modules/ve-mw/ce/nodes/ve.ce.MWTransclusionNode.js - About 1 hr to fix

      Function VeCeMWBlockImageNode has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      ve.ce.MWBlockImageNode = function VeCeMWBlockImageNode() {
          // Parent constructor
          ve.ce.MWBlockImageNode.super.apply( this, arguments );
      
          const type = this.model.getAttribute( 'type' );
      Severity: Minor
      Found in modules/ve-mw/ce/nodes/ve.ce.MWBlockImageNode.js - About 1 hr to fix

        Method __construct has 9 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                ApiMain $main,
                string $name,
                HookContainer $hookContainer,
                IBufferingStatsdDataFactory $statsdDataFactory,
                PageEditStash $pageEditStash,
        Severity: Major
        Found in includes/ApiVisualEditorEdit.php - About 1 hr to fix

          Function trackSaveError has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          ve.init.mw.ArticleTargetEvents.prototype.trackSaveError = function ( code ) {
              // Maps error codes to editAttemptStep types
              const typeMap = {
                      badtoken: 'userBadToken',
                      assertanonfailed: 'userNewUser',
          Severity: Minor
          Found in modules/ve-mw/init/ve.init.mw.ArticleTargetEvents.js - About 1 hr to fix

            Function filterParameters has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            ve.ui.MWTransclusionOutlineTemplateWidget.prototype.filterParameters = function ( query ) {
                const template = this.templateModel,
                    spec = this.templateModel.getSpec(),
                    visibility = {};
                let nothingFound = true;

              Function newFromImageAttributes has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              ve.dm.MWImageModel.static.newFromImageAttributes = function ( attrs, parentDoc ) {
                  const imgModel = new ve.dm.MWImageModel(
                      parentDoc,
                      {
                          resourceName: attrs.resource,
              Severity: Minor
              Found in modules/ve-mw/dm/models/ve.dm.MWImageModel.js - About 1 hr to fix

                Method onTextSlotDiffRendererTablePrefix has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function onTextSlotDiffRendererTablePrefix(
                        TextSlotDiffRenderer $textSlotDiffRenderer,
                        IContextSource $context,
                        array &$parts
                    ) {
                Severity: Minor
                Found in includes/Hooks.php - About 1 hr to fix

                  Method getMessageInfo has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      protected function getMessageInfo( ResourceLoaderContext $context ) {
                          $editSubmitButtonLabelPublish = $this->getConfig()
                              ->get( 'EditSubmitButtonLabelPublish' );
                          $saveButtonLabelKey = $editSubmitButtonLabelPublish ? 'publishchanges' : 'savechanges';
                          $saveButtonLabel = $context->msg( $saveButtonLabelKey )->text();
                  Severity: Minor
                  Found in includes/VisualEditorDataModule.php - About 1 hr to fix

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

                    ve.init.mw.ArticleTarget.prototype.teardown = function () {
                        if ( !this.teardownPromise ) {
                            const surface = this.getSurface();
                    
                            // Restore access keys
                    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 setPage has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                    ve.ui.MWTwoPaneTransclusionDialogLayout.prototype.setPage = function ( name ) {
                        const page = this.pages[ name ];
                    
                        if ( page && name === this.currentPageName ) {
                            return;
                    Severity: Minor
                    Found in modules/ve-mw/ui/layouts/ve.ui.MWTwoPaneTransclusionDialogLayout.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 setupNewSection has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                    ve.init.mw.DesktopArticleTarget.prototype.setupNewSection = function ( surface ) {
                        if ( surface.getMode() === 'source' && this.section === 'new' ) {
                            if ( !this.sectionTitle ) {
                                this.sectionTitle = new OO.ui.TextInputWidget( {
                                    $element: $( '<h2>' ),
                    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 updateHistoryState has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                    ve.init.mw.DesktopArticleTarget.prototype.updateHistoryState = function () {
                        const veaction = this.getDefaultMode() === 'visual' ? 'edit' : 'editsource',
                            section = this.section;
                    
                        // Push veaction=edit(source) url in history (if not already present).
                    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 toDomElements has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                    ve.dm.MWNowikiAnnotation.static.toDomElements = function ( dataElement, doc, converter, childDomElements ) {
                        const originalDomElements = converter.getStore().value( dataElement.originalDomElementsHash ),
                            originalChildren = originalDomElements && originalDomElements[ 0 ] && originalDomElements[ 0 ].childNodes,
                            domElement = document.createElement( 'span' );
                    
                    
                    Severity: Minor
                    Found in modules/ve-mw/dm/annotations/ve.dm.MWNowikiAnnotation.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 setSelectionByPageName has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                    ve.ui.MWTransclusionOutlineWidget.prototype.setSelectionByPageName = function ( pageName ) {
                        const selectedPartId = pageName ? pageName.split( '/', 1 )[ 0 ] : null,
                            isParameter = pageName ? pageName.length > selectedPartId.length : false;
                    
                        for ( const partId in this.partWidgets ) {
                    Severity: Minor
                    Found in modules/ve-mw/ui/widgets/ve.ui.MWTransclusionOutlineWidget.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 initFromMetaList has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                    ve.ui.MWTocWidget.prototype.initFromMetaList = function () {
                        const items = this.metaList.getItemsInGroup( 'mwTOC' );
                        if ( items.length === 0 ) {
                            return;
                        }
                    Severity: Minor
                    Found in modules/ve-mw/ui/widgets/ve.ui.MWTocWidget.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 VeUiMWParameterPage has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                    ve.ui.MWParameterPage = function VeUiMWParameterPage( parameter, config ) {
                        const paramName = parameter.getName();
                    
                        // Configuration initialization
                        config = ve.extendObject( {
                    Severity: Minor
                    Found in modules/ve-mw/ui/pages/ve.ui.MWParameterPage.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 getTargetDataFromHref has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                    mw.libs.ve.getTargetDataFromHref = function ( href, doc ) {
                        function regexEscape( str ) {
                            return str.replace( /([.?*+^$[\]\\(){}|-])/g, '\\$1' );
                        }
                    
                    
                    Severity: Minor
                    Found in modules/ve-mw/preinit/ve.utils.parsoid.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 generateContents has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                    ve.ce.MWExtensionNode.prototype.generateContents = function ( config ) {
                        const deferred = ve.createDeferred(),
                            mwData = ve.copy( this.getModel().getAttribute( 'mw' ) ),
                            extsrc = config && config.extsrc !== undefined ? config.extsrc : ( ve.getProp( mwData, 'body', 'extsrc' ) || '' ),
                            attrs = config && config.attrs || mwData.attrs,
                    Severity: Minor
                    Found in modules/ve-mw/ce/nodes/ve.ce.MWExtensionNode.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 updateHistoryState has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    ve.init.mw.DesktopArticleTarget.prototype.updateHistoryState = function () {
                        const veaction = this.getDefaultMode() === 'visual' ? 'edit' : 'editsource',
                            section = this.section;
                    
                        // Push veaction=edit(source) url in history (if not already present).
                    Severity: Minor
                    Found in modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language