wikimedia/mediawiki-extensions-UploadWizard

View on GitHub

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 ] ) {
Severity: Minor
Found in resources/mw.UploadWizardUpload.js - About 1 hr to fix

    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',
    Severity: Minor
    Found in resources/mw.UploadWizard.js - About 1 hr to fix

      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'
      Severity: Minor
      Found in resources/details/uw.DateDetailsWidget.js - About 1 hr to fix

        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' ),
        Severity: Minor
        Found in resources/details/uw.MultipleLanguageInputWidget.js - About 1 hr to fix

          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'] ?? '';
          Severity: Minor
          Found in includes/CampaignPageFormatter.php - About 1 hr to fix

          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 ) ) {
          Severity: Minor
          Found in includes/Config.php - About 1 hr to fix

          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;
          Severity: Minor
          Found in resources/jquery/jquery.morphCrossfade.js - About 1 hr to fix

            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 );
            Severity: Minor
            Found in resources/ui/steps/uw.ui.Upload.js - About 1 hr to fix

              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' );
              Severity: Minor
              Found in resources/ui/steps/uw.ui.Upload.js - About 1 hr to fix

                Function removeItem has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    uw.ConcurrentQueue.prototype.removeItem = function ( item ) {
                        var index, found;
                
                        found = false;
                
                
                Severity: Minor
                Found in resources/uw.ConcurrentQueue.js - About 1 hr to fix

                  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 );
                  
                  
                  Severity: Minor
                  Found in resources/ui/steps/uw.ui.Metadata.js - About 1 hr to fix

                    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,
                    Severity: Minor
                    Found in resources/controller/uw.controller.Upload.js - About 1 hr to fix

                      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;
                      Severity: Minor
                      Found in resources/controller/uw.controller.Deed.js - About 1 hr to fix

                        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(
                        Severity: Minor
                        Found in resources/details/uw.UlsWidget.js - About 1 hr to fix

                          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 {
                          Severity: Major
                          Found in resources/mw.UploadWizardLicenseInput.js - About 1 hr to fix

                            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 = [];
                            Severity: Major
                            Found in resources/mw.FlickrChecker.js - About 1 hr to fix

                              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' ] )
                              Severity: Minor
                              Found in maintenance/migrateCampaigns.php - About 55 mins to fix

                              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
                              Severity: Major
                              Found in includes/CampaignHooks.php - About 50 mins to fix

                                Method onPageMoveComplete has 7 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                        $oldTitle,
                                        $newTitle,
                                        $user,
                                        $pageid,
                                        $redirid,
                                Severity: Major
                                Found in includes/CampaignHooks.php - About 50 mins to fix

                                  Function GroupProgressBar has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                      mw.GroupProgressBar = function ( selector, uploads, successStates, errorStates, progressProperty, weightProperty ) {
                                  Severity: Minor
                                  Found in resources/mw.GroupProgressBar.js - About 45 mins to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language