wikimedia/mediawiki-extensions-UploadWizard

View on GitHub

Showing 141 of 272 total issues

Function checkStatus has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    mw.FormDataTransport.prototype.checkStatus = function () {
        var transport = this,
            params = OO.cloneObject( this.formData );

        if ( this.aborted ) {
Severity: Minor
Found in resources/transports/mw.FormDataTransport.js - About 1 hr to fix

    Function validateFile has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        uw.controller.Upload.prototype.validateFile = function ( upload ) {
            var extension,
                i,
                actualMaxSize = mw.UploadWizard.config.maxMwUploadSize,
    
    
    Severity: Minor
    Found in resources/controller/uw.controller.Upload.js - About 1 hr to fix

      Function checkFlickr has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          checkFlickr: function ( flickrInputUrl ) {
              var photoIdMatches, albumIdMatches, userCollectionMatches, userPhotostreamMatches, groupPoolMatches, userGalleryMatches, userFavoritesMatches;
      
              photoIdMatches = flickrInputUrl.match( /flickr\.com\/(?:x\/t\/[^/]+\/)?photos\/[^/]+\/([0-9]+)/ );
              albumIdMatches = flickrInputUrl.match( /flickr\.com\/photos\/[^/]+\/(sets|albums)\/([0-9]+)/ );
      Severity: Minor
      Found in resources/mw.FlickrChecker.js - 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 initialiseSteps has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              initialiseSteps: function () {
                  var self = this,
                      steps = {};
      
                  steps.tutorial = new uw.controller.Tutorial( this.api, this.config );
      Severity: Minor
      Found in resources/mw.UploadWizard.js - About 1 hr to fix

        Method getImageHtml has 39 lines of code (exceeds 25 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 ) ) {
        Severity: Minor
        Found in includes/Tutorial.php - About 1 hr to fix

          Method getWizardHtml has 39 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function getWizardHtml() {
                  $config = Config::getConfig( $this->campaign );
          
                  if ( array_key_exists(
                      'display', $config ) && array_key_exists( 'headerLabel', $config['display'] )
          Severity: Minor
          Found in includes/Specials/SpecialUploadWizard.php - About 1 hr to fix

            Function valid has 37 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                uw.controller.Details.prototype.valid = function () {
                    // validityPromises will hold all promises for all uploads;
                    // prefilling with a bogus promise (no warnings & errors) to
                    // ensure $.when always resolves with an array of multiple
                    // results (if there's just 1, it would otherwise have just
            Severity: Minor
            Found in resources/controller/uw.controller.Details.js - About 1 hr to fix

              Method getHtml has 37 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static function getHtml( $campaign = null ) {
                      global $wgLang;
              
                      $error = null;
                      $errorHtml = '';
              Severity: Minor
              Found in includes/Tutorial.php - About 1 hr to fix

                Function checkFlickr has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    checkFlickr: function ( flickrInputUrl ) {
                        var photoIdMatches, albumIdMatches, userCollectionMatches, userPhotostreamMatches, groupPoolMatches, userGalleryMatches, userFavoritesMatches;
                
                        photoIdMatches = flickrInputUrl.match( /flickr\.com\/(?:x\/t\/[^/]+\/)?photos\/[^/]+\/([0-9]+)/ );
                        albumIdMatches = flickrInputUrl.match( /flickr\.com\/photos\/[^/]+\/(sets|albums)\/([0-9]+)/ );
                Severity: Minor
                Found in resources/mw.FlickrChecker.js - About 1 hr to fix

                  Function addNextButton has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      uw.ui.Details.prototype.addNextButton = function () {
                          var ui = this;
                  
                          this.nextButtonPromise.done( () => {
                              ui.$buttons.append(
                  Severity: Minor
                  Found in resources/ui/steps/uw.ui.Details.js - About 1 hr to fix

                    Function UWLicenseGroup has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        uw.LicenseGroup = function UWLicenseGroup( config, type, api, count ) {
                            var self = this;
                    
                            uw.LicenseGroup.super.call( this, {} );
                    
                    
                    Severity: Minor
                    Found in resources/uw.LicenseGroup.js - About 1 hr to fix

                      Function prefillLocation has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              prefillLocation: function () {
                                  var dir,
                                      m = this.upload.imageinfo.metadata,
                                      values = {};
                      
                      
                      Severity: Minor
                      Found in resources/mw.UploadWizardDetails.js - About 1 hr to fix

                        Function copyMetadata has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            uw.CopyMetadataWidget.prototype.copyMetadata = function ( metadataTypes ) {
                                var titleZero, matches, i,
                                    uploads = this.copyTo,
                                    sourceUpload = this.copyFrom,
                                    serialized = sourceUpload.details.getSerialized(),
                        Severity: Minor
                        Found in resources/uw.CopyMetadataWidget.js - About 1 hr to fix

                          Function addUpload has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              uw.ui.Thanks.prototype.addUpload = function ( upload ) {
                                  var thumbWikiText, $thanksDiv, $thumbnailWrapDiv, $thumbnailDiv, $thumbnailCaption, $thumbnailLink;
                          
                                  thumbWikiText = '[[' + [
                                      upload.details.getTitle().getPrefixedText(),
                          Severity: Minor
                          Found in resources/ui/steps/uw.ui.Thanks.js - About 1 hr to fix

                            Function setupDateInput has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                uw.DateDetailsWidget.prototype.setupDateInput = function ( mode ) {
                                    var
                                        oldDateInputWidget = this.dateInputWidget;
                            
                                    if ( mode === undefined ) {
                            Severity: Minor
                            Found in resources/details/uw.DateDetailsWidget.js - About 1 hr to fix

                              Function submitWikiText has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                      submitWikiText: function ( wikiText ) {
                                          var params,
                                              tags = [ 'uploadwizard' ],
                                              deed = this.upload.deedChooser.deed,
                                              comment = '',
                              Severity: Minor
                              Found in resources/mw.UploadWizardDetails.js - About 1 hr to fix

                                Function validateTitleInput has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    uw.TitleDetailsWidget.prototype.validateTitleInput = function ( value ) {
                                        var
                                            errors = [],
                                            processDestinationCheck = this.processDestinationCheck,
                                            title = this.buildTitleFromInput( value ),
                                Severity: Minor
                                Found in resources/details/uw.TitleDetailsWidget.js - About 1 hr to fix

                                  Function createImagePickerField has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      mw.UploadWizardUploadInterface.prototype.createImagePickerField = function ( index, setDisabled ) {
                                          var $fieldContainer = $( '<div>' ).addClass( 'mwe-upwiz-objref-pick-image' ),
                                              attributes = {
                                                  type: 'checkbox',
                                                  class: 'imgPicker',
                                  Severity: Minor
                                  Found in resources/mw.UploadWizardUploadInterface.js - About 1 hr to fix

                                    Function thumbnailPublisher has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                            function thumbnailPublisher( thumbnails ) {
                                                if ( thumbnails === null ) {
                                                    // the api call failed somehow, no thumbnail data.
                                                    deferred.resolve( null );
                                                } else {
                                    Severity: Minor
                                    Found in resources/mw.UploadWizardUpload.js - About 1 hr to fix

                                      Method execute has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                          public function execute( $subPage ) {
                                              $request = $this->getRequest();
                                      
                                              $start = $request->getIntOrNull( 'start' );
                                      
                                      
                                      Severity: Minor
                                      Found in includes/Specials/SpecialCampaigns.php - About 1 hr to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language