Showing 436 of 912 total issues
Function createItem
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.ui.MWLanguageVariantOneWayInspector.prototype.createItem = function ( from, lang, to ) {
const fromTextTarget = this.createTextTarget( OO.ui.msg(
'visualeditor-mwlanguagevariantinspector-oneway-from-text-placeholder'
) );
const languageInput = new ve.ui.LanguageInputWidget( {
Function processQueue
has 41 lines of code (exceeds 25 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();
}
Function VeUiMwEducationPopup
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.ui.MWEducationPopupWidget = function VeUiMwEducationPopup( $target, config ) {
config = config || {};
// HACK: Do not display on platforms other than desktop
if ( !( ve.init.mw.DesktopArticleTarget && ve.init.target instanceof ve.init.mw.DesktopArticleTarget ) ) {
Function insertImageNode
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.dm.MWImageModel.prototype.insertImageNode = function ( fragment ) {
const nodeType = this.getImageNodeType(),
surfaceModel = fragment.getSurface();
if ( !( fragment.getSelection() instanceof ve.dm.LinearSelection ) ) {
Function switchToFallbackWikitextEditor
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.init.mw.DesktopArticleTarget.prototype.switchToFallbackWikitextEditor = function ( modified ) {
const oldId = mw.config.get( 'wgRevisionId' ) || $( 'input[name=parentRevId]' ).val();
const prefPromise = mw.libs.ve.setEditorPreference( 'wikitext' );
if ( !modified ) {
Method onBeforePageDisplay
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function onBeforePageDisplay( $output, $skin ): void {
$services = MediaWikiServices::getInstance();
$hookRunner = new VisualEditorHookRunner( $services->getHookContainer() );
if ( !$hookRunner->onVisualEditorBeforeEditor( $output, $skin ) ) {
$output->addJsConfigVars( 'wgVisualEditorDisabledByHook', true );
Function initAutosave
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
ve.init.mw.Target.prototype.initAutosave = function ( config ) {
// Old function signature
// TODO: Remove after fixed downstream
if ( typeof config === 'boolean' ) {
config = { suppressNotification: config };
- 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 updateRedirectInterface
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
ve.init.mw.ArticleTarget.prototype.updateRedirectInterface = function ( $sub, $msg ) {
// For the subtitle, replace the real one with ours.
// This is more complicated than it should be because we have to fiddle with the <br>.
const $currentSub = $( '#redirectsub' );
if ( $currentSub.length ) {
- 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 onSelect
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
ve.ui.MWFeedbackDialogTool.prototype.onSelect = function () {
this.setActive( false );
if ( !this.feedbackPromise ) {
this.feedbackPromise = mw.loader.using( 'mediawiki.feedback' ).then( () => {
- 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 13 (exceeds 5 allowed). Consider refactoring. Open
ve.ui.MWSaveDialog.prototype.getSetupProcess = function ( data ) {
return ve.ui.MWSaveDialog.super.prototype.getSetupProcess.call( this, data )
.next( () => {
const surfaceMode = ve.init.target.getSurface().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 onDocumentKeyDown
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
ve.ui.MWTransclusionOutlineParameterSelectWidget.prototype.onDocumentKeyDown = function ( e ) {
let item;
switch ( e.keyCode ) {
case OO.ui.Keys.HOME:
- 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 getPreviewHtml
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
ve.dm.MWLanguageVariantNode.static.getPreviewHtml = function ( variantInfo, opts ) {
if ( variantInfo.disabled ) {
return variantInfo.disabled.t;
} else if ( variantInfo.name ) {
return ve.init.platform.getLanguageName( variantInfo.name.t.toLowerCase() );
- 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 getTeardownProcess
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.ui.MWMagicLinkNodeInspector.prototype.getTeardownProcess = function ( data ) {
data = data || {};
return ve.ui.MWMagicLinkNodeInspector.super.prototype.getTeardownProcess.call( this, data )
.first( () => {
const surfaceView = this.manager.getSurface().getView(),
Function getVisualDiffGeneratorPromise
has 39 lines of code (exceeds 25 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 ) {
Function VeUiMWCategoryPopupWidget
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.ui.MWCategoryPopupWidget = function VeUiMWCategoryPopupWidget( config ) {
// Configuration initialization
config = ve.extendObject( { autoClose: true }, config );
// Parent constructor
Function getSetupProcess
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.ui.MWSaveDialog.prototype.getSetupProcess = function ( data ) {
return ve.ui.MWSaveDialog.super.prototype.getSetupProcess.call( this, data )
.next( () => {
const surfaceMode = ve.init.target.getSurface().getMode();
Function describeChanges
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.dm.MWImageNode.static.describeChanges = function ( attributeChanges, attributes ) {
const customKeys = [ 'width', 'height', 'defaultSize', 'src', 'href' ],
descriptions = [];
function describeSize( width, height ) {
Function getActionProcess
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.ui.MWTemplateDialog.prototype.getActionProcess = function ( action ) {
if ( action === 'done' ) {
return new OO.ui.Process( () => {
const deferred = ve.createDeferred();
this.checkRequiredParameters().done( () => {
Function onContainerScroll
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.init.mw.MobileArticleTarget.prototype.onContainerScroll = function () {
// Editor may not have loaded yet, in which case `this.surface` is undefined
const surfaceView = this.surface && this.surface.getView(),
isActiveWithKeyboard = surfaceView && surfaceView.isFocused() && !surfaceView.isDeactivated();
Method diffWikitext
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function diffWikitext( Title $title, ?int $fromId, $wikitext, $section = null ) {
$apiParams = [
'action' => 'compare',
'prop' => 'diff',
// Because we're just providing wikitext, we only care about the main slot