wikimedia/mediawiki-extensions-UploadWizard

View on GitHub

Showing 260 of 260 total issues

Function extractMetadataFromJpegMeta has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    mw.UploadWizardUpload.prototype.extractMetadataFromJpegMeta = function () {
        var binReader, jpegmeta,
            deferred = $.Deferred(),
            upload = this;
        if ( this.file && this.file.type === 'image/jpeg' ) {
Severity: Minor
Found in resources/mw.UploadWizardUpload.js - About 1 hr to fix

    Function displayer has 42 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

                function displayer() {
                    var totalWeight = 0.0,
                        fraction = 0.0,
                        successStateCount = 0,
                        errorStateCount = 0,
    Severity: Minor
    Found in resources/mw.GroupProgressBar.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 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 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

          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

            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

              Function addCopyMetadataFeature has 39 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  uw.controller.Details.prototype.addCopyMetadataFeature = function () {
                      var first,
                          // uploads can only be edited when they're in a certain state:
                          // a flat out upload failure or a completed upload can not be edited
                          invalidStates = [ 'aborted', 'error', 'complete' ],
              Severity: Minor
              Found in resources/controller/uw.controller.Details.js - About 1 hr to fix

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                        this.authorInputField = new uw.FieldLayout( this.authorInput, {
                            label: $( '<li>' )
                                .addClass( 'mwe-upwiz-label-title' )
                                .msg( 'mwe-upwiz-author-text', this.uploadCount, mw.user ),
                            required: true
                Severity: Major
                Found in resources/deed/uw.deed.ThirdParty.js and 1 other location - About 1 hr to fix
                resources/deed/uw.deed.ThirdParty.js on lines 69..74

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 65.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                        this.sourceInputField = new uw.FieldLayout( this.sourceInput, {
                            label: $( '<li>' )
                                .addClass( 'mwe-upwiz-label-title' )
                                .msg( 'mwe-upwiz-source-text', this.uploadCount, mw.user ),
                            required: true
                Severity: Major
                Found in resources/deed/uw.deed.ThirdParty.js and 1 other location - About 1 hr to fix
                resources/deed/uw.deed.ThirdParty.js on lines 113..118

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 65.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                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

                    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

                      Similar blocks of code found in 2 locations. Consider refactoring.
                      Open

                          uw.controller.Upload.prototype.moveNext = function () {
                              this.removeErrorUploads();
                      
                              uw.controller.Step.prototype.moveNext.call( this );
                          };
                      Severity: Major
                      Found in resources/controller/uw.controller.Upload.js and 1 other location - About 1 hr to fix
                      resources/controller/uw.controller.Details.js on lines 83..87

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 64.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Similar blocks of code found in 2 locations. Consider refactoring.
                      Open

                          uw.controller.Details.prototype.moveNext = function () {
                              this.removeErrorUploads();
                      
                              uw.controller.Step.prototype.moveNext.call( this );
                          };
                      Severity: Major
                      Found in resources/controller/uw.controller.Details.js and 1 other location - About 1 hr to fix
                      resources/controller/uw.controller.Upload.js on lines 107..111

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 64.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      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 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 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 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
                                Severity
                                Category
                                Status
                                Source
                                Language