Showing 166 of 183 total issues
Method domParseMobile
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function domParseMobile( OutputPage $out, $html = '' ) {
$services = MediaWikiServices::getInstance();
/** @var FeaturesManager $featuresManager */
$featuresManager = $services->getService( 'MobileFrontend.FeaturesManager' );
/** @var MobileContext $context */
Function editorLoadingOverlay
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function editorLoadingOverlay( afterShow, afterHide, loadBasicEditor ) {
let timeout;
const
$fakeToolbar = fakeToolbar(),
$loadBasicWrapper = $( '<div>' ).addClass( 've-loadbasiceditor' ),
Method detectMobileDevice
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function detectMobileDevice( $userAgent ) {
$patterns = [
'mobi',
'240x240',
'240x320',
Function postRender
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
postRender: function () {
let
$img;
const
$el = this.$el,
Function template
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
get template() {
return util.template( `
<div class="block-message block-message-container">
<div class="block-message-icon"></div>
<div class="block-message-info">
Function getStructuredLanguages
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
getStructuredLanguages: function (
languages,
variants,
frequentlyUsedLanguages,
showSuggestedLanguages,
Function getContent
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
getContent: function () {
let options;
const self = this;
Method executeViewEditWatchlist
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function executeViewEditWatchlist() {
$ns = NS_MAIN;
$images = [];
$watchlist = $this->getWatchlistInfo();
Function parseBlockInfo
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function parseBlockInfo( blockinfo ) {
const blockInfo = {
partial: blockinfo.blockpartial || false,
noCreateAccount: blockinfo.blocknocreate || false,
anonOnly: blockinfo.blockanononly === undefined ? true : blockinfo.blockanononly,
Function amcOutreachDrawer
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function amcOutreachDrawer(
action,
promoCampaign,
mwMessage,
mwUtil,
Method submitSettingsForm
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function submitSettingsForm() {
$request = $this->getRequest();
$user = $this->getUser();
if ( $user->isRegistered() && !$user->matchEditToken( $request->getVal( 'token' ) ) ) {
Method doRewriteImagesForLazyLoading
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function doRewriteImagesForLazyLoading( $el, ?DOMDocument $doc ) {
if ( $doc === null ) {
return;
}
$lazyLoadSkipSmallImages = $this->skipSmall;
Function referenceDrawer
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
function referenceDrawer( props ) {
const errorIcon = props.error ? new IconButton( {
name: 'error',
isSmall: true
} ).$el : null;
Function createAnonWarning
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
createAnonWarning: function ( options ) {
const $actions = $( '<div>' ).addClass( 'actions' ),
// Use MediaWiki ResourceLoader require(), not Webpack require()
contLangMessages = (
Function onBeforePageDisplay
has a Cognitive Complexity of 15 (exceeds 5 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' );
- 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 findChildInSectionLead
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
findChildInSectionLead( sectionIndex, selector ) {
let $heading, $nextHeading;
const headingSelector = HEADING_SELECTOR;
- 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 getTopHeadings
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
private function getTopHeadings( DOMElement $doc ): array {
$headings = [];
foreach ( $this->topHeadingTags as $tagName ) {
$allTags = DOMCompat::querySelectorAll( $doc, $tagName );
- 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 _switchToVisualEditor
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
_switchToVisualEditor: function ( wikitext ) {
const self = this;
this.log( {
action: 'abort',
type: 'switchnochange',
Function getPreview
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
getPreview: function ( options ) {
let
sectionLine = '',
sectionId = '';
Function defaults
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
get defaults() {
return {
createDetailsAnchorHref: function () {
return function ( blockId, render ) {
return mw.util.getUrl( 'Special:BlockList', { wpTarget: '#' + render( blockId ) } );