wikimedia/mediawiki-extensions-MobileFrontend

View on GitHub

Showing 191 of 191 total issues

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

<?php

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

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

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

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

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

      <?php
      
      use MediaWiki\Config\Config;
      use MediaWiki\MediaWikiServices;
      use MobileFrontend\Devices\DeviceDetectorService;
      Severity: Major
      Found in includes/MobileContext.php - About 1 day to fix

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

        /* global $ */
        var Overlay = require( '../mobile.startup/Overlay' ),
            util = require( '../mobile.startup/util' ),
            parseBlockInfo = require( './parseBlockInfo' ),
            headers = require( '../mobile.startup/headers' ),
        Severity: Minor
        Found in src/mobile.editor.overlay/EditorOverlayBase.js - About 7 hrs to fix

          MobileContext has 46 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 6 hrs to fix

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

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

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

              var 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 116 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 356 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  /* global $ */
                  var 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 316 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

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

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

                          public function onBeforePageDisplay( $out, $skin ): void {
                              $context = MobileContext::singleton();
                              $services = MediaWikiServices::getInstance();
                              $config = $services->getService( 'MobileFrontend.Config' );
                              $mfEnableXAnalyticsLogging = $config->get( 'MFEnableXAnalyticsLogging' );
                      Severity: Major
                      Found in includes/MobileFrontendHooks.php - About 3 hrs to fix

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

                        function initMobileOptions() {
                            var $form = $( '#mobile-options' ),
                                $betaToggle = $( '#enable-beta-toggle' ),
                                $amcToggle = $( '#enable-amc-toggle' ),
                                toggles = [];
                        Severity: Major
                        Found in src/mobile.special.mobileoptions.scripts.js - 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 postRender has 73 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  postRender: function () {
                                      var 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 _enable has 73 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                Toggler.prototype._enable = function () {
                                    var 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 VisualEditorOverlay has 71 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  function VisualEditorOverlay( options ) {
                                      var surfaceReady = util.Deferred();
                                  
                                      EditorOverlayBase.call( this,
                                          util.extend( {
                                  Severity: Major
                                  Found in src/mobile.editor.overlay/VisualEditorOverlay.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 ) {
                                            var
                                                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