Showing 912 of 912 total issues
Function updateHistoryState
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
ve.init.mw.DesktopArticleTarget.prototype.updateHistoryState = function () {
const veaction = this.getDefaultMode() === 'visual' ? 'edit' : 'editsource',
section = this.section;
// Push veaction=edit(source) url in history (if not already present).
- 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 10 (exceeds 5 allowed). Consider refactoring. Open
ve.dm.MWNowikiAnnotation.static.toDomElements = function ( dataElement, doc, converter, childDomElements ) {
const originalDomElements = converter.getStore().value( dataElement.originalDomElementsHash ),
originalChildren = originalDomElements && originalDomElements[ 0 ] && originalDomElements[ 0 ].childNodes,
domElement = document.createElement( '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 setSelectionByPageName
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
ve.ui.MWTransclusionOutlineWidget.prototype.setSelectionByPageName = function ( pageName ) {
const selectedPartId = pageName ? pageName.split( '/', 1 )[ 0 ] : null,
isParameter = pageName ? pageName.length > selectedPartId.length : false;
for ( const partId in this.partWidgets ) {
- 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 initFromMetaList
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
ve.ui.MWTocWidget.prototype.initFromMetaList = function () {
const items = this.metaList.getItemsInGroup( 'mwTOC' );
if ( items.length === 0 ) {
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 VeUiMWParameterPage
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
ve.ui.MWParameterPage = function VeUiMWParameterPage( parameter, config ) {
const paramName = parameter.getName();
// Configuration initialization
config = ve.extendObject( {
- 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 getTargetDataFromHref
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
mw.libs.ve.getTargetDataFromHref = function ( href, doc ) {
function regexEscape( str ) {
return str.replace( /([.?*+^$[\]\\(){}|-])/g, '\\$1' );
}
- 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 generateContents
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
ve.ce.MWExtensionNode.prototype.generateContents = function ( config ) {
const deferred = ve.createDeferred(),
mwData = ve.copy( this.getModel().getAttribute( 'mw' ) ),
extsrc = config && config.extsrc !== undefined ? config.extsrc : ( ve.getProp( mwData, 'body', 'extsrc' ) || '' ),
attrs = config && config.attrs || mwData.attrs,
- 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 updateHistoryState
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.init.mw.DesktopArticleTarget.prototype.updateHistoryState = function () {
const veaction = this.getDefaultMode() === 'visual' ? 'edit' : 'editsource',
section = this.section;
// Push veaction=edit(source) url in history (if not already present).
Function create
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.ui.MWWikitextDataTransferHandlerFactory.prototype.create = function () {
// Parent method
const handler = ve.ui.MWWikitextDataTransferHandlerFactory.super.prototype.create.apply( this, arguments ),
resolve = handler.resolve.bind( handler );
Function runDiffTest
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
runDiffTest: function ( oldHtml, newHtml, done ) {
const target = ve.init.target,
surface = target.surface;
if ( target.saveDialog ) {
Function resetCaption
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.ui.MWMediaDialog.prototype.resetCaption = function () {
const doc = this.getFragment().getDocument();
// Get existing caption. We only do this in setup, because the caption
// should not reset to original if the image is replaced or edited.
Function setupHotkeyTriggers
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.ui.MWTransclusionDialog.prototype.setupHotkeyTriggers = function () {
// Lower-case modifier and key names as specified in {@see ve.ui.Trigger}
const isMac = ve.getSystemPlatform() === 'mac',
meta = isMac ? 'meta+' : 'ctrl+';
const hotkeys = {
Function surfaceReady
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.init.mw.DesktopArticleTarget.prototype.surfaceReady = function () {
if ( !this.activating ) {
// Activation was aborted before we got here. Do nothing
// TODO are there things we need to clean up?
return;
Function attachImageModel
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.ui.MWMediaDialog.prototype.attachImageModel = function () {
if ( this.imageModel ) {
this.imageModel.disconnect( this );
this.sizeWidget.disconnect( this );
}
Function removePages
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.ui.MWTwoPaneTransclusionDialogLayout.prototype.removePages = function ( pagesNamesToRemove ) {
const pagesToRemove = [],
isCurrentParameter = this.pages[ this.currentPageName ] instanceof ve.ui.MWParameterPage;
let isCurrentPageRemoved = false,
prevSelectionCandidate, nextSelectionCandidate;
Function selectRange
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.ui.MWAceEditorWidget.prototype.selectRange = function ( from, to ) {
this.focus();
this.loadingPromise.done( () => {
const doc = this.editor.getSession().getDocument(),
lines = doc.getAllLines();
Function describeChanges
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.dm.MWExtensionNode.static.describeChanges = function ( attributeChanges, attributes, element ) {
const descriptions = [],
fromBody = attributeChanges.mw.from.body,
toBody = attributeChanges.mw.to.body;
Function initializeFilters
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.ui.MWTransclusionOutlineTemplateWidget.prototype.initializeFilters = function () {
this.searchWidget = new OO.ui.SearchInputWidget( {
title: ve.msg( 'visualeditor-dialog-transclusion-filter-title', this.templateModel.getSpec().getLabel() ),
placeholder: ve.msg( 'visualeditor-dialog-transclusion-filter-placeholder' ),
classes: [ 've-ui-mwTransclusionOutlineTemplateWidget-searchWidget' ]
Function hasMatchingAncestor
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.dm.MWWikitextSurfaceFragment.prototype.hasMatchingAncestor = function ( type, attributes ) {
const nodes = this.getSelectedLeafNodes();
let all = !!nodes.length;
for ( let i = 0, len = nodes.length; i < len; i++ ) {
Function getCategoryWidgetFromName
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.ui.MWCategoryInputWidget.prototype.getCategoryWidgetFromName = function ( name ) {
const cachedData = ve.init.platform.linkCache.getCached( mw.Title.newFromText(
name,
mw.config.get( 'wgNamespaceIds' ).category
).getPrefixedText() );