Showing 436 of 912 total issues
Function toDomElements
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.dm.MWGalleryImageNode.static.toDomElements = function ( data, doc, converter ) {
// ImageNode:
// <li> li (gallerybox)
// <div> thumbDiv
// <span> container
Function renderCategories
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.init.mw.ArticleTarget.prototype.renderCategories = function ( categoryItems ) {
const promises = [],
categories = { hidden: {}, normal: {} };
categoryItems.forEach( ( categoryItem, index ) => {
const attributes = ve.copy( ve.getProp( categoryItem, 'element', 'attributes' ) );
Function showSaveDialog
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.init.mw.ArticleTarget.prototype.showSaveDialog = function ( action, checkboxName ) {
let firstLoad = false;
if ( !this.isSaveable() || this.saveDialogIsOpening ) {
return;
Function teardown
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.ui.MWSettingsPage.prototype.teardown = function ( data ) {
// Data initialisation
data = data || {};
if ( data.action !== 'done' ) {
return;
Function toDomElements
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.dm.MWTransclusionNode.static.toDomElements = function ( dataElement, doc, converter ) {
const store = converter.getStore(),
originalMw = dataElement.attributes.originalMw,
originalDomElements = store.value( dataElement.originalDomElementsHash );
Function toDomElements
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.dm.MWInlineImageNode.static.toDomElements = function ( dataElement, doc, converter ) {
const attributes = dataElement.attributes,
container = doc.createElement( 'span' ),
imgWrapper = doc.createElement( attributes.href ? 'a' : 'span' ),
img = doc.createElement( attributes.isError ? 'span' : attributes.mediaTag ),
Function restoreEditSection
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
ve.init.mw.ArticleTarget.prototype.restoreEditSection = function () {
const section = this.section !== null ? this.section : this.visibleSection;
const surface = this.getSurface();
const mode = surface.getMode();
- 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 buildMediaInfoPanel
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
ve.ui.MWMediaDialog.prototype.buildMediaInfoPanel = function ( imageinfo ) {
const contentDirection = this.getFragment().getDocument().getDir(),
imageTitleText = imageinfo.title || imageinfo.canonicaltitle,
imageTitle = new OO.ui.LabelWidget( {
label: mw.Title.newFromText( imageTitleText ).getNameText()
- 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 VeUiMWMediaInfoFieldWidget
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
ve.ui.MWMediaInfoFieldWidget = function VeUiMWMediaInfoFieldWidget( content, config ) {
// Configuration initialization
config = config || {};
// Parent constructor
- 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 19 (exceeds 5 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;
- 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 64 lines of code (exceeds 25 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' ),
File init.js
has 272 lines of code (exceeds 250 allowed). Consider refactoring. Open
mw.editcheck = {
config: require( './config.json' ),
ecenable: !!( new URL( location.href ).searchParams.get( 'ecenable' ) || window.MWVE_FORCE_EDIT_CHECK_ENABLED )
};
Function changeImageSource
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.dm.MWImageModel.prototype.changeImageSource = function ( attrs, APIinfo ) {
this.changedImageSource = true;
if ( attrs.mediaType ) {
this.setMediaType( attrs.mediaType );
Function VeCeMWGalleryImageNode
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.ce.MWGalleryImageNode = function VeCeMWGalleryImageNode( model ) {
// Parent constructor
ve.ce.MWGalleryImageNode.super.apply( this, arguments );
// DOM hierarchy for MWGalleryImageNode:
Function getTeardownProcess
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.ui.MWWikitextLinkAnnotationInspector.prototype.getTeardownProcess = function ( data ) {
data = data || {};
// Call grand-parent
return ve.ui.FragmentInspector.prototype.getTeardownProcess.call( this, data )
.first( () => {
Method onGetPreferences
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function onGetPreferences( $user, &$preferences ) {
$services = MediaWikiServices::getInstance();
$userOptionsLookup = $services->getUserOptionsLookup();
$veConfig = $services->getConfigFactory()->makeConfig( 'visualeditor' );
$isBeta = $veConfig->get( 'VisualEditorEnableBetaFeature' );
File ve.ui.MWSettingsPage.js
has 268 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*!
* VisualEditor user interface MWSettingsPage class.
*
* @copyright See AUTHORS.txt
* @license The MIT License (MIT); see LICENSE.txt
Function save
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
ve.init.mw.ArticleTarget.prototype.save = function ( doc, options ) {
// Prevent duplicate requests
if ( this.saving ) {
return this.saving;
}
- 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 teardown
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
ve.ui.MWCategoriesPage.prototype.teardown = function ( data ) {
const currentDefaultSortKeyItem = this.getDefaultSortKeyItem(),
newDefaultSortKey = this.defaultSortInput.getValue();
if ( data && data.action === 'done' ) {
- 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 teardown
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.init.mw.DesktopArticleTarget.prototype.teardown = function ( trackMechanism ) {
// Event tracking
let abortType, abortedMode;
if ( trackMechanism ) {
if ( this.activating ) {