Showing 436 of 912 total issues
Function exports
has 152 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function ( grunt ) {
const conf = grunt.file.readJSON( 'extension.json' ),
screenshotOptions = {
reporter: 'spec',
// TODO: Work out how to catch this timeout and continue.
Method onSkinTemplateNavigation__Universal
has 151 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function onSkinTemplateNavigation__Universal( $skin, &$links ): void {
$services = MediaWikiServices::getInstance();
$userOptionsLookup = $services->getUserOptionsLookup();
$config = $services->getConfigFactory()
->makeConfig( 'visualeditor' );
Function teardown
has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring. Open
ve.ui.MWAdvancedSettingsPage.prototype.teardown = function ( data ) {
// Data initialization
data = data || {};
if ( data.action !== 'done' ) {
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 initialize
has 135 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.ui.MWSaveDialog.prototype.initialize = function () {
const mwString = require( 'mediawiki.String' );
// Parent method
ve.ui.MWSaveDialog.super.prototype.initialize.call( this );
Function onReplacePart
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
ve.ui.MWTemplateDialog.prototype.onReplacePart = function ( removed, added ) {
const removePages = [];
if ( removed ) {
// Remove parameter pages of removed templates
- 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
File ve.ui.MWTransclusionDialog.js
has 383 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*!
* VisualEditor user interface MWTransclusionDialog class.
*
* @copyright See AUTHORS.txt
* @license The MIT License (MIT); see LICENSE.txt
Function teardown
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
ve.ui.MWSettingsPage.prototype.teardown = function ( data ) {
// Data initialisation
data = data || {};
if ( data.action !== 'done' ) {
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 showPage
has 127 lines of code (exceeds 25 allowed). Consider refactoring. Open
function showPage( title, importTitle ) {
const specialTitle = mw.Title.newFromText( 'Special:CollabPad/' + title.toString() );
setTitle( mw.msg( 'collabpad-doctitle', title.getPrefixedText() ) );
Method execute
has 126 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function execute() {
$user = $this->getUser();
$params = $this->extractRequestParams();
$result = [];
File ve.init.mw.Target.js
has 371 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*!
* VisualEditor MediaWiki Initialization Target class.
*
* @copyright See AUTHORS.txt
* @license The MIT License (MIT); see LICENSE.txt
Function insertOrUpdateNode
has 115 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.ui.MWGalleryDialog.prototype.insertOrUpdateNode = function () {
const surfaceModel = this.getFragment().getSurface(),
surfaceModelDocument = surfaceModel.getDocument(),
items = this.galleryGroup.items,
data = [];
Function VeUiMWSettingsPage
has 114 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.ui.MWSettingsPage = function VeUiMWSettingsPage( name, config ) {
// Parent constructor
ve.ui.MWSettingsPage.super.apply( this, arguments );
// Properties
Function toDomElements
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
ve.dm.MWBlockImageNode.static.toDomElements = function ( data, doc, converter ) {
const dataElement = data[ 0 ],
attributes = dataElement.attributes,
figure = doc.createElement( 'figure' ),
imgWrapper = doc.createElement( attributes.href ? 'a' : 'span' ),
- 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 30 (exceeds 5 allowed). Consider refactoring. Open
ve.dm.MWImageNode.static.describeChanges = function ( attributeChanges, attributes ) {
const customKeys = [ 'width', 'height', 'defaultSize', 'src', 'href' ],
descriptions = [];
function describeSize( width, height ) {
- 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 110 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.ui.MWLanguageVariantNodeContextItem.prototype.renderBody = function () {
const $body = this.$body,
$table = $( '<table>' ),
$header = $( '<tr>' ),
variantInfo = this.model.getVariantInfo(),
File ve.init.mw.ArticleTargetLoader.js
has 346 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*!
* VisualEditor MediaWiki ArticleTargetLoader.
*
* @copyright See AUTHORS.txt
* @license The MIT License (MIT); see LICENSE.txt
Function describeChanges
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
ve.dm.MWTransclusionNode.static.describeChanges = function ( attributeChanges ) {
const descriptions = [ ve.msg( 'visualeditor-changedesc-mwtransclusion' ) ];
// This method assumes that the behavior of isDiffComparable above remains
// the same, so it doesn't have to consider whether the actual template
- 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 28 (exceeds 5 allowed). Consider refactoring. Open
ve.dm.MWGalleryImageNode.static.toDataElement = function ( domElements, converter ) {
// TODO: Improve handling of missing files. See 'isError' in MWBlockImageNode#toDataElement
const li = domElements[ 0 ];
const img = li.querySelector( '.mw-file-element' );
const imgWrapper = img.parentNode;
- 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 101 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.ui.MWGalleryDialog.prototype.getSetupProcess = function ( data ) {
return ve.ui.MWGalleryDialog.super.prototype.getSetupProcess.call( this, data )
.next( () => {
const namespaceIds = mw.config.get( 'wgNamespaceIds' ),
mwData = this.selectedNode && this.selectedNode.getAttribute( 'mw' ),
Hooks
has 32 functions (exceeds 20 allowed). Consider refactoring. Open
class Hooks implements
TextSlotDiffRendererTablePrefixHook,
BeforeInitializeHook,
BeforePageDisplayHook,
ChangeTagsListActiveHook,