Showing 436 of 912 total issues
Avoid too many return
statements within this function. Open
return '';
Avoid too many return
statements within this function. Open
return null;
Avoid too many return
statements within this method. Open
return;
Avoid too many return
statements within this function. Open
return 'unknown'; // should never happen
Avoid too many return
statements within this function. Open
return variantInfo.oneway[ languageIndex ].t;
Function setDefaultMode
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
ve.init.mw.ArticleTarget.prototype.setDefaultMode = function () {
const oldDefaultMode = this.defaultMode;
// Parent method
ve.init.mw.ArticleTarget.super.prototype.setDefaultMode.apply( this, arguments );
- 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 initialize
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
ve.ui.MWMediaDialog.prototype.initialize = function () {
// Parent method
ve.ui.MWMediaDialog.super.prototype.initialize.call( this );
// Main layout
- 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 maybeShowMetaDialog
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
ve.init.mw.DesktopArticleTarget.prototype.maybeShowMetaDialog = function () {
if ( this.welcomeDialogPromise ) {
// Pop out the notices when the welcome dialog is closed
this.welcomeDialogPromise
.always( () => {
- 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 switchToWikitextEditor
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
ve.init.mw.ArticleTarget.prototype.switchToWikitextEditor = function ( modified ) {
// When switching with changes we always pass the full page as changes in visual section mode
// can still affect the whole document (e.g. removing a reference)
if ( modified ) {
this.section = null;
- 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 onPositionCheckboxChange
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
ve.ui.MWMediaDialog.prototype.onPositionCheckboxChange = function ( isSelected ) {
const currentModelAlignment = this.imageModel.getAlignment();
this.positionSelect.setDisabled( !isSelected );
this.checkChanged();
- 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 onSaveDialogReview
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
ve.init.mw.ArticleTarget.prototype.onSaveDialogReview = function () {
if ( !this.saveDialog.hasDiff ) {
this.emit( 'saveReview' );
this.saveDialog.pushPending();
// Acquire a temporary user username before diffing, so that signatures and
- 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 getSectionHashFromPage
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
ve.init.mw.ArticleTarget.prototype.getSectionHashFromPage = function () {
// Assume there are section edit links, as the user just did a section edit. This also means
// that the section numbers line up correctly, as not every H_ tag is a numbered section.
const $sections = this.$editableContent.find( '.mw-editsection' );
- 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 refreshControls
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
ve.ui.MWTwoPaneTransclusionDialogLayout.prototype.refreshControls = function () {
const partId = this.getSelectedTopLevelPartId(),
canBeDeleted = !!partId;
let canMoveUp, canMoveDown = 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 resetCaption
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
ve.ui.MWMediaDialog.prototype.resetCaption = function () {
const doc = this.getFragment().getDocument();
// Get existing caption. We only do this in setup, because the caption
// should not reset to original if the image is replaced or edited.
- 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 afterActivate
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
ve.init.mw.DesktopArticleTarget.prototype.afterActivate = function () {
$( 'html' ).removeClass( 've-activating' ).addClass( 've-active' );
// Disable TemplateStyles in the original content
// (We do this here because toggling 've-active' class above hides it)
- 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 setupSkinTabs
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
ve.init.mw.DesktopArticleTarget.prototype.setupSkinTabs = function () {
if ( this.isViewPage ) {
const namespaceNumber = mw.config.get( 'wgNamespaceNumber' );
const namespaceName = mw.config.get( 'wgCanonicalNamespace' );
const isTalkNamespace = mw.Title.isTalkNamespace( namespaceNumber );
- 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 getSetupProcess
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
ve.ui.MWAlienExtensionInspector.prototype.getSetupProcess = function ( data ) {
return ve.ui.MWAlienExtensionInspector.super.prototype.getSetupProcess.call( this, data )
.next( () => {
const attributes = this.selectedNode.getAttribute( 'mw' ).attrs;
- 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 renderBody
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
ve.ui.MWLanguageVariantNodeContextItem.prototype.renderBody = function () {
const $body = this.$body,
$table = $( '<table>' ),
$header = $( '<tr>' ),
variantInfo = this.model.getVariantInfo(),
- 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 updateSize
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
ve.ui.MWExpandableContentElement.prototype.updateSize = function () {
this.toggle( true );
if ( Math.floor( this.calculateCurrentTextHeight() / this.getLineHeight() ) > 3 ) {
if ( !this.$container ) {
- 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 toDomElements
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
ve.dm.MWCategoryMetaItem.static.toDomElements = function ( dataElement, doc, converter ) {
let domElement;
const category = dataElement.attributes.category || '';
if ( converter.isForPreview() ) {
domElement = doc.createElement( 'a' );
- 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"