Showing 166 of 183 total issues
Method getLineHtml
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getLineHtml( MobilePage $mp ) {
$thumb = $mp->getSmallThumbnailHtml( true );
$title = $mp->getTitle();
if ( !$thumb ) {
$thumb = Html::rawElement( 'div', [
Function Drawer
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
function Drawer( props ) {
this.drawerClassName = props.className || '';
this.collapseIcon = new IconButton( {
icon: 'expand',
additionalClassNames: 'cancel',
Function postRender
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
postRender() {
const self = this,
searchResults = new SearchResultsView( {
searchContentLabel: mw.msg( 'mobile-frontend-search-content' ),
noResultsMsg: mw.msg( 'mobile-frontend-search-no-results' ),
Function switchToSourceEditor
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
switchToSourceEditor: function ( dataPromise ) {
const self = this,
SourceEditorOverlay = this.SourceEditorOverlay,
options = this.getOptionsForSwitch();
this.log( {
Function findChildInSectionLead
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
findChildInSectionLead( sectionIndex, selector ) {
let $heading, $nextHeading;
const headingSelector = HEADING_SELECTOR;
Function onSaveComplete
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
onSaveComplete: function ( newRevId, redirectUrl, tempUserCreated ) {
const
self = this;
this.saved = true;
Function SearchOverlay
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
function SearchOverlay( params ) {
const header = searchHeader(
params.placeholderMsg,
params.action || mw.config.get( 'wgScript' ),
( query ) => this.performSearch( query ),
Function onSaveBegin
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
onSaveBegin: function () {
const self = this,
options = {
summary: this.getEditSummary()
};
Method onRequestContextCreateSkin
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function onRequestContextCreateSkin( $context, &$skin ) {
$mobileContext = $this->mobileContext;
$mobileContext->doToggling();
if ( !$mobileContext->shouldDisplayMobileView() ) {
Function exports
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
action,
promoCampaign,
mwMessage,
mwUtil,
toast,
Method getResourceLoaderMFConfigVars
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getResourceLoaderMFConfigVars() {
$vars = [];
$config = MediaWikiServices::getInstance()->getService( 'MobileFrontend.Config' );
$mfScriptPath = $config->get( 'MFScriptPath' );
$pageProps = $config->get( 'MFQueryPropModules' );
Function init
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function init( $container ) {
// T360781 - since this is invoked via hook, the value of $container is not guaranteed.
// If undefined, return early since no further work can be done on $container.
if ( !( $container[ 0 ] instanceof HTMLElement ) ) {
Function getStructuredLanguages
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
getStructuredLanguages: function (
languages,
variants,
frequentlyUsedLanguages,
showSuggestedLanguages,
- 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 onEditLinkClick
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function onEditLinkClick( elem, ev, router ) {
let section;
if ( $( EDITSECTION_SELECTOR ).length === 0 ) {
// If section edit links are not available, the only edit link
// should allow editing the whole page (T232170)
- 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 scrollToLeadParagraph
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
scrollToLeadParagraph: function () {
let editLead, editLeadView, readLead, offset, initialCursorOffset;
const
currentPageHTMLParser = this.options.currentPageHTMLParser,
- 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 domParseMobile
has a Cognitive Complexity of 10 (exceeds 5 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 */
- 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 delegateEvents
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
delegateEvents( events ) {
let match, key, method;
events = events || this.options.events;
if ( events ) {
// Remove current events before re-binding them
- 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 parseBlockInfo
has a Cognitive Complexity of 10 (exceeds 5 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,
- 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 submitSettingsForm
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private function submitSettingsForm() {
$request = $this->getRequest();
$user = $this->getUser();
if ( $user->isRegistered() && !$user->matchEditToken( $request->getVal( 'token' ) ) ) {
- 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 getUserPageContent
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected static function getUserPageContent( IContextSource $output,
User $pageUser, Title $title
) {
/** @var MobileContext $context */
$context = MediaWikiServices::getInstance()->getService( 'MobileFrontend.Context' );