Showing 141 of 272 total issues
Function maybeRetry
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
mw.FormDataTransport.prototype.maybeRetry = function ( contextMsg, code, response, retryMethod, file, offset ) {
Method onEditFilterMergedContent
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public function onEditFilterMergedContent( IContextSource $context, Content $content, Status $status, $summary,
User $user, $minoredit
Function getImageHtml
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static function getImageHtml( MediaTransformOutput $thumb, $tutorial ) {
$helpDeskUrl = wfMessage( 'mwe-upwiz-help-desk-url' )->text();
// Per convention, we may be either using an absolute URL or a wiki page title in this UI message
if ( preg_match( '/^(?:' . wfUrlProtocols() . ')/', $helpDeskUrl ) ) {
- 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 applyObjectReferenceToButtons
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private function applyObjectReferenceToButtons( $objRef ) {
$customizableButtons = [ 'homeButton', 'beginButton' ];
foreach ( $customizableButtons as $button ) {
if ( isset( $this->parsedConfig['display'][$button]['target'] ) &&
- 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
Method onPageSaveComplete
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
$wikiPage,
$userIdentity,
$summary,
$flags,
$revisionRecord,
Consider simplifying this complex logical expression. Open
if (
this.descriptionsDetails.getWikiText() === '' &&
this.upload.file !== undefined
) {
m = this.upload.imageinfo.metadata;
Function setDuplicateError
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
mw.ApiUploadHandler.prototype.setDuplicateError = function ( code, result, localDuplicates, foreignDuplicates, unknownAmount ) {
Function execute
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function execute( $subPage ) {
$request = $this->getRequest();
$start = $request->getIntOrNull( 'start' );
- 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 handleCampaign
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected function handleCampaign() {
$campaignName = $this->getRequest()->getVal( 'campaign' );
if ( $campaignName === null ) {
$campaignName = Config::getSetting( 'defaultCampaign' );
}
- 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 trimArray
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function trimArray( $array ) {
$newArray = [];
foreach ( $array as $key => $value ) {
if ( is_array( $value ) ) {
$trimmedValue = $this->trimArray( $value );
- 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 execute
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function execute() {
$params = $this->extractRequestParams();
$limit = $params['limit'];
- 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
return mw.DestinationChecker.checkTitle( title.getPrefixedText() )
.then( ( result ) => {
var moreErrors = processDestinationCheck( result );
if ( result.blacklist.unavailable ) {
// We don't have a title blacklist, so just check for some likely undesirable patterns.
Avoid too many return
statements within this function. Open
return this.submitWikiTextInternal( params );
Avoid too many return
statements within this function. Open
return false;
Avoid too many return
statements within this function. Open
return;
Avoid too many return
statements within this function. Open
return true;
Avoid too many return
statements within this function. Open
return $.Deferred().reject( code, { errors: [ { html: message } ] } );
Avoid too many return
statements within this function. Open
return this.submitWikiTextInternal( params );
Avoid too many return
statements within this function. Open
return $.Deferred().reject( 'this-info-missing', result );
Avoid too many return
statements within this function. Open
return false;