Showing 436 of 912 total issues
Function activateTarget
has 83 lines of code (exceeds 25 allowed). Consider refactoring. Open
function activateTarget( mode, section, tPromise, modified ) {
let dataPromise;
updateTabs( true, mode, section === 'new' );
Function toDataElement
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
ve.dm.MWBlockImageNode.static.toDataElement = function ( domElements, converter ) {
const figure = domElements[ 0 ];
const img = figure.querySelector( '.mw-file-element' ); // <img>, <video>, <audio>, or <span> if mw:Error
// Images copied from the old parser output can have typeof=mw:Image but no resource information. T337438
if ( !img || !img.hasAttribute( 'resource' ) ) {
- 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 createValueInput
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
ve.ui.MWParameterPage.prototype.createValueInput = function () {
const type = this.parameter.getType(),
value = this.parameter.getValue(),
valueInputConfig = this.getDefaultInputConfig();
- 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 onSkinEditSectionLinks
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function onSkinEditSectionLinks( $skin, $title, $section,
$tooltip, &$result, $lang
) {
$services = MediaWikiServices::getInstance();
$userOptionsLookup = $services->getUserOptionsLookup();
Method execute
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function execute( $subPage ) {
$this->setHeaders();
$this->checkPermissions();
$output = $this->getOutput();
Function createScreenshotEnvironment
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
function createScreenshotEnvironment( test ) {
let clientSize, driver;
test.beforeEach( function () {
const lang = this.currentTest.parent.lang || 'en';
Function teardown
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.ui.MWAdvancedSettingsPage.prototype.teardown = function ( data ) {
// Data initialization
data = data || {};
if ( data.action !== 'done' ) {
return;
Function restorePage
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
ve.init.mw.DesktopArticleTarget.prototype.restorePage = function () {
// Restore any previous redirectMsg/redirectsub
this.setRealRedirectInterface();
if ( this.$originalCategories ) {
$( '#catlinks' ).replaceWith( this.$originalCategories );
- 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 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.dm.MWBlockImageNode.static.toDataElement = function ( domElements, converter ) {
const figure = domElements[ 0 ];
const img = figure.querySelector( '.mw-file-element' ); // <img>, <video>, <audio>, or <span> if mw:Error
// Images copied from the old parser output can have typeof=mw:Image but no resource information. T337438
if ( !img || !img.hasAttribute( 'resource' ) ) {
Function toDataElement
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.dm.MWInlineImageNode.static.toDataElement = function ( domElements, converter ) {
const container = domElements[ 0 ]; // <span>
if ( !container.children.length ) {
// Malformed image, alienate (T267282)
return null;
Method getAllowedParams
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getAllowedParams() {
return [
'paction' => [
ParamValidator::PARAM_REQUIRED => true,
ParamValidator::PARAM_TYPE => [
Function VeUiMWTemplatePage
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.ui.MWTemplatePage = function VeUiMWTemplatePage( template, name, config ) {
const link = template.getTemplateDataQueryTitle();
// Configuration initialization
config = ve.extendObject( {
Function addExactMatch
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.ui.MWTemplateTitleInputWidget.prototype.addExactMatch = function ( response ) {
const query = this.getQueryValue(),
title = mw.Title.newFromText( query, this.namespace );
// No point in trying anything when the title is invalid
if ( !title ) {
Function getVisualDiffGeneratorPromise
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
ve.init.mw.ArticleTarget.prototype.getVisualDiffGeneratorPromise = function () {
return mw.loader.using( 'ext.visualEditor.diffLoader' ).then( () => {
const mode = this.getSurface().getMode();
if ( !this.originalDmDocPromise ) {
- 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 exports
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function () {
const veDone = arguments[ arguments.length - 1 ];
window.seleniumUtils = {
getBoundingRect: function ( elements ) {
- 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 getActionProcess
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.ui.MWMediaDialog.prototype.getActionProcess = function ( action ) {
let handler;
switch ( action ) {
case 'change':
File ve.ui.MWTransclusionOutlineTemplateWidget.js
has 280 lines of code (exceeds 250 allowed). Consider refactoring. Open
/**
* Container for a template as rendered in the template dialog sidebar.
* Contains search and visibility inputs, and a list of parameters when available.
*
* @class
Function getLookupRequest
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.ui.MWTemplateTitleInputWidget.prototype.getLookupRequest = function () {
let promise = ve.ui.MWTemplateTitleInputWidget.super.prototype.getLookupRequest.call( this );
if ( mw.config.get( 'wgVisualEditorConfig' ).cirrusSearchLookup ) {
promise = promise
.then( this.addExactMatch.bind( this ) )
Function saveComplete
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.init.mw.ArticleTarget.prototype.saveComplete = function ( data ) {
this.editSummaryValue = null;
this.initialEditSummary = null;
this.saveDeferred.resolve();
Function createValueInput
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.ui.MWParameterPage.prototype.createValueInput = function () {
const type = this.parameter.getType(),
value = this.parameter.getValue(),
valueInputConfig = this.getDefaultInputConfig();