Showing 436 of 912 total issues
Function toggleWrapSelection
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.ui.MWWikitextAction.prototype.toggleWrapSelection = function ( before, after, placeholder, expandOffsetsCallback, unwrapOffsetsCallback ) {
const originalFragment = this.surface.getModel().getFragment( null, false, true /* excludeInsertions */ );
let fragment = originalFragment;
let textBefore, textAfter;
Function processChangeQueue
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.dm.MWTransclusionModel.prototype.processChangeQueue = function () {
const templateNamespaceId = mw.config.get( 'wgNamespaceIds' ).template,
titles = [];
if ( !this.changeQueue.length ) {
Function createImageNode
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.dm.MWImageModel.static.createImageNode = function ( attributes, imageType ) {
const defaultThumbSize = mw.config.get( 'wgVisualEditorConfig' )
.thumbLimits[ mw.user.options.get( 'thumbsize' ) ];
const attrs = ve.extendObject( {
Function showPreview
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.ui.MWSaveDialog.prototype.showPreview = function ( response ) {
if ( response instanceof $ ) {
this.$previewViewer.empty().append(
// eslint-disable-next-line no-jquery/no-append-html
$( '<em>' ).append( response )
Function getValidationErrors
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.ui.MWAddParameterPage.prototype.getValidationErrors = function ( name ) {
if ( !name ) {
return [];
}
Function load
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.dm.MWTransclusionModel.prototype.load = function ( data ) {
const promises = [];
// Convert single part format to multi-part format
// Parsoid doesn't use this format any more, but we accept it for backwards compatibility
Function getSaveButtonLabel
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
ve.init.mw.ArticleTarget.prototype.getSaveButtonLabel = function ( startProcess, forceShort ) {
const suffix = startProcess ? '-start' : '';
if ( forceShort || OO.ui.isMobile() ) {
// The following messages can be used here:
- 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 addPartWidget
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
ve.ui.MWTransclusionOutlineWidget.prototype.addPartWidget = function ( part, newPosition, removed ) {
const keys = Object.keys( this.partWidgets ),
onlyPart = keys.length === 1 && this.partWidgets[ keys[ 0 ] ];
if ( onlyPart instanceof ve.ui.MWTransclusionOutlineTemplateWidget ) {
// To recalculate the height of the sticky header when we enter multi-part mode
- 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 toDataElement
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
ve.dm.MWExternalLinkAnnotation.static.toDataElement = function ( domElements, converter ) {
const domElement = domElements[ 0 ],
type = domElement.getAttribute( 'rel' ) || domElement.getAttribute( 'typeof' ) || domElement.getAttribute( 'property' ) || '',
types = type.trim().split( /\s+/ );
- 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 resetDefaultDimensions
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
ve.dm.MWImageModel.prototype.resetDefaultDimensions = function () {
const originalDimensions = this.scalable.getOriginalDimensions();
if ( !ve.isEmptyObject( originalDimensions ) ) {
if ( this.getType() === 'thumb' || this.getType() === 'frameless' ) {
- 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 describeChanges
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
ve.dm.MWExtensionNode.static.describeChanges = function ( attributeChanges, attributes, element ) {
const descriptions = [],
fromBody = attributeChanges.mw.from.body,
toBody = attributeChanges.mw.to.body;
- 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 setType
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
ve.dm.MWImageModel.prototype.setType = function ( type ) {
const isDefaultAligned = this.isDefaultAligned( this.imageCurrentType );
this.type = type;
- 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 matchFunction
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
ve.ui.MWWikitextStringTransferHandler.static.matchFunction = function ( item ) {
const text = item.getAsString(),
registry = ve.ui.mwWikitextTransferRegistry;
// If the mime type is explicitly wikitext (ie, not plain text),
- 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 onAttributeChange
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
ve.ce.MWBlockImageNode.prototype.onAttributeChange = function ( key, from, to ) {
// Mixin method
ve.ce.MWImageNode.prototype.onAttributeChange.apply( this, arguments );
if ( key === 'height' || key === 'width' ) {
- 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 onUpdate
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
ve.ce.MWGalleryNode.prototype.onUpdate = function () {
const mwAttrs = this.model.getAttribute( 'mw' ).attrs;
const defaults = mw.config.get( 'wgVisualEditorConfig' ).galleryOptions;
const mode = mwAttrs.mode || defaults.mode;
- 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 onVisualEditorApiVisualEditorEditPostSave
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
ProperPageIdentity $page,
UserIdentity $user,
string $wikitext,
array $params,
array $pluginData,
Method onVisualEditorApiVisualEditorEditPostSave
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
ProperPageIdentity $page,
UserIdentity $user,
string $wikitext,
array $params,
array $pluginData,
Function getCanonicalParam
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
ve.ui.MWDefinedTransclusionContextItem.prototype.getCanonicalParam = function ( name ) {
const params = this.tool.params || {};
if ( Object.prototype.hasOwnProperty.call( params, name ) ) {
const aliases = Array.isArray( params[ name ] ) ? params[ name ] : [ params[ name ] ];
- 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 ( reselect ) {
this.bookletLayout.focusPart( reselect );
}
Function getActionProcess
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
ve.ui.MWExtensionDialog.prototype.getActionProcess = function ( action ) {
if ( action === '' ) {
if ( this.hasMeaningfulEdits() ) {
// eslint-disable-next-line arrow-body-style
return new OO.ui.Process( () => {
- 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"