Showing 436 of 912 total issues
Function unwrapParsoidSections
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
mw.libs.ve.unwrapParsoidSections = function ( element, keepSection ) {
Array.prototype.forEach.call( element.querySelectorAll( 'section[data-mw-section-id]' ), ( section ) => {
const parent = section.parentNode,
sectionId = section.getAttribute( 'data-mw-section-id' );
// Copy section ID to first child (should be a heading)
- 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 reduplicateStyles
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
mw.libs.ve.reduplicateStyles = function ( element ) {
Array.prototype.forEach.call( element.querySelectorAll( 'link[rel~="mw-deduplicated-inline-style"]' ), ( link ) => {
const href = link.getAttribute( 'href' );
if ( !href || href.slice( 0, 'mw-data:'.length ) !== 'mw-data:' ) {
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
Avoid too many return
statements within this function. Open
Open
return mw.user.options.set( keyOrValueMap, jsonValue );
Avoid too many return
statements within this function. Open
Open
return this.getApi().get( {
action: 'query',
// Can't use a direct lookup by title because we need this to be case-insensitive
generator: 'prefixsearch',
gpssearch: query,
Avoid too many return
statements within this function. Open
Open
return new ve.ui.MWParameterCheckboxInputWidget( valueInputConfig );
Avoid too many return
statements within this function. Open
Open
return ve.ui.MWExternalLinkAnnotationWidget.static.createExternalLinkInputWidget( valueInputConfig );
Avoid too many return
statements within this function. Open
Open
return new ve.ui.MWLazyMultilineTextInputWidget( valueInputConfig );
Avoid too many return
statements within this function. Open
Open
return new ve.ui.MWLazyMultilineTextInputWidget( ve.extendObject( {
rows: 1,
autosize: true,
allowLinebreaks: false
}, valueInputConfig ) );
Avoid too many return
statements within this function. Open
Open
return true;
Avoid too many return
statements within this function. Open
Open
return false;
Avoid too many return
statements within this function. Open
Open
return new OO.ui.ComboBoxInputWidget( valueInputConfig );
Avoid too many return
statements within this function. Open
Open
return false;
Avoid too many return
statements within this function. Open
Open
return returnExternalData();
Avoid too many return
statements within this method. Open
Open
return self::getLastEditor( $user, $req );
Avoid too many return
statements within this function. Open
Open
return 'oneway';
Avoid too many return
statements within this function. Open
Open
return true;
Avoid too many return
statements within this function. Open
Open
return false;
Avoid too many return
statements within this method. Open
Open
return true;
Avoid too many return
statements within this method. Open
Open
return;
Avoid too many return
statements within this function. Open
Open
return variantInfo.twoway[ languageIndex ].t;