Showing 436 of 912 total issues
File ve.dm.MWTransclusionModel.js
has 330 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*!
* VisualEditor DataModel MWTransclusionModel class.
*
* @copyright See AUTHORS.txt
* @license The MIT License (MIT); see LICENSE.txt
Function exports
has 97 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function () {
const veDone = arguments[ arguments.length - 1 ];
window.seleniumUtils = {
getBoundingRect: function ( elements ) {
Function VeUiMWAdvancedSettingsPage
has 97 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.ui.MWAdvancedSettingsPage = function VeUiMWAdvancedSettingsPage( name, config ) {
// Parent constructor
ve.ui.MWAdvancedSettingsPage.super.apply( this, arguments );
// Properties
exports
has 31 functions (exceeds 20 allowed). Consider refactoring. Open
module.exports = {
toolbar: function () {
const done = arguments[ arguments.length - 1 ];
// HACK: The test page is on the help namespace, so overwrite the
// read tab with the nstab-main message.
Function VeUiMWParameterPage
has 95 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.ui.MWParameterPage = function VeUiMWParameterPage( parameter, config ) {
const paramName = parameter.getName();
// Configuration initialization
config = ve.extendObject( {
File ve.ui.MWLinkAnnotationInspector.js
has 323 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*!
* VisualEditor UserInterface LinkAnnotationInspector class.
*
* @copyright See AUTHORS.txt
* @license The MIT License (MIT); see LICENSE.txt
Function processQueue
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
ve.init.mw.ApiResponseCache.prototype.processQueue = function () {
const rejectSubqueue = ( rejectQueue ) => {
for ( let i = 0, len = rejectQueue.length; i < len; i++ ) {
this.deferreds[ rejectQueue[ i ] ].reject();
}
- 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 26 (exceeds 5 allowed). Consider refactoring. Open
ve.dm.MWGalleryImageNode.static.toDomElements = function ( data, doc, converter ) {
// ImageNode:
// <li> li (gallerybox)
// <div> thumbDiv
// <span> 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 26 (exceeds 5 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 ),
- 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 saveFail
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
ve.init.mw.ArticleTarget.prototype.saveFail = function ( doc, saveData, code, data ) {
this.pageDeletedWarning = false;
let handled = false;
// Handle empty response
- 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 25 (exceeds 5 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' ),
- 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 postContent
has 88 lines of code (exceeds 25 allowed). Consider refactoring. Open
postContent: function ( data, options ) {
options = options || {};
const api = options.api || new mw.Api();
let start;
Function swapPanel
has 86 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.ui.MWSaveDialog.prototype.swapPanel = function ( panel, noFocus ) {
if ( ( [ 'save', 'review', 'preview', 'conflict' ].indexOf( panel ) ) === -1 ) {
throw new Error( 'Unknown saveDialog panel: ' + panel );
}
Function toDomElements
has a Cognitive Complexity of 24 (exceeds 5 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 );
- 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 escapeParameter
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
ve.dm.MWTransclusionNode.static.escapeParameter = function ( param ) {
let input = param,
output = '',
inNowiki = false,
bracketStack = 0,
- 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 getLookupMenuOptionsFromData
has 85 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.ui.MWCategoryInputWidget.prototype.getLookupMenuOptionsFromData = function ( data ) {
const itemWidgets = [],
existingCategoryItems = [],
matchingCategoryItems = [],
hiddenCategoryItems = [],
File ve.dm.MWTransclusionNode.js
has 307 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*!
* VisualEditor DataModel MWTransclusionNode class.
*
* @copyright See AUTHORS.txt
* @license The MIT License (MIT); see LICENSE.txt
File ve.ui.MWTemplateDialog.js
has 306 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*!
* VisualEditor user interface MWTemplateDialog class.
*
* @copyright See AUTHORS.txt
* @license The MIT License (MIT); see LICENSE.txt
Function getSetupProcess
has 83 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.ui.MWWikitextLinkAnnotationInspector.prototype.getSetupProcess = function ( data ) {
// Annotation inspector stages the annotation, so call its parent
// Call grand-parent
return ve.ui.AnnotationInspector.super.prototype.getSetupProcess.call( this, data )
.next( () => {
Function toDataElement
has 83 lines of code (exceeds 25 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;