Showing 166 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;
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;
File EditorOverlayBase.js
has 467 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* global $ */
/**
* @class EditorOverlayBase
* @private
*/
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;
MobileFrontendHooks
has 44 functions (exceeds 20 allowed). Consider refactoring. Open
class MobileFrontendHooks implements
APIQuerySiteInfoGeneralInfoHook,
AuthChangeFormFieldsHook,
RequestContextCreateSkinHook,
BeforeDisplayNoArticleTextHook,
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';
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' ),
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();
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' ),
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;
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' );
File MobileFrontend.alias.php
has 292 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Aliases for MobileFrontend extension
*
* @file
`` has 26 functions (exceeds 20 allowed). Consider refactoring. Open
mfExtend( EditorOverlayBase, Overlay, {
/**
* @memberof EditorOverlayBase
* @instance
* @mixes Overlay#defaults
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)
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 );
- Read upRead up
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' } );
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( {
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 = [];
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 ) } );
- Read upRead up
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;
- Read upRead up
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"