wikimedia/mediawiki-extensions-UploadWizard

View on GitHub

Showing 260 of 260 total issues

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

    uw.ui.Details.prototype.load = function ( uploads ) {
        uw.ui.Step.prototype.load.call( this, uploads );

        if ( mw.UploadWizard.config.wikibase.enabled && mw.UploadWizard.config.wikibase.captions ) {
            this.$div.prepend(
Severity: Minor
Found in resources/ui/steps/uw.ui.Details.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

      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

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

                this.purposeRadio.on( 'select', ( selectedOption ) => {
                    revealOptionContent( self.purposeRadio.$element, selectedOption.$element );
        
                    // let's also emit a 'change' event to satisfy the listener that checks
                    // and shows/hides an error message
        Severity: Major
        Found in resources/deed/uw.deed.OwnWork.js and 1 other location - About 1 hr to fix
        resources/deed/uw.deed.OwnWork.js on lines 227..233

        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 62.

        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.originOthersRadio.on( 'select', ( selectedOption ) => {
                    revealOptionContent( self.originOthersRadio.$element, selectedOption.$element );
        
                    // let's also emit a 'change' event on the parent radio to satisfy the listener
                    // that checks and shows/hides an error message
        Severity: Major
        Found in resources/deed/uw.deed.OwnWork.js and 1 other location - About 1 hr to fix
        resources/deed/uw.deed.OwnWork.js on lines 324..330

        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 62.

        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 initialize has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            uw.PatentDialog.prototype.initialize = function () {
                var filenames = [],
                    label = new OO.ui.LabelWidget(),
                    panels = new OO.ui.PanelLayout( { padded: true, expanded: false } );
        
        
        Severity: Minor
        Found in resources/deed/dialog/uw.deed.dialog.PatentDialog.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

            Function UWStatementWidget has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                uw.StatementWidget = function UWStatementWidget( config ) {
                    var EntityInputWidget =
                        mw.loader.require( 'wikibase.mediainfo.statements' ).inputs.EntityInputWidget,
                        FormatValueElement =
                            mw.loader.require( 'wikibase.mediainfo.base' ).FormatValueElement;
            Severity: Minor
            Found in resources/details/uw.StatementWidget.js - About 1 hr to fix

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

                      this.retryButtonSomeFailed = new OO.ui.ButtonWidget( {
                          label: mw.message( 'mwe-upwiz-file-retry' ).text(),
                          flags: [ 'progressive', 'primary' ]
                      } ).on( 'click', startDetails );
              Severity: Major
              Found in resources/ui/steps/uw.ui.Details.js and 2 other locations - About 1 hr to fix
              resources/ui/steps/uw.ui.Details.js on lines 37..40
              resources/ui/steps/uw.ui.Details.js on lines 54..57

              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 61.

              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 3 locations. Consider refactoring.
              Open

                      this.nextButton = new OO.ui.ButtonWidget( {
                          label: mw.message( 'mwe-upwiz-publish-details' ).text(),
                          flags: [ 'progressive', 'primary' ]
                      } ).on( 'click', startDetails );
              Severity: Major
              Found in resources/ui/steps/uw.ui.Details.js and 2 other locations - About 1 hr to fix
              resources/ui/steps/uw.ui.Details.js on lines 49..52
              resources/ui/steps/uw.ui.Details.js on lines 54..57

              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 61.

              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 3 locations. Consider refactoring.
              Open

                      this.retryButtonAllFailed = new OO.ui.ButtonWidget( {
                          label: mw.message( 'mwe-upwiz-file-retry' ).text(),
                          flags: [ 'progressive', 'primary' ]
                      } ).on( 'click', startDetails );
              Severity: Major
              Found in resources/ui/steps/uw.ui.Details.js and 2 other locations - About 1 hr to fix
              resources/ui/steps/uw.ui.Details.js on lines 37..40
              resources/ui/steps/uw.ui.Details.js on lines 49..52

              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 61.

              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 getStashImageInfo has 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  mw.UploadWizardUpload.prototype.getStashImageInfo = function ( callback, props, width, height ) {
                      var params = {
                          prop: 'stashimageinfo',
                          siifilekey: this.fileKey,
                          siiprop: props.join( '|' )
              Severity: Minor
              Found in resources/mw.UploadWizardUpload.js - About 1 hr to fix

                Function getApi has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        getApi: function ( options ) {
                            var api = new mw.Api( options );
                
                            api.ajax = function ( parameters, ajaxOptions ) {
                                var original, override;
                Severity: Minor
                Found in resources/mw.UploadWizard.js - About 1 hr to fix

                  Function validateTitleInput has 32 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 setValues has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        setValues: function ( values, groupName ) {
                            var selectedGroups = [];
                    
                            var input = this;
                            this.getItems().forEach( ( group ) => {
                    Severity: Minor
                    Found in resources/mw.UploadWizardLicenseInput.js - About 1 hr to fix

                      Function execute has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function execute( $subPage ) {
                              // side effects: if we can't upload, will print error page to wgOut
                              // and return false
                              if ( !( $this->isUploadAllowed() && $this->isUserUploadAllowed( $this->getUser() ) ) ) {
                                  return;
                      Severity: Minor
                      Found in includes/Specials/SpecialUploadWizard.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 UploadWizardLicenseInput has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                      Open

                      mw.UploadWizardLicenseInput = function ( config, count, api ) {
                          mw.UploadWizardLicenseInput.super.call( this );
                          OO.ui.mixin.GroupElement.call( this );
                      
                          this.count = count;
                      Severity: Minor
                      Found in resources/mw.UploadWizardLicenseInput.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 UWUITutorial has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          uw.ui.Tutorial = function UWUITutorial() {
                              var ui = this;
                      
                              uw.ui.Step.call(
                                  this,
                      Severity: Minor
                      Found in resources/ui/steps/uw.ui.Tutorial.js - About 1 hr to fix

                        Function UWDeedInterface has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            uw.deed.Abstract = function UWDeedInterface( name, config, uploads ) {
                                var tcName, details, field, input;
                                this.name = name;
                                this.config = config;
                                uw.deed.Abstract.prototype.instanceCount++;
                        Severity: Minor
                        Found in resources/deed/uw.deed.Abstract.js - About 1 hr to fix

                          Function setImageURL has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              setImageURL: function ( index ) {
                                  var upload = this.imageUploads[ index ];
                                  var photoId = upload.photoId;
                                  var checker = this;
                          
                          
                          Severity: Minor
                          Found in resources/mw.FlickrChecker.js - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language