Showing 436 of 912 total issues
Function replacePageContent
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
html, categoriesHtml, displayTitle, lastModified, contentSub, sections
Function switchPanels
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
ve.ui.MWMediaDialog.prototype.switchPanels = function ( panel, noFocus ) {
switch ( panel ) {
case 'edit':
this.setSize( this.constructor.static.size );
// Set the edit panel
- 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 addPages
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
ve.ui.MWTwoPaneTransclusionDialogLayout.prototype.addPages = function ( pages, index ) {
const stackLayoutPages = this.stackLayout.getItems();
// Remove pages with same names
const remove = [];
- 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 saveComplete
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
ve.init.mw.ArticleTarget.prototype.saveComplete = function ( data ) {
this.editSummaryValue = null;
this.initialEditSummary = null;
this.saveDeferred.resolve();
- 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 onToggleUnusedFields
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
ve.ui.MWTransclusionOutlineTemplateWidget.prototype.onToggleUnusedFields = function ( visibility, fromClick ) {
if ( visibility ) {
this.createAllParameterCheckboxes();
}
- 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 getRange
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
ve.ui.MWAceEditorWidget.prototype.getRange = function () {
let lines;
function posToOffset( row, col ) {
let offset = 0;
- 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 onRequestImagesSuccess
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
ve.ui.MWGalleryDialog.prototype.onRequestImagesSuccess = function ( response ) {
const thumbUrls = {},
items = [],
config = { isMobile: this.isMobile, draggable: !this.isReadOnly() };
- 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 getActionProcess
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
ve.ui.MWExtensionWindow.prototype.getActionProcess = function ( action, process ) {
return process.first( () => {
if ( action === 'done' ) {
if ( this.constructor.static.allowedEmpty || this.input.getValue() !== '' ) {
this.insertOrUpdateNode();
- 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 transformWikitext
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
PageIdentity $page,
Bcp47Code $targetLanguage,
string $wikitext,
bool $bodyOnly,
?int $oldid,
Method onSkinEditSectionLinks
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public function onSkinEditSectionLinks( $skin, $title, $section,
$tooltip, &$result, $lang
Avoid deeply nested control flow statements. Open
if ( typeof change === 'string' ) {
listItem.appendChild( document.createTextNode( change ) );
} else {
change.forEach( ( node ) => {
listItem.appendChild( node );
Function onBeforePageDisplay
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function onBeforePageDisplay( $output, $skin ): void {
$services = MediaWikiServices::getInstance();
$hookRunner = new VisualEditorHookRunner( $services->getHookContainer() );
if ( !$hookRunner->onVisualEditorBeforeEditor( $output, $skin ) ) {
$output->addJsConfigVars( 'wgVisualEditorDisabledByHook', true );
- 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 onCustomEditor
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function onCustomEditor( $article, $user ) {
$req = $article->getContext()->getRequest();
$services = MediaWikiServices::getInstance();
$urlUtils = $services->getUrlUtils();
$veConfig = $services->getConfigFactory()->makeConfig( 'visualeditor' );
- 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
Avoid deeply nested control flow statements. Open
if ( data && data.action === 'prefer-ve' ) {
location.href = veEditUrl;
} else if ( data && data.action === 'multi-tab' ) {
location.reload();
}
Method onBeforeInitialize
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
$title, $article, $output, $user, $request, $mediaWiki
Avoid deeply nested control flow statements. Open
if ( !paramChanges ) {
paramChanges = document.createElement( 'ul' );
descriptions.push( paramChanges );
}
Function VeCeMWInlineImageNode
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
ve.ce.MWInlineImageNode = function VeCeMWInlineImageNode( model, config ) {
let $image;
let hasHref = false;
if ( model.getAttribute( 'isError' ) ) {
- 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 matchLanguage
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
ve.dm.MWLanguageVariantNode.static.matchLanguage = function ( items ) {
const userVariant = mw.config.get( 'wgUserVariant' ),
fallbacks = mw.config.get( 'wgVisualEditor' ).pageVariantFallbacks,
languageCodes =
( userVariant ? [ userVariant ] : [] ).concat( fallbacks || [] );
- 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
Avoid deeply nested control flow statements. Open
if ( confirmed ) {
return dataPromise;
} else {
// If they requested the latest version, invalidate the autosave state
mw.storage.session.remove( 've-docstate' );
Function register
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
mw.editcheck.EditCheckFactory.prototype.register = function ( constructor, name ) {
name = name || ( constructor.static && constructor.static.name );
if ( typeof name !== 'string' || name === '' ) {
throw new Error( 'Check names must be strings and must not be empty' );
- 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"