Showing 141 of 272 total issues
Function getThumbnail
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
mw.UploadWizardUpload.prototype.getThumbnail = function ( width, height ) {
var upload = this,
deferred = $.Deferred();
if ( this.thumbnailPromise[ width + 'x' + height ] ) {
Function ajax
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
api.ajax = function ( parameters, ajaxOptions ) {
var original, override;
$.extend( parameters, {
errorformat: 'html',
Function UWDateDetailsWidget
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
uw.DateDetailsWidget = function UWDateDetailsWidget( config ) {
uw.DateDetailsWidget.super.call( this );
this.upload = config.upload;
this.dateInputWidgetMode = null; // or: 'calendar', 'arbitrary'
Function UWMultipleLanguageInputWidget
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
uw.MultipleLanguageInputWidget = function UWMultipleLanguageInputWidget( config ) {
this.config = $.extend( {
required: true,
label: mw.message( '' ),
errorBlank: mw.message( 'mwe-upwiz-error-blank' ),
Function generateReadHtml
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function generateReadHtml() {
$config = $this->campaign->getParsedConfig();
$campaignTitle = $config['title'] ?? $this->campaign->getName();
$campaignDescription = $config['description'] ?? '';
- 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 arrayReplaceSanely
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public static function arrayReplaceSanely( $array, $array1 ) {
$newArray = [];
foreach ( $array as $key => $value ) {
if ( array_key_exists( $key, $array1 ) ) {
- 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 morphCrossfade
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
$.fn.morphCrossfade = function ( newPanelSelector, speed ) {
var $this = $( this );
if ( typeof speed === 'undefined' ) {
speed = 400;
Function updateFileCounts
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
uw.ui.Upload.prototype.updateFileCounts = function ( haveUploads, fewerThanMax ) {
this.$fileList.toggleClass( 'mwe-upwiz-filled-filelist', haveUploads );
this.$addFileContainer.toggleClass( 'mwe-upwiz-add-files-0', !haveUploads );
this.setAddButtonText( haveUploads );
Function load
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
uw.ui.Upload.prototype.load = function ( uploads ) {
uw.ui.Step.prototype.load.call( this, uploads );
if ( uploads.length === 0 ) {
this.$fileList.removeClass( 'mwe-upwiz-filled-filelist' );
Function removeItem
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
uw.ConcurrentQueue.prototype.removeItem = function ( item ) {
var index, found;
found = false;
Function load
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
uw.ui.Metadata.prototype.load = function ( uploads ) {
this.$div.empty().append( this.$content );
uw.ui.Step.prototype.load.call( this, uploads );
Function UWControllerUpload
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
uw.controller.Upload = function UWControllerUpload( api, config ) {
var step = this;
uw.controller.Step.call(
this,
Function moveNext
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
uw.controller.Deed.prototype.moveNext = function () {
var
self = this,
deedChoosers = this.getUniqueDeedChoosers( this.uploads ),
allValidityPromises;
Function UWUlsWidget
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
uw.UlsWidget = function UWUlsWidget( config ) {
uw.UlsWidget.super.call( this );
this.$element = $( '<div>' )
.append(
Consider simplifying this complex logical expression. Open
if ( config.licenseGroups === undefined ) {
var group = new mw.uploadWizard.LicenseGroup( config, this.type, this.api, this.count );
groups.push( group );
this.$element.append( this.$group );
} else {
Consider simplifying this complex logical expression. Open
if ( albumIdMatches || photoIdMatches || userCollectionMatches || userPhotostreamMatches ||
groupPoolMatches || userGalleryMatches || userFavoritesMatches ) {
// eslint-disable-next-line no-jquery/no-global-selector
$( '#mwe-upwiz-upload-add-flickr-container' ).hide();
this.imageUploads = [];
Function getConfigFromDB
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private function getConfigFromDB( $id ) {
$config = [];
$confProps = $this->dbr->newSelectQueryBuilder()
->select( [ 'cc_property', 'cc_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
Method onArticleDeleteComplete
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
$article, $user, $reason, $id, $content, $logEntry, $archivedRevisionCount
Method onPageMoveComplete
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
$oldTitle,
$newTitle,
$user,
$pageid,
$redirid,
Function GroupProgressBar
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
mw.GroupProgressBar = function ( selector, uploads, successStates, errorStates, progressProperty, weightProperty ) {