Showing 436 of 912 total issues
Function updateRedirectInterface
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.init.mw.ArticleTarget.prototype.updateRedirectInterface = function ( $sub, $msg ) {
// For the subtitle, replace the real one with ours.
// This is more complicated than it should be because we have to fiddle with the <br>.
const $currentSub = $( '#redirectsub' );
if ( $currentSub.length ) {
Function initialize
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.ui.MWLanguageVariantFilterInspector.prototype.initialize = function () {
ve.ui.MWLanguageVariantFilterInspector.super.prototype.initialize.call( this );
this.textTarget = this.createTextTarget( OO.ui.msg(
'visualeditor-mwlanguagevariantinspector-filter-text-placeholder'
) );
Function getActionProcess
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.ui.MWTransclusionDialog.prototype.getActionProcess = function ( action ) {
const willLoseProgress = this.getMode() === 'insert' ?
// A new template with no parameters is not considered valuable.
this.transclusionModel.containsValuableData() :
// The user has changed a parameter, and is not on the template search page.
Function VeUiMWTransclusionOutlinePartWidget
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.ui.MWTransclusionOutlinePartWidget = function VeUiMWTransclusionOutlinePartWidget( part, config ) {
this.part = part;
// Parent constructor
ve.ui.MWTransclusionOutlinePartWidget.super.call( this, ve.extendObject( config, {
Function VeUiMWCategoryWidget
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.ui.MWCategoryWidget = function VeUiMWCategoryWidget( config ) {
// Config initialization
config = config || {};
// Parent constructor
Function getUpdatedAttributes
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.dm.MWImageModel.prototype.getUpdatedAttributes = function () {
const origAttrs = this.getOriginalImageAttributes();
let currentDimensions;
// Adjust default dimensions if size is set to default
Function setEditorPreference
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
function setEditorPreference( editor ) {
// If visual mode isn't available, don't set the editor preference as the
// user has expressed no choice by opening this editor. (T246259)
// Strictly speaking the same thing should happen if visual mode is
// available but source mode isn't, but that is never the case.
Function getPreviewHtml
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.dm.MWLanguageVariantNode.static.getPreviewHtml = function ( variantInfo, opts ) {
if ( variantInfo.disabled ) {
return variantInfo.disabled.t;
} else if ( variantInfo.name ) {
return ve.init.platform.getLanguageName( variantInfo.name.t.toLowerCase() );
Function reduplicateStyles
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
mw.libs.ve.reduplicateStyles = function ( element ) {
Array.prototype.forEach.call( element.querySelectorAll( 'link[rel~="mw-deduplicated-inline-style"]' ), ( link ) => {
const href = link.getAttribute( 'href' );
if ( !href || href.slice( 0, 'mw-data:'.length ) !== 'mw-data:' ) {
return;
Function getSetupProcess
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
ve.ui.MWMediaDialog.prototype.getSetupProcess = function ( data ) {
return ve.ui.MWMediaDialog.super.prototype.getSetupProcess.call( this, data )
.next( () => {
const isReadOnly = 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 VeUiMWWikitextSurface
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
ve.ui.MWWikitextSurface = function VeUiMWWikitextSurface() {
// Parent constructor
ve.ui.MWWikitextSurface.super.apply( this, arguments );
// Initialization
- 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 teardown
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
ve.init.mw.DesktopArticleTarget.prototype.teardown = function ( trackMechanism ) {
// Event tracking
let abortType, abortedMode;
if ( trackMechanism ) {
if ( this.activating ) {
- 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 surfaceReady
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
ve.init.mw.ArticleTarget.prototype.surfaceReady = function () {
const accessKeyPrefix = $.fn.updateTooltipAccessKeys.getAccessKeyPrefix().replace( /-/g, '+' ),
accessKeyModifiers = new ve.ui.Trigger( accessKeyPrefix + '-' ).modifiers,
surfaceModel = this.getSurface().getModel();
- 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 insertImageNode
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
ve.dm.MWImageModel.prototype.insertImageNode = function ( fragment ) {
const nodeType = this.getImageNodeType(),
surfaceModel = fragment.getSurface();
if ( !( fragment.getSelection() instanceof ve.dm.LinearSelection ) ) {
- 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 changeImageSource
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
ve.dm.MWImageModel.prototype.changeImageSource = function ( attrs, APIinfo ) {
this.changedImageSource = true;
if ( attrs.mediaType ) {
this.setMediaType( attrs.mediaType );
- 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 getPartsList
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
ve.dm.MWTransclusionNode.prototype.getPartsList = function () {
if ( !this.partsList ) {
this.partsList = [];
const content = this.getAttribute( 'mw' );
for ( let i = 0; i < content.parts.length; i++ ) {
- 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 wrapLine
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.ui.MWWikitextAction.prototype.wrapLine = function ( before, after, placeholder, unwrapOffsetsCallback ) {
let originalFragment = this.surface.getModel().getFragment( null, false, true /* excludeInsertions */ );
const selectedNodes = originalFragment.getLeafNodes();
let unwrapped = false;
Function export
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.ui.MWExportWikitextDialog.prototype.export = function () {
const wikitext = this.wikitextLayout.textInput.getValue(),
title = this.titleInput.getMWTitle(),
importTitle = ve.init.target.getImportTitle();
Function switchPanels
has 31 lines of code (exceeds 25 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
Function getTeardownProcess
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.ui.MWGalleryDialog.prototype.getTeardownProcess = function ( data ) {
return ve.ui.MWGalleryDialog.super.prototype.getTeardownProcess.call( this, data )
.first( () => {
// Layouts
this.indexLayout.setTabPanel( 'images' );