wikimedia/mediawiki-extensions-MobileFrontend

View on GitHub

Showing 183 of 183 total issues

File MobileFrontendHooks.php has 697 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

// phpcs:disable MediaWiki.NamingConventions.LowerCamelFunctionsName.FunctionName

use MediaWiki\Actions\ActionEntryPoint;
Severity: Major
Found in includes/MobileFrontendHooks.php - About 1 day to fix

    Function setupEditor has 226 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function setupEditor( page, skin, currentPageHTMLParser, router ) {
        const
            overlayManager = OverlayManager.getSingleton(),
            isNewPage = page.id === 0;
    
    
    Severity: Major
    Found in src/mobile.init/editor.js - About 1 day to fix

      File EditorOverlayBase.js has 467 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /* global $ */
      /**
       * @class EditorOverlayBase
       * @private
       */
      Severity: Minor
      Found in src/mobile.editor.overlay/EditorOverlayBase.js - About 7 hrs to fix

        File MobileContext.php has 436 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        
        use MediaWiki\Config\Config;
        use MediaWiki\Context\ContextSource;
        use MediaWiki\Context\IContextSource;
        Severity: Minor
        Found in includes/MobileContext.php - About 6 hrs to fix

          MobileFrontendHooks has 44 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class MobileFrontendHooks implements
              APIQuerySiteInfoGeneralInfoHook,
              AuthChangeFormFieldsHook,
              RequestContextCreateSkinHook,
              BeforeDisplayNoArticleTextHook,
          Severity: Minor
          Found in includes/MobileFrontendHooks.php - About 6 hrs to fix

            MobileContext has 41 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class MobileContext extends ContextSource {
                public const MODE_BETA = 'beta';
                public const MODE_STABLE = 'stable';
                public const OPTIN_COOKIE_NAME = 'optin';
                public const STOP_MOBILE_REDIRECT_COOKIE_NAME = 'stopMobileRedirect';
            Severity: Minor
            Found in includes/MobileContext.php - About 5 hrs to fix

              File SourceEditorOverlay.js has 373 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              const EditorOverlayBase = require( './EditorOverlayBase' ),
                  util = require( '../mobile.startup/util' ),
                  icons = require( '../mobile.startup/icons' ),
                  Section = require( '../mobile.startup/Section' ),
                  saveFailureMessage = require( './saveFailureMessage' ),
              Severity: Minor
              Found in src/mobile.editor.overlay/SourceEditorOverlay.js - About 4 hrs to fix

                Method addSettingsForm has 119 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private function addSettingsForm() {
                        $out = $this->getOutput();
                        $user = $this->getUser();
                        $isTemp = $user->isTemp();
                
                
                Severity: Major
                Found in includes/specials/SpecialMobileOptions.php - About 4 hrs to fix

                  File editor.js has 357 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  /* global $ */
                  const M = require( '../mobile.startup/moduleLoaderSingleton' ),
                      util = require( '../mobile.startup/util' ),
                      editorLoadingOverlay = require( './editorLoadingOverlay' ),
                      OverlayManager = require( '../mobile.startup/OverlayManager' ),
                  Severity: Minor
                  Found in src/mobile.init/editor.js - About 4 hrs to fix

                    File SpecialMobileOptions.php has 341 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    <?php
                    
                    use MediaWiki\Config\Config;
                    use MediaWiki\Deferred\DeferredUpdates;
                    use MediaWiki\Html\Html;
                    Severity: Minor
                    Found in includes/specials/SpecialMobileOptions.php - About 4 hrs to fix

                      Method onBeforePageDisplay has 76 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function onBeforePageDisplay( $out, $skin ): void {
                              $context = $this->mobileContext;
                              $mfEnableXAnalyticsLogging = $this->config->get( 'MFEnableXAnalyticsLogging' );
                              $mfNoIndexPages = $this->config->get( 'MFNoindexPages' );
                              $isCanonicalLinkHandledByCore = $this->config->get( 'EnableCanonicalServerLink' );
                      Severity: Major
                      Found in includes/MobileFrontendHooks.php - About 3 hrs to fix

                        File MobileFrontend.alias.php has 292 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        <?php
                        /**
                         * Aliases for MobileFrontend extension
                         *
                         * @file
                        Severity: Minor
                        Found in MobileFrontend.alias.php - About 3 hrs to fix

                          `` has 26 functions (exceeds 20 allowed). Consider refactoring.
                          Open

                          mfExtend( EditorOverlayBase, Overlay, {
                              /**
                               * @memberof EditorOverlayBase
                               * @instance
                               * @mixes Overlay#defaults
                          Severity: Minor
                          Found in src/mobile.editor.overlay/EditorOverlayBase.js - About 3 hrs to fix

                            Function _enable has 73 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            Toggler.prototype._enable = function () {
                                const self = this;
                            
                                // FIXME This should use .find() instead of .children(), some extensions like Wikibase
                                // want to toggle other headlines than direct descendants of $container. (T95889)
                            Severity: Major
                            Found in src/mobile.startup/Toggler.js - About 2 hrs to fix

                              Function moveFirstParagraphBeforeInfobox has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  private function moveFirstParagraphBeforeInfobox( DOMElement $leadSection, ?DOMDocument $doc ) {
                                      if ( $doc === null ) {
                                          return;
                                      }
                                      $xPath = new DOMXPath( $doc );
                              Severity: Minor
                              Found in includes/Transforms/MoveLeadParagraphTransform.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 postRender has 72 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  postRender: function () {
                                      const self = this;
                              
                                      // log edit attempt
                                      this.log( { action: 'ready' } );
                              Severity: Major
                              Found in src/mobile.editor.overlay/SourceEditorOverlay.js - About 2 hrs to fix

                                Function VisualEditorOverlay has 71 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                function VisualEditorOverlay( options ) {
                                    const surfaceReady = util.Deferred();
                                
                                    EditorOverlayBase.call( this,
                                        util.extend( {
                                Severity: Major
                                Found in src/mobile.editor.overlay/VisualEditorOverlay.js - About 2 hrs to fix

                                  Function initMobileOptions has 69 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  function initMobileOptions() {
                                      const $form = $( '#mobile-options' ),
                                          $betaToggle = $( '#enable-beta-toggle' ),
                                          $amcToggle = $( '#enable-amc-toggle' ),
                                          toggles = [];
                                  Severity: Major
                                  Found in src/mobile.special.mobileoptions.scripts.js - About 2 hrs to fix

                                    Function defaults has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                        get defaults() {
                                            return {
                                                createDetailsAnchorHref: function () {
                                                    return function ( blockId, render ) {
                                                        return mw.util.getUrl( 'Special:BlockList', { wpTarget: '#' + render( blockId ) } );
                                    Severity: Minor
                                    Found in src/mobile.editor.overlay/BlockMessageDetails.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 performSearch has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                        performSearch( query ) {
                                            const
                                                self = this,
                                                api = this.api,
                                                delay = this.gateway.isCached( query ) ? 0 : SEARCH_DELAY;
                                    Severity: Minor
                                    Found in src/mobile.startup/search/SearchOverlay.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

                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language