Showing 912 of 912 total issues
Function setActiveParameter
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
ve.ui.MWTransclusionOutlineParameterSelectWidget.prototype.setActiveParameter = function ( paramName ) {
// Note: We know unnamed parameter placeholders never have an item here
const newItem = paramName ? this.findItemFromData( paramName ) : null;
// Unhighlight when called with no parameter name
this.highlightItem( newItem );
- 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 VeUiMwEducationPopup
has a Cognitive Complexity of 6 (exceeds 5 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 ) ) {
- 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 queryCategoryStatus
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
ve.ui.MWCategoryWidget.prototype.queryCategoryStatus = function ( categoryNames ) {
// Get rid of any we already know the hidden status of, or have an entry
// if normalizedTitles (i.e. have been fetched before)
const categoryNamesToQuery = categoryNames.filter( ( name ) => {
if ( this.normalizedTitles[ name ] ) {
- 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 getDefaultDir
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
ve.dm.MWImageModel.prototype.getDefaultDir = function ( imageNodeType ) {
imageNodeType = imageNodeType || this.getImageNodeType();
if ( this.parentDoc.getDir() === 'rtl' ) {
// Assume position is 'left'
- 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 6 (exceeds 5 allowed). Consider refactoring. Open
ve.dm.MWExtensionNode.static.toDomElements = function ( dataElement, doc, converter ) {
const originalMw = dataElement.attributes.originalMw;
let els;
// If the transclusion is unchanged just send back the
- 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 updateScalableDetails
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
ve.dm.MWImageModel.prototype.updateScalableDetails = function ( originalDimensions ) {
let newDimensions;
// Resize the new image's current dimensions to default or based on the bounding box
if ( this.isDefaultSize() ) {
- 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 scaleToThumbnailSize
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
ve.dm.MWImageNode.static.scaleToThumbnailSize = function ( dimensions, mediaType ) {
const defaultThumbSize = mw.config.get( 'wgVisualEditorConfig' )
.thumbLimits[ mw.user.options.get( 'thumbsize' ) ];
mediaType = mediaType || 'BITMAP';
- 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 MWLibsVESwitchPopupWidget
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
mw.libs.ve.SwitchPopupWidget = function MWLibsVESwitchPopupWidget( mode, config ) {
const prefix = mode === 'visual' ? 'visualeditor-mweditmodewt' : 'visualeditor-mweditmodeve',
option = mode === 'visual' ? 'visualeditor-hidevisualswitchpopup' : 'visualeditor-hidesourceswitchpopup';
// 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 getCssClass
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
ve.ce.MWBlockImageNode.prototype.getCssClass = function ( type, alignment ) {
// TODO use this.model.getAttribute( 'type' ) etc., see T54065
// Default is different between RTL and LTR wikis:
if ( type === 'default' && alignment === 'default' ) {
if ( this.getModel().getDocument().getDir() === 'rtl' ) {
- 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 onGetPreferences
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function onGetPreferences( $user, &$preferences ) {
$services = MediaWikiServices::getInstance();
$userOptionsLookup = $services->getUserOptionsLookup();
$veConfig = $services->getConfigFactory()->makeConfig( 'visualeditor' );
$isBeta = $veConfig->get( 'VisualEditorEnableBetaFeature' );
- 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 getMessages
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getMessages() {
$messages = parent::getMessages();
$services = MediaWikiServices::getInstance();
$veConfig = $services->getConfigFactory()->makeConfig( 'visualeditor' );
- 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 isSupportedEditPage
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private static function isSupportedEditPage( Title $title, User $user, WebRequest $req ): bool {
if (
$req->getVal( 'action' ) !== 'edit' ||
!MediaWikiServices::getInstance()->getPermissionManager()->quickUserCan( 'edit', $user, $title )
) {
- 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"