Showing 436 of 912 total issues
Function onEditTabClick
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
onEditTabClick: function ( mode, e ) {
if ( !init.isUnmodifiedLeftClick( e ) ) {
return;
}
if ( !active && mode === 'source' && !init.isWikitextAvailable ) {
Function syncScalableToType
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.dm.MWImageNode.static.syncScalableToType = function ( type, mediaType, scalable ) {
const defaultThumbSize = mw.config.get( 'wgVisualEditorConfig' )
.thumbLimits[ mw.user.options.get( 'thumbsize' ) ];
const originalDimensions = scalable.getOriginalDimensions();
Function onLoadLanguageData
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.ui.MWLanguagesPage.prototype.onLoadLanguageData = function ( languages ) {
const $languagesTable = $( '<table>' ),
languageslength = languages.length;
$languagesTable
Function setupEditLinks
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
setupEditLinks: function () {
// NWE
if ( init.isWikitextAvailable && !isOnlyTabVE() ) {
$(
// Edit section links, except VE ones when both editors visible
Method saveWikitext
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function saveWikitext( Title $title, $wikitext, $params ) {
$apiParams = [
'action' => 'edit',
'title' => $title->getPrefixedDBkey(),
'text' => $wikitext,
Function setActive
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.ui.MWHelpListToolGroup.prototype.setActive = function () {
// Parent method
ve.ui.MWHelpListToolGroup.super.prototype.setActive.apply( this, arguments );
if ( this.active && !this.versionPromise ) {
Function loadSuccess
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.init.mw.ArticleTarget.prototype.loadSuccess = function ( response ) {
const data = response ? ( response.visualeditor || response.visualeditoredit ) : null;
if ( !data || typeof data.content !== 'string' ) {
this.loadFail( 've-api', { errors: [ {
Function getSetupProcess
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.ui.MWMetaDialog.prototype.getSetupProcess = function ( data ) {
data = data || {};
return ve.ui.MWMetaDialog.super.prototype.getSetupProcess.call( this, data )
.next( () => {
const surfaceModel = this.getFragment().getSurface(),
Function onDocumentKeyDown
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.ui.MWTransclusionOutlineParameterSelectWidget.prototype.onDocumentKeyDown = function ( e ) {
let item;
switch ( e.keyCode ) {
case OO.ui.Keys.HOME:
Function fixFragmentLinks
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
mw.libs.ve.fixFragmentLinks = function ( container, docTitle, prefix ) {
const docTitleText = docTitle.getPrefixedText();
prefix = prefix || '';
Array.prototype.forEach.call( container.querySelectorAll( 'a[href*="#"]' ), ( el ) => {
let fragment = null;
Function getSaveFields
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
ve.init.mw.ArticleTarget.prototype.getSaveFields = function () {
const fields = {};
if ( this.section === 'new' ) {
// MediaWiki action=edit UI doesn't have separate parameters for edit summary and new section
- 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 parseDocument
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
ve.init.mw.Target.static.parseDocument = function ( documentString, mode, section, onlySection ) {
let doc;
if ( mode === 'source' ) {
// Parent method
doc = ve.init.mw.Target.super.static.parseDocument.call( this, documentString, 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 onWindowPopState
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
ve.init.mw.DesktopArticleTarget.prototype.onWindowPopState = function ( e ) {
if ( !this.verifyPopState( e.state ) ) {
// Ignore popstate events fired for states not created by us
// This also filters out the initial fire in Chrome (T59901).
return;
- 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 parseMetadata
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
ve.init.mw.ArticleTarget.prototype.parseMetadata = function ( response ) {
const data = response ? ( response.visualeditor || response.visualeditoredit ) : null;
if ( !data ) {
this.loadFail( 've-api', { errors: [ {
- 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 loadSuccess
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
ve.init.mw.ArticleTarget.prototype.loadSuccess = function ( response ) {
const data = response ? ( response.visualeditor || response.visualeditoredit ) : null;
if ( !data || typeof data.content !== 'string' ) {
this.loadFail( 've-api', { errors: [ {
- 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 getAllParametersOrdered
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
ve.dm.MWTemplateModel.prototype.getAllParametersOrdered = function () {
const spec = this.spec,
usedAliases = {};
let primaryName;
- 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 setTemplateData
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
ve.dm.MWTemplateSpecModel.prototype.setTemplateData = function ( data ) {
if ( !data || !ve.isPlainObject( data ) ) {
return;
}
- 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 insertOrUpdateNode
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
ve.ui.MWGalleryDialog.prototype.insertOrUpdateNode = function () {
const surfaceModel = this.getFragment().getSurface(),
surfaceModelDocument = surfaceModel.getDocument(),
items = this.galleryGroup.items,
data = [];
- 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 VeCeMWGalleryImageNode
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
ve.ce.MWGalleryImageNode = function VeCeMWGalleryImageNode( model ) {
// Parent constructor
ve.ce.MWGalleryImageNode.super.apply( this, arguments );
// DOM hierarchy for MWGalleryImageNode:
- 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 findAddedContent
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
mw.editcheck.AddReferenceEditCheck.prototype.findAddedContent = function ( documentModel, includeReferencedContent ) {
// Broken out so a helper for tagging can call it
const ranges = this.getModifiedContentRanges( documentModel ).filter( ( range ) => {
if ( !includeReferencedContent ) {
// 4. Exclude any ranges that already contain references
- 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"