Showing 166 of 183 total issues
Method isSupportedEditRequest
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected static function isSupportedEditRequest( IContextSource $context ) {
/** @var MobileContext $mobileContext */
$mobileContext = MediaWikiServices::getInstance()->getService( 'MobileFrontend.Context' );
if ( !$mobileContext->shouldDisplayMobileView() ) {
return false;
Function scrollToLeadParagraph
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
scrollToLeadParagraph: function () {
let editLead, editLeadView, readLead, offset, initialCursorOffset;
const
currentPageHTMLParser = this.options.currentPageHTMLParser,
Function getButtonConfig
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
getButtonConfig() {
let cta = true;
const config = {
progressive: true
},
Method identifyInfoboxElement
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function identifyInfoboxElement( DOMXPath $xPath, DOMElement $section ): ?DOMElement {
$paths = [
// Infoboxes: *.infobox
'.//*[contains(concat(" ",normalize-space(@class)," ")," infobox ")]',
// Thumbnail images: .thumb, figure (Parsoid)
Method onCustomEditor
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function onCustomEditor( $article, $user ) {
$req = $article->getContext()->getRequest();
$title = $article->getTitle();
if (
!$req->getVal( 'mfnoscript' ) &&
Function bindEditLinksLoginDrawer
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function bindEditLinksLoginDrawer( router ) {
let drawer;
function showLoginDrawer() {
if ( !drawer ) {
drawer = new CtaDrawer( {
Method shouldDisplayMobileViewInternal
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function shouldDisplayMobileViewInternal() {
// May be overridden programmatically
if ( $this->forceMobileView ) {
return true;
}
Function getLicenseMsg
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
getLicenseMsg() {
const $licenseLinks = this.getLicenseLinks();
let licenseMsg;
if ( $licenseLinks.length ) {
Method __construct
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
HookContainer $hookContainer,
Config $config,
SkinFactory $skinFactory,
UserOptionsLookup $userOptionsLookup,
WatchlistManager $watchlistManager,
Function exports
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function () {
const
currentPage = require( '../mobile.startup/currentPage' )(),
Toggler = require( '../mobile.startup/Toggler' ),
sectionCollapsing = require( '../mobile.startup/sectionCollapsing' ),
- 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 makeSections
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private function makeSections( DOMElement $body, array $headingWrappers ) {
$ownerDocument = $body->ownerDocument;
if ( $ownerDocument === null ) {
return;
}
- 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 executeViewEditWatchlist
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
protected function executeViewEditWatchlist() {
$ns = NS_MAIN;
$images = [];
$watchlist = $this->getWatchlistInfo();
- 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 showReference
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
showReference( id, page, refNumber, pageHTMLParser, gateway, props,
onShowNestedReference
Function init
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function init( currentPage, currentPageHTMLParser, skin, router ) {
let editErrorMessage, editRestrictions;
// see: https://www.mediawiki.org/wiki/Manual:Interface/JavaScript#Page-specific
const isReadOnly = mw.config.get( 'wgMinervaReadOnly' );
const isEditable = !isReadOnly && mw.config.get( 'wgIsProbablyEditable' );
- 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 initMobileOptions
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function initMobileOptions() {
const $form = $( '#mobile-options' ),
$betaToggle = $( '#enable-beta-toggle' ),
$amcToggle = $( '#enable-amc-toggle' ),
toggles = [];
- 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 parse
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function parse( resp ) {
let displayTitle;
const thumb = resp.thumbnail,
pageprops = resp.pageprops || {
displaytitle: mw.html.escape( resp.title )
- 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 getMobileUrl
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function getMobileUrl( $url, $forceHttps = false ) {
$urlUtils = MediaWikiServices::getInstance()->getUrlUtils();
$parsedUrl = $urlUtils->parse( $url );
// if parsing failed, maybe it's a local Url, try to expand and reparse it - task T107505
if ( !$parsedUrl ) {
- 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
Method onMediaWikiPerformAction
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public function onMediaWikiPerformAction( $output, $article, $title, $user,
$request, $entryPoint
Function isSupportedEditRequest
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected static function isSupportedEditRequest( IContextSource $context ) {
/** @var MobileContext $mobileContext */
$mobileContext = MediaWikiServices::getInstance()->getService( 'MobileFrontend.Context' );
if ( !$mobileContext->shouldDisplayMobileView() ) {
return false;
- 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 createPromoCampaign
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
onShow,
actions,
campaignName,
campaignActive,
userEligible,